X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=extras%2Fvolume_id%2Fvolume_id%2Futil.c;h=22abc9cbf8c7b5c212e3919dc529f6cbf1698a6f;hp=6159a5992800edcf9415555eb8f9e0391b79c1e2;hb=138068d690d79e71239d3e776f01560afbabc1cb;hpb=e4d4a557e53c3fbcf14bd1bb29686fd884905b53 diff --git a/extras/volume_id/volume_id/util.c b/extras/volume_id/volume_id/util.c index 6159a5992..22abc9cbf 100644 --- a/extras/volume_id/volume_id/util.c +++ b/extras/volume_id/volume_id/util.c @@ -138,8 +138,13 @@ void volume_id_set_uuid(struct volume_id *id, const __u8 *buf, enum uuid_format break; case UUID_DCE: count = 16; + break; + case UUID_DCE_STRING: + count = 36; + break; } memcpy(id->uuid_raw, buf, count); + id->uuid_raw_len = count; /* if set, create string in the same format, the native platform uses */ for (i = 0; i < count; i++) @@ -172,6 +177,10 @@ set: buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], buf[14],buf[15]); break; + case UUID_DCE_STRING: + memcpy(id->uuid, buf, count); + id->uuid[count] = '\0'; + break; } } @@ -179,7 +188,7 @@ __u8 *volume_id_get_buffer(struct volume_id *id, __u64 off, unsigned int len) { unsigned int buf_len; - dbg("get buffer off 0x%llx(%llu), len 0x%x", off, off, len); + dbg("get buffer off 0x%llx(%llu), len 0x%x", (unsigned long long) off, (unsigned long long) off, len); /* check if requested area fits in superblock buffer */ if (off + len <= SB_BUFFER_SIZE) { if (id->sbbuf == NULL) { @@ -190,7 +199,7 @@ __u8 *volume_id_get_buffer(struct volume_id *id, __u64 off, unsigned int len) /* check if we need to read */ if ((off + len) > id->sbbuf_len) { - dbg("read sbbuf len:0x%llx", off + len); + dbg("read sbbuf len:0x%llx", (unsigned long long) (off + len)); lseek(id->fd, 0, SEEK_SET); buf_len = read(id->fd, id->sbbuf, off + len); dbg("got 0x%x (%i) bytes", buf_len, buf_len); @@ -215,7 +224,7 @@ __u8 *volume_id_get_buffer(struct volume_id *id, __u64 off, unsigned int len) /* check if we need to read */ if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { - dbg("read seekbuf off:0x%llx len:0x%x", off, len); + dbg("read seekbuf off:0x%llx len:0x%x", (unsigned long long) off, len); if (lseek(id->fd, off, SEEK_SET) == -1) return NULL; buf_len = read(id->fd, id->seekbuf, len);