Lines Matching refs:footer
117 vhd_footer_in(vhd_footer_t *footer) in vhd_footer_in() argument
119 BE32_IN(&footer->features); in vhd_footer_in()
120 BE32_IN(&footer->ff_version); in vhd_footer_in()
121 BE64_IN(&footer->data_offset); in vhd_footer_in()
122 BE32_IN(&footer->timestamp); in vhd_footer_in()
123 BE32_IN(&footer->crtr_ver); in vhd_footer_in()
124 BE32_IN(&footer->crtr_os); in vhd_footer_in()
125 BE64_IN(&footer->orig_size); in vhd_footer_in()
126 BE64_IN(&footer->curr_size); in vhd_footer_in()
127 BE32_IN(&footer->geometry); in vhd_footer_in()
128 BE32_IN(&footer->type); in vhd_footer_in()
129 BE32_IN(&footer->checksum); in vhd_footer_in()
133 vhd_footer_out(vhd_footer_t *footer) in vhd_footer_out() argument
135 BE32_OUT(&footer->features); in vhd_footer_out()
136 BE32_OUT(&footer->ff_version); in vhd_footer_out()
137 BE64_OUT(&footer->data_offset); in vhd_footer_out()
138 BE32_OUT(&footer->timestamp); in vhd_footer_out()
139 BE32_OUT(&footer->crtr_ver); in vhd_footer_out()
140 BE32_OUT(&footer->crtr_os); in vhd_footer_out()
141 BE64_OUT(&footer->orig_size); in vhd_footer_out()
142 BE64_OUT(&footer->curr_size); in vhd_footer_out()
143 BE32_OUT(&footer->geometry); in vhd_footer_out()
144 BE32_OUT(&footer->type); in vhd_footer_out()
145 BE32_OUT(&footer->checksum); in vhd_footer_out()
231 vhd_checksum_footer(vhd_footer_t *footer) in vhd_checksum_footer() argument
238 tmp = footer->checksum; in vhd_checksum_footer()
239 footer->checksum = 0; in vhd_checksum_footer()
241 blob = (unsigned char *)footer; in vhd_checksum_footer()
245 footer->checksum = tmp; in vhd_checksum_footer()
250 vhd_validate_footer(vhd_footer_t *footer) in vhd_validate_footer() argument
255 csize = sizeof(footer->cookie); in vhd_validate_footer()
256 if (memcmp(footer->cookie, HD_COOKIE, csize) != 0 && in vhd_validate_footer()
257 memcmp(footer->cookie, VHD_POISON_COOKIE, csize) != 0) { in vhd_validate_footer()
259 strncpy(buf, footer->cookie, sizeof(buf)); in vhd_validate_footer()
265 checksum = vhd_checksum_footer(footer); in vhd_validate_footer()
266 if (checksum != footer->checksum) { in vhd_validate_footer()
271 if (footer->hidden && in vhd_validate_footer()
272 !strncmp(footer->crtr_app, "tap", 3) && in vhd_validate_footer()
273 (footer->crtr_ver == VHD_VERSION(0, 1) || in vhd_validate_footer()
274 footer->crtr_ver == VHD_VERSION(1, 1))) { in vhd_validate_footer()
275 char tmp = footer->hidden; in vhd_validate_footer()
276 footer->hidden = 0; in vhd_validate_footer()
277 checksum = vhd_checksum_footer(footer); in vhd_validate_footer()
278 footer->hidden = tmp; in vhd_validate_footer()
280 if (checksum == footer->checksum) in vhd_validate_footer()
286 footer->checksum, checksum); in vhd_validate_footer()
459 (ctx->footer.crtr_ver == VHD_VERSION(0, 1) || in vhd_hidden()
460 ctx->footer.crtr_ver == VHD_VERSION(1, 1))) { in vhd_hidden()
471 *hidden = ctx->footer.hidden; in vhd_hidden()
492 if (cur->footer.type != HD_TYPE_DIFF) in vhd_chain_depth()
570 ctx->footer.crtr_ver == 0x00000001) in vhd_bitmap_test()
580 ctx->footer.crtr_ver == 0x00000001) in vhd_bitmap_set()
590 ctx->footer.crtr_ver == 0x00000001) in vhd_bitmap_clear()
613 eom = ctx->footer.data_offset + sizeof(vhd_header_t); in vhd_end_of_headers()
774 if (!vhd_validate_footer(&ctx->footer)) in vhd_get_footer()
777 return vhd_read_footer(ctx, &ctx->footer); in vhd_get_footer()
821 memset(&ctx->footer, 0, sizeof(vhd_footer_t)); in vhd_put_footer()
857 vhd_read_short_footer(vhd_context_t *ctx, vhd_footer_t *footer) in vhd_read_short_footer() argument
894 memcpy(footer, buf, sizeof(vhd_footer_t)); in vhd_read_short_footer()
896 vhd_footer_in(footer); in vhd_read_short_footer()
897 err = vhd_validate_footer(footer); in vhd_read_short_footer()
908 vhd_read_footer_at(vhd_context_t *ctx, vhd_footer_t *footer, off_t off) in vhd_read_footer_at() argument
931 memcpy(footer, buf, sizeof(vhd_footer_t)); in vhd_read_footer_at()
933 vhd_footer_in(footer); in vhd_read_footer_at()
934 err = vhd_validate_footer(footer); in vhd_read_footer_at()
945 vhd_read_footer(vhd_context_t *ctx, vhd_footer_t *footer) in vhd_read_footer() argument
958 err = vhd_read_footer_at(ctx, footer, off - 512); in vhd_read_footer()
962 err = vhd_read_short_footer(ctx, footer); in vhd_read_footer()
969 return vhd_read_footer_at(ctx, footer, 0); in vhd_read_footer()
1025 off = ctx->footer.data_offset; in vhd_read_header()
1201 if (ctx->footer.crtr_ver <= VHD_VERSION(0, 1)) in vhd_has_batmap()
1204 if (ctx->footer.crtr_ver >= VHD_VERSION(1, 2)) in vhd_has_batmap()
1528 ctx->footer.crtr_ver == VHD_VERSION(0, 1)) in vhd_header_decode_parent()
1549 if (ctx->footer.type != HD_TYPE_DIFF) { in vhd_parent_locator_read()
1635 if (ctx->footer.type != HD_TYPE_DIFF) in vhd_parent_locator_get()
1671 if (ctx->footer.type != HD_TYPE_DIFF) in vhd_parent_locator_write_at()
1897 vhd_write_footer_at(vhd_context_t *ctx, vhd_footer_t *footer, off_t off) in vhd_write_footer_at() argument
1912 memcpy(f, footer, sizeof(vhd_footer_t)); in vhd_write_footer_at()
1936 vhd_write_footer(vhd_context_t *ctx, vhd_footer_t *footer) in vhd_write_footer() argument
1948 err = vhd_write_footer_at(ctx, footer, off); in vhd_write_footer()
1955 return vhd_write_footer_at(ctx, footer, 0); in vhd_write_footer()
2011 off = ctx->footer.data_offset; in vhd_write_header()
2325 memcpy(&ctx->footer, buf, sizeof(vhd_footer_t)); in vhd_open_fast()
2326 vhd_footer_in(&ctx->footer); in vhd_open_fast()
2327 err = vhd_validate_footer(&ctx->footer); in vhd_open_fast()
2332 if (ctx->footer.data_offset != sizeof(vhd_footer_t)) in vhd_open_fast()
2395 err = vhd_read_footer(ctx, &ctx->footer); in vhd_open()
2437 memset(&ctx->footer, 0, sizeof(vhd_footer_t)); in vhd_initialize_footer()
2438 memcpy(ctx->footer.cookie, HD_COOKIE, sizeof(ctx->footer.cookie)); in vhd_initialize_footer()
2439 ctx->footer.features = HD_RESERVED; in vhd_initialize_footer()
2440 ctx->footer.ff_version = HD_FF_VERSION; in vhd_initialize_footer()
2441 ctx->footer.timestamp = vhd_time(time(NULL)); in vhd_initialize_footer()
2442 ctx->footer.crtr_ver = VHD_CURRENT_VERSION; in vhd_initialize_footer()
2443 ctx->footer.crtr_os = 0x00000000; in vhd_initialize_footer()
2444 ctx->footer.orig_size = size; in vhd_initialize_footer()
2445 ctx->footer.curr_size = size; in vhd_initialize_footer()
2446 ctx->footer.geometry = vhd_chs(size); in vhd_initialize_footer()
2447 ctx->footer.type = type; in vhd_initialize_footer()
2448 ctx->footer.saved = 0; in vhd_initialize_footer()
2449 ctx->footer.data_offset = 0xFFFFFFFFFFFFFFFF; in vhd_initialize_footer()
2450 strcpy(ctx->footer.crtr_app, "tap"); in vhd_initialize_footer()
2451 vhd_uuid_generate(&ctx->footer.uuid); in vhd_initialize_footer()
2545 ctx->header.max_bat_size = (ctx->footer.curr_size + in vhd_initialize_header()
2548 ctx->footer.data_offset = VHD_SECTOR_SIZE; in vhd_initialize_header()
2550 if (ctx->footer.type == HD_TYPE_DYNAMIC) in vhd_initialize_header()
2568 vhd_uuid_copy(&ctx->header.prt_uuid, &parent.footer.uuid); in vhd_initialize_header()
2570 size = parent.footer.curr_size; in vhd_initialize_header()
2573 ctx->footer.orig_size = size; in vhd_initialize_header()
2574 ctx->footer.curr_size = size; in vhd_initialize_header()
2575 ctx->footer.geometry = vhd_chs(size); in vhd_initialize_header()
2591 if (ctx->footer.type != HD_TYPE_DIFF) in vhd_write_parent_locators()
2658 vhd_uuid_copy(&child->header.prt_uuid, &parent.footer.uuid); in vhd_change_parent()
2778 if (ctx->footer.type != HD_TYPE_FIXED) in vhd_initialize_fixed_disk()
2790 for (i = 0; i < ctx->footer.curr_size >> VHD_BLOCK_SHIFT; i++) { in vhd_initialize_fixed_disk()
2829 return vhd_write_footer_at(ctx, &ctx->footer, in vhd_set_phys_size()
2840 vhd_footer_t *footer; in __vhd_create() local
2859 footer = &ctx.footer; in __vhd_create()
2891 err = vhd_write_footer_at(&ctx, &ctx.footer, 0); in __vhd_create()
2932 err = vhd_write_footer_at(&ctx, &ctx.footer, off); in __vhd_create()
3132 if (vhd->footer.type == HD_TYPE_DIFF) { in __vhd_io_dynamic_read()
3174 if (vhd_sectors_to_bytes(sec + secs) > ctx->footer.curr_size) in vhd_io_read()
3254 if (vhd_sectors_to_bytes(sector + secs) > ctx->footer.curr_size) in __vhd_io_dynamic_write()
3330 ret = vhd_write_footer(ctx, &ctx->footer); in __vhd_io_dynamic_write()
3341 if (vhd_sectors_to_bytes(sec + secs) > ctx->footer.curr_size) in vhd_io_write()