Re: [PATCH 1/6] path: use openat()

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

 



On Mon, Jul 03, 2017 at 01:52:56PM +0200, Ruediger Meier wrote:
> From: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>
> 
> path_vcreate_with_prefix() is going to be removed.
> 
> Signed-off-by: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>
> ---
>  lib/path.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 96 insertions(+), 15 deletions(-)
> 
> diff --git a/lib/path.c b/lib/path.c
> index 79c1e7a..94181fe 100644
> --- a/lib/path.c
> +++ b/lib/path.c
> @@ -26,18 +26,60 @@
>  #include <stdio.h>
>  #include <inttypes.h>
>  #include <errno.h>
> +#include <sys/stat.h>
>  
>  #include "all-io.h"
>  #include "path.h"
>  #include "nls.h"
>  #include "c.h"
>  
> +static int rootfd = -1;
>  static size_t prefixlen;
> +static char pathbuf_prefix[PATH_MAX];
>  static char pathbuf[PATH_MAX];

We use sysfs.c in shared libs, it means that global variables are
unacceptable.

It would be better to have "struct path_cxt" and use it within "struct
sysfs_cxt". For tools where we don't use "struct sysfs_cxt" (e.g.
lscpu) we can directly use "struct path_cxt".

I guess it should be possible to replace sysfs_cxt->dir_fd with
"struct path_cxt" where it points to $SYSROOT/sysfs/block/<device>.

    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