On Sun, 2009-01-18 at 14:40 +0100, Peter Klotz wrote:
> Calling btrfsctl results in this message when module btrfs.ko is not loaded:
>
> root@asus:/root# btrfsctl -A /dev/sda
> ioctl:: Bad file descriptor
..
> The output with applied patch:
>
> root@asus:/root# btrfsctl -A /dev/sda
> failed to open /dev/btrfs-control
It would probably be better to use perror() instead of fprintf, in order
to give the actual error message. I often find it useful to know why the
device failed to open - is it missing, permission issues? I've updated
the patch:
diff --git a/btrfsctl.c b/btrfsctl.c
index e049799..df1a165 100644
--- a/btrfsctl.c
+++ b/btrfsctl.c
@@ -189,6 +189,10 @@ int main(int ac, char **av)
if (command == BTRFS_IOC_SCAN_DEV) {
fd = open("/dev/btrfs-control", O_RDWR);
+ if (fd < 0) {
+ perror("failed to open /dev/btrfs-control");
+ exit(1);
+ }
name = fname;
} else {
fd = open_file_or_dir(fname);
--
Calvin Walton <calvin.walton@xxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html