diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-06-24 14:03:20 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-06-24 14:03:20 +0100 |
commit | a61c4df7f669496dc21f26919f272b934048da6d (patch) | |
tree | 45a69b4f0a5536674c8bb92b3611da1e890b659c /tools/blktap2/vhd | |
parent | ed072758a72fe04de1afe547c15aabc5f4612f2d (diff) | |
download | xen-a61c4df7f669496dc21f26919f272b934048da6d.tar.gz xen-a61c4df7f669496dc21f26919f272b934048da6d.tar.bz2 xen-a61c4df7f669496dc21f26919f272b934048da6d.zip |
blktap2: Further netbsd build fixes.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'tools/blktap2/vhd')
-rw-r--r-- | tools/blktap2/vhd/lib/libvhd-journal.c | 2 | ||||
-rw-r--r-- | tools/blktap2/vhd/lib/libvhd.c | 48 | ||||
-rw-r--r-- | tools/blktap2/vhd/lib/vhd-util-check.c | 4 | ||||
-rw-r--r-- | tools/blktap2/vhd/lib/vhd-util-read.c | 4 |
4 files changed, 40 insertions, 18 deletions
diff --git a/tools/blktap2/vhd/lib/libvhd-journal.c b/tools/blktap2/vhd/lib/libvhd-journal.c index 4112c9d6af..24383ff62b 100644 --- a/tools/blktap2/vhd/lib/libvhd-journal.c +++ b/tools/blktap2/vhd/lib/libvhd-journal.c @@ -237,7 +237,7 @@ vhd_journal_add_journal_header(vhd_journal_t *j) if (err) return err; - uuid_copy(j->header.uuid, vhd->footer.uuid); + blk_uuid_copy(&j->header.uuid, &vhd->footer.uuid); memcpy(j->header.cookie, VHD_JOURNAL_HEADER_COOKIE, sizeof(j->header.cookie)); j->header.vhd_footer_offset = off - sizeof(vhd_footer_t); diff --git a/tools/blktap2/vhd/lib/libvhd.c b/tools/blktap2/vhd/lib/libvhd.c index add9365f42..03bee720c5 100644 --- a/tools/blktap2/vhd/lib/libvhd.c +++ b/tools/blktap2/vhd/lib/libvhd.c @@ -1308,7 +1308,8 @@ vhd_macx_encode_location(char *name, char **out, int *outlen) iconv_t cd; int len, err; size_t ibl, obl; - char *uri, *urip, *uri_utf8, *uri_utf8p, *ret; + char *uri, *uri_utf8, *uri_utf8p, *ret; + const char *urip; err = 0; ret = NULL; @@ -1319,7 +1320,7 @@ vhd_macx_encode_location(char *name, char **out, int *outlen) ibl = len; obl = len; - uri = urip = malloc(ibl + 1); + urip = uri = malloc(ibl + 1); uri_utf8 = uri_utf8p = malloc(obl); if (!uri || !uri_utf8) @@ -1333,7 +1334,11 @@ vhd_macx_encode_location(char *name, char **out, int *outlen) snprintf(uri, ibl+1, "file://%s", name); - if (iconv(cd, &urip, &ibl, &uri_utf8p, &obl) == (size_t)-1 || + if (iconv(cd, +#if defined(__linux__) || (__Linux__) + (char **) +#endif + &urip, &ibl, &uri_utf8p, &obl) == (size_t)-1 || ibl || obl) { err = (errno ? -errno : -EIO); goto out; @@ -1364,7 +1369,8 @@ vhd_w2u_encode_location(char *name, char **out, int *outlen) iconv_t cd; int len, err; size_t ibl, obl; - char *uri, *urip, *uri_utf16, *uri_utf16p, *tmp, *ret; + char *uri, *uri_utf16, *uri_utf16p, *tmp, *ret; + const char *urip; err = 0; ret = NULL; @@ -1418,7 +1424,11 @@ vhd_w2u_encode_location(char *name, char **out, int *outlen) goto out; } - if (iconv(cd, &urip, &ibl, &uri_utf16p, &obl) == (size_t)-1 || + if (iconv(cd, +#if defined(__linux__) || (__Linux__) + (char **) +#endif + &urip, &ibl, &uri_utf16p, &obl) == (size_t)-1 || ibl || obl) { err = (errno ? -errno : -EIO); goto out; @@ -1459,7 +1469,11 @@ vhd_macx_decode_location(const char *in, char *out, int len) if (cd == (iconv_t)-1) return NULL; - if (iconv(cd, (char **)&in, &ibl, &out, &obl) == (size_t)-1 || ibl) + if (iconv(cd, +#if defined(__linux__) || defined(__Linux__) + (char **) +#endif + &in, &ibl, &out, &obl) == (size_t)-1 || ibl) return NULL; iconv_close(cd); @@ -1487,7 +1501,11 @@ vhd_w2u_decode_location(const char *in, char *out, int len, char *utf_type) if (cd == (iconv_t)-1) return NULL; - if (iconv(cd, (char **)&in, &ibl, &out, &obl) == (size_t)-1 || ibl) + if (iconv(cd, +#if defined(__linux__) || defined(__Linux__) + (char **) +#endif + &in, &ibl, &out, &obl) == (size_t)-1 || ibl) return NULL; iconv_close(cd); @@ -2435,7 +2453,7 @@ vhd_initialize_footer(vhd_context_t *ctx, int type, uint64_t size) ctx->footer.saved = 0; ctx->footer.data_offset = 0xFFFFFFFFFFFFFFFF; strcpy(ctx->footer.crtr_app, "tap"); - uuid_generate(ctx->footer.uuid); + blk_uuid_generate(&ctx->footer.uuid); } static int @@ -2479,7 +2497,11 @@ vhd_initialize_header_parent_name(vhd_context_t *ctx, const char *parent_path) memset(dst, 0, obl); - if (iconv(cd, (char **)&pname, &ibl, &dst, &obl) == (size_t)-1 || ibl) + if (iconv(cd, +#if defined(__linux__) || defined(__Linux__) + (char **) +#endif + &pname, &ibl, &dst, &obl) == (size_t)-1 || ibl) err = (errno ? -errno : -EINVAL); out: @@ -2546,7 +2568,7 @@ vhd_initialize_header(vhd_context_t *ctx, const char *parent_path, return err; ctx->header.prt_ts = vhd_time(stats.st_mtime); - uuid_copy(ctx->header.prt_uuid, parent.footer.uuid); + blk_uuid_copy(&ctx->header.prt_uuid, &parent.footer.uuid); if (!size) size = parent.footer.curr_size; vhd_close(&parent); @@ -2628,7 +2650,7 @@ vhd_change_parent(vhd_context_t *child, char *parent_path, int raw) } if (raw) { - uuid_clear(child->header.prt_uuid); + blk_uuid_clear(&child->header.prt_uuid); } else { err = vhd_open(&parent, ppath, VHD_OPEN_RDONLY); if (err) { @@ -2636,7 +2658,7 @@ vhd_change_parent(vhd_context_t *child, char *parent_path, int raw) ppath, child->file, err); goto out; } - uuid_copy(child->header.prt_uuid, parent.footer.uuid); + blk_uuid_copy(&child->header.prt_uuid, &parent.footer.uuid); vhd_close(&parent); } @@ -2695,7 +2717,7 @@ vhd_create_batmap(vhd_context_t *ctx) header = &ctx->batmap.header; memset(header, 0, sizeof(vhd_batmap_header_t)); - memcpy(header->cookie, VHD_BATMAP_COOKIE, sizeof(*header->cookie)); + memcpy(header->cookie, VHD_BATMAP_COOKIE, sizeof(header->cookie)); err = vhd_batmap_header_offset(ctx, &off); if (err) diff --git a/tools/blktap2/vhd/lib/vhd-util-check.c b/tools/blktap2/vhd/lib/vhd-util-check.c index 9dbd9e1941..b6bb1b7c52 100644 --- a/tools/blktap2/vhd/lib/vhd-util-check.c +++ b/tools/blktap2/vhd/lib/vhd-util-check.c @@ -218,7 +218,7 @@ vhd_util_check_validate_differencing_header(vhd_context_t *vhd) if (vhd_util_check_zeros(header->loc, sizeof(header->loc))) return "invalid non-null parent locators"; - if (!uuid_is_null(header->prt_uuid)) + if (!blk_uuid_is_nil(&header->prt_uuid)) return "invalid non-null parent uuid"; if (header->prt_ts) @@ -320,7 +320,7 @@ vhd_util_check_validate_parent(vhd_context_t *vhd, const char *ppath) VHD_OPEN_RDONLY | VHD_OPEN_IGNORE_DISABLED)) return "error opening parent"; - if (uuid_compare(vhd->header.prt_uuid, parent.footer.uuid)) { + if (blk_uuid_compare(&vhd->header.prt_uuid, &parent.footer.uuid)) { msg = "invalid parent uuid"; goto out; } diff --git a/tools/blktap2/vhd/lib/vhd-util-read.c b/tools/blktap2/vhd/lib/vhd-util-read.c index a462fdc4df..0afb3dcceb 100644 --- a/tools/blktap2/vhd/lib/vhd-util-read.c +++ b/tools/blktap2/vhd/lib/vhd-util-read.c @@ -78,7 +78,7 @@ vhd_print_header(vhd_context_t *vhd, vhd_header_t *h, int hex) (err ? "failed to read name" : name)); free(name); - uuid_unparse(h->prt_uuid, uuid); + blk_uuid_to_string(&h->prt_uuid, uuid); printf("Parent UUID : %s\n", uuid); vhd_time_to_string(h->prt_ts, time_str); @@ -153,7 +153,7 @@ vhd_print_footer(vhd_footer_t *f, int hex) printf("Checksum : 0x%x|0x%x (%s)\n", f->checksum, cksm, f->checksum == cksm ? "Good!" : "Bad!"); - uuid_unparse(f->uuid, uuid); + blk_uuid_to_string(&f->uuid, uuid); printf("UUID : %s\n", uuid); printf("Saved state : %s\n", f->saved == 0 ? "No" : "Yes"); |