Commit c04030e1 authored by Ulrich Drepper's avatar Ulrich Drepper Committed by Linus Torvalds

[PATCH] flags parameter for linkat

I'm currently at the POSIX meeting and one thing covered was the
incompatibility of Linux's link() with the POSIX definition.  The name.
Linux does not follow symlinks, POSIX requires it does.

Even if somebody thinks this is a good default behavior we cannot change this
because it would break the ABI.  But the fact remains that some application
might want this behavior.

We have one chance to help implementing this without breaking the behavior.
 For this we could use the new linkat interface which would need a new
flags parameter.  If the new parameter is AT_SYMLINK_FOLLOW the new
behavior could be invoked.

I do not want to introduce such a patch now.  But we could add the
parameter now, just don't use it.  The patch below would do this.  Can we
get this late patch applied before the release more or less fixes the
syscall API?
Signed-off-by: default avatarUlrich Drepper <drepper@redhat.com>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ee713059
...@@ -626,7 +626,7 @@ einval: li v0, -EINVAL ...@@ -626,7 +626,7 @@ einval: li v0, -EINVAL
sys sys_fstatat64 4 sys sys_fstatat64 4
sys sys_unlinkat 3 sys sys_unlinkat 3
sys sys_renameat 4 /* 4295 */ sys sys_renameat 4 /* 4295 */
sys sys_linkat 4 sys sys_linkat 5
sys sys_symlinkat 3 sys sys_symlinkat 3
sys sys_readlinkat 4 sys sys_readlinkat 4
sys sys_fchmodat 3 sys sys_fchmodat 3
......
...@@ -1552,6 +1552,7 @@ sys_linkat_wrapper: ...@@ -1552,6 +1552,7 @@ sys_linkat_wrapper:
llgtr %r3,%r3 # const char * llgtr %r3,%r3 # const char *
lgfr %r4,%r4 # int lgfr %r4,%r4 # int
llgtr %r5,%r5 # const char * llgtr %r5,%r5 # const char *
lgfr %r6,%r6 # int
jg sys_linkat jg sys_linkat
.globl sys_symlinkat_wrapper .globl sys_symlinkat_wrapper
......
...@@ -2224,13 +2224,17 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de ...@@ -2224,13 +2224,17 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
* and other special files. --ADM * and other special files. --ADM
*/ */
asmlinkage long sys_linkat(int olddfd, const char __user *oldname, asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
int newdfd, const char __user *newname) int newdfd, const char __user *newname,
int flags)
{ {
struct dentry *new_dentry; struct dentry *new_dentry;
struct nameidata nd, old_nd; struct nameidata nd, old_nd;
int error; int error;
char * to; char * to;
if (flags != 0)
return -EINVAL;
to = getname(newname); to = getname(newname);
if (IS_ERR(to)) if (IS_ERR(to))
return PTR_ERR(to); return PTR_ERR(to);
...@@ -2263,7 +2267,7 @@ asmlinkage long sys_linkat(int olddfd, const char __user *oldname, ...@@ -2263,7 +2267,7 @@ asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
asmlinkage long sys_link(const char __user *oldname, const char __user *newname) asmlinkage long sys_link(const char __user *oldname, const char __user *newname)
{ {
return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname); return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0);
} }
/* /*
......
...@@ -543,7 +543,7 @@ asmlinkage long sys_unlinkat(int dfd, const char __user * pathname, int flag); ...@@ -543,7 +543,7 @@ asmlinkage long sys_unlinkat(int dfd, const char __user * pathname, int flag);
asmlinkage long sys_symlinkat(const char __user * oldname, asmlinkage long sys_symlinkat(const char __user * oldname,
int newdfd, const char __user * newname); int newdfd, const char __user * newname);
asmlinkage long sys_linkat(int olddfd, const char __user *oldname, asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
int newdfd, const char __user *newname); int newdfd, const char __user *newname, int flags);
asmlinkage long sys_renameat(int olddfd, const char __user * oldname, asmlinkage long sys_renameat(int olddfd, const char __user * oldname,
int newdfd, const char __user * newname); int newdfd, const char __user * newname);
asmlinkage long sys_futimesat(int dfd, char __user *filename, asmlinkage long sys_futimesat(int dfd, char __user *filename,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment