Re: [PATCH] lsblk: use Y/N instead of 0/1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry, I forgot to CC util-linux-ng list.

Hi Dave,

On 11/29/2010 03:16 PM, Davidlohr Bueso wrote:
> From: Davidlohr Bueso <dave@xxxxxxx>
> 
> This notation is a little more user friendly and applies to information about removable, readonly and rotational devices
> 
> Signed-off-by: Davidlohr Bueso <dave@xxxxxxx>
> ---
>  misc-utils/lsblk.c |   47 ++++++++++++++++++++++++++++++++++++++---------
>  1 files changed, 38 insertions(+), 9 deletions(-)
> 
> diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
> index 6c5a205..a8c29a6 100644
> --- a/misc-utils/lsblk.c
> +++ b/misc-utils/lsblk.c
> @@ -504,6 +504,24 @@ static void probe_device(struct blkdev_cxt *cxt)
>  	return;
>  }
>  
> +static int is_removable_device(struct blkdev_cxt *cxt)
> +{
> +	char *str = NULL;

Assigning NULL is not necessary here.

> +	int ret = 0;
> +
> +	str = sysfs_strdup(cxt, "removable");
> +
> +	if (!str && cxt->parent)
> +		str = sysfs_strdup(cxt->parent, "removable");
> +
> +	if (str) {
> +		ret = atoi(str);

ato*() functions are obsolete, we probably should use strtol() instead.

> +		free(str);

free(NULL) is safe.

> +	}
> +
> +	return ret;
> +}
> +

Thanks,
		Marek

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux