Skip to content

Commit

Permalink
fs: Constify path_is_under()'s arguments
Browse files Browse the repository at this point in the history
The function path_is_under() doesn't modify the paths pointed by its
arguments but only browse them. Constifying this pointers make a cleaner
interface to be used by (future) code which may only have access to
const struct path pointers (e.g. LSM hooks).

Signed-off-by: Mickaël Salaün <[email protected]>
Cc: Alexander Viro <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
l0kod authored and Al Viro committed Dec 5, 2016
1 parent e5517c2 commit 640eb7e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2997,7 +2997,7 @@ bool is_path_reachable(struct mount *mnt, struct dentry *dentry,
return &mnt->mnt == root->mnt && is_subdir(dentry, root->dentry);
}

bool path_is_under(struct path *path1, struct path *path2)
bool path_is_under(const struct path *path1, const struct path *path2)
{
bool res;
read_seqlock_excl(&mount_lock);
Expand Down
2 changes: 1 addition & 1 deletion include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2709,7 +2709,7 @@ extern struct file * open_exec(const char *);

/* fs/dcache.c -- generic fs support functions */
extern bool is_subdir(struct dentry *, struct dentry *);
extern bool path_is_under(struct path *, struct path *);
extern bool path_is_under(const struct path *, const struct path *);

extern char *file_path(struct file *, char *, int);

Expand Down

0 comments on commit 640eb7e

Please sign in to comment.