Re: [PATCH 1/2] libmount: use autofs mount hint to ignore autofs mount entries

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

 



On Wed, Nov 16, 2022 at 10:00:45AM +0800, Ian Kent wrote:
> diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c
> index 75f8e406b..293f0a8ed 100644
> --- a/libmount/src/tab_parse.c
> +++ b/libmount/src/tab_parse.c
> @@ -762,6 +762,14 @@ int mnt_table_parse_stream(struct libmnt_table *tb, FILE *f, const char *filenam
>  		if (rc == 0 && tb->fltrcb && tb->fltrcb(fs, tb->fltrcb_data))
>  			rc = 1;	/* filtered out by callback... */
>  
> +		if (mnt_table_ignore_autofs(tb)) {

 if (rc == 0 && mnt_table_ignore_autofs(tb)) {

Don't waste time if already ignored or in case of error :-)

> +/*
> + * mnt_table_enable_ignore_autofs:
> + * @tb: table
> + *
> + * Enable ignore autofs mount table entries on reading.
> + */
> +int mnt_table_enable_ignore_autofs(struct libmnt_table *tb)
> +{
> +	if (!tb)
> +		return -EINVAL;
> +	tb->ignore_autofs = 1;
> +	return 0;
> +}


The library usually uses the same function to enable as well as disable:

int mnt_table_enable_ignore_autofs(struct libmnt_table *tb, int ignore)
{
    if (tb)
        return -EINVAL;
    tb->ignore_autofs = ignore ? 1 : 0;
}

and mnt_context_enable_ignore_autofs() is the same.


    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com




[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