linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>,
	Matthew Bobrowski <mbobrowski@mbobrowski.org>,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v3 03/13] fanotify: rename struct fanotify_{,perm_}event_info
Date: Wed, 28 Nov 2018 15:29:30 +0100	[thread overview]
Message-ID: <20181128142930.GG15604@quack2.suse.cz> (raw)
In-Reply-To: <20181125134352.21499-4-amir73il@gmail.com>

On Sun 25-11-18 15:43:42, Amir Goldstein wrote:
> struct fanotify_event_info "inherits" from struct fsnotify_event and
> therefore a more appropriate (and short) name for it is fanotify_event.
> Same for struct fanotify_perm_event_info, which now "inherits" from
> struct fanotify_event.
> 
> We plan to reuse the name struct fanotify_event_info for user visible
> event info record format.
> 
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>

Why not and I like that the name is shorter :)

								Honza

> ---
>  fs/notify/fanotify/fanotify.c      | 14 +++++++-------
>  fs/notify/fanotify/fanotify.h      | 16 ++++++++--------
>  fs/notify/fanotify/fanotify_user.c | 20 ++++++++++----------
>  3 files changed, 25 insertions(+), 25 deletions(-)
> 
> diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
> index 3723f3d18d20..ecd5f4aec624 100644
> --- a/fs/notify/fanotify/fanotify.c
> +++ b/fs/notify/fanotify/fanotify.c
> @@ -19,7 +19,7 @@
>  static bool should_merge(struct fsnotify_event *old_fsn,
>  			 struct fsnotify_event *new_fsn)
>  {
> -	struct fanotify_event_info *old, *new;
> +	struct fanotify_event *old, *new;
>  
>  	pr_debug("%s: old=%p new=%p\n", __func__, old_fsn, new_fsn);
>  	old = FANOTIFY_E(old_fsn);
> @@ -58,7 +58,7 @@ static int fanotify_merge(struct list_head *list, struct fsnotify_event *event)
>  }
>  
>  static int fanotify_get_response(struct fsnotify_group *group,
> -				 struct fanotify_perm_event_info *event,
> +				 struct fanotify_perm_event *event,
>  				 struct fsnotify_iter_info *iter_info)
>  {
>  	int ret;
> @@ -141,11 +141,11 @@ static u32 fanotify_group_event_mask(struct fsnotify_iter_info *iter_info,
>  		~marks_ignored_mask;
>  }
>  
> -struct fanotify_event_info *fanotify_alloc_event(struct fsnotify_group *group,
> +struct fanotify_event *fanotify_alloc_event(struct fsnotify_group *group,
>  						 struct inode *inode, u32 mask,
>  						 const struct path *path)
>  {
> -	struct fanotify_event_info *event = NULL;
> +	struct fanotify_event *event = NULL;
>  	gfp_t gfp = GFP_KERNEL_ACCOUNT;
>  
>  	/*
> @@ -160,7 +160,7 @@ struct fanotify_event_info *fanotify_alloc_event(struct fsnotify_group *group,
>  	memalloc_use_memcg(group->memcg);
>  
>  	if (fanotify_is_perm_event(mask)) {
> -		struct fanotify_perm_event_info *pevent;
> +		struct fanotify_perm_event *pevent;
>  
>  		pevent = kmem_cache_alloc(fanotify_perm_event_cachep, gfp);
>  		if (!pevent)
> @@ -197,7 +197,7 @@ static int fanotify_handle_event(struct fsnotify_group *group,
>  				 struct fsnotify_iter_info *iter_info)
>  {
>  	int ret = 0;
> -	struct fanotify_event_info *event;
> +	struct fanotify_event *event;
>  	struct fsnotify_event *fsn_event;
>  
>  	BUILD_BUG_ON(FAN_ACCESS != FS_ACCESS);
> @@ -275,7 +275,7 @@ static void fanotify_free_group_priv(struct fsnotify_group *group)
>  
>  static void fanotify_free_event(struct fsnotify_event *fsn_event)
>  {
> -	struct fanotify_event_info *event;
> +	struct fanotify_event *event;
>  
>  	event = FANOTIFY_E(fsn_event);
>  	path_put(&event->path);
> diff --git a/fs/notify/fanotify/fanotify.h b/fs/notify/fanotify/fanotify.h
> index ea05b8a401e7..fb84dd3289f8 100644
> --- a/fs/notify/fanotify/fanotify.h
> +++ b/fs/notify/fanotify/fanotify.h
> @@ -12,7 +12,7 @@ extern struct kmem_cache *fanotify_perm_event_cachep;
>   * fanotify_handle_event() and freed when the information is retrieved by
>   * userspace
>   */
> -struct fanotify_event_info {
> +struct fanotify_event {
>  	struct fsnotify_event fse;
>  	/*
>  	 * We hold ref to this path so it may be dereferenced at any point
> @@ -29,16 +29,16 @@ struct fanotify_event_info {
>   * group->notification_list to group->fanotify_data.access_list to wait for
>   * user response.
>   */
> -struct fanotify_perm_event_info {
> -	struct fanotify_event_info fae;
> +struct fanotify_perm_event {
> +	struct fanotify_event fae;
>  	int response;	/* userspace answer to question */
>  	int fd;		/* fd we passed to userspace for this event */
>  };
>  
> -static inline struct fanotify_perm_event_info *
> +static inline struct fanotify_perm_event *
>  FANOTIFY_PE(struct fsnotify_event *fse)
>  {
> -	return container_of(fse, struct fanotify_perm_event_info, fae.fse);
> +	return container_of(fse, struct fanotify_perm_event, fae.fse);
>  }
>  
>  static inline bool fanotify_is_perm_event(u32 mask)
> @@ -47,11 +47,11 @@ static inline bool fanotify_is_perm_event(u32 mask)
>  		mask & FANOTIFY_PERM_EVENTS;
>  }
>  
> -static inline struct fanotify_event_info *FANOTIFY_E(struct fsnotify_event *fse)
> +static inline struct fanotify_event *FANOTIFY_E(struct fsnotify_event *fse)
>  {
> -	return container_of(fse, struct fanotify_event_info, fse);
> +	return container_of(fse, struct fanotify_event, fse);
>  }
>  
> -struct fanotify_event_info *fanotify_alloc_event(struct fsnotify_group *group,
> +struct fanotify_event *fanotify_alloc_event(struct fsnotify_group *group,
>  						 struct inode *inode, u32 mask,
>  						 const struct path *path);
> diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
> index e03be5071362..2dbb2662a92f 100644
> --- a/fs/notify/fanotify/fanotify_user.c
> +++ b/fs/notify/fanotify/fanotify_user.c
> @@ -73,7 +73,7 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
>  }
>  
>  static int create_fd(struct fsnotify_group *group,
> -		     struct fanotify_event_info *event,
> +		     struct fanotify_event *event,
>  		     struct file **file)
>  {
>  	int client_fd;
> @@ -120,13 +120,13 @@ static int fill_event_metadata(struct fsnotify_group *group,
>  			       struct file **file)
>  {
>  	int ret = 0;
> -	struct fanotify_event_info *event;
> +	struct fanotify_event *event;
>  
>  	pr_debug("%s: group=%p metadata=%p event=%p\n", __func__,
>  		 group, metadata, fsn_event);
>  
>  	*file = NULL;
> -	event = container_of(fsn_event, struct fanotify_event_info, fse);
> +	event = container_of(fsn_event, struct fanotify_event, fse);
>  	metadata->event_len = FAN_EVENT_METADATA_LEN;
>  	metadata->metadata_len = FAN_EVENT_METADATA_LEN;
>  	metadata->vers = FANOTIFY_METADATA_VERSION;
> @@ -144,10 +144,10 @@ static int fill_event_metadata(struct fsnotify_group *group,
>  	return ret;
>  }
>  
> -static struct fanotify_perm_event_info *dequeue_event(
> +static struct fanotify_perm_event *dequeue_event(
>  				struct fsnotify_group *group, int fd)
>  {
> -	struct fanotify_perm_event_info *event, *return_e = NULL;
> +	struct fanotify_perm_event *event, *return_e = NULL;
>  
>  	spin_lock(&group->notification_lock);
>  	list_for_each_entry(event, &group->fanotify_data.access_list,
> @@ -169,7 +169,7 @@ static struct fanotify_perm_event_info *dequeue_event(
>  static int process_access_response(struct fsnotify_group *group,
>  				   struct fanotify_response *response_struct)
>  {
> -	struct fanotify_perm_event_info *event;
> +	struct fanotify_perm_event *event;
>  	int fd = response_struct->fd;
>  	int response = response_struct->response;
>  
> @@ -364,7 +364,7 @@ static ssize_t fanotify_write(struct file *file, const char __user *buf, size_t
>  static int fanotify_release(struct inode *ignored, struct file *file)
>  {
>  	struct fsnotify_group *group = file->private_data;
> -	struct fanotify_perm_event_info *event, *next;
> +	struct fanotify_perm_event *event, *next;
>  	struct fsnotify_event *fsn_event;
>  
>  	/*
> @@ -682,7 +682,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
>  	struct fsnotify_group *group;
>  	int f_flags, fd;
>  	struct user_struct *user;
> -	struct fanotify_event_info *oevent;
> +	struct fanotify_event *oevent;
>  
>  	pr_debug("%s: flags=%x event_f_flags=%x\n",
>  		 __func__, flags, event_f_flags);
> @@ -949,10 +949,10 @@ static int __init fanotify_user_setup(void)
>  
>  	fanotify_mark_cache = KMEM_CACHE(fsnotify_mark,
>  					 SLAB_PANIC|SLAB_ACCOUNT);
> -	fanotify_event_cachep = KMEM_CACHE(fanotify_event_info, SLAB_PANIC);
> +	fanotify_event_cachep = KMEM_CACHE(fanotify_event, SLAB_PANIC);
>  	if (IS_ENABLED(CONFIG_FANOTIFY_ACCESS_PERMISSIONS)) {
>  		fanotify_perm_event_cachep =
> -			KMEM_CACHE(fanotify_perm_event_info, SLAB_PANIC);
> +			KMEM_CACHE(fanotify_perm_event, SLAB_PANIC);
>  	}
>  
>  	return 0;
> -- 
> 2.17.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2018-11-29  1:31 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-25 13:43 [PATCH v3 00/13] fanotify: add support for more event types Amir Goldstein
2018-11-25 13:43 ` [PATCH v3 01/13] fsnotify: annotate directory entry modification events Amir Goldstein
2018-11-28 12:59   ` Jan Kara
2018-11-28 14:39     ` Amir Goldstein
2018-11-28 14:43       ` Jan Kara
2018-11-28 15:01         ` Amir Goldstein
2018-11-25 13:43 ` [PATCH v3 02/13] fsnotify: send all event types to super block marks Amir Goldstein
2018-11-28 14:26   ` Jan Kara
2018-11-25 13:43 ` [PATCH v3 03/13] fanotify: rename struct fanotify_{,perm_}event_info Amir Goldstein
2018-11-28 14:29   ` Jan Kara [this message]
2018-11-25 13:43 ` [PATCH v3 04/13] fanotify: define the structures to report a unique file identifier Amir Goldstein
2018-11-28 15:27   ` Jan Kara
2018-11-28 16:24     ` Amir Goldstein
2018-11-28 17:43       ` Jan Kara
2018-11-28 18:34         ` Amir Goldstein
2018-11-29  7:51           ` Jan Kara
2018-11-29  8:16             ` Amir Goldstein
2018-11-29 10:16               ` Jan Kara
2018-11-29 11:10                 ` Amir Goldstein
2018-11-30 15:32                 ` Amir Goldstein
2018-12-01 16:43                   ` Amir Goldstein
2018-11-25 13:43 ` [PATCH v3 05/13] fanotify: classify events that hold a " Amir Goldstein
2018-11-28 15:33   ` Jan Kara
2018-11-28 15:44     ` Jan Kara
2018-11-28 15:52       ` Amir Goldstein
2018-11-25 13:43 ` [PATCH v3 06/13] fanotify: encode file identifier for FAN_REPORT_FID Amir Goldstein
2018-11-25 13:43 ` [PATCH v3 07/13] fanotify: copy event fid info to user Amir Goldstein
2018-11-29  9:00   ` Jan Kara
     [not found]     ` <CAOQ4uxjcb=UqQiw0XcpDfetK28bM4tOYdvgxPwhkjgE2mxpt=g@mail.gmail.com>
2018-11-29  9:49       ` Jan Kara
2018-11-25 13:43 ` [PATCH v3 08/13] fanotify: enable FAN_REPORT_FID init flag Amir Goldstein
2018-11-29  9:46   ` Jan Kara
2018-11-29 10:52     ` Jan Kara
2018-11-29 11:03     ` Amir Goldstein
2018-11-29 13:08       ` Jan Kara
2018-11-25 13:43 ` [PATCH v3 09/13] fanotify: cache fsid in fsnotify_mark_connector Amir Goldstein
2018-11-29 10:48   ` Jan Kara
2018-11-29 11:42     ` Amir Goldstein
2018-11-29 13:11       ` Jan Kara
2018-11-25 13:43 ` [PATCH v3 10/13] fanotify: check FS_ISDIR flag instead of d_is_dir() Amir Goldstein
2018-11-25 13:43 ` [PATCH v3 11/13] fanotify: support events with data type FSNOTIFY_EVENT_INODE Amir Goldstein
2018-11-25 13:43 ` [PATCH v3 12/13] fanotify: add support for create/attrib/move/delete events Amir Goldstein
2018-11-25 13:43 ` [PATCH v3 13/13] fanotify: report FAN_ONDIR to listener with FAN_REPORT_FID Amir Goldstein

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=20181128142930.GG15604@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=amir73il@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mbobrowski@mbobrowski.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;
as well as URLs for NNTP newsgroup(s).