Improve *access*() parameter name consistency.

The current code mixes the use of `flags' and `mode'. This is a bit
confusing, since the faccessat() function as a `flag' parameter to store
the AT_ flag.

Make this less confusing by using the same name as used in the POSIX
specification -- `amode'.
This commit is contained in:
Ed Schouten 2011-11-19 06:35:15 +00:00
parent 80b93ff342
commit d3a993d46b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=227691
10 changed files with 37 additions and 37 deletions

View File

@ -86,7 +86,7 @@
struct l_utimbuf *times); }
31 AUE_NULL UNIMPL stty
32 AUE_NULL UNIMPL gtty
33 AUE_ACCESS STD { int linux_access(char *path, l_int flags); }
33 AUE_ACCESS STD { int linux_access(char *path, l_int amode); }
34 AUE_NICE STD { int linux_nice(l_int inc); }
35 AUE_NULL UNIMPL ftime
36 AUE_SYNC NOPROTO { int sync(void); }
@ -490,7 +490,7 @@
char *buf, l_int bufsiz); }
306 AUE_FCHMODAT STD { int linux_fchmodat(l_int dfd, const char *filename, \
l_mode_t mode); }
307 AUE_FACCESSAT STD { int linux_faccessat(l_int dfd, const char *filename, l_int mode); }
307 AUE_FACCESSAT STD { int linux_faccessat(l_int dfd, const char *filename, l_int amode); }
308 AUE_NULL STD { int linux_pselect6(void); }
309 AUE_NULL STD { int linux_ppoll(void); }
310 AUE_NULL STD { int linux_unshare(void); }

View File

@ -113,7 +113,7 @@
int *alen); }
32 AUE_GETSOCKNAME NOPROTO { int getsockname(int fdes, caddr_t asa, \
int *alen); }
33 AUE_ACCESS NOPROTO { int access(char *path, int flags); }
33 AUE_ACCESS NOPROTO { int access(char *path, int amode); }
34 AUE_CHFLAGS NOPROTO { int chflags(char *path, int flags); }
35 AUE_FCHFLAGS NOPROTO { int fchflags(int fd, int flags); }
36 AUE_SYNC NOPROTO { int sync(void); }
@ -671,7 +671,7 @@
const char *attrname); }
374 AUE_NULL NOPROTO { int __setugid(int flag); }
375 AUE_NULL UNIMPL nfsclnt
376 AUE_EACCESS NOPROTO { int eaccess(char *path, int flags); }
376 AUE_EACCESS NOPROTO { int eaccess(char *path, int amode); }
377 AUE_NULL UNIMPL afs_syscall
378 AUE_NMOUNT STD { int freebsd32_nmount(struct iovec32 *iovp, \
unsigned int iovcnt, int flags); }
@ -911,7 +911,7 @@
u_int32_t id1, u_int32_t id2, \
size_t cpusetsize, \
const cpuset_t *mask); }
489 AUE_FACCESSAT NOPROTO { int faccessat(int fd, char *path, int mode, \
489 AUE_FACCESSAT NOPROTO { int faccessat(int fd, char *path, int amode, \
int flag); }
490 AUE_FCHMODAT NOPROTO { int fchmodat(int fd, const char *path, \
mode_t mode, int flag); }

View File

@ -565,16 +565,16 @@ linux_access(struct thread *td, struct linux_access_args *args)
int error;
/* linux convention */
if (args->flags & ~(F_OK | X_OK | W_OK | R_OK))
if (args->amode & ~(F_OK | X_OK | W_OK | R_OK))
return (EINVAL);
LCONVPATHEXIST(td, args->path, &path);
#ifdef DEBUG
if (ldebug(access))
printf(ARGS(access, "%s, %d"), path, args->flags);
printf(ARGS(access, "%s, %d"), path, args->amode);
#endif
error = kern_access(td, path, UIO_SYSSPACE, args->flags);
error = kern_access(td, path, UIO_SYSSPACE, args->amode);
LFREEPATH(path);
return (error);
@ -587,7 +587,7 @@ linux_faccessat(struct thread *td, struct linux_faccessat_args *args)
int error, dfd;
/* linux convention */
if (args->mode & ~(F_OK | X_OK | W_OK | R_OK))
if (args->amode & ~(F_OK | X_OK | W_OK | R_OK))
return (EINVAL);
dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
@ -595,11 +595,11 @@ linux_faccessat(struct thread *td, struct linux_faccessat_args *args)
#ifdef DEBUG
if (ldebug(access))
printf(ARGS(access, "%s, %d"), path, args->mode);
printf(ARGS(access, "%s, %d"), path, args->amode);
#endif
error = kern_accessat(td, dfd, path, UIO_SYSSPACE, 0 /* XXX */,
args->mode);
args->amode);
LFREEPATH(path);
return (error);

View File

@ -488,7 +488,7 @@ svr4_sys_access(td, uap)
int error;
CHECKALTEXIST(td, uap->path, &newpath);
error = kern_access(td, newpath, UIO_SYSSPACE, uap->flags);
error = kern_access(td, newpath, UIO_SYSSPACE, uap->amode);
free(newpath, M_TEMP);
return (error);
}

