Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cbaab2db authored by Al Viro's avatar Al Viro
Browse files

simpler calling conventions for filename_mountpoint()



a) make it accept ERR_PTR() as filename (and return its PTR_ERR() in that case)
b) make it putname() the sucker in the end otherwise

simplifies life for callers...

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 51689104
Loading
Loading
Loading
Loading
+7 −16
Original line number Original line Diff line number Diff line
@@ -2373,13 +2373,17 @@ static int
filename_mountpoint(int dfd, struct filename *s, struct path *path,
filename_mountpoint(int dfd, struct filename *s, struct path *path,
			unsigned int flags)
			unsigned int flags)
{
{
	int error = path_mountpoint(dfd, s->name, path, flags | LOOKUP_RCU);
	int error;
	if (IS_ERR(s))
		return PTR_ERR(s);
	error = path_mountpoint(dfd, s->name, path, flags | LOOKUP_RCU);
	if (unlikely(error == -ECHILD))
	if (unlikely(error == -ECHILD))
		error = path_mountpoint(dfd, s->name, path, flags);
		error = path_mountpoint(dfd, s->name, path, flags);
	if (unlikely(error == -ESTALE))
	if (unlikely(error == -ESTALE))
		error = path_mountpoint(dfd, s->name, path, flags | LOOKUP_REVAL);
		error = path_mountpoint(dfd, s->name, path, flags | LOOKUP_REVAL);
	if (likely(!error))
	if (likely(!error))
		audit_inode(s, path->dentry, 0);
		audit_inode(s, path->dentry, 0);
	putname(s);
	return error;
	return error;
}
}


@@ -2401,27 +2405,14 @@ int
user_path_mountpoint_at(int dfd, const char __user *name, unsigned int flags,
user_path_mountpoint_at(int dfd, const char __user *name, unsigned int flags,
			struct path *path)
			struct path *path)
{
{
	struct filename *s = getname(name);
	return filename_mountpoint(dfd, getname(name), path, flags);
	int error;
	if (IS_ERR(s))
		return PTR_ERR(s);
	error = filename_mountpoint(dfd, s, path, flags);
	putname(s);
	return error;
}
}


int
int
kern_path_mountpoint(int dfd, const char *name, struct path *path,
kern_path_mountpoint(int dfd, const char *name, struct path *path,
			unsigned int flags)
			unsigned int flags)
{
{
	struct filename *s = getname_kernel(name);
	return filename_mountpoint(dfd, getname_kernel(name), path, flags);
	int retval = PTR_ERR(s);

	if (!IS_ERR(s)) {
		retval = filename_mountpoint(dfd, s, path, flags);
		putname(s);
	}
	return retval;
}
}
EXPORT_SYMBOL(kern_path_mountpoint);
EXPORT_SYMBOL(kern_path_mountpoint);