Skip to content

Commit 3391399

Browse files
amir73iljankara
authored andcommitted
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>
1 parent a0a92d2 commit 3391399

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

fs/notify/fanotify/fanotify.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
static bool should_merge(struct fsnotify_event *old_fsn,
2020
struct fsnotify_event *new_fsn)
2121
{
22-
struct fanotify_event_info *old, *new;
22+
struct fanotify_event *old, *new;
2323

2424
pr_debug("%s: old=%p new=%p\n", __func__, old_fsn, new_fsn);
2525
old = FANOTIFY_E(old_fsn);
@@ -36,7 +36,7 @@ static bool should_merge(struct fsnotify_event *old_fsn,
3636
static int fanotify_merge(struct list_head *list, struct fsnotify_event *event)
3737
{
3838
struct fsnotify_event *test_event;
39-
struct fanotify_event_info *new;
39+
struct fanotify_event *new;
4040

4141
pr_debug("%s: list=%p event=%p\n", __func__, list, event);
4242
new = FANOTIFY_E(event);
@@ -60,7 +60,7 @@ static int fanotify_merge(struct list_head *list, struct fsnotify_event *event)
6060
}
6161

6262
static int fanotify_get_response(struct fsnotify_group *group,
63-
struct fanotify_perm_event_info *event,
63+
struct fanotify_perm_event *event,
6464
struct fsnotify_iter_info *iter_info)
6565
{
6666
int ret;
@@ -143,11 +143,11 @@ static u32 fanotify_group_event_mask(struct fsnotify_iter_info *iter_info,
143143
~marks_ignored_mask;
144144
}
145145

146-
struct fanotify_event_info *fanotify_alloc_event(struct fsnotify_group *group,
146+
struct fanotify_event *fanotify_alloc_event(struct fsnotify_group *group,
147147
struct inode *inode, u32 mask,
148148
const struct path *path)
149149
{
150-
struct fanotify_event_info *event = NULL;
150+
struct fanotify_event *event = NULL;
151151
gfp_t gfp = GFP_KERNEL_ACCOUNT;
152152

153153
/*
@@ -162,7 +162,7 @@ struct fanotify_event_info *fanotify_alloc_event(struct fsnotify_group *group,
162162
memalloc_use_memcg(group->memcg);
163163

164164
if (fanotify_is_perm_event(mask)) {
165-
struct fanotify_perm_event_info *pevent;
165+
struct fanotify_perm_event *pevent;
166166

167167
pevent = kmem_cache_alloc(fanotify_perm_event_cachep, gfp);
168168
if (!pevent)
@@ -200,7 +200,7 @@ static int fanotify_handle_event(struct fsnotify_group *group,
200200
struct fsnotify_iter_info *iter_info)
201201
{
202202
int ret = 0;
203-
struct fanotify_event_info *event;
203+
struct fanotify_event *event;
204204
struct fsnotify_event *fsn_event;
205205

206206
BUILD_BUG_ON(FAN_ACCESS != FS_ACCESS);
@@ -278,7 +278,7 @@ static void fanotify_free_group_priv(struct fsnotify_group *group)
278278

279279
static void fanotify_free_event(struct fsnotify_event *fsn_event)
280280
{
281-
struct fanotify_event_info *event;
281+
struct fanotify_event *event;
282282

283283
event = FANOTIFY_E(fsn_event);
284284
path_put(&event->path);

fs/notify/fanotify/fanotify.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extern struct kmem_cache *fanotify_perm_event_cachep;
1212
* fanotify_handle_event() and freed when the information is retrieved by
1313
* userspace
1414
*/
15-
struct fanotify_event_info {
15+
struct fanotify_event {
1616
struct fsnotify_event fse;
1717
u32 mask;
1818
/*
@@ -30,16 +30,16 @@ struct fanotify_event_info {
3030
* group->notification_list to group->fanotify_data.access_list to wait for
3131
* user response.
3232
*/
33-
struct fanotify_perm_event_info {
34-
struct fanotify_event_info fae;
33+
struct fanotify_perm_event {
34+
struct fanotify_event fae;
3535
int response; /* userspace answer to question */
3636
int fd; /* fd we passed to userspace for this event */
3737
};
3838

39-
static inline struct fanotify_perm_event_info *
39+
static inline struct fanotify_perm_event *
4040
FANOTIFY_PE(struct fsnotify_event *fse)
4141
{
42-
return container_of(fse, struct fanotify_perm_event_info, fae.fse);
42+
return container_of(fse, struct fanotify_perm_event, fae.fse);
4343
}
4444

4545
static inline bool fanotify_is_perm_event(u32 mask)
@@ -48,11 +48,11 @@ static inline bool fanotify_is_perm_event(u32 mask)
4848
mask & FANOTIFY_PERM_EVENTS;
4949
}
5050

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)
5252
{
53-
return container_of(fse, struct fanotify_event_info, fse);
53+
return container_of(fse, struct fanotify_event, fse);
5454
}
5555

56-
struct fanotify_event_info *fanotify_alloc_event(struct fsnotify_group *group,
56+
struct fanotify_event *fanotify_alloc_event(struct fsnotify_group *group,
5757
struct inode *inode, u32 mask,
5858
const struct path *path);

fs/notify/fanotify/fanotify_user.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
7373
}
7474

7575
static int create_fd(struct fsnotify_group *group,
76-
struct fanotify_event_info *event,
76+
struct fanotify_event *event,
7777
struct file **file)
7878
{
7979
int client_fd;
@@ -120,13 +120,13 @@ static int fill_event_metadata(struct fsnotify_group *group,
120120
struct file **file)
121121
{
122122
int ret = 0;
123-
struct fanotify_event_info *event;
123+
struct fanotify_event *event;
124124

125125
pr_debug("%s: group=%p metadata=%p event=%p\n", __func__,
126126
group, metadata, fsn_event);
127127

128128
*file = NULL;
129-
event = container_of(fsn_event, struct fanotify_event_info, fse);
129+
event = container_of(fsn_event, struct fanotify_event, fse);
130130
metadata->event_len = FAN_EVENT_METADATA_LEN;
131131
metadata->metadata_len = FAN_EVENT_METADATA_LEN;
132132
metadata->vers = FANOTIFY_METADATA_VERSION;
@@ -144,10 +144,10 @@ static int fill_event_metadata(struct fsnotify_group *group,
144144
return ret;
145145
}
146146

147-
static struct fanotify_perm_event_info *dequeue_event(
147+
static struct fanotify_perm_event *dequeue_event(
148148
struct fsnotify_group *group, int fd)
149149
{
150-
struct fanotify_perm_event_info *event, *return_e = NULL;
150+
struct fanotify_perm_event *event, *return_e = NULL;
151151

152152
spin_lock(&group->notification_lock);
153153
list_for_each_entry(event, &group->fanotify_data.access_list,
@@ -169,7 +169,7 @@ static struct fanotify_perm_event_info *dequeue_event(
169169
static int process_access_response(struct fsnotify_group *group,
170170
struct fanotify_response *response_struct)
171171
{
172-
struct fanotify_perm_event_info *event;
172+
struct fanotify_perm_event *event;
173173
int fd = response_struct->fd;
174174
int response = response_struct->response;
175175

@@ -370,7 +370,7 @@ static ssize_t fanotify_write(struct file *file, const char __user *buf, size_t
370370
static int fanotify_release(struct inode *ignored, struct file *file)
371371
{
372372
struct fsnotify_group *group = file->private_data;
373-
struct fanotify_perm_event_info *event, *next;
373+
struct fanotify_perm_event *event, *next;
374374
struct fsnotify_event *fsn_event;
375375

376376
/*
@@ -688,7 +688,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
688688
struct fsnotify_group *group;
689689
int f_flags, fd;
690690
struct user_struct *user;
691-
struct fanotify_event_info *oevent;
691+
struct fanotify_event *oevent;
692692

693693
pr_debug("%s: flags=%x event_f_flags=%x\n",
694694
__func__, flags, event_f_flags);
@@ -955,10 +955,10 @@ static int __init fanotify_user_setup(void)
955955

956956
fanotify_mark_cache = KMEM_CACHE(fsnotify_mark,
957957
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);
959959
if (IS_ENABLED(CONFIG_FANOTIFY_ACCESS_PERMISSIONS)) {
960960
fanotify_perm_event_cachep =
961-
KMEM_CACHE(fanotify_perm_event_info, SLAB_PANIC);
961+
KMEM_CACHE(fanotify_perm_event, SLAB_PANIC);
962962
}
963963

964964
return 0;

0 commit comments

Comments
 (0)