Add a custom VOP_PATHCONF method for fuse.

This method handles _PC_FILESIZEBITS, _PC_SYMLINK_MAX, and _PC_NO_TRUNC.
For other values it defers to vop_stdpathconf().

MFC after:	1 month
Sponsored by:	Chelsio Communications
This commit is contained in:
jhb 2017-12-19 19:09:06 +00:00
parent 4be4c74c89
commit 826956798a

View File

@ -126,6 +126,7 @@ static vop_lookup_t fuse_vnop_lookup;
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;
@ -158,7 +159,7 @@ struct vop_vector fuse_vnops = {
.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,
@ -1175,6 +1176,25 @@ fuse_vnop_open(struct vop_open_args *ap)
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_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;