View File

@ -77,7 +77,7 @@
31 AUE_NULL UNIMPL stty
32 AUE_NULL UNIMPL gtty
33 AUE_NULL STD { int svr4_sys_access(char *path, \
int flags); }
int amode); }
34 AUE_NULL STD { int svr4_sys_nice(int prio); }
35 AUE_NULL UNIMPL statfs
36 AUE_NULL NOPROTO { int sync(void); }

View File

@ -243,7 +243,7 @@ ibcs2_access(td, uap)
int error;
CHECKALTEXIST(td, uap->path, &path);
error = kern_access(td, path, UIO_SYSSPACE, uap->flags);
error = kern_access(td, path, UIO_SYSSPACE, uap->amode);
free(path, M_TEMP);
return (error);
}

View File

@ -80,7 +80,7 @@
struct ibcs2_utimbuf *buf); }
31 AUE_NULL UNIMPL ibcs2_stty
32 AUE_NULL UNIMPL ibcs2_gtty
33 AUE_ACCESS STD { int ibcs2_access(char *path, int flags); }
33 AUE_ACCESS STD { int ibcs2_access(char *path, int amode); }
34 AUE_NICE STD { int ibcs2_nice(int incr); }
35 AUE_STATFS STD { int ibcs2_statfs(char *path, \
struct ibcs2_statfs *buf, int len, \

View File

@ -86,7 +86,7 @@
struct l_utimbuf *times); }
31 AUE_NULL UNIMPL stty
32 AUE_NULL UNIMPL gtty
33 AUE_ACCESS STD { int linux_access(char *path, l_int flags); }
33 AUE_ACCESS STD { int linux_access(char *path, l_int amode); }
34 AUE_NICE STD { int linux_nice(l_int inc); }
35 AUE_NULL UNIMPL ftime
36 AUE_SYNC NOPROTO { int sync(void); }
@ -500,7 +500,7 @@
char *buf, l_int bufsiz); }
306 AUE_FCHMODAT STD { int linux_fchmodat(l_int dfd, const char *filename, \
l_mode_t mode); }
307 AUE_FACCESSAT STD { int linux_faccessat(l_int dfd, const char *filename, l_int mode); }
307 AUE_FACCESSAT STD { int linux_faccessat(l_int dfd, const char *filename, l_int amode); }
308 AUE_NULL STD { int linux_pselect6(void); }
309 AUE_NULL STD { int linux_ppoll(void); }
310 AUE_NULL STD { int linux_unshare(void); }

View File

