Commit 33913997 authored by Amir Goldstein's avatar Amir Goldstein Committed by Jan Kara

fanotify: rename struct fanotify_{,perm_}event_info

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: default avatarAmir Goldstein <amir73il@gmail.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent a0a92d26
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
static bool should_merge(struct fsnotify_event *old_fsn, static bool should_merge(struct fsnotify_event *old_fsn,
struct fsnotify_event *new_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); pr_debug("%s: old=%p new=%p\n", __func__, old_fsn, new_fsn);
old = FANOTIFY_E(old_fsn); old = FANOTIFY_E(old_fsn);
...@@ -36,7 +36,7 @@ static bool should_merge(struct fsnotify_event *old_fsn, ...@@ -36,7 +36,7 @@ static bool should_merge(struct fsnotify_event *old_fsn,
static int fanotify_merge(struct list_head *list, struct fsnotify_event *event) static int fanotify_merge(struct list_head *list, struct fsnotify_event *event)
{ {
struct fsnotify_event *test_event; struct fsnotify_event *test_event;
struct fanotify_event_info *new; struct fanotify_event *new;
pr_debug("%s: list=%p event=%p\n", __func__, list, event); pr_debug("%s: list=%p event=%p\n", __func__, list, event);
new = FANOTIFY_E(event); new = FANOTIFY_E(event);
...@@ -60,7 +60,7 @@ static int fanotify_merge(struct list_head *list, struct fsnotify_event *event) ...@@ -60,7 +60,7 @@ static int fanotify_merge(struct list_head *list, struct fsnotify_event *event)
} }
static int fanotify_get_response(struct fsnotify_group *group, 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) struct fsnotify_iter_info *iter_info)
{ {
int ret; int ret;
...@@ -143,11 +143,11 @@ static u32 fanotify_group_event_mask(struct fsnotify_iter_info *iter_info, ...@@ -143,11 +143,11 @@ static u32 fanotify_group_event_mask(struct fsnotify_iter_info *iter_info,
~marks_ignored_mask; ~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, struct inode *inode, u32 mask,
const struct path *path) const struct path *path)
{ {
struct fanotify_event_info *event = NULL; struct fanotify_event *event = NULL;
gfp_t gfp = GFP_KERNEL_ACCOUNT; gfp_t gfp = GFP_KERNEL_ACCOUNT;
/* /*
...@@ -162,7 +162,7 @@ struct fanotify_event_info *fanotify_alloc_event(struct fsnotify_group *group, ...@@ -162,7 +162,7 @@ struct fanotify_event_info *fanotify_alloc_event(struct fsnotify_group *group,
memalloc_use_memcg(group->memcg); memalloc_use_memcg(group->memcg);
if (fanotify_is_perm_event(mask)) { 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); pevent = kmem_cache_alloc(fanotify_perm_event_cachep, gfp);
if (!pevent) if (!pevent)
...@@ -200,7 +200,7 @@ static int fanotify_handle_event(struct fsnotify_group *group, ...@@ -200,7 +200,7 @@ static int fanotify_handle_event(struct fsnotify_group *group,
struct fsnotify_iter_info *iter_info) struct fsnotify_iter_info *iter_info)
{ {
int ret = 0; int ret = 0;
struct fanotify_event_info *event; struct fanotify_event *event;
struct fsnotify_event *fsn_event; struct fsnotify_event *fsn_event;
BUILD_BUG_ON(FAN_ACCESS != FS_ACCESS); BUILD_BUG_ON(FAN_ACCESS != FS_ACCESS);
...@@ -278,7 +278,7 @@ static void fanotify_free_group_priv(struct fsnotify_group *group) ...@@ -278,7 +278,7 @@ static void fanotify_free_group_priv(struct fsnotify_group *group)
static void fanotify_free_event(struct fsnotify_event *fsn_event) static void fanotify_free_event(struct fsnotify_event *fsn_event)
{ {
struct fanotify_event_info *event; struct fanotify_event *event;
event = FANOTIFY_E(fsn_event); event = FANOTIFY_E(fsn_event);
path_put(&event->path); path_put(&event->path);
......
...@@ -12,7 +12,7 @@ extern struct kmem_cache *fanotify_perm_event_cachep; ...@@ -12,7 +12,7 @@ extern struct kmem_cache *fanotify_perm_event_cachep;
* fanotify_handle_event() and freed when the information is retrieved by * fanotify_handle_event() and freed when the information is retrieved by
* userspace * userspace
*/ */
struct fanotify_event_info { struct fanotify_event {
struct fsnotify_event fse; struct fsnotify_event fse;
u32 mask; u32 mask;
/* /*
...@@ -30,16 +30,16 @@ struct fanotify_event_info { ...@@ -30,16 +30,16 @@ struct fanotify_event_info {
* group->notification_list to group->fanotify_data.access_list to wait for * group->notification_list to group->fanotify_data.access_list to wait for
* user response. * user response.
*/ */
struct fanotify_perm_event_info { struct fanotify_perm_event {
struct fanotify_event_info fae; struct fanotify_event fae;
int response; /* userspace answer to question */ int response; /* userspace answer to question */
int fd; /* fd we passed to userspace for this event */ 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) 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) static inline bool fanotify_is_perm_event(u32 mask)
...@@ -48,11 +48,11 @@ static inline bool fanotify_is_perm_event(u32 mask) ...@@ -48,11 +48,11 @@ static inline bool fanotify_is_perm_event(u32 mask)
mask & FANOTIFY_PERM_EVENTS; 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, struct inode *inode, u32 mask,
const struct path *path); const struct path *path);
...@@ -73,7 +73,7 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group, ...@@ -73,7 +73,7 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
} }
static int create_fd(struct fsnotify_group *group, static int create_fd(struct fsnotify_group *group,
struct fanotify_event_info *event, struct fanotify_event *event,
struct file **file) struct file **file)
{ {
int client_fd; int client_fd;
...@@ -120,13 +120,13 @@ static int fill_event_metadata(struct fsnotify_group *group, ...@@ -120,13 +120,13 @@ static int fill_event_metadata(struct fsnotify_group *group,
struct file **file) struct file **file)
{ {
int ret = 0; int ret = 0;
struct fanotify_event_info *event; struct fanotify_event *event;
pr_debug("%s: group=%p metadata=%p event=%p\n", __func__, pr_debug("%s: group=%p metadata=%p event=%p\n", __func__,
group, metadata, fsn_event); group, metadata, fsn_event);
*file = NULL; *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->event_len = FAN_EVENT_METADATA_LEN;
metadata->metadata_len = FAN_EVENT_METADATA_LEN; metadata->metadata_len = FAN_EVENT_METADATA_LEN;
metadata->vers = FANOTIFY_METADATA_VERSION; metadata->vers = FANOTIFY_METADATA_VERSION;
...@@ -144,10 +144,10 @@ static int fill_event_metadata(struct fsnotify_group *group, ...@@ -144,10 +144,10 @@ static int fill_event_metadata(struct fsnotify_group *group,
return ret; return ret;
} }
static struct fanotify_perm_event_info *dequeue_event( static struct fanotify_perm_event *dequeue_event(
struct fsnotify_group *group, int fd) 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); spin_lock(&group->notification_lock);
list_for_each_entry(event, &group->fanotify_data.access_list, list_for_each_entry(event, &group->fanotify_data.access_list,
...@@ -169,7 +169,7 @@ static struct fanotify_perm_event_info *dequeue_event( ...@@ -169,7 +169,7 @@ static struct fanotify_perm_event_info *dequeue_event(
static int process_access_response(struct fsnotify_group *group, static int process_access_response(struct fsnotify_group *group,
struct fanotify_response *response_struct) struct fanotify_response *response_struct)
{ {
struct fanotify_perm_event_info *event; struct fanotify_perm_event *event;
int fd = response_struct->fd; int fd = response_struct->fd;
int response = response_struct->response; int response = response_struct->response;
...@@ -370,7 +370,7 @@ static ssize_t fanotify_write(struct file *file, const char __user *buf, size_t ...@@ -370,7 +370,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) static int fanotify_release(struct inode *ignored, struct file *file)
{ {
struct fsnotify_group *group = file->private_data; 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; struct fsnotify_event *fsn_event;
/* /*
...@@ -688,7 +688,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) ...@@ -688,7 +688,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
struct fsnotify_group *group; struct fsnotify_group *group;
int f_flags, fd; int f_flags, fd;
struct user_struct *user; struct user_struct *user;
struct fanotify_event_info *oevent; struct fanotify_event *oevent;
pr_debug("%s: flags=%x event_f_flags=%x\n", pr_debug("%s: flags=%x event_f_flags=%x\n",
__func__, flags, event_f_flags); __func__, flags, event_f_flags);
...@@ -955,10 +955,10 @@ static int __init fanotify_user_setup(void) ...@@ -955,10 +955,10 @@ static int __init fanotify_user_setup(void)
fanotify_mark_cache = KMEM_CACHE(fsnotify_mark, fanotify_mark_cache = KMEM_CACHE(fsnotify_mark,
SLAB_PANIC|SLAB_ACCOUNT); 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)) { if (IS_ENABLED(CONFIG_FANOTIFY_ACCESS_PERMISSIONS)) {
fanotify_perm_event_cachep = fanotify_perm_event_cachep =
KMEM_CACHE(fanotify_perm_event_info, SLAB_PANIC); KMEM_CACHE(fanotify_perm_event, SLAB_PANIC);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment