Skip to contentSkip to conversation

fanotify: display group registration info

RFC In review Eric Paris 1 participant 1 message Sep 26, 2008 Fsnotify: filesystem notification infrastructure

lore
Share & tools
lore

Eric Paris

author
#0 lore raw

RFC 4/11 fanotify: display group registration info

fanotify: display group registration info

From: Eric Paris <[email protected]>

new file /security/fanotify/[name]/info will display registration information so a process can know if the group gives what it wants, needs to be cleanup up, should be reused, etc etc.

---

 fs/notify/Makefile    |    2 +
 fs/notify/fanotify.h  |    4 ++
 fs/notify/group.c     |    7 ++++
 fs/notify/info_user.c |   85 +++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 97 insertions(+), 1 deletions(-)
 create mode 100644 fs/notify/info_user.c
fs/notify/Makefile +1 -1
index 21ca1da..01915f7 100644
@@ -3,4 +3,4 @@ obj-$(CONFIG_INOTIFY_USER)	+= inotify_user.o
 
 obj-$(CONFIG_DNOTIFY)		+= dnotify.o
 
-obj-$(CONFIG_FANOTIFY)		+= fanotify.o notification.o notification_user.o group.o group_user.o
+obj-$(CONFIG_FANOTIFY)		+= fanotify.o notification.o notification_user.o group.o group_user.o info_user.o
fs/notify/fanotify.h +4 -0
index d6bc0c0..78d8be0 100644
@@ -24,6 +24,7 @@ struct fanotify_group {
 	char *name;			/* group name used for register/unregister matching */
 	struct dentry *subdir;		/* pointer to fanotify/name dentry */
 	struct dentry *notification;	/* pointer to fanotify/name/notification dentry */
+	struct dentry *info;		/* pointer to fanotify/name/info dentry */
 };
 
 /*
@@ -66,6 +67,9 @@ extern struct list_head groups;
 extern __init int fanotify_register_init(void);
 extern __init int fanotify_register_uninit(void);
 
+extern int fanotify_info_user_destroy(struct fanotify_group *group);
+extern int fanotify_info_user_create(struct fanotify_group *group);
+
 extern int fanotify_notification_user_destroy(struct fanotify_group *group);
 extern int fanotify_notification_user_create(struct fanotify_group *group);
 
fs/notify/group.c +7 -0
index a7a4d7f..926d0a4 100644
@@ -45,6 +45,7 @@ void fanotify_get_group(struct fanotify_group *group)
 void fanotify_kill_group(struct fanotify_group *group)
 {
 	fanotify_notification_user_destroy(group);
+	fanotify_info_user_destroy(group);
 
 	securityfs_remove(group->subdir);
 	group->subdir = NULL;
@@ -107,12 +108,18 @@ int fanotify_register_group(char *name, unsigned int mask)
 	if (rc)
 		goto out_clean_subdir;
 
+	rc = fanotify_info_user_create(group);
+	if (rc)
+		goto out_clean_notification;
+
 	/* add it */
 	list_add_rcu(&group->group_list, &groups);
 	mutex_unlock(&groups_mutex);
 
 	return 0;
 
+out_clean_notification:
+	fanotify_notification_user_destroy(group);
 out_clean_subdir:
 	securityfs_remove(subdir);
 out_free_name:
fs/notify/info_user.c new file +85 -0

85 lines not on this page · raw message