Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F168183811
D12572.id33645.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
21 KB
Referenced Files
None
Subscribers
None
D12572.id33645.diff
View Options
Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h
===================================================================
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h
@@ -201,6 +201,7 @@
boolean_t z_is_sa; /* are we native sa? */
} znode_t;
+#define ZFS_LINK_MAX 0xffffffffffffffff
/*
* Range locking rules
Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c
===================================================================
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c
@@ -527,24 +527,20 @@
ASSERT_VOP_ELOCKED(ZTOV(dzp), __func__);
ASSERT_VOP_ELOCKED(ZTOV(zp), __func__);
-#if 0
if (zp_is_dir) {
error = 0;
- if (dzp->z_links >= LINK_MAX)
+ if (dzp->z_links >= ZFS_LINK_MAX)
error = SET_ERROR(EMLINK);
return (error);
}
-#endif
if (!(flag & ZRENAMING)) {
if (zp->z_unlinked) { /* no new links to unlinked zp */
ASSERT(!(flag & (ZNEW | ZEXISTS)));
return (SET_ERROR(ENOENT));
}
-#if 0
- if (zp->z_links >= LINK_MAX) {
+ if (zp->z_links >= ZFS_LINK_MAX) {
return (SET_ERROR(EMLINK));
}
-#endif
zp->z_links++;
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_LINKS(zfsvfs), NULL,
&zp->z_links, sizeof (zp->z_links));
Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
===================================================================
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
@@ -2658,7 +2658,6 @@
int error = 0;
uint32_t blksize;
u_longlong_t nblocks;
- uint64_t links;
uint64_t mtime[2], ctime[2], crtime[2], rdev;
xvattr_t *xvap = (xvattr_t *)vap; /* vap may be an xvattr_t * */
xoptattr_t *xoap = NULL;
@@ -2711,10 +2710,9 @@
#endif
vap->va_nodeid = zp->z_id;
if ((vp->v_flag & VROOT) && zfs_show_ctldir(zp))
- links = zp->z_links + 1;
+ vap->va_nlink = zp->z_links + 1;
else
- links = zp->z_links;
- vap->va_nlink = MIN(links, LINK_MAX); /* nlink_t limit! */
+ vap->va_nlink = zp->z_links;
vap->va_size = zp->z_size;
#ifdef illumos
vap->va_rdev = vp->v_rdev;
@@ -4419,7 +4417,7 @@
switch (cmd) {
case _PC_LINK_MAX:
- *valp = INT_MAX;
+ *valp = MIN(LONG_MAX, ZFS_LINK_MAX);
return (0);
case _PC_FILESIZEBITS:
@@ -5420,30 +5418,25 @@
int error;
error = zfs_pathconf(ap->a_vp, ap->a_name, &val, curthread->td_ucred, NULL);
- if (error == 0)
+ if (error == 0) {
*ap->a_retval = val;
- else if (error == EOPNOTSUPP)
- error = vop_stdpathconf(ap);
- return (error);
-}
-
-static int
-zfs_freebsd_fifo_pathconf(ap)
- struct vop_pathconf_args /* {
- struct vnode *a_vp;
- int a_name;
- register_t *a_retval;
- } */ *ap;
-{
+ return (error);
+ }
+ if (error != EOPNOTSUPP)
+ return (error);
switch (ap->a_name) {
- case _PC_ACL_EXTENDED:
- case _PC_ACL_NFS4:
- case _PC_ACL_PATH_MAX:
- case _PC_MAC_PRESENT:
- return (zfs_freebsd_pathconf(ap));
+ case _PC_NAME_MAX:
+ *ap->a_retval = NAME_MAX;
+ return (0);
+ case _PC_PIPE_BUF:
+ if (ap->a_vp->v_type == VDIR || ap->a_vp->v_type == VFIFO) {
+ *ap->a_retval = PIPE_BUF;
+ return (0);
+ }
+ return (EINVAL);
default:
- return (fifo_specops.vop_pathconf(ap));
+ return (vop_stdpathconf(ap));
}
}
@@ -6057,7 +6050,7 @@
.vop_reclaim = zfs_freebsd_reclaim,
.vop_setattr = zfs_freebsd_setattr,
.vop_write = VOP_PANIC,
- .vop_pathconf = zfs_freebsd_fifo_pathconf,
+ .vop_pathconf = zfs_freebsd_pathconf,
.vop_fid = zfs_freebsd_fid,
.vop_getacl = zfs_freebsd_getacl,
.vop_setacl = zfs_freebsd_setacl,
Index: sys/fs/devfs/devfs_vnops.c
===================================================================
--- sys/fs/devfs/devfs_vnops.c
+++ sys/fs/devfs/devfs_vnops.c
@@ -1178,6 +1178,18 @@
{
switch (ap->a_name) {
+ case _PC_FILESIZEBITS:
+ *ap->a_retval = 64;
+ return (0);
+ case _PC_NAME_MAX:
+ *ap->a_retval = NAME_MAX;
+ return (0);
+ case _PC_LINK_MAX:
+ *ap->a_retval = INT_MAX;
+ return (0);
+ case _PC_SYMLINK_MAX:
+ *ap->a_retval = MAXPATHLEN;
+ return (0);
case _PC_MAX_CANON:
if (ap->a_vp->v_vflag & VV_ISTTY) {
*ap->a_retval = MAX_CANON;
@@ -1207,6 +1219,9 @@
*ap->a_retval = 0;
#endif
return (0);
+ case _PC_CHOWN_RESTRICTED:
+ *ap->a_retval = 1;
+ return (0);
default:
return (vop_stdpathconf(ap));
}
Index: sys/fs/ext2fs/ext2_vnops.c
===================================================================
--- sys/fs/ext2fs/ext2_vnops.c
+++ sys/fs/ext2fs/ext2_vnops.c
@@ -180,6 +180,7 @@
.vop_getattr = ext2_getattr,
.vop_inactive = ext2_inactive,
.vop_kqfilter = ext2fifo_kqfilter,
+ .vop_pathconf = ext2_pathconf,
.vop_print = ext2_print,
.vop_read = VOP_PANIC,
.vop_reclaim = ext2_reclaim,
@@ -1627,6 +1628,18 @@
else
*ap->a_retval = ext2_max_nlink(VTOI(ap->a_vp));
break;
+ case _PC_NAME_MAX:
+ *ap->a_retval = NAME_MAX;
+ break;
+ case _PC_PIPE_BUF:
+ if (ap->a_vp->v_type == VDIR || ap->a_vp->v_type == VFIFO)
+ *ap->a_retval = PIPE_BUF;
+ else
+ error = EINVAL;
+ break;
+ case _PC_CHOWN_RESTRICTED:
+ *ap->a_retval = 1;
+ break;
case _PC_NO_TRUNC:
*ap->a_retval = 1;
break;
Index: sys/fs/fdescfs/fdesc_vnops.c
===================================================================
--- sys/fs/fdescfs/fdesc_vnops.c
+++ sys/fs/fdescfs/fdesc_vnops.c
@@ -53,6 +53,8 @@
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/stat.h>
+#include <sys/syscallsubr.h>
+#include <sys/unistd.h>
#include <sys/vnode.h>
#include <fs/fdescfs/fdesc.h>
@@ -68,6 +70,7 @@
static vop_getattr_t fdesc_getattr;
static vop_lookup_t fdesc_lookup;
static vop_open_t fdesc_open;
+static vop_pathconf_t fdesc_pathconf;
static vop_readdir_t fdesc_readdir;
static vop_readlink_t fdesc_readlink;
static vop_reclaim_t fdesc_reclaim;
@@ -80,7 +83,7 @@
.vop_getattr = fdesc_getattr,
.vop_lookup = fdesc_lookup,
.vop_open = fdesc_open,
- .vop_pathconf = vop_stdpathconf,
+ .vop_pathconf = fdesc_pathconf,
.vop_readdir = fdesc_readdir,
.vop_readlink = fdesc_readlink,
.vop_reclaim = fdesc_reclaim,
@@ -394,6 +397,27 @@
}
static int
+fdesc_pathconf(struct vop_pathconf_args *ap)
+{
+ struct vnode *vp = ap->a_vp;
+
+ switch (ap->a_name) {
+ case _PC_NAME_MAX:
+ *ap->a_retval = NAME_MAX;
+ return (0);
+ case _PC_LINK_MAX:
+ if (VTOFDESC(vp)->fd_type == Froot)
+ *ap->a_retval = 2;
+ else
+ *ap->a_retval = 1;
+ return (0);
+ default:
+ return (kern_fpathconf(curthread, VTOFDESC(vp)->fd_fd,
+ ap->a_name));
+ }
+}
+
+static int
fdesc_getattr(struct vop_getattr_args *ap)
{
struct vnode *vp = ap->a_vp;
Index: sys/fs/fifofs/fifo_vnops.c
===================================================================
--- sys/fs/fifofs/fifo_vnops.c
+++ sys/fs/fifofs/fifo_vnops.c
@@ -86,7 +86,7 @@
.vop_mkdir = VOP_PANIC,
.vop_mknod = VOP_PANIC,
.vop_open = fifo_open,
- .vop_pathconf = vop_stdpathconf,
+ .vop_pathconf = VOP_PANIC,
.vop_print = fifo_print,
.vop_read = VOP_PANIC,
.vop_readdir = VOP_PANIC,
Index: sys/fs/fuse/fuse_vnops.c
===================================================================
--- sys/fs/fuse/fuse_vnops.c
+++ sys/fs/fuse/fuse_vnops.c
@@ -120,6 +120,7 @@
static vop_mkdir_t fuse_vnop_mkdir;
static vop_mknod_t fuse_vnop_mknod;
static vop_open_t fuse_vnop_open;
+static vop_pathconf_t fuse_vnop_pathconf;
static vop_read_t fuse_vnop_read;
static vop_readdir_t fuse_vnop_readdir;
static vop_readlink_t fuse_vnop_readlink;
@@ -148,7 +149,7 @@
.vop_mkdir = fuse_vnop_mkdir,
.vop_mknod = fuse_vnop_mknod,
.vop_open = fuse_vnop_open,
- .vop_pathconf = vop_stdpathconf,
+ .vop_pathconf = fuse_vnop_pathconf,
.vop_read = fuse_vnop_read,
.vop_readdir = fuse_vnop_readdir,
.vop_readlink = fuse_vnop_readlink,
@@ -1164,6 +1165,31 @@
return error;
}
+static int
+fuse_vnop_pathconf(struct vop_pathconf_args *ap)
+{
+
+ switch (ap->a_name) {
+ case _PC_FILESIZEBITS:
+ *ap->a_retval = 64;
+ return (0);
+ case _PC_NAME_MAX:
+ *ap->a_retval = NAME_MAX;
+ return (0);
+ case _PC_LINK_MAX:
+ *ap->a_retval = FUSE_LINK_MAX;
+ return (0);
+ case _PC_SYMLINK_MAX:
+ *ap->a_retval = MAXPATHLEN;
+ return (0);
+ case _PC_NO_TRUNC:
+ *ap->a_retval = 1;
+ return (0);
+ default:
+ return (vop_stdpathconf(ap));
+ }
+}
+
/*
struct vnop_read_args {
struct vnode *a_vp;
Index: sys/fs/msdosfs/msdosfs_vnops.c
===================================================================
--- sys/fs/msdosfs/msdosfs_vnops.c
+++ sys/fs/msdosfs/msdosfs_vnops.c
@@ -1869,12 +1869,18 @@
struct msdosfsmount *pmp = VTODE(ap->a_vp)->de_pmp;
switch (ap->a_name) {
+ case _PC_FILESIZEBITS:
+ *ap->a_retval = 32;
+ return (0);
case _PC_LINK_MAX:
*ap->a_retval = 1;
return (0);
case _PC_NAME_MAX:
*ap->a_retval = pmp->pm_flags & MSDOSFSMNT_LONGNAME ? WIN_MAXLEN : 12;
return (0);
+ case _PC_CHOWN_RESTRICTED:
+ *ap->a_retval = 1;
+ return (0);
case _PC_NO_TRUNC:
*ap->a_retval = 0;
return (0);
Index: sys/fs/nandfs/nandfs_vnops.c
===================================================================
--- sys/fs/nandfs/nandfs_vnops.c
+++ sys/fs/nandfs/nandfs_vnops.c
@@ -1352,7 +1352,7 @@
struct nandfs_inode *inode = &node->nn_inode;
int error;
- if (inode->i_links_count >= LINK_MAX)
+ if (inode->i_links_count >= NANDFS_LINK_MAX)
return (EMLINK);
if (inode->i_flags & (IMMUTABLE | APPEND))
@@ -1574,7 +1574,7 @@
fdnode = VTON(fdvp);
fnode = VTON(fvp);
- if (fnode->nn_inode.i_links_count >= LINK_MAX) {
+ if (fnode->nn_inode.i_links_count >= NANDFS_LINK_MAX) {
VOP_UNLOCK(fvp, 0);
error = EMLINK;
goto abortit;
@@ -1837,7 +1837,7 @@
if (nandfs_fs_full(dir_node->nn_nandfsdev))
return (ENOSPC);
- if (dir_inode->i_links_count >= LINK_MAX)
+ if (dir_inode->i_links_count >= NANDFS_LINK_MAX)
return (EMLINK);
error = nandfs_node_create(nmp, &node, mode);
@@ -2236,6 +2236,21 @@
error = 0;
switch (ap->a_name) {
+ case _PC_LINK_MAX:
+ *ap->a_retval = NANDFS_LINK_MAX;
+ break;
+ case _PC_NAME_MAX:
+ *ap->a_retval = NANDFS_NAME_LEN;
+ break;
+ case _PC_PIPE_BUF:
+ if (ap->a_vp->v_type == VDIR || ap->a_vp->v_type == VFIFO)
+ *ap->a_retval = PIPE_BUF;
+ else
+ error = EINVAL;
+ break;
+ case _PC_CHOWN_RESTRICTED:
+ *ap->a_retval = 1;
+ break;
case _PC_NO_TRUNC:
*ap->a_retval = 1;
break;
@@ -2403,6 +2418,7 @@
.vop_close = nandfsfifo_close,
.vop_getattr = nandfs_getattr,
.vop_inactive = nandfs_inactive,
+ .vop_pathconf = nandfs_pathconf,
.vop_print = nandfs_print,
.vop_read = VOP_PANIC,
.vop_reclaim = nandfs_reclaim,
Index: sys/fs/nfs/nfs_commonport.c
===================================================================
--- sys/fs/nfs/nfs_commonport.c
+++ sys/fs/nfs/nfs_commonport.c
@@ -322,7 +322,7 @@
*/
switch (flag) {
case _PC_LINK_MAX:
- *retf = LINK_MAX;
+ *retf = NFS_LINK_MAX;
break;
case _PC_NAME_MAX:
*retf = NAME_MAX;
Index: sys/fs/nfs/nfs_commonsubs.c
===================================================================
--- sys/fs/nfs/nfs_commonsubs.c
+++ sys/fs/nfs/nfs_commonsubs.c
@@ -881,7 +881,7 @@
NFSV3_FSFHOMOGENEOUS | NFSV3_FSFCANSETTIME);
}
if (pc != NULL) {
- pc->pc_linkmax = LINK_MAX;
+ pc->pc_linkmax = NFS_LINK_MAX;
pc->pc_namemax = NAME_MAX;
pc->pc_notrunc = 0;
pc->pc_chownrestricted = 0;
@@ -1318,7 +1318,7 @@
NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
if (compare) {
if (!(*retcmpp)) {
- if (fxdr_unsigned(int, *tl) != LINK_MAX)
+ if (fxdr_unsigned(int, *tl) != NFS_LINK_MAX)
*retcmpp = NFSERR_NOTSAME;
}
} else if (pc != NULL) {
Index: sys/fs/nfs/nfsproto.h
===================================================================
--- sys/fs/nfs/nfsproto.h
+++ sys/fs/nfs/nfsproto.h
@@ -776,6 +776,8 @@
#define fa3_mtime fa_un.fa_nfsv3.nfsv3fa_mtime
#define fa3_ctime fa_un.fa_nfsv3.nfsv3fa_ctime
+#define NFS_LINK_MAX 0xffffffff
+
struct nfsv2_sattr {
u_int32_t sa_mode;
u_int32_t sa_uid;
Index: sys/fs/nfsclient/nfs_clcomsubs.c
===================================================================
--- sys/fs/nfsclient/nfs_clcomsubs.c
+++ sys/fs/nfsclient/nfs_clcomsubs.c
@@ -431,7 +431,7 @@
nap->na_mode = fxdr_unsigned(u_short, fp->fa_mode);
nap->na_rdev = makedev(fxdr_unsigned(u_char, fp->fa3_rdev.specdata1),
fxdr_unsigned(u_char, fp->fa3_rdev.specdata2));
- nap->na_nlink = fxdr_unsigned(u_short, fp->fa_nlink);
+ nap->na_nlink = fxdr_unsigned(uint32_t, fp->fa_nlink);
nap->na_uid = fxdr_unsigned(uid_t, fp->fa_uid);
nap->na_gid = fxdr_unsigned(gid_t, fp->fa_gid);
nap->na_size = fxdr_hyper(&fp->fa3_size);
Index: sys/fs/nfsclient/nfs_clvnops.c
===================================================================
--- sys/fs/nfsclient/nfs_clvnops.c
+++ sys/fs/nfsclient/nfs_clvnops.c
@@ -187,6 +187,7 @@
.vop_fsync = nfs_fsync,
.vop_getattr = nfs_getattr,
.vop_inactive = ncl_inactive,
+ .vop_pathconf = nfs_pathconf,
.vop_print = nfs_print,
.vop_read = nfsfifo_read,
.vop_reclaim = ncl_reclaim,
@@ -3448,7 +3449,7 @@
* For NFSv2 (or NFSv3 when not one of the above 4 a_names),
* just fake them.
*/
- pc.pc_linkmax = LINK_MAX;
+ pc.pc_linkmax = NFS_LINK_MAX;
pc.pc_namemax = NFS_MAXNAMLEN;
pc.pc_notrunc = 1;
pc.pc_chownrestricted = 1;
@@ -3463,6 +3464,12 @@
case _PC_NAME_MAX:
*ap->a_retval = pc.pc_namemax;
break;
+ case _PC_PIPE_BUF:
+ if (ap->a_vp->v_type == VDIR || ap->a_vp->v_type == VFIFO)
+ *ap->a_retval = PIPE_BUF;
+ else
+ error = EINVAL;
+ break;
case _PC_CHOWN_RESTRICTED:
*ap->a_retval = pc.pc_chownrestricted;
break;
Index: sys/fs/smbfs/smbfs_vnops.c
===================================================================
--- sys/fs/smbfs/smbfs_vnops.c
+++ sys/fs/smbfs/smbfs_vnops.c
@@ -897,8 +897,12 @@
int error = 0;
switch (ap->a_name) {
- case _PC_LINK_MAX:
- *retval = 0;
+ case _PC_FILESIZEBITS:
+ if (vcp->vc_sopt.sv_caps & (SMB_CAP_LARGE_READX |
+ SMB_CAP_LARGE_WRITEX))
+ *retval = 64;
+ else
+ *retval = 32;
break;
case _PC_NAME_MAX:
*retval = (vcp->vc_hflags2 & SMB_FLAGS2_KNOWS_LONG_NAMES) ? 255 : 12;
@@ -906,6 +910,9 @@
case _PC_PATH_MAX:
*retval = 800; /* XXX: a correct one ? */
break;
+ case _PC_NO_TRUNC:
+ *retval = 1;
+ break;
default:
error = vop_stdpathconf(ap);
}
Index: sys/fs/tmpfs/tmpfs.h
===================================================================
--- sys/fs/tmpfs/tmpfs.h
+++ sys/fs/tmpfs/tmpfs.h
@@ -195,8 +195,8 @@
uid_t tn_uid; /* (v) */
gid_t tn_gid; /* (v) */
mode_t tn_mode; /* (v) */
+ int tn_links; /* (v) */
u_long tn_flags; /* (v) */
- nlink_t tn_links; /* (v) */
struct timespec tn_atime; /* (vi) */
struct timespec tn_mtime; /* (vi) */
struct timespec tn_ctime; /* (vi) */
@@ -304,6 +304,8 @@
#define tn_reg tn_spec.tn_reg
#define tn_fifo tn_spec.tn_fifo
+#define TMPFS_LINK_MAX INT_MAX
+
#define TMPFS_NODE_LOCK(node) mtx_lock(&(node)->tn_interlock)
#define TMPFS_NODE_UNLOCK(node) mtx_unlock(&(node)->tn_interlock)
#define TMPFS_NODE_MTX(node) (&(node)->tn_interlock)
Index: sys/fs/tmpfs/tmpfs_fifoops.c
===================================================================
--- sys/fs/tmpfs/tmpfs_fifoops.c
+++ sys/fs/tmpfs/tmpfs_fifoops.c
@@ -69,5 +69,6 @@
.vop_access = tmpfs_access,
.vop_getattr = tmpfs_getattr,
.vop_setattr = tmpfs_setattr,
+ .vop_pathconf = tmpfs_pathconf,
.vop_print = tmpfs_print,
};
Index: sys/fs/tmpfs/tmpfs_subr.c
===================================================================
--- sys/fs/tmpfs/tmpfs_subr.c
+++ sys/fs/tmpfs/tmpfs_subr.c
@@ -727,8 +727,8 @@
if (vap->va_type == VDIR) {
/* Ensure that we do not overflow the maximum number of links
* imposed by the system. */
- MPASS(dnode->tn_links <= LINK_MAX);
- if (dnode->tn_links == LINK_MAX) {
+ MPASS(dnode->tn_links <= TMPFS_LINK_MAX);
+ if (dnode->tn_links == TMPFS_LINK_MAX) {
return (EMLINK);
}
Index: sys/fs/tmpfs/tmpfs_vnops.h
===================================================================
--- sys/fs/tmpfs/tmpfs_vnops.h
+++ sys/fs/tmpfs/tmpfs_vnops.h
@@ -49,6 +49,7 @@
vop_access_t tmpfs_access;
vop_getattr_t tmpfs_getattr;
vop_setattr_t tmpfs_setattr;
+vop_pathconf_t tmpfs_pathconf;
vop_print_t tmpfs_print;
vop_reclaim_t tmpfs_reclaim;
Index: sys/fs/tmpfs/tmpfs_vnops.c
===================================================================
--- sys/fs/tmpfs/tmpfs_vnops.c
+++ sys/fs/tmpfs/tmpfs_vnops.c
@@ -614,8 +614,8 @@
/* Ensure that we do not overflow the maximum number of links imposed
* by the system. */
- MPASS(node->tn_links <= LINK_MAX);
- if (node->tn_links == LINK_MAX) {
+ MPASS(node->tn_links <= TMPFS_LINK_MAX);
+ if (node->tn_links == TMPFS_LINK_MAX) {
error = EMLINK;
goto out;
}
@@ -1333,9 +1333,10 @@
return 0;
}
-static int
+int
tmpfs_pathconf(struct vop_pathconf_args *v)
{
+ struct vnode *vp = v->a_vp;
int name = v->a_name;
register_t *retval = v->a_retval;
@@ -1344,6 +1345,25 @@
error = 0;
switch (name) {
+ case _PC_LINK_MAX:
+ *retval = TMPFS_LINK_MAX;
+ break;
+
+ case _PC_NAME_MAX:
+ *retval = NAME_MAX;
+ break;
+
+ case _PC_PIPE_BUF:
+ if (vp->v_type == VDIR || vp->v_type == VFIFO)
+ *retval = PIPE_BUF;
+ else
+ error = EINVAL;
+ break;
+
+ case _PC_CHOWN_RESTRICTED:
+ *retval = 1;
+ break;
+
case _PC_NO_TRUNC:
*retval = 1;
break;
Index: sys/fs/udf/udf_vnops.c
===================================================================
--- sys/fs/udf/udf_vnops.c
+++ sys/fs/udf/udf_vnops.c
@@ -100,6 +100,7 @@
.vop_default = &fifo_specops,
.vop_access = udf_access,
.vop_getattr = udf_getattr,
+ .vop_pathconf = udf_pathconf,
.vop_print = udf_print,
.vop_reclaim = udf_reclaim,
.vop_setattr = udf_setattr,
@@ -398,6 +399,12 @@
case _PC_NO_TRUNC:
*a->a_retval = 1;
return (0);
+ case _PC_PIPE_BUF:
+ if (a->a_vp->v_type == VDIR || a->a_vp->v_type == VFIFO) {
+ *a->a_retval = PIPE_BUF;
+ return (0);
+ }
+ return (EINVAL);
default:
return (vop_stdpathconf(a));
}
Index: sys/kern/kern_descrip.c
===================================================================
--- sys/kern/kern_descrip.c
+++ sys/kern/kern_descrip.c
@@ -1416,26 +1416,33 @@
int
sys_fpathconf(struct thread *td, struct fpathconf_args *uap)
{
+
+ return (kern_fpathconf(td, uap->fd, uap->name));
+}
+
+int
+kern_fpathconf(struct thread *td, int fd, int name)
+{
struct file *fp;
struct vnode *vp;
cap_rights_t rights;
int error;
- error = fget(td, uap->fd, cap_rights_init(&rights, CAP_FPATHCONF), &fp);
+ error = fget(td, fd, cap_rights_init(&rights, CAP_FPATHCONF), &fp);
if (error != 0)
return (error);
- if (uap->name == _PC_ASYNC_IO) {
+ if (name == _PC_ASYNC_IO) {
td->td_retval[0] = _POSIX_ASYNCHRONOUS_IO;
goto out;
}
vp = fp->f_vnode;
if (vp != NULL) {
vn_lock(vp, LK_SHARED | LK_RETRY);
- error = VOP_PATHCONF(vp, uap->name, td->td_retval);
+ error = VOP_PATHCONF(vp, name, td->td_retval);
VOP_UNLOCK(vp, 0);
} else if (fp->f_type == DTYPE_PIPE || fp->f_type == DTYPE_SOCKET) {
- if (uap->name != _PC_PIPE_BUF) {
+ if (name != _PC_PIPE_BUF) {
error = EINVAL;
} else {
td->td_retval[0] = PIPE_BUF;
Index: sys/kern/vfs_default.c
===================================================================
--- sys/kern/vfs_default.c
+++ sys/kern/vfs_default.c
@@ -477,21 +477,9 @@
case _PC_ASYNC_IO:
*ap->a_retval = _POSIX_ASYNCHRONOUS_IO;
return (0);
- case _PC_NAME_MAX:
- *ap->a_retval = NAME_MAX;
- return (0);
case _PC_PATH_MAX:
*ap->a_retval = PATH_MAX;
return (0);
- case _PC_LINK_MAX:
- *ap->a_retval = LINK_MAX;
- return (0);
- case _PC_PIPE_BUF:
- *ap->a_retval = PIPE_BUF;
- return (0);
- case _PC_CHOWN_RESTRICTED:
- *ap->a_retval = 1;
- return (0);
default:
return (EINVAL);
}
Index: sys/sys/syscallsubr.h
===================================================================
--- sys/sys/syscallsubr.h
+++ sys/sys/syscallsubr.h
@@ -109,6 +109,7 @@
int kern_fcntl_freebsd(struct thread *td, int fd, int cmd, long arg);
int kern_fhstat(struct thread *td, fhandle_t fh, struct stat *buf);
int kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf);
+int kern_fpathconf(struct thread *td, int fd, int name);
int kern_fstat(struct thread *td, int fd, struct stat *sbp);
int kern_fstatfs(struct thread *td, int fd, struct statfs *buf);
int kern_fsync(struct thread *td, int fd, bool fullsync);
Index: sys/ufs/ufs/ufs_vnops.c
===================================================================
--- sys/ufs/ufs/ufs_vnops.c
+++ sys/ufs/ufs/ufs_vnops.c
@@ -122,7 +122,6 @@
static vop_whiteout_t ufs_whiteout;
static vop_close_t ufsfifo_close;
static vop_kqfilter_t ufsfifo_kqfilter;
-static vop_pathconf_t ufsfifo_pathconf;
SYSCTL_NODE(_vfs, OID_AUTO, ufs, CTLFLAG_RD, 0, "UFS filesystem");
@@ -2404,30 +2403,6 @@
}
/*
- * Return POSIX pathconf information applicable to fifos.
- */
-static int
-ufsfifo_pathconf(ap)
- struct vop_pathconf_args /* {
- struct vnode *a_vp;
- int a_name;
- int *a_retval;
- } */ *ap;
-{
-
- switch (ap->a_name) {
- case _PC_ACL_EXTENDED:
- case _PC_ACL_NFS4:
- case _PC_ACL_PATH_MAX:
- case _PC_MAC_PRESENT:
- return (ufs_pathconf(ap));
- default:
- return (fifo_specops.vop_pathconf(ap));
- }
- /* NOTREACHED */
-}
-
-/*
* Return POSIX pathconf information applicable to ufs filesystems.
*/
static int
@@ -2448,6 +2423,15 @@
case _PC_NAME_MAX:
*ap->a_retval = UFS_MAXNAMLEN;
break;
+ case _PC_PIPE_BUF:
+ if (ap->a_vp->v_type == VDIR || ap->a_vp->v_type == VFIFO)
+ *ap->a_retval = PIPE_BUF;
+ else
+ error = EINVAL;
+ break;
+ case _PC_CHOWN_RESTRICTED:
+ *ap->a_retval = 1;
+ break;
case _PC_NO_TRUNC:
*ap->a_retval = 1;
break;
@@ -2798,7 +2782,7 @@
.vop_inactive = ufs_inactive,
.vop_kqfilter = ufsfifo_kqfilter,
.vop_markatime = ufs_markatime,
- .vop_pathconf = ufsfifo_pathconf,
+ .vop_pathconf = ufs_pathconf,
.vop_print = ufs_print,
.vop_read = VOP_PANIC,
.vop_reclaim = ufs_reclaim,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Aug 27, 6:34 PM (3 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37409318
Default Alt Text
D12572.id33645.diff (21 KB)
Attached To
Mode
D12572: Various pathconf() fixes.
Attached
Detach File
Event Timeline
Log In to Comment