Re: [PATCH 09/17] mountpoint: add struct mountpoint_control

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

 



On Sun, Sep 07, 2014 at 01:42:57PM +0100, Sami Kerola wrote:
> This unifies variable names in different functions, and removes redundant
> stat() calls.
> 
> Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
> ---
>  sys-utils/mountpoint.c | 86 ++++++++++++++++++++++++--------------------------
>  1 file changed, 41 insertions(+), 45 deletions(-)
> 
> diff --git a/sys-utils/mountpoint.c b/sys-utils/mountpoint.c
> index 3919ab7..3392cdd 100644
> --- a/sys-utils/mountpoint.c
> +++ b/sys-utils/mountpoint.c
> @@ -40,9 +40,17 @@
>  #include "closestream.h"
>  #include "pathnames.h"
>  
> -static int quiet;
> +struct mountpoint_control {
> +	char *devname;

 This member name makes the code difficult to read, on many places it's
 not device at all. Please, use "path" or "spec" rather then "devname".

> +	dev_t dev;
> +	struct stat st;
> +	uint8_t
> +		dev_devno:1,
> +		fs_devno:1,
> +		quiet:1;
> +};

 Use "unsigned int" for bit fields, it's compiler business to optimize
 how the bits are packed in the struct.


C99, 6.7.2.1 Structure and union specifiers

 A bit-field shall have a type that is a qualified or unqualified
 version of _Bool, signed int, unsigned int, or some other
 implementation-defined type.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" 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