diff options
author | Amir Goldstein <amir73il@gmail.com> | 2019-01-10 12:04:32 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2019-02-06 09:25:45 -0500 |
commit | 33913997d5c06781c162952c6e5017131fc5aa19 (patch) | |
tree | c8fbd8ba8a338833008ce6e32929a18fd6f8e223 /fs/notify | |
parent | a0a92d261f2922f4b5d2c0a98d6c41a89c7f5edd (diff) |
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: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify')
-rw-r--r-- | fs/notify/fanotify/fanotify.c | 16 | ||||
-rw-r--r-- | fs/notify/fanotify/fanotify.h | 16 | ||||
-rw-r--r-- | fs/notify/fanotify/fanotify_user.c | 20 |
3 files changed, 26 insertions, 26 deletions
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c index 98197802bbfb..d8e3b6e50844 100644 --- a/fs/notify/fanotify/fanotify.c +++ b/fs/notify/fanotify/fanotify.c | |||
@@ -19,7 +19,7 @@ | |||
19 | static bool should_merge(struct fsnotify_event *old_fsn, | 19 | static bool should_merge(struct fsnotify_event *old_fsn, |
20 | struct fsnotify_event *new_fsn) | 20 | struct fsnotify_event *new_fsn) |
21 | { | 21 | { |
22 | struct fanotify_event_info *old, *new; | 22 | struct fanotify_event *old, *new; |
23 | 23 | ||
24 | pr_debug("%s: old=%p new=%p\n", __func__, old_fsn, new_fsn); | 24 | pr_debug("%s: old=%p new=%p\n", __func__, old_fsn, new_fsn); |
25 | old = FANOTIFY_E(old_fsn); | 25 | old = FANOTIFY_E(old_fsn); |
@@ -36,7 +36,7 @@ static bool should_merge(struct fsnotify_event *old_fsn, | |||
36 | static int fanotify_merge(struct list_head *list, struct fsnotify_event *event) | 36 | static int fanotify_merge(struct list_head *list, struct fsnotify_event *event) |
37 | { | 37 | { |
38 | struct fsnotify_event *test_event; | 38 | struct fsnotify_event *test_event; |
39 | struct fanotify_event_info *new; | 39 | struct fanotify_event *new; |
40 | 40 | ||
41 | pr_debug("%s: list=%p event=%p\n", __func__, list, event); | 41 | pr_debug("%s: list=%p event=%p\n", __func__, list, event); |
42 | new = FANOTIFY_E(event); | 42 | new = FANOTIFY_E(event); |
@@ -60,7 +60,7 @@ static int fanotify_merge(struct list_head *list, struct fsnotify_event *event) | |||
60 | } | 60 | } |
61 | 61 | ||
62 | static int fanotify_get_response(struct fsnotify_group *group, | 62 | static int fanotify_get_response(struct fsnotify_group *group, |
63 | struct fanotify_perm_event_info *event, | 63 | struct fanotify_perm_event *event, |
64 | struct fsnotify_iter_info *iter_info) | 64 | struct fsnotify_iter_info *iter_info) |
65 | { | 65 | { |
66 | int ret; | 66 | int ret; |
@@ -143,11 +143,11 @@ static u32 fanotify_group_event_mask(struct fsnotify_iter_info *iter_info, | |||
143 | ~marks_ignored_mask; | 143 | ~marks_ignored_mask; |
144 | } | 144 | } |
145 | 145 | ||
146 | struct fanotify_event_info *fanotify_alloc_event(struct fsnotify_group *group, | 146 | struct fanotify_event *fanotify_alloc_event(struct fsnotify_group *group, |
147 | struct inode *inode, u32 mask, | 147 | struct inode *inode, u32 mask, |
148 | const struct path *path) | 148 | const struct path *path) |
149 | { | 149 | { |
150 | struct fanotify_event_info *event = NULL; | 150 | struct fanotify_event *event = NULL; |
151 | gfp_t gfp = GFP_KERNEL_ACCOUNT; | 151 | gfp_t gfp = GFP_KERNEL_ACCOUNT; |
152 | 152 | ||
153 | /* | 153 | /* |
@@ -162,7 +162,7 @@ struct fanotify_event_info *fanotify_alloc_event(struct fsnotify_group *group, | |||
162 | memalloc_use_memcg(group->memcg); | 162 | memalloc_use_memcg(group->memcg); |
163 | 163 | ||
164 | if (fanotify_is_perm_event(mask)) { | 164 | if (fanotify_is_perm_event(mask)) { |
165 | struct fanotify_perm_event_info *pevent; | 165 | struct fanotify_perm_event *pevent; |
166 | 166 | ||
167 | pevent = kmem_cache_alloc(fanotify_perm_event_cachep, gfp); | 167 | pevent = kmem_cache_alloc(fanotify_perm_event_cachep, gfp); |
168 | if (!pevent) | 168 | if (!pevent) |
@@ -200,7 +200,7 @@ static int fanotify_handle_event(struct fsnotify_group *group, | |||
200 | struct fsnotify_iter_info *iter_info) | 200 | struct fsnotify_iter_info *iter_info) |
201 | { | 201 | { |
202 | int ret = 0; | 202 | int ret = 0; |
203 | struct fanotify_event_info *event; | 203 | struct fanotify_event *event; |
204 | struct fsnotify_event *fsn_event; | 204 | struct fsnotify_event *fsn_event; |
205 | 205 | ||
206 | BUILD_BUG_ON(FAN_ACCESS != FS_ACCESS); | 206 | BUILD_BUG_ON(FAN_ACCESS != FS_ACCESS); |
@@ -278,7 +278,7 @@ static void fanotify_free_group_priv(struct fsnotify_group *group) | |||
278 | 278 | ||
279 | static void fanotify_free_event(struct fsnotify_event *fsn_event) | 279 | static void fanotify_free_event(struct fsnotify_event *fsn_event) |
280 | { | 280 | { |
281 | struct fanotify_event_info *event; | 281 | struct fanotify_event *event; |
282 | 282 | ||
283 | event = FANOTIFY_E(fsn_event); | 283 | event = FANOTIFY_E(fsn_event); |
284 | path_put(&event->path); | 284 | path_put(&event->path); |
diff --git a/fs/notify/fanotify/fanotify.h b/fs/notify/fanotify/fanotify.h index e630d787d4c3..898b5b2bc1c7 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; | |||
12 | * fanotify_handle_event() and freed when the information is retrieved by | 12 | * fanotify_handle_event() and freed when the information is retrieved by |
13 | * userspace | 13 | * userspace |
14 | */ | 14 | */ |
15 | struct fanotify_event_info { | 15 | struct fanotify_event { |
16 | struct fsnotify_event fse; | 16 | struct fsnotify_event fse; |
17 | u32 mask; | 17 | u32 mask; |
18 | /* | 18 | /* |
@@ -30,16 +30,16 @@ struct fanotify_event_info { | |||
30 | * group->notification_list to group->fanotify_data.access_list to wait for | 30 | * group->notification_list to group->fanotify_data.access_list to wait for |
31 | * user response. | 31 | * user response. |
32 | */ | 32 | */ |
33 | struct fanotify_perm_event_info { | 33 | struct fanotify_perm_event { |
34 | struct fanotify_event_info fae; | 34 | struct fanotify_event fae; |
35 | int response; /* userspace answer to question */ | 35 | int response; /* userspace answer to question */ |
36 | int fd; /* fd we passed to userspace for this event */ | 36 | int fd; /* fd we passed to userspace for this event */ |
37 | }; | 37 | }; |
38 | 38 | ||
39 | static inline struct fanotify_perm_event_info * | 39 | static inline struct fanotify_perm_event * |
40 | FANOTIFY_PE(struct fsnotify_event *fse) | 40 | FANOTIFY_PE(struct fsnotify_event *fse) |
41 | { | 41 | { |
42 | return container_of(fse, struct fanotify_perm_event_info, fae.fse); | 42 | return container_of(fse, struct fanotify_perm_event, fae.fse); |
43 | } | 43 | } |
44 | 44 | ||
45 | static inline bool fanotify_is_perm_event(u32 mask) | 45 | static inline bool fanotify_is_perm_event(u32 mask) |
@@ -48,11 +48,11 @@ static inline bool fanotify_is_perm_event(u32 mask) | |||
48 | mask & FANOTIFY_PERM_EVENTS; | 48 | mask & FANOTIFY_PERM_EVENTS; |
49 | } | 49 | } |
50 | 50 | ||
51 | static inline struct fanotify_event_info *FANOTIFY_E(struct fsnotify_event *fse) | 51 | static inline struct fanotify_event *FANOTIFY_E(struct fsnotify_event *fse) |
52 | { | 52 | { |
53 | return container_of(fse, struct fanotify_event_info, fse); | 53 | return container_of(fse, struct fanotify_event, fse); |
54 | } | 54 | } |
55 | 55 | ||
56 | struct fanotify_event_info *fanotify_alloc_event(struct fsnotify_group *group, | 56 | struct fanotify_event *fanotify_alloc_event(struct fsnotify_group *group, |
57 | struct inode *inode, u32 mask, | 57 | struct inode *inode, u32 mask, |
58 | const struct path *path); | 58 | const struct path *path); |
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index dea47d07cc29..55cd87b0cc26 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, | |||
73 | } | 73 | } |
74 | 74 | ||
75 | static int create_fd(struct fsnotify_group *group, | 75 | static int create_fd(struct fsnotify_group *group, |
76 | struct fanotify_event_info *event, | 76 | struct fanotify_event *event, |
77 | struct file **file) | 77 | struct file **file) |
78 | { | 78 | { |
79 | int client_fd; | 79 | int client_fd; |
@@ -120,13 +120,13 @@ static int fill_event_metadata(struct fsnotify_group *group, | |||
120 | struct file **file) | 120 | struct file **file) |
121 | { | 121 | { |
122 | int ret = 0; | 122 | int ret = 0; |
123 | struct fanotify_event_info *event; | 123 | struct fanotify_event *event; |
124 | 124 | ||
125 | pr_debug("%s: group=%p metadata=%p event=%p\n", __func__, | 125 | pr_debug("%s: group=%p metadata=%p event=%p\n", __func__, |
126 | group, metadata, fsn_event); | 126 | group, metadata, fsn_event); |
127 | 127 | ||
128 | *file = NULL; | 128 | *file = NULL; |
129 | event = container_of(fsn_event, struct fanotify_event_info, fse); | 129 | event = container_of(fsn_event, struct fanotify_event, fse); |
130 | metadata->event_len = FAN_EVENT_METADATA_LEN; | 130 | metadata->event_len = FAN_EVENT_METADATA_LEN; |
131 | metadata->metadata_len = FAN_EVENT_METADATA_LEN; | 131 | metadata->metadata_len = FAN_EVENT_METADATA_LEN; |
132 | metadata->vers = FANOTIFY_METADATA_VERSION; | 132 | metadata->vers = FANOTIFY_METADATA_VERSION; |
@@ -144,10 +144,10 @@ static int fill_event_metadata(struct fsnotify_group *group, | |||
144 | return ret; | 144 | return ret; |
145 | } | 145 | } |
146 | 146 | ||
147 | static struct fanotify_perm_event_info *dequeue_event( | 147 | static struct fanotify_perm_event *dequeue_event( |
148 | struct fsnotify_group *group, int fd) | 148 | struct fsnotify_group *group, int fd) |
149 | { | 149 | { |
150 | struct fanotify_perm_event_info *event, *return_e = NULL; | 150 | struct fanotify_perm_event *event, *return_e = NULL; |
151 | 151 | ||
152 | spin_lock(&group->notification_lock); | 152 | spin_lock(&group->notification_lock); |
153 | list_for_each_entry(event, &group->fanotify_data.access_list, | 153 | list_for_each_entry(event, &group->fanotify_data.access_list, |
@@ -169,7 +169,7 @@ static struct fanotify_perm_event_info *dequeue_event( | |||
169 | static int process_access_response(struct fsnotify_group *group, | 169 | static int process_access_response(struct fsnotify_group *group, |
170 | struct fanotify_response *response_struct) | 170 | struct fanotify_response *response_struct) |
171 | { | 171 | { |
172 | struct fanotify_perm_event_info *event; | 172 | struct fanotify_perm_event *event; |
173 | int fd = response_struct->fd; | 173 | int fd = response_struct->fd; |
174 | int response = response_struct->response; | 174 | int response = response_struct->response; |
175 | 175 | ||
@@ -370,7 +370,7 @@ static ssize_t fanotify_write(struct file *file, const char __user *buf, size_t | |||
370 | static int fanotify_release(struct inode *ignored, struct file *file) | 370 | static int fanotify_release(struct inode *ignored, struct file *file) |
371 | { | 371 | { |
372 | struct fsnotify_group *group = file->private_data; | 372 | struct fsnotify_group *group = file->private_data; |
373 | struct fanotify_perm_event_info *event, *next; | 373 | struct fanotify_perm_event *event, *next; |
374 | struct fsnotify_event *fsn_event; | 374 | struct fsnotify_event *fsn_event; |
375 | 375 | ||
376 | /* | 376 | /* |
@@ -688,7 +688,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) | |||
688 | struct fsnotify_group *group; | 688 | struct fsnotify_group *group; |
689 | int f_flags, fd; | 689 | int f_flags, fd; |
690 | struct user_struct *user; | 690 | struct user_struct *user; |
691 | struct fanotify_event_info *oevent; | 691 | struct fanotify_event *oevent; |
692 | 692 | ||
693 | pr_debug("%s: flags=%x event_f_flags=%x\n", | 693 | pr_debug("%s: flags=%x event_f_flags=%x\n", |
694 | __func__, flags, event_f_flags); | 694 | __func__, flags, event_f_flags); |
@@ -955,10 +955,10 @@ static int __init fanotify_user_setup(void) | |||
955 | 955 | ||
956 | fanotify_mark_cache = KMEM_CACHE(fsnotify_mark, | 956 | fanotify_mark_cache = KMEM_CACHE(fsnotify_mark, |
957 | SLAB_PANIC|SLAB_ACCOUNT); | 957 | SLAB_PANIC|SLAB_ACCOUNT); |
958 | fanotify_event_cachep = KMEM_CACHE(fanotify_event_info, SLAB_PANIC); | 958 | fanotify_event_cachep = KMEM_CACHE(fanotify_event, SLAB_PANIC); |
959 | if (IS_ENABLED(CONFIG_FANOTIFY_ACCESS_PERMISSIONS)) { | 959 | if (IS_ENABLED(CONFIG_FANOTIFY_ACCESS_PERMISSIONS)) { |
960 | fanotify_perm_event_cachep = | 960 | fanotify_perm_event_cachep = |
961 | KMEM_CACHE(fanotify_perm_event_info, SLAB_PANIC); | 961 | KMEM_CACHE(fanotify_perm_event, SLAB_PANIC); |
962 | } | 962 | } |
963 | 963 | ||
964 | return 0; | 964 | return 0; |