Implement 1003.1-2001 pathconf() keys.

This is based on r106058 in UFS.

MFC after:	1 month
This commit is contained in:
Pedro F. Giffuni 2013-07-10 22:03:01 +00:00
parent 68fd965f98
commit c5249f35b8

View File

@ -1410,33 +1410,68 @@ ext2fifo_kqfilter(struct vop_kqfilter_args *ap)
static int static int
ext2_pathconf(struct vop_pathconf_args *ap) ext2_pathconf(struct vop_pathconf_args *ap)
{ {
int error = 0;
switch (ap->a_name) { switch (ap->a_name) {
case _PC_LINK_MAX: case _PC_LINK_MAX:
*ap->a_retval = EXT2_LINK_MAX; *ap->a_retval = EXT2_LINK_MAX;
return (0); break;
case _PC_NAME_MAX: case _PC_NAME_MAX:
*ap->a_retval = NAME_MAX; *ap->a_retval = NAME_MAX;
return (0); break;
case _PC_PATH_MAX: case _PC_PATH_MAX:
*ap->a_retval = PATH_MAX; *ap->a_retval = PATH_MAX;
return (0); break;
case _PC_PIPE_BUF: case _PC_PIPE_BUF:
*ap->a_retval = PIPE_BUF; *ap->a_retval = PIPE_BUF;
return (0); break;
case _PC_CHOWN_RESTRICTED: case _PC_CHOWN_RESTRICTED:
*ap->a_retval = 1; *ap->a_retval = 1;
return (0); break;
case _PC_NO_TRUNC: case _PC_NO_TRUNC:
*ap->a_retval = 1; *ap->a_retval = 1;
return (0); break;
case _PC_MIN_HOLE_SIZE: case _PC_MIN_HOLE_SIZE:
*ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize; *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize;
return(0); break;
case _PC_ASYNC_IO:
/* _PC_ASYNC_IO should have been handled by upper layers. */
KASSERT(0, ("_PC_ASYNC_IO should not get here"));
error = EINVAL;
break;
case _PC_PRIO_IO:
*ap->a_retval = 0;
break;
case _PC_SYNC_IO:
*ap->a_retval = 0;
break;
case _PC_ALLOC_SIZE_MIN:
*ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_bsize;
break;
case _PC_FILESIZEBITS:
*ap->a_retval = 64;
break;
case _PC_REC_INCR_XFER_SIZE:
*ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize;
break;
case _PC_REC_MAX_XFER_SIZE:
*ap->a_retval = -1; /* means ``unlimited'' */
break;
case _PC_REC_MIN_XFER_SIZE:
*ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize;
break;
case _PC_REC_XFER_ALIGN:
*ap->a_retval = PAGE_SIZE;
break;
case _PC_SYMLINK_MAX:
*ap->a_retval = MAXPATHLEN;
break;
default: default:
return (EINVAL); error = EINVAL;
break;
} }
/* NOTREACHED */ return (error);
} }
/* /*