fs/notify: constify path
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 4 Aug 2022 16:57:38 +0000 (12:57 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 1 Sep 2022 21:37:29 +0000 (17:37 -0400)
Reviewed-by: Matthew Bobrowski <repnop@google.com>
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/notify/fanotify/fanotify.c
fs/notify/fanotify/fanotify.h
fs/notify/fanotify/fanotify_user.c

index cd7d09a569fff98684698609beaef412bb226754..a2a15bc4df280268ce224fb64b0934513eb2f3e2 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "fanotify.h"
 
-static bool fanotify_path_equal(struct path *p1, struct path *p2)
+static bool fanotify_path_equal(const struct path *p1, const struct path *p2)
 {
        return p1->mnt == p2->mnt && p1->dentry == p2->dentry;
 }
index 1d9f11255c64f5408e6d0ce900b9c8c61867e686..bf6d4d38afa04bf05dc47b300d0b60644cff7619 100644 (file)
@@ -458,7 +458,7 @@ static inline bool fanotify_event_has_path(struct fanotify_event *event)
                event->type == FANOTIFY_EVENT_TYPE_PATH_PERM;
 }
 
-static inline struct path *fanotify_event_path(struct fanotify_event *event)
+static inline const struct path *fanotify_event_path(struct fanotify_event *event)
 {
        if (event->type == FANOTIFY_EVENT_TYPE_PATH)
                return &FANOTIFY_PE(event)->path;
index f0e49a406ffa820bcca39c2eb7bf99adb880635a..4546da4a54f953cc5a8d0ddc3e2805330fe05006 100644 (file)
@@ -249,7 +249,7 @@ out:
        return event;
 }
 
-static int create_fd(struct fsnotify_group *group, struct path *path,
+static int create_fd(struct fsnotify_group *group, const struct path *path,
                     struct file **file)
 {
        int client_fd;
@@ -619,7 +619,7 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
                                  char __user *buf, size_t count)
 {
        struct fanotify_event_metadata metadata;
-       struct path *path = fanotify_event_path(event);
+       const struct path *path = fanotify_event_path(event);
        struct fanotify_info *info = fanotify_event_info(event);
        unsigned int info_mode = FAN_GROUP_FLAG(group, FANOTIFY_INFO_MODES);
        unsigned int pidfd_mode = info_mode & FAN_REPORT_PIDFD;
@@ -1553,7 +1553,7 @@ static int fanotify_test_fid(struct dentry *dentry)
 }
 
 static int fanotify_events_supported(struct fsnotify_group *group,
-                                    struct path *path, __u64 mask,
+                                    const struct path *path, __u64 mask,
                                     unsigned int flags)
 {
        unsigned int mark_type = flags & FANOTIFY_MARK_TYPE_BITS;