Fix ioctl arg size (userland incompatible change!)
authorChris Mason <chris.mason@oracle.com>
Fri, 16 Jan 2009 17:05:01 +0000 (12:05 -0500)
committerChris Mason <chris.mason@oracle.com>
Fri, 16 Jan 2009 17:05:01 +0000 (12:05 -0500)
The structure used to send device in btrfs ioctl calls was not
properly aligned, and so 32 bit ioctls would not work properly on
64 bit kernels.

We could fix this with compat ioctls, but we're just one byte away
and it doesn't make sense at this stage to carry about the compat ioctls
forever at this stage in the project.

This patch brings the ioctl arg up to an evenly aligned 4k.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
ioctl.h
utils.c

diff --git a/ioctl.h b/ioctl.h
index 5fb2ad1..a084f33 100644 (file)
--- a/ioctl.h
+++ b/ioctl.h
@@ -23,7 +23,7 @@
 
 #define BTRFS_IOCTL_MAGIC 0x94
 #define BTRFS_VOL_NAME_MAX 255
-#define BTRFS_PATH_NAME_MAX 3072
+#define BTRFS_PATH_NAME_MAX 4087
 
 struct btrfs_ioctl_vol_args {
        __s64 fd;
diff --git a/utils.c b/utils.c
index 694a92f..8f49c7a 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -653,18 +653,13 @@ void btrfs_register_one_device(char *fname)
 
        fd = open("/dev/btrfs-control", O_RDONLY);
        if (fd < 0) {
-               fprintf(stderr, "failed to open"
-                       "/dev/btrfs-control\n");
-               exit(1);
+               fprintf(stderr, "failed to open /dev/btrfs-control "
+                       "skipping device registration\n");
+               return;
        }
        strcpy(args.name, fname);
        ret = ioctl(fd, BTRFS_IOC_SCAN_DEV, &args);
        close(fd);
-       if (ret < 0) {
-               fprintf(stderr, "failed to register device %s\n",
-                       fname);
-               exit(1);
-       }
 }
 
 int btrfs_scan_one_dir(char *dirname, int run_ioctl)