/*
- * Copyright (c) 2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2019 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
NULLFSDEBUG("nullfs_mount(mp = %p) %llx\n", (void *)mp, vfs_flags(mp));
- if (vfs_flags(mp) & MNT_ROOTFS)
- return (EOPNOTSUPP);
+ if (vfs_flags(mp) & MNT_ROOTFS) {
+ return EOPNOTSUPP;
+ }
/*
* Update is a no-op
}
/* lowervrootvp has an iocount after vnode_lookup, drop that for a usecount.
- Keep this to signal what we want to keep around the thing we are mirroring.
- Drop it in unmount.*/
+ * Keep this to signal what we want to keep around the thing we are mirroring.
+ * Drop it in unmount.*/
error = vnode_ref(lowerrootvp);
vnode_put(lowerrootvp);
- if (error)
- {
+ if (error) {
// If vnode_ref failed, then null it out so it can't be used anymore in cleanup.
lowerrootvp = NULL;
goto error;
xmp->nullm_rootvp = vp;
/* read the flags the user set, but then ignore some of them, we will only
- allow them if they are set on the lower file system */
+ * allow them if they are set on the lower file system */
uint64_t flags = vfs_flags(mp) & (~(MNT_IGNORE_OWNERSHIP | MNT_LOCAL));
uint64_t lowerflags = vfs_flags(vnode_mount(lowerrootvp)) & (MNT_LOCAL | MNT_QUARANTINE | MNT_IGNORE_OWNERSHIP | MNT_NOEXEC);
MAC_PERFORM(mount_label_associate, cred, vnode_mount(lowerrootvp), vfs_mntlabel(mp));
NULLFSDEBUG("nullfs_mount: lower %s, alias at %s\n", sp->f_mntfromname, sp->f_mntonname);
- return (0);
+ return 0;
error:
if (xmp) {
/* check entitlement or superuser*/
if (!IOTaskHasEntitlement(current_task(), NULLFS_ENTITLEMENT) &&
- vfs_context_suser(ctx) != 0) {
+ vfs_context_suser(ctx) != 0) {
return EPERM;
}
vnode_getalways(vp);
error = vflush(mp, vp, flags);
- if (error)
- {
+ if (error) {
vnode_put(vp);
- return (error);
+ return error;
}
- if (vnode_isinuse(vp,1) && flags == 0)
- {
+ if (vnode_isinuse(vp, 1) && flags == 0) {
vnode_put(vp);
return EBUSY;
}
uint64_t vflags = vfs_flags(mp);
vfs_setflags(mp, vflags & ~MNT_LOCAL);
- return (0);
+ return 0;
}
static int
vp = MOUNTTONULLMOUNT(mp)->nullm_rootvp;
error = vnode_get(vp);
- if (error)
+ if (error) {
return error;
+ }
*vpp = vp;
return 0;
vol_capabilities_attr_t capabilities;
struct vfsstatfs * sp = vfs_statfs(mp);
- struct timespec tzero = {0, 0};
+ struct timespec tzero = {.tv_sec = 0, .tv_nsec = 0};
NULLFSDEBUG("%s\n", __FUNCTION__);
capabilities.valid[VOL_CAPABILITIES_INTERFACES] &=
~(VOL_CAP_INT_SEARCHFS | VOL_CAP_INT_ATTRLIST | VOL_CAP_INT_READDIRATTR | VOL_CAP_INT_EXCHANGEDATA |
- VOL_CAP_INT_COPYFILE | VOL_CAP_INT_ALLOCATE | VOL_CAP_INT_VOL_RENAME | VOL_CAP_INT_ADVLOCK | VOL_CAP_INT_FLOCK);
+ VOL_CAP_INT_COPYFILE | VOL_CAP_INT_ALLOCATE | VOL_CAP_INT_VOL_RENAME | VOL_CAP_INT_ADVLOCK | VOL_CAP_INT_FLOCK);
}
}
- if (VFSATTR_IS_ACTIVE(vfap, f_create_time))
+ if (VFSATTR_IS_ACTIVE(vfap, f_create_time)) {
VFSATTR_RETURN(vfap, f_create_time, tzero);
+ }
- if (VFSATTR_IS_ACTIVE(vfap, f_modify_time))
+ if (VFSATTR_IS_ACTIVE(vfap, f_modify_time)) {
VFSATTR_RETURN(vfap, f_modify_time, tzero);
+ }
- if (VFSATTR_IS_ACTIVE(vfap, f_access_time))
+ if (VFSATTR_IS_ACTIVE(vfap, f_access_time)) {
VFSATTR_RETURN(vfap, f_access_time, tzero);
+ }
- if (VFSATTR_IS_ACTIVE(vfap, f_bsize))
+ if (VFSATTR_IS_ACTIVE(vfap, f_bsize)) {
VFSATTR_RETURN(vfap, f_bsize, sp->f_bsize);
+ }
- if (VFSATTR_IS_ACTIVE(vfap, f_iosize))
+ if (VFSATTR_IS_ACTIVE(vfap, f_iosize)) {
VFSATTR_RETURN(vfap, f_iosize, sp->f_iosize);
+ }
- if (VFSATTR_IS_ACTIVE(vfap, f_owner))
+ if (VFSATTR_IS_ACTIVE(vfap, f_owner)) {
VFSATTR_RETURN(vfap, f_owner, 0);
+ }
- if (VFSATTR_IS_ACTIVE(vfap, f_blocks))
+ if (VFSATTR_IS_ACTIVE(vfap, f_blocks)) {
VFSATTR_RETURN(vfap, f_blocks, sp->f_blocks);
+ }
- if (VFSATTR_IS_ACTIVE(vfap, f_bfree))
+ if (VFSATTR_IS_ACTIVE(vfap, f_bfree)) {
VFSATTR_RETURN(vfap, f_bfree, sp->f_bfree);
+ }
- if (VFSATTR_IS_ACTIVE(vfap, f_bavail))
+ if (VFSATTR_IS_ACTIVE(vfap, f_bavail)) {
VFSATTR_RETURN(vfap, f_bavail, sp->f_bavail);
+ }
- if (VFSATTR_IS_ACTIVE(vfap, f_bused))
+ if (VFSATTR_IS_ACTIVE(vfap, f_bused)) {
VFSATTR_RETURN(vfap, f_bused, sp->f_bused);
+ }
- if (VFSATTR_IS_ACTIVE(vfap, f_files))
+ if (VFSATTR_IS_ACTIVE(vfap, f_files)) {
VFSATTR_RETURN(vfap, f_files, sp->f_files);
+ }
- if (VFSATTR_IS_ACTIVE(vfap, f_ffree))
+ if (VFSATTR_IS_ACTIVE(vfap, f_ffree)) {
VFSATTR_RETURN(vfap, f_ffree, sp->f_ffree);
+ }
- if (VFSATTR_IS_ACTIVE(vfap, f_fssubtype))
+ if (VFSATTR_IS_ACTIVE(vfap, f_fssubtype)) {
VFSATTR_RETURN(vfap, f_fssubtype, 0);
+ }
if (VFSATTR_IS_ACTIVE(vfap, f_capabilities)) {
memcpy(&vfap->f_capabilities, &capabilities, sizeof(vol_capabilities_attr_t));
/*
* XXX - Assumes no data cached at null layer.
*/
- return (0);
+ return 0;
}
return 0;
}
-extern struct vnodeopv_desc nullfs_vnodeop_opv_desc;
+extern const struct vnodeopv_desc nullfs_vnodeop_opv_desc;
-struct vnodeopv_desc * nullfs_vnodeopv_descs[] = {
- &nullfs_vnodeop_opv_desc,
+const struct vnodeopv_desc * nullfs_vnodeopv_descs[] = {
+ &nullfs_vnodeop_opv_desc,
};
struct vfsops nullfs_vfsops = {
- .vfs_mount = nullfs_mount,
- .vfs_unmount = nullfs_unmount,
- .vfs_start = nullfs_vfs_start,
- .vfs_root = nullfs_root,
- .vfs_getattr = nullfs_vfs_getattr,
- .vfs_sync = nullfs_sync,
- .vfs_init = nullfs_init,
- .vfs_sysctl = NULL,
- .vfs_setattr = NULL,
+ .vfs_mount = nullfs_mount,
+ .vfs_unmount = nullfs_unmount,
+ .vfs_start = nullfs_vfs_start,
+ .vfs_root = nullfs_root,
+ .vfs_getattr = nullfs_vfs_getattr,
+ .vfs_sync = nullfs_sync,
+ .vfs_init = nullfs_init,
+ .vfs_sysctl = NULL,
+ .vfs_setattr = NULL,
};
-