diff options
Diffstat (limited to 'sys/ufs/ufs')
-rw-r--r-- | sys/ufs/ufs/dinode.h | 34 | ||||
-rw-r--r-- | sys/ufs/ufs/inode.h | 2 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_lookup.c | 2 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 33 |
4 files changed, 35 insertions, 36 deletions
diff --git a/sys/ufs/ufs/dinode.h b/sys/ufs/ufs/dinode.h index 3c213770dec0..0a201ce0b43b 100644 --- a/sys/ufs/ufs/dinode.h +++ b/sys/ufs/ufs/dinode.h @@ -95,23 +95,23 @@ typedef int64_t ufs_lbn_t; typedef int64_t ufs_time_t; /* File permissions. */ -#define UFS_IEXEC 0000100 /* Executable. */ -#define UFS_IWRITE 0000200 /* Writeable. */ -#define UFS_IREAD 0000400 /* Readable. */ -#define UFS_ISVTX 0001000 /* Sticky bit. */ -#define UFS_ISGID 0002000 /* Set-gid. */ -#define UFS_ISUID 0004000 /* Set-uid. */ +#define IEXEC 0000100 /* Executable. */ +#define IWRITE 0000200 /* Writeable. */ +#define IREAD 0000400 /* Readable. */ +#define ISVTX 0001000 /* Sticky bit. */ +#define ISGID 0002000 /* Set-gid. */ +#define ISUID 0004000 /* Set-uid. */ /* File types. */ -#define UFS_IFMT 0170000 /* Mask of file type. */ -#define UFS_IFIFO 0010000 /* Named pipe (fifo). */ -#define UFS_IFCHR 0020000 /* Character device. */ -#define UFS_IFDIR 0040000 /* Directory file. */ -#define UFS_IFBLK 0060000 /* Block device. */ -#define UFS_IFREG 0100000 /* Regular file. */ -#define UFS_IFLNK 0120000 /* Symbolic link. */ -#define UFS_IFSOCK 0140000 /* UNIX domain socket. */ -#define UFS_IFWHT 0160000 /* Whiteout. */ +#define IFMT 0170000 /* Mask of file type. */ +#define IFIFO 0010000 /* Named pipe (fifo). */ +#define IFCHR 0020000 /* Character device. */ +#define IFDIR 0040000 /* Directory file. */ +#define IFBLK 0060000 /* Block device. */ +#define IFREG 0100000 /* Regular file. */ +#define IFLNK 0120000 /* Symbolic link. */ +#define IFSOCK 0140000 /* UNIX domain socket. */ +#define IFWHT 0160000 /* Whiteout. */ /* * A dinode contains all the meta-data associated with a UFS2 file. @@ -125,7 +125,7 @@ typedef int64_t ufs_time_t; #define UFS_NIADDR 3 /* Indirect addresses in inode. */ struct ufs2_dinode { - u_int16_t di_mode; /* 0: UFS_IFMT, permissions; below. */ + u_int16_t di_mode; /* 0: IFMT, permissions; see below. */ int16_t di_nlink; /* 2: File link count. */ u_int32_t di_uid; /* 4: File owner. */ u_int32_t di_gid; /* 8: File group. */ @@ -168,7 +168,7 @@ struct ufs2_dinode { * are defined by types with precise widths. */ struct ufs1_dinode { - u_int16_t di_mode; /* 0: UFS_IFMT, permissions; below. */ + u_int16_t di_mode; /* 0: IFMT, permissions; see below. */ int16_t di_nlink; /* 2: File link count. */ uint32_t di_freelink; /* 4: SUJ: Next unlinked inode. */ u_int64_t di_size; /* 8: File byte count. */ diff --git a/sys/ufs/ufs/inode.h b/sys/ufs/ufs/inode.h index 23b173ed04ef..1bd53a78699b 100644 --- a/sys/ufs/ufs/inode.h +++ b/sys/ufs/ufs/inode.h @@ -113,7 +113,7 @@ struct inode { u_int32_t i_flags; /* Status flags (chflags). */ u_int32_t i_uid; /* File owner. */ u_int32_t i_gid; /* File group. */ - u_int16_t i_mode; /* UFS_IFMT, permissions; see below. */ + u_int16_t i_mode; /* IFMT, permissions; see below. */ int16_t i_nlink; /* File link count. */ }; /* diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c index 86cc7f2221ba..3714096795ac 100644 --- a/sys/ufs/ufs/ufs_lookup.c +++ b/sys/ufs/ufs/ufs_lookup.c @@ -125,7 +125,7 @@ ufs_delete_denied(struct vnode *vdp, struct vnode *tdp, struct ucred *cred, * may not delete it (unless she's root). This * implements append-only directories. */ - if ((VTOI(vdp)->i_mode & UFS_ISVTX) && + if ((VTOI(vdp)->i_mode & ISVTX) && VOP_ACCESS(vdp, VADMIN, cred, td) && VOP_ACCESS(tdp, VADMIN, cred, td)) return (EPERM); diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 5b33e5343229..66651e3f71bb 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -470,7 +470,7 @@ ufs_getattr(ap) */ vap->va_fsid = dev2udev(ITOUMP(ip)->um_dev); vap->va_fileid = ip->i_number; - vap->va_mode = ip->i_mode & ~UFS_IFMT; + vap->va_mode = ip->i_mode & ~IFMT; vap->va_nlink = ip->i_effnlink; vap->va_uid = ip->i_uid; vap->va_gid = ip->i_gid; @@ -750,7 +750,7 @@ ufs_chmod(vp, mode, cred, td) if (priv_check_cred(cred, PRIV_VFS_STICKYFILE, 0)) return (EFTYPE); } - if (!groupmember(ip->i_gid, cred) && (mode & UFS_ISGID)) { + if (!groupmember(ip->i_gid, cred) && (mode & ISGID)) { error = priv_check_cred(cred, PRIV_VFS_SETGID, 0); if (error) return (error); @@ -759,7 +759,7 @@ ufs_chmod(vp, mode, cred, td) /* * Deny setting setuid if we are not the file owner. */ - if ((mode & UFS_ISUID) && ip->i_uid != cred->cr_uid) { + if ((mode & ISUID) && ip->i_uid != cred->cr_uid) { error = priv_check_cred(cred, PRIV_VFS_ADMIN, 0); if (error) return (error); @@ -888,10 +888,9 @@ good: panic("ufs_chown: lost quota"); #endif /* QUOTA */ ip->i_flag |= IN_CHANGE; - if ((ip->i_mode & (UFS_ISUID | UFS_ISGID)) && - (ouid != uid || ogid != gid)) { + if ((ip->i_mode & (ISUID | ISGID)) && (ouid != uid || ogid != gid)) { if (priv_check_cred(cred, PRIV_VFS_RETAINSUGID, 0)) { - ip->i_mode &= ~(UFS_ISUID | UFS_ISGID); + ip->i_mode &= ~(ISUID | ISGID); DIP_SET(ip, i_mode, ip->i_mode); } } @@ -1277,7 +1276,7 @@ relock: error = EPERM; goto unlockout; } - if ((fip->i_mode & UFS_IFMT) == UFS_IFDIR) { + if ((fip->i_mode & IFMT) == IFDIR) { /* * Avoid ".", "..", and aliases of "." for obvious reasons. */ @@ -1409,7 +1408,7 @@ relock: * to it. Also, ensure source and target are compatible * (both directories, or both not directories). */ - if ((tip->i_mode & UFS_IFMT) == UFS_IFDIR) { + if ((tip->i_mode & IFMT) == IFDIR) { if ((tip->i_effnlink > 2) || !ufs_dirempty(tip, tdp->i_number, tcnp->cn_cred)) { error = ENOTEMPTY; @@ -1801,7 +1800,7 @@ ufs_mkdir(ap) goto out; } dmode = vap->va_mode & 0777; - dmode |= UFS_IFDIR; + dmode |= IFDIR; /* * Must simulate part of ufs_makeinode here to acquire the inode, * but not have it entered in the parent directory. The entry is @@ -1834,8 +1833,8 @@ ufs_mkdir(ap) * 'give it away' so that the SUID is still forced on. */ if ((dvp->v_mount->mnt_flag & MNT_SUIDDIR) && - (dp->i_mode & UFS_ISUID) && dp->i_uid) { - dmode |= UFS_ISUID; + (dp->i_mode & ISUID) && dp->i_uid) { + dmode |= ISUID; ip->i_uid = dp->i_uid; DIP_SET(ip, i_uid, dp->i_uid); #ifdef QUOTA @@ -2125,7 +2124,7 @@ ufs_symlink(ap) struct inode *ip; int len, error; - error = ufs_makeinode(UFS_IFLNK | ap->a_vap->va_mode, ap->a_dvp, + error = ufs_makeinode(IFLNK | ap->a_vap->va_mode, ap->a_dvp, vpp, ap->a_cnp, "ufs_symlink"); if (error) return (error); @@ -2570,8 +2569,8 @@ ufs_makeinode(mode, dvp, vpp, cnp, callfunc) panic("%s: no name", callfunc); #endif *vpp = NULL; - if ((mode & UFS_IFMT) == 0) - mode |= UFS_IFREG; + if ((mode & IFMT) == 0) + mode |= IFREG; if (pdir->i_effnlink < 2) { print_bad_link_count(callfunc, dvp); @@ -2598,7 +2597,7 @@ ufs_makeinode(mode, dvp, vpp, cnp, callfunc) * Note that this drops off the execute bits for security. */ if ((dvp->v_mount->mnt_flag & MNT_SUIDDIR) && - (pdir->i_mode & UFS_ISUID) && + (pdir->i_mode & ISUID) && (pdir->i_uid != cnp->cn_cred->cr_uid) && pdir->i_uid) { ip->i_uid = pdir->i_uid; DIP_SET(ip, i_uid, ip->i_uid); @@ -2657,9 +2656,9 @@ ufs_makeinode(mode, dvp, vpp, cnp, callfunc) DIP_SET(ip, i_nlink, 1); if (DOINGSOFTDEP(tvp)) softdep_setup_create(VTOI(dvp), ip); - if ((ip->i_mode & UFS_ISGID) && !groupmember(ip->i_gid, cnp->cn_cred) && + if ((ip->i_mode & ISGID) && !groupmember(ip->i_gid, cnp->cn_cred) && priv_check_cred(cnp->cn_cred, PRIV_VFS_SETGID, 0)) { - ip->i_mode &= ~UFS_ISGID; + ip->i_mode &= ~ISGID; DIP_SET(ip, i_mode, ip->i_mode); } |