btrfs-progs: mkfs: do not try to register non-block-devices
authorDavid Sterba <dsterba@suse.cz>
Sat, 6 Jun 2015 00:17:13 +0000 (02:17 +0200)
committerDavid Sterba <dsterba@suse.cz>
Mon, 8 Jun 2015 15:50:46 +0000 (17:50 +0200)
commit1bcedaae799d117957e36f8ffddc0d9d84274c2d
tree0db3fc17d8b0a27b1cb9787a0359c08e34e45c3a
parent49ac5f50b5d466c92be25c83aa354c64c1f00ca3
btrfs-progs: mkfs: do not try to register non-block-devices

A mkfs on a regular file will try to call the DEV_SCAN ioctl that will
take the loop through the kernel and fail:

 ERROR: device scan failed './test.img' - Block device required

If a user without permission to open the control device tries to mkfs a
regular file, an error message is printed:

 failed to open /dev/btrfs-control skipping device registration: Permission denied

So we should not try to pass a non-block-device besides that this makes
the --quiet option more quiet.

Signed-off-by: David Sterba <dsterba@suse.cz>
mkfs.c