+ }
+ }
+ KDBG_RELEASE(DBG_MOUNTROOT | DBG_FUNC_END, error ? error : ENODEV, 4);
+ return ENODEV;
+}
+
+/*
+ * Mount the data volume of an ROSV volume group
+ */
+int
+vfs_mount_rosv_data(void)
+{
+#if CONFIG_ROSV_STARTUP
+ int error = 0;
+ int do_rosv_mounts = 0;
+
+ error = vnode_get(rootvnode);
+ if (error) {
+ /* root must be mounted first */
+ printf("vnode_get(rootvnode) failed with error %d\n", error);
+ return error;
+ }
+
+ printf("NOTE: Attempting ROSV mount\n");
+ struct vfs_attr vfsattr;
+ VFSATTR_INIT(&vfsattr);
+ VFSATTR_WANTED(&vfsattr, f_capabilities);
+ if (vfs_getattr(rootvnode->v_mount, &vfsattr, vfs_context_kernel()) == 0 &&
+ VFSATTR_IS_SUPPORTED(&vfsattr, f_capabilities)) {
+ if ((vfsattr.f_capabilities.capabilities[VOL_CAPABILITIES_FORMAT] & VOL_CAP_FMT_VOL_GROUPS) &&
+ (vfsattr.f_capabilities.valid[VOL_CAPABILITIES_FORMAT] & VOL_CAP_FMT_VOL_GROUPS)) {
+ printf("NOTE: DETECTED ROSV CONFIG\n");
+ do_rosv_mounts = 1;
+ }
+ }
+
+ if (!do_rosv_mounts) {
+ vnode_put(rootvnode);
+ //bail out if config not supported
+ return 0;
+ }
+
+ char datapath[] = PLATFORM_DATA_VOLUME_MOUNT_POINT; /* !const because of internal casting */
+
+ /* Mount the data volume */
+ printf("attempting kernel mount for data volume... \n");
+ error = kernel_mount(rootvnode->v_mount->mnt_vfsstat.f_fstypename, NULLVP, NULLVP,
+ datapath, (rootvnode->v_mount), 0, 0, (KERNEL_MOUNT_DATAVOL), vfs_context_kernel());
+
+ if (error) {
+ printf("Failed to mount data volume (%d)\n", error);
+ }
+
+ vnode_put(rootvnode);
+
+ return error;
+
+#else
+ return 0;
+#endif
+}
+
+/*
+ * Mount the VM volume of a container
+ */
+int
+vfs_mount_vm(void)
+{
+#if CONFIG_MOUNT_VM
+ int error = 0;
+
+ error = vnode_get(rootvnode);
+ if (error) {
+ /* root must be mounted first */
+ printf("vnode_get(rootvnode) failed with error %d\n", error);
+ return error;
+ }
+
+ char vmpath[] = PLATFORM_VM_VOLUME_MOUNT_POINT; /* !const because of internal casting */
+
+ /* Mount the VM volume */
+ printf("attempting kernel mount for vm volume... \n");
+ error = kernel_mount(rootvnode->v_mount->mnt_vfsstat.f_fstypename, NULLVP, NULLVP,
+ vmpath, (rootvnode->v_mount), 0, 0, (KERNEL_MOUNT_VMVOL), vfs_context_kernel());
+
+ if (error) {
+ printf("Failed to mount vm volume (%d)\n", error);
+ } else {
+ printf("mounted VM volume\n");