diff mbox

[3/3] btrfs-progs: fi usage: cleanup unneccessary permission error check

Message ID 9be13116-09f2-6f24-7e81-d215f5b215cc@jp.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Misono Tomohiro Nov. 30, 2017, 7:53 a.m. UTC
Since BTRFS_IOC_FS_INFO does not require root privilege, there is no
need to check EPERM error.

Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
---
 cmds-fi-usage.c | 7 -------
 1 file changed, 7 deletions(-)

Comments

Qu Wenruo Nov. 30, 2017, 8:02 a.m. UTC | #1
On 2017年11月30日 15:53, Misono, Tomohiro wrote:
> Since BTRFS_IOC_FS_INFO does not require root privilege, there is no
> need to check EPERM error.
> 
> Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> ---
>  cmds-fi-usage.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/cmds-fi-usage.c b/cmds-fi-usage.c
> index 7bbc9896..b0721560 100644
> --- a/cmds-fi-usage.c
> +++ b/cmds-fi-usage.c
> @@ -522,8 +522,6 @@ static int load_device_info(int fd, struct device_info **device_info_ptr,
>  
>  	ret = ioctl(fd, BTRFS_IOC_FS_INFO, &fi_args);
>  	if (ret < 0) {
> -		if (errno == EPERM)
> -			return -errno;
>  		error("cannot get filesystem info: %s",
>  				strerror(errno));
>  		return 1;
> @@ -597,11 +595,6 @@ int load_chunk_and_device_info(int fd, struct chunk_info **chunkinfo,
>  	}
>  
>  	ret = load_device_info(fd, devinfo, devcount);
> -	if (ret == -EPERM) {
> -		warning(
> -		"cannot get filesystem info from ioctl(FS_INFO), run as root");
> -		ret = 0;
> -	}
>  
>  	return ret;
>  }
>
diff mbox

Patch

diff --git a/cmds-fi-usage.c b/cmds-fi-usage.c
index 7bbc9896..b0721560 100644
--- a/cmds-fi-usage.c
+++ b/cmds-fi-usage.c
@@ -522,8 +522,6 @@  static int load_device_info(int fd, struct device_info **device_info_ptr,
 
 	ret = ioctl(fd, BTRFS_IOC_FS_INFO, &fi_args);
 	if (ret < 0) {
-		if (errno == EPERM)
-			return -errno;
 		error("cannot get filesystem info: %s",
 				strerror(errno));
 		return 1;
@@ -597,11 +595,6 @@  int load_chunk_and_device_info(int fd, struct chunk_info **chunkinfo,
 	}
 
 	ret = load_device_info(fd, devinfo, devcount);
-	if (ret == -EPERM) {
-		warning(
-		"cannot get filesystem info from ioctl(FS_INFO), run as root");
-		ret = 0;
-	}
 
 	return ret;
 }