btrfs-progs: mkfs: check the status of file at mkfs
authorMisono, Tomohiro <misono.tomohiro@jp.fujitsu.com>
Fri, 24 Nov 2017 05:21:15 +0000 (14:21 +0900)
committerDavid Sterba <dsterba@suse.com>
Wed, 3 Jan 2018 16:09:57 +0000 (17:09 +0100)
commite460ccd6d13bb2cc4939fb860b50964dfbd3c247
treeaa77d4581e99d7e78cb7d01fd411a739cc34c390
parentdc06cda3d6afb4fad5ddfd1508a33f79c2e68efb
btrfs-progs: mkfs: check the status of file at mkfs

Currently, only the status of block devices is checked at mkfs,
but we should also check for regular files whether they are already
formatted or mounted to prevent overwrite accidentally.

Device status is checked by test_dev_for_mkfs().
The part which is not related to block device is split from this
and used for both block device and regular file.

Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
mkfs/common.c
mkfs/common.h
mkfs/main.c