]> err.no Git - util-linux/commitdiff
losetup: use standard uintxy_t types (struct loop_info64)
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 3 Dec 2007 13:17:23 +0000 (14:17 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 3 Dec 2007 14:27:52 +0000 (15:27 +0100)
The kernel loop_info64 definition uses __u{8,32,64} types,
but userspace uses unsigned {long long,int,char} types.

This patch turns into exactly defined standard uint{8,32,64}_t types.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
mount/lomount.c
mount/loop.h

index d91a99f3437965eb3ae6ff9cee559212109f82a7..56d7234d85c4f280ed0fbe13d71dfdc308dc3048 100644 (file)
@@ -17,6 +17,7 @@
 #include <sys/stat.h>
 #include <sys/mman.h>
 #include <sys/sysmacros.h>
+#include <inttypes.h>
 
 #include "loop.h"
 #include "lomount.h"
@@ -81,15 +82,15 @@ show_loop(char *device) {
                loopinfo64.lo_file_name[LO_NAME_SIZE-1] = 0;
                loopinfo64.lo_crypt_name[LO_NAME_SIZE-1] = 0;
 
-               printf("%s: [%04llx]:%llu (%s)",
+               printf("%s: [%04" PRIx64 "]:%" PRIu64 " (%s)",
                       device, loopinfo64.lo_device, loopinfo64.lo_inode,
                       loopinfo64.lo_file_name);
 
                if (loopinfo64.lo_offset)
-                       printf(_(", offset %lld"), loopinfo64.lo_offset);
+                       printf(_(", offset %" PRIu64 ), loopinfo64.lo_offset);
 
                if (loopinfo64.lo_sizelimit)
-                       printf(_(", sizelimit %lld"), loopinfo64.lo_sizelimit);
+                       printf(_(", sizelimit %" PRIu64 ), loopinfo64.lo_sizelimit);
 
                if (loopinfo64.lo_encrypt_type ||
                    loopinfo64.lo_crypt_name[0]) {
@@ -97,7 +98,7 @@ show_loop(char *device) {
 
                        if (*e == 0 && loopinfo64.lo_encrypt_type == 1)
                                e = "XOR";
-                       printf(_(", encryption %s (type %d)"),
+                       printf(_(", encryption %s (type %" PRIu32 ")"),
                               e, loopinfo64.lo_encrypt_type);
                }
                printf("\n");
index 5e8782899ad71c043c367b9c9b8f913aa7a1c424..415f74798398d1e8081ab9b5fc1842045fb15e34 100644 (file)
@@ -2,6 +2,7 @@
 #define MNT_LOOP_H
 
 #include <linux/posix_types.h>
+#include <stdint.h>
 #include "linux_version.h"
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,68)
@@ -40,24 +41,20 @@ struct loop_info {
        char            reserved[4];
 };
 
-/*
- * Where to get __u8, __u32, __u64? Let us use unsigned char/int/long long
- * and get punished when someone comes with 128-bit long longs.
- */
 struct loop_info64 {
-       unsigned long long      lo_device;
-       unsigned long long      lo_inode;
-       unsigned long long      lo_rdevice;
-       unsigned long long      lo_offset;
-       unsigned long long      lo_sizelimit; /* bytes, 0 == max available */
-       unsigned int            lo_number;
-       unsigned int            lo_encrypt_type;
-       unsigned int            lo_encrypt_key_size;
-       unsigned int            lo_flags;
-       unsigned char           lo_file_name[LO_NAME_SIZE];
-       unsigned char           lo_crypt_name[LO_NAME_SIZE];
-       unsigned char           lo_encrypt_key[LO_KEY_SIZE];
-       unsigned long long      lo_init[2];
+       uint64_t        lo_device;
+       uint64_t        lo_inode;
+       uint64_t        lo_rdevice;
+       uint64_t        lo_offset;
+       uint64_t        lo_sizelimit; /* bytes, 0 == max available */
+       uint32_t        lo_number;
+       uint32_t        lo_encrypt_type;
+       uint32_t        lo_encrypt_key_size;
+       uint32_t        lo_flags;
+       uint8_t         lo_file_name[LO_NAME_SIZE];
+       uint8_t         lo_crypt_name[LO_NAME_SIZE];
+       uint8_t         lo_encrypt_key[LO_KEY_SIZE];
+       uint64_t        lo_init[2];
 };
 
 #endif /* MNT_LOOP_H */