svn commit: r248597 - in head: bin/chflags bin/mv lib/libc/sys sys/compat/freebsd32 sys/fs/tmpfs sys/kern sys/sys tools/regression/pjdfstest
Pawel Jakub Dawidek
pjd at FreeBSD.org
Thu Mar 21 22:44:36 UTC 2013
Author: pjd
Date: Thu Mar 21 22:44:33 2013
New Revision: 248597
URL: http://svnweb.freebsd.org/changeset/base/248597
Log:
- Make 'flags' argument to chflags(2), fchflags(2) and lchflags(2) of type
u_long. Before this change it was of type int for syscalls, but prototypes
in sys/stat.h and documentation for chflags(2) and fchflags(2) (but not
for lchflags(2)) stated that it was u_long. Now some related functions
use u_long type for flags (strtofflags(3), fflagstostr(3)).
- Make path argument of type 'const char *' for consistency.
Discussed on: arch
Sponsored by: The FreeBSD Foundation
Modified:
head/bin/chflags/chflags.c
head/bin/mv/mv.c
head/lib/libc/sys/chflags.2
head/sys/compat/freebsd32/syscalls.master
head/sys/fs/tmpfs/tmpfs.h
head/sys/fs/tmpfs/tmpfs_subr.c
head/sys/kern/syscalls.master
head/sys/kern/vfs_syscalls.c
head/sys/sys/stat.h
head/tools/regression/pjdfstest/pjdfstest.c
Modified: head/bin/chflags/chflags.c
==============================================================================
--- head/bin/chflags/chflags.c Thu Mar 21 22:36:43 2013 (r248596)
+++ head/bin/chflags/chflags.c Thu Mar 21 22:44:33 2013 (r248597)
@@ -117,11 +117,7 @@ main(int argc, char *argv[])
} else
fts_options = hflag ? FTS_PHYSICAL : FTS_LOGICAL;
- /* XXX: Why don't chflags and lchflags have compatible prototypes? */
- if (hflag)
- change_flags = (int (*)(const char *, unsigned long))lchflags;
- else
- change_flags = chflags;
+ change_flags = hflag ? lchflags : chflags;
flags = *argv;
if (*flags >= '0' && *flags <= '7') {
Modified: head/bin/mv/mv.c
==============================================================================
--- head/bin/mv/mv.c Thu Mar 21 22:36:43 2013 (r248596)
+++ head/bin/mv/mv.c Thu Mar 21 22:44:33 2013 (r248597)
@@ -337,7 +337,7 @@ err: if (unlink(to))
* on a file that we copied, i.e., that we didn't create.)
*/
errno = 0;
- if (fchflags(to_fd, (u_long)sbp->st_flags))
+ if (fchflags(to_fd, sbp->st_flags))
if (errno != EOPNOTSUPP || sbp->st_flags != 0)
warn("%s: set flags (was: 0%07o)", to, sbp->st_flags);
Modified: head/lib/libc/sys/chflags.2
==============================================================================
--- head/lib/libc/sys/chflags.2 Thu Mar 21 22:36:43 2013 (r248596)
+++ head/lib/libc/sys/chflags.2 Thu Mar 21 22:44:33 2013 (r248597)
@@ -42,11 +42,11 @@
.In sys/stat.h
.In unistd.h
.Ft int
-.Fn chflags "const char *path" "u_long flags"
+.Fn chflags "const char *path" "unsigned long flags"
.Ft int
-.Fn lchflags "const char *path" "int flags"
+.Fn lchflags "const char *path" "unsigned long flags"
.Ft int
-.Fn fchflags "int fd" "u_long flags"
+.Fn fchflags "int fd" "unsigned long flags"
.Sh DESCRIPTION
The file whose name
is given by
Modified: head/sys/compat/freebsd32/syscalls.master
==============================================================================
--- head/sys/compat/freebsd32/syscalls.master Thu Mar 21 22:36:43 2013 (r248596)
+++ head/sys/compat/freebsd32/syscalls.master Thu Mar 21 22:44:33 2013 (r248597)
@@ -114,8 +114,8 @@
32 AUE_GETSOCKNAME NOPROTO { int getsockname(int fdes, caddr_t asa, \
int *alen); }
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); }
+34 AUE_CHFLAGS NOPROTO { int chflags(const char *path, u_long flags); }
+35 AUE_FCHFLAGS NOPROTO { int fchflags(int fd, u_long flags); }
36 AUE_SYNC NOPROTO { int sync(void); }
37 AUE_KILL NOPROTO { int kill(int pid, int signum); }
38 AUE_STAT COMPAT { int freebsd32_stat(char *path, \
@@ -693,7 +693,8 @@
389 AUE_NULL UNIMPL __mac_set_file
390 AUE_NULL NOPROTO { int kenv(int what, const char *name, \
char *value, int len); }
-391 AUE_LCHFLAGS NOPROTO { int lchflags(const char *path, int flags); }
+391 AUE_LCHFLAGS NOPROTO { int lchflags(const char *path, \
+ u_long flags); }
392 AUE_NULL NOPROTO { int uuidgen(struct uuid *store, \
int count); }
393 AUE_SENDFILE STD { int freebsd32_sendfile(int fd, int s, \
Modified: head/sys/fs/tmpfs/tmpfs.h
==============================================================================
--- head/sys/fs/tmpfs/tmpfs.h Thu Mar 21 22:36:43 2013 (r248596)
+++ head/sys/fs/tmpfs/tmpfs.h Thu Mar 21 22:44:33 2013 (r248597)
@@ -183,7 +183,7 @@ struct tmpfs_node {
uid_t tn_uid;
gid_t tn_gid;
mode_t tn_mode;
- int tn_flags;
+ u_long tn_flags;
nlink_t tn_links;
struct timespec tn_atime;
struct timespec tn_mtime;
@@ -418,7 +418,7 @@ int tmpfs_dir_getdents(struct tmpfs_node
int tmpfs_dir_whiteout_add(struct vnode *, struct componentname *);
void tmpfs_dir_whiteout_remove(struct vnode *, struct componentname *);
int tmpfs_reg_resize(struct vnode *, off_t, boolean_t);
-int tmpfs_chflags(struct vnode *, int, struct ucred *, struct thread *);
+int tmpfs_chflags(struct vnode *, u_long, struct ucred *, struct thread *);
int tmpfs_chmod(struct vnode *, mode_t, struct ucred *, struct thread *);
int tmpfs_chown(struct vnode *, uid_t, gid_t, struct ucred *,
struct thread *);
Modified: head/sys/fs/tmpfs/tmpfs_subr.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_subr.c Thu Mar 21 22:36:43 2013 (r248596)
+++ head/sys/fs/tmpfs/tmpfs_subr.c Thu Mar 21 22:44:33 2013 (r248597)
@@ -1355,7 +1355,8 @@ retry:
* The vnode must be locked on entry and remain locked on exit.
*/
int
-tmpfs_chflags(struct vnode *vp, int flags, struct ucred *cred, struct thread *p)
+tmpfs_chflags(struct vnode *vp, u_long flags, struct ucred *cred,
+ struct thread *p)
{
int error;
struct tmpfs_node *node;
Modified: head/sys/kern/syscalls.master
==============================================================================
--- head/sys/kern/syscalls.master Thu Mar 21 22:36:43 2013 (r248596)
+++ head/sys/kern/syscalls.master Thu Mar 21 22:44:33 2013 (r248597)
@@ -115,8 +115,8 @@
struct sockaddr * __restrict asa, \
__socklen_t * __restrict alen); }
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); }
+34 AUE_CHFLAGS STD { int chflags(const char *path, u_long flags); }
+35 AUE_FCHFLAGS STD { int fchflags(int fd, u_long flags); }
36 AUE_SYNC STD { int sync(void); }
37 AUE_KILL STD { int kill(int pid, int signum); }
38 AUE_STAT COMPAT { int stat(char *path, struct ostat *ub); }
@@ -696,7 +696,8 @@
struct mac *mac_p); }
390 AUE_NULL STD { int kenv(int what, const char *name, \
char *value, int len); }
-391 AUE_LCHFLAGS STD { int lchflags(const char *path, int flags); }
+391 AUE_LCHFLAGS STD { int lchflags(const char *path, \
+ u_long flags); }
392 AUE_NULL STD { int uuidgen(struct uuid *store, \
int count); }
393 AUE_SENDFILE STD { int sendfile(int fd, int s, off_t offset, \
Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c Thu Mar 21 22:36:43 2013 (r248596)
+++ head/sys/kern/vfs_syscalls.c Thu Mar 21 22:44:33 2013 (r248597)
@@ -101,7 +101,7 @@ SDT_PROBE_ARGTYPE(vfs, , stat, reg, 1, "
static int chroot_refuse_vdir_fds(struct filedesc *fdp);
static int getutimes(const struct timeval *, enum uio_seg, struct timespec *);
-static int setfflags(struct thread *td, struct vnode *, int);
+static int setfflags(struct thread *td, struct vnode *, u_long);
static int setutimes(struct thread *td, struct vnode *,
const struct timespec *, int, int);
static int vn_access(struct vnode *vp, int user_flags, struct ucred *cred,
@@ -2615,7 +2615,7 @@ static int
setfflags(td, vp, flags)
struct thread *td;
struct vnode *vp;
- int flags;
+ u_long flags;
{
int error;
struct mount *mp;
@@ -2657,16 +2657,16 @@ setfflags(td, vp, flags)
*/
#ifndef _SYS_SYSPROTO_H_
struct chflags_args {
- char *path;
- int flags;
+ const char *path;
+ u_long flags;
};
#endif
int
sys_chflags(td, uap)
struct thread *td;
register struct chflags_args /* {
- char *path;
- int flags;
+ const char *path;
+ u_long flags;
} */ *uap;
{
int error;
@@ -2689,8 +2689,8 @@ int
sys_lchflags(td, uap)
struct thread *td;
register struct lchflags_args /* {
- char *path;
- int flags;
+ const char *path;
+ u_long flags;
} */ *uap;
{
int error;
@@ -2713,7 +2713,7 @@ sys_lchflags(td, uap)
#ifndef _SYS_SYSPROTO_H_
struct fchflags_args {
int fd;
- int flags;
+ u_long flags;
};
#endif
int
@@ -2721,7 +2721,7 @@ sys_fchflags(td, uap)
struct thread *td;
register struct fchflags_args /* {
int fd;
- int flags;
+ u_long flags;
} */ *uap;
{
struct file *fp;
Modified: head/sys/sys/stat.h
==============================================================================
--- head/sys/sys/stat.h Thu Mar 21 22:36:43 2013 (r248596)
+++ head/sys/sys/stat.h Thu Mar 21 22:44:33 2013 (r248597)
@@ -306,7 +306,7 @@ int fchmodat(int, const char *, mode_t,
#endif
int fstat(int, struct stat *);
#if __BSD_VISIBLE
-int lchflags(const char *, int);
+int lchflags(const char *, unsigned long);
int lchmod(const char *, mode_t);
#endif
#if __POSIX_VISIBLE >= 200112
Modified: head/tools/regression/pjdfstest/pjdfstest.c
==============================================================================
--- head/tools/regression/pjdfstest/pjdfstest.c Thu Mar 21 22:36:43 2013 (r248596)
+++ head/tools/regression/pjdfstest/pjdfstest.c Thu Mar 21 22:44:33 2013 (r248597)
@@ -831,7 +831,8 @@ call_syscall(struct syscall_desc *scall,
#endif
#ifdef HAS_LCHFLAGS
case ACTION_LCHFLAGS:
- rval = lchflags(STR(0), (int)str2flags(chflags_flags, STR(1)));
+ rval = lchflags(STR(0),
+ (unsigned long)str2flags(chflags_flags, STR(1)));
break;
#endif
case ACTION_TRUNCATE:
More information about the svn-src-head
mailing list