namei.c (554a8b9f54cd7ca2b89f5dc227df08be082fae0d) namei.c (8a5e929dd2e05ab4d3d89f58c5e8fca596af8f3a)
1/*
2 * linux/fs/namei.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 */
6
7/*
8 * Some corrections by tytso.

--- 1951 unchanged lines hidden (view full) ---

1960 error = do_truncate(path->dentry, 0,
1961 ATTR_MTIME|ATTR_CTIME|ATTR_OPEN,
1962 filp);
1963 }
1964 put_write_access(inode);
1965 return error;
1966}
1967
1/*
2 * linux/fs/namei.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 */
6
7/*
8 * Some corrections by tytso.

--- 1951 unchanged lines hidden (view full) ---

1960 error = do_truncate(path->dentry, 0,
1961 ATTR_MTIME|ATTR_CTIME|ATTR_OPEN,
1962 filp);
1963 }
1964 put_write_access(inode);
1965 return error;
1966}
1967
1968/*
1969 * Note that while the flag value (low two bits) for sys_open means:
1970 * 00 - read-only
1971 * 01 - write-only
1972 * 10 - read-write
1973 * 11 - special
1974 * it is changed into
1975 * 00 - no permissions needed
1976 * 01 - read-permission
1977 * 10 - write-permission
1978 * 11 - read-write
1979 * for the internal routines (ie open_namei()/follow_link() etc)
1980 * This is more logical, and also allows the 00 "no perm needed"
1981 * to be used for symlinks (where the permissions are checked
1982 * later).
1983 *
1984*/
1985static inline int open_to_namei_flags(int flag)
1986{
1968static inline int open_to_namei_flags(int flag)
1969{
1987 if ((flag+1) & O_ACCMODE)
1988 flag++;
1970 if ((flag & O_ACCMODE) == 3)
1971 flag--;
1989 return flag;
1990}
1991
1992/*
1993 * Handle the last step of open()
1994 */
1995static struct file *do_last(struct nameidata *nd, struct path *path,
1996 const struct open_flags *op, const char *pathname)

--- 1329 unchanged lines hidden ---
1972 return flag;
1973}
1974
1975/*
1976 * Handle the last step of open()
1977 */
1978static struct file *do_last(struct nameidata *nd, struct path *path,
1979 const struct open_flags *op, const char *pathname)

--- 1329 unchanged lines hidden ---