@ -115,7 +115,7 @@
32 AUE_GETSOCKNAME STD { int getsockname(int fdes, \
struct sockaddr * __restrict asa, \
__socklen_t * __restrict alen); }
33 AUE_ACCESS STD { int access(char *path, int flags); }
33 AUE_ACCESS STD { int access(char *path, int amode); }
34 AUE_CHFLAGS STD { int chflags(char *path, int flags); }
35 AUE_FCHFLAGS STD { int fchflags(int fd, int flags); }
36 AUE_SYNC STD { int sync(void); }
@ -671,7 +671,7 @@
const char *attrname); }
374 AUE_NULL STD { int __setugid(int flag); }
375 AUE_NULL UNIMPL nfsclnt
376 AUE_EACCESS STD { int eaccess(char *path, int flags); }
376 AUE_EACCESS STD { int eaccess(char *path, int amode); }
377 AUE_NULL NOSTD|NOTSTATIC { int afs3_syscall(long syscall, \
long parm1, long parm2, long parm3, \
long parm4, long parm5, long parm6); }
@ -870,7 +870,7 @@
488 AUE_NULL STD { int cpuset_setaffinity(cpulevel_t level, \
cpuwhich_t which, id_t id, size_t cpusetsize, \
const cpuset_t *mask); }
489 AUE_FACCESSAT STD { int faccessat(int fd, char *path, int mode, \
489 AUE_FACCESSAT STD { int faccessat(int fd, char *path, int amode, \
int flag); }
490 AUE_FCHMODAT STD { int fchmodat(int fd, char *path, mode_t mode, \
int flag); }

View File

@ -2144,7 +2144,7 @@ vn_access(vp, user_flags, cred, td)
#ifndef _SYS_SYSPROTO_H_
struct access_args {
char *path;
int flags;
int amode;
};
#endif
int
@ -2152,18 +2152,18 @@ sys_access(td, uap)
struct thread *td;
register struct access_args /* {
char *path;
int flags;
int amode;
} */ *uap;
{
return (kern_access(td, uap->path, UIO_USERSPACE, uap->flags));
return (kern_access(td, uap->path, UIO_USERSPACE, uap->amode));
}
#ifndef _SYS_SYSPROTO_H_
struct faccessat_args {
int dirfd;
char *path;
int mode;
int amode;
int flag;
}
#endif
@ -2174,19 +2174,19 @@ sys_faccessat(struct thread *td, struct faccessat_args *uap)
if (uap->flag & ~AT_EACCESS)
return (EINVAL);
return (kern_accessat(td, uap->fd, uap->path, UIO_USERSPACE, uap->flag,
uap->mode));
uap->amode));
}
int
kern_access(struct thread *td, char *path, enum uio_seg pathseg, int mode)
kern_access(struct thread *td, char *path, enum uio_seg pathseg, int amode)
{
return (kern_accessat(td, AT_FDCWD, path, pathseg, 0, mode));
return (kern_accessat(td, AT_FDCWD, path, pathseg, 0, amode));
}
int
kern_accessat(struct thread *td, int fd, char *path, enum uio_seg pathseg,
int flags, int mode)
int flag, int amode)
{
struct ucred *cred, *tmpcred;
struct vnode *vp;
@ -2198,7 +2198,7 @@ kern_accessat(struct thread *td, int fd, char *path, enum uio_seg pathseg,
* Create and modify a temporary credential instead of one that
* is potentially shared.
*/
if (!(flags & AT_EACCESS)) {
if (!(flag & AT_EACCESS)) {
cred = td->td_ucred;
tmpcred = crdup(cred);
tmpcred->cr_uid = cred->cr_ruid;
@ -2206,7 +2206,7 @@ kern_accessat(struct thread *td, int fd, char *path, enum uio_seg pathseg,
td->td_ucred = tmpcred;
} else
cred = tmpcred = td->td_ucred;
AUDIT_ARG_VALUE(mode);
AUDIT_ARG_VALUE(amode);
NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | MPSAFE |
AUDITVNODE1, pathseg, path, fd, CAP_FSTAT, td);
if ((error = namei(&nd)) != 0)
@ -2214,12 +2214,12 @@ kern_accessat(struct thread *td, int fd, char *path, enum uio_seg pathseg,
vfslocked = NDHASGIANT(&nd);
vp = nd.ni_vp;
error = vn_access(vp, mode, tmpcred, td);
error = vn_access(vp, amode, tmpcred, td);
NDFREE(&nd, NDF_ONLY_PNBUF);
vput(vp);
VFS_UNLOCK_GIANT(vfslocked);
out1:
if (!(flags & AT_EACCESS)) {
if (!(flag & AT_EACCESS)) {
td->td_ucred = cred;
crfree(tmpcred);
}
@ -2232,7 +2232,7 @@ kern_accessat(struct thread *td, int fd, char *path, enum uio_seg pathseg,
#ifndef _SYS_SYSPROTO_H_
struct eaccess_args {
char *path;
int flags;
int amode;
};
#endif
int
@ -2240,18 +2240,18 @@ sys_eaccess(td, uap)
struct thread *td;
register struct eaccess_args /* {
char *path;
int flags;
int amode;
} */ *uap;
{
return (kern_eaccess(td, uap->path, UIO_USERSPACE, uap->flags));
return (kern_eaccess(td, uap->path, UIO_USERSPACE, uap->amode));
}
int
kern_eaccess(struct thread *td, char *path, enum uio_seg pathseg, int flags)
kern_eaccess(struct thread *td, char *path, enum uio_seg pathseg, int amode)
{
return (kern_accessat(td, AT_FDCWD, path, pathseg, AT_EACCESS, flags));
return (kern_accessat(td, AT_FDCWD, path, pathseg, AT_EACCESS, amode));
}
#if defined(COMPAT_43)