Commit graph

4 commits

Author SHA1 Message Date
Zhao Lei d0c0f90b38 btrfs-progs: filesystem: use btrfs_open_dir for btrfs filesystem command
We can use btrfs_open_dir() to check whether target dir is
in btrfs's mount point before open, instead of checking it in
kernel space of ioctl, and return fuzzy error message.

Before patch:
  # (/mnt/tmp is not btrfs mountpoint)
  #
  # btrfs filesystem df /mnt/tmp
  ERROR: couldn't get space info - Inappropriate ioctl for device
  ERROR: get_df failed Inappropriate ioctl for device
  #

After patch:
  # ./btrfs filesystem df /mnt/tmp
  ERROR: not btrfs filesystem: /mnt/tmp
  #

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2015-11-02 09:35:00 +01:00
David Sterba 49ac9aa1e8 btrfs-progs: fix error checking in load_device_info
load_device_info queries the FS_INFO ioctl and this may fail with EPERM
on older kernels. The check did not verify the ioctl return value and
incorrectly returned EPERM if it was previously stored in errno.

This fixes 'btrfs fi usage' that will print the overall summary for all
users (provided that the FS_INFO ioctl is already unprivileged).

Signed-off-by: David Sterba <dsterba@suse.com>
2015-10-02 17:56:43 +02:00
Zhao Lei 665dc49ef6 btrfs-progs: Use common unit parser for btrfs filesystem command
Move to use get_unit_mode_from_arg() for cmds-filesystem.c,
to make "btrfs filesystem df/show/usage"'s unit argument same.

Also have cleanup effect: 19 insertions(+), 181 deletions(-)

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2015-09-01 14:02:48 +02:00
David Sterba c8927d5116 btrfs-progs: cleanup, rename *disk_usage* files to usage
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-04-22 18:21:48 +02:00
Renamed from cmds-fi-disk_usage.c (Browse further)