chiark / gitweb /
[PATCH] fix ia64 compile
[elogind.git] / extras / volume_id / volume_id / util.c
index 0cd2eadec1313ee00bf7a80907759bca7ab77d43..22abc9cbf8c7b5c212e3919dc529f6cbf1698a6f 100644 (file)
@@ -53,6 +53,8 @@ static char *usage_to_string(enum volume_id_usage usage_id)
                return "raid";
        case VOLUME_ID_DISKLABEL:
                return "disklabel";
+       case VOLUME_ID_CRYPTO:
+               return "crypto";
        case VOLUME_ID_UNPROBED:
                return "unprobed";
        case VOLUME_ID_UNUSED:
@@ -136,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++)
@@ -170,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;
        }
 }
 
@@ -177,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) {
@@ -188,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);
@@ -213,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);