mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: John McCutchan <ttb@tentacle.dhs.org>
Cc: linux-kernel@vger.kernel.org, rml@novell.com
Subject: Re: [patch] add two inotify_add_watch flags
Date: Fri, 9 Dec 2005 14:51:44 -0800	[thread overview]
Message-ID: <20051209145144.4b118f09.akpm@osdl.org> (raw)
In-Reply-To: <1133927688.20396.8.camel@localhost.localdomain>

John McCutchan <ttb@tentacle.dhs.org> wrote:
>
> -static int find_inode(const char __user *dirname, struct nameidata *nd)
> +static int find_inode(const char __user *dirname, struct nameidata *nd,
> +		      int only_dir, int dont_follow_symlink)
>  {
>  	int error;
> +	unsigned flags = 0;
>  
> -	error = __user_walk(dirname, LOOKUP_FOLLOW, nd);
> +	if (!dont_follow_symlink)
> +		flags |= LOOKUP_FOLLOW;
> +	if (only_dir)
> +		flags |= LOOKUP_DIRECTORY;
> +
> +	error = __user_walk(dirname, flags, nd);
>  	if (error)
>  		return error;
>  	/* you can only watch an inode if you have read permissions on it */
> @@ -943,7 +950,7 @@
>  		goto fput_and_out;
>  	}
>  
> -	ret = find_inode(path, &nd);
> +	ret = find_inode(path, &nd, mask & IN_ONLYDIR, mask & IN_DONT_FOLLOW);
>  	if (unlikely(ret))
>  		goto fput_and_out;

I'd have thought that it'd be more general to pass the __user_walk flags
into find_inode(), rather than calculating them in the callee.  Slightly
more efficient too.  

  parent reply	other threads:[~2005-12-09 22:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-07  3:54 John McCutchan
2005-12-07 18:26 ` Robert Love
2005-12-09 22:51 ` Andrew Morton [this message]
2005-12-09 23:07   ` John McCutchan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051209145144.4b118f09.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rml@novell.com \
    --cc=ttb@tentacle.dhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®