Skip to content

Commit b853a16

Browse files
author
Al Viro
committed
turn user_{path_at,path,lpath,path_dir}() into static inlines
Signed-off-by: Al Viro <[email protected]>
1 parent 9883d18 commit b853a16

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed

fs/namei.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2299,13 +2299,7 @@ int user_path_at_empty(int dfd, const char __user *name, unsigned flags,
22992299
return filename_lookup(dfd, getname_flags(name, flags, empty),
23002300
flags, path, NULL);
23012301
}
2302-
2303-
int user_path_at(int dfd, const char __user *name, unsigned flags,
2304-
struct path *path)
2305-
{
2306-
return user_path_at_empty(dfd, name, flags, path, NULL);
2307-
}
2308-
EXPORT_SYMBOL(user_path_at);
2302+
EXPORT_SYMBOL(user_path_at_empty);
23092303

23102304
/*
23112305
* NB: most callers don't do anything directly with the reference to the

include/linux/namei.h

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
#ifndef _LINUX_NAMEI_H
22
#define _LINUX_NAMEI_H
33

4-
#include <linux/dcache.h>
5-
#include <linux/errno.h>
6-
#include <linux/linkage.h>
4+
#include <linux/kernel.h>
75
#include <linux/path.h>
8-
9-
struct vfsmount;
6+
#include <linux/fcntl.h>
7+
#include <linux/errno.h>
108

119
enum { MAX_NESTED_LINKS = 8 };
1210

@@ -46,13 +44,29 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
4644
#define LOOKUP_ROOT 0x2000
4745
#define LOOKUP_EMPTY 0x4000
4846

49-
extern int user_path_at(int, const char __user *, unsigned, struct path *);
5047
extern int user_path_at_empty(int, const char __user *, unsigned, struct path *, int *empty);
5148

52-
#define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path)
53-
#define user_lpath(name, path) user_path_at(AT_FDCWD, name, 0, path)
54-
#define user_path_dir(name, path) \
55-
user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, path)
49+
static inline int user_path_at(int dfd, const char __user *name, unsigned flags,
50+
struct path *path)
51+
{
52+
return user_path_at_empty(dfd, name, flags, path, NULL);
53+
}
54+
55+
static inline int user_path(const char __user *name, struct path *path)
56+
{
57+
return user_path_at_empty(AT_FDCWD, name, LOOKUP_FOLLOW, path, NULL);
58+
}
59+
60+
static inline int user_lpath(const char __user *name, struct path *path)
61+
{
62+
return user_path_at_empty(AT_FDCWD, name, 0, path, NULL);
63+
}
64+
65+
static inline int user_path_dir(const char __user *name, struct path *path)
66+
{
67+
return user_path_at_empty(AT_FDCWD, name,
68+
LOOKUP_FOLLOW | LOOKUP_DIRECTORY, path, NULL);
69+
}
5670

5771
extern int kern_path(const char *, unsigned, struct path *);
5872

0 commit comments

Comments
 (0)