diff --git a/contrib/debian/openzfs-zfsutils.install b/contrib/debian/openzfs-zfsutils.install index 10083351ab..6b10fc0d22 100644 --- a/contrib/debian/openzfs-zfsutils.install +++ b/contrib/debian/openzfs-zfsutils.install @@ -91,6 +91,7 @@ usr/share/man/man8/zfs_ids_to_path.8 usr/share/man/man8/zfs_prepare_disk.8 usr/share/man/man7/zfsconcepts.7 usr/share/man/man7/zfsprops.7 +usr/share/man/man7/zfsprops-macos.7 usr/share/man/man8/zgenhostid.8 usr/share/man/man8/zinject.8 usr/share/man/man8/zpool-add.8 diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h index c7e48d1edc..99dd299031 100644 --- a/include/sys/fs/zfs.h +++ b/include/sys/fs/zfs.h @@ -193,6 +193,11 @@ typedef enum { ZFS_PROP_SNAPSHOTS_CHANGED, ZFS_PROP_PREFETCH, ZFS_PROP_VOLTHREADING, + ZFS_PROP_BROWSE, /* macOS: nobrowse/browse */ + ZFS_PROP_IGNOREOWNER, /* macOS: ignoreowner mount */ + ZFS_PROP_LASTUNMOUNT, /* macOS: Spotlight required */ + ZFS_PROP_MIMIC, /* macOS: mimic=hfs|apfs */ + ZFS_PROP_DEVDISK, /* macOS: create IOkit virtual disk */ ZFS_NUM_PROPS } zfs_prop_t; @@ -560,6 +565,19 @@ typedef enum { ZFS_PREFETCH_ALL = 2 } zfs_prefetch_type_t; +typedef enum zfs_mimic { + ZFS_MIMIC_OFF = 0, + ZFS_MIMIC_HFS, + ZFS_MIMIC_APFS, + ZFS_MIMIC_NTFS +} zfs_mimic_t; + +typedef enum zfs_devdisk { + ZFS_DEVDISK_POOLONLY = 0, + ZFS_DEVDISK_OFF, + ZFS_DEVDISK_ON +} zfs_devdisk_t; + #define DEFAULT_PBKDF2_ITERATIONS 350000 #define MIN_PBKDF2_ITERATIONS 100000 @@ -1534,6 +1552,8 @@ typedef enum zfs_ioc { ZFS_IOC_USERNS_DETACH = ZFS_IOC_UNJAIL, /* 0x86 (Linux) */ ZFS_IOC_SET_BOOTENV, /* 0x87 */ ZFS_IOC_GET_BOOTENV, /* 0x88 */ + ZFS_IOC_PROXY_DATASET, /* 0x89 (macOS) */ + ZFS_IOC_PROXY_REMOVE, /* 0x8a (macOS) */ ZFS_IOC_LAST } zfs_ioc_t; diff --git a/lib/libzfs/libzfs.abi b/lib/libzfs/libzfs.abi index 88baa4168c..2bc4f43c57 100644 --- a/lib/libzfs/libzfs.abi +++ b/lib/libzfs/libzfs.abi @@ -1871,7 +1871,12 @@ - + + + + + + @@ -5939,7 +5944,9 @@ - + + + diff --git a/lib/libzfs_core/libzfs_core.abi b/lib/libzfs_core/libzfs_core.abi index 1062a6b52d..03244be1cd 100644 --- a/lib/libzfs_core/libzfs_core.abi +++ b/lib/libzfs_core/libzfs_core.abi @@ -1455,7 +1455,9 @@ - + + + diff --git a/man/Makefile.am b/man/Makefile.am index 194bb47216..a4f1f5a64b 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -21,6 +21,7 @@ dist_man_MANS = \ %D%/man7/zpool-features.7 \ %D%/man7/zpoolconcepts.7 \ %D%/man7/zpoolprops.7 \ + %D%/man7/zfsprops-macos.7 \ \ %D%/man8/fsck.zfs.8 \ %D%/man8/mount.zfs.8 \ diff --git a/man/man7/zfsprops-macos.7 b/man/man7/zfsprops-macos.7 new file mode 100644 index 0000000000..f04c340bdb --- /dev/null +++ b/man/man7/zfsprops-macos.7 @@ -0,0 +1,94 @@ +.\" +.\" CDDL HEADER START +.\" +.\" The contents of this file are subject to the terms of the +.\" Common Development and Distribution License (the "License"). +.\" You may not use this file except in compliance with the License. +.\" +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +.\" or http://www.opensolaris.org/os/licensing. +.\" See the License for the specific language governing permissions +.\" and limitations under the License. +.\" +.\" When distributing Covered Code, include this CDDL HEADER in each +.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. +.\" If applicable, add the following below this CDDL HEADER, with the +.\" fields enclosed by brackets "[]" replaced with your own identifying +.\" information: Portions Copyright [yyyy] [name of copyright owner] +.\" +.\" CDDL HEADER END +.\" +.\" +.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved. +.\" Copyright 2011 Joshua M. Clulow +.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved. +.\" Copyright (c) 2011, Pawel Jakub Dawidek +.\" Copyright (c) 2012, Glen Barber +.\" Copyright (c) 2012, Bryan Drewery +.\" Copyright (c) 2013, Steven Hartland +.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved. +.\" Copyright (c) 2014, Joyent, Inc. All rights reserved. +.\" Copyright (c) 2014 by Adam Stevko. All rights reserved. +.\" Copyright (c) 2014 Integros [integros.com] +.\" Copyright (c) 2016 Nexenta Systems, Inc. All Rights Reserved. +.\" Copyright (c) 2014, Xin LI +.\" Copyright (c) 2014-2015, The FreeBSD Foundation, All Rights Reserved. +.\" Copyright 2019 Richard Laager. All rights reserved. +.\" Copyright 2018 Nexenta Systems, Inc. +.\" Copyright 2019 Joyent, Inc. +.\" Copyright (c) 2019, Kjeld Schouten-Lebbing +.\" +.Dd April 29, 2021 +.Dt ZFSPROPS-MACOS 7 +.Os +. +.Sh NAME +.Nm zfsprops-macos +.Nd native properties of ZFS datasets specific to macOS +. +.Sh DESCRIPTION +These properties are like the native properties described in +.Xr zfsprops 7 +but they are specific to macOS. +.Pp +The following native properties can be used to change the behavior of a ZFS +dataset. +.Bl -tag -width "" +.It Xo +.Sy browse Ns = Ns Sy on Ns | Ns Sy off +.Xc +Equivalent to mount option +.Sy browse/nobrowse . +This option indicates +that the mount point should not be visible via the GUI (i.e., appear +on the Desktop as a separate volume). Setting it to off will result +in Spotlight being unavailable for the specified mount point. +The default value is +.Sy off . +.It Xo +.Sy ignoreowner Ns = Ns Sy on Ns | Ns Sy off +.Xc +Equivalent to mount option +.Sy noowners . +Ignore the ownership field for the entire volume. +The default value is +.Sy off . +.It Xo +.Sy mimic Ns = Ns Sy hfs Ns | Ns Sy apfs Ns | Ns Sy ntfs Ns | Ns Sy off +.Xc +Some applications check if the filesystem type is and refuse to work with ZFS. +In this situation, this property can be enabled and the chosen filesystem type +will be reported. +The default value is +.Sy off . +.It Xo +.Sy devdisk Ns = Ns Sy poolonly Ns | Ns Sy on Ns | Ns Sy off +.Xc +Create a /dev/diskX pseudo-disk for the mount, which has better compatibility +with macOS UI. +Due to the cost of creating a /dev/disk entry, the default value is set to +.Sy poolonly +as to only create an entry for the pool's root dataset. +For lower datasets, set to +.Sy on . +.El diff --git a/module/zcommon/zfs_prop.c b/module/zcommon/zfs_prop.c index 764993b45e..8b20f617c5 100644 --- a/module/zcommon/zfs_prop.c +++ b/module/zcommon/zfs_prop.c @@ -398,6 +398,23 @@ zfs_prop_init(void) struct zfs_mod_supported_features *sfeatures = zfs_mod_list_supported(ZFS_SYSFS_DATASET_PROPERTIES); + /* __APPLE__ */ + static zprop_index_t devdisk_table[] = { + { "poolonly", ZFS_DEVDISK_POOLONLY }, + { "off", ZFS_DEVDISK_OFF }, + { "on", ZFS_DEVDISK_ON }, + { NULL } + }; + + static zprop_index_t mimic_table[] = { + { "off", ZFS_MIMIC_OFF }, + { "hfs", ZFS_MIMIC_HFS }, + { "apfs", ZFS_MIMIC_APFS }, + { "ntfs", ZFS_MIMIC_NTFS }, + { NULL } + }; + /* __APPLE__ */ + /* inherit index properties */ zprop_register_index(ZFS_PROP_REDUNDANT_METADATA, "redundant_metadata", ZFS_REDUNDANT_METADATA_ALL, @@ -609,6 +626,26 @@ zfs_prop_init(void) ZFS_TYPE_DATASET | ZFS_TYPE_BOOKMARK, "[,...]", "RSNAPS", sfeatures); + /* + * These props are needed for compatability with pools created + * using openzfsonosx + */ + zprop_register_index(ZFS_PROP_BROWSE, "browse", 1, + PROP_INHERIT, ZFS_TYPE_FILESYSTEM, "on | off", + "COM.APPLE.BROWSE", boolean_table, sfeatures); + zprop_register_index(ZFS_PROP_IGNOREOWNER, "ignoreowner", 0, + PROP_INHERIT, ZFS_TYPE_FILESYSTEM, "on | off", + "COM.APPLE.IGNOREOWNER", boolean_table, sfeatures); + zprop_register_hidden(ZFS_PROP_LASTUNMOUNT, "COM.APPLE.LASTUNMOUNT", + PROP_TYPE_NUMBER, PROP_READONLY, ZFS_TYPE_DATASET, "LASTUNMOUNT", + B_FALSE, sfeatures); + zprop_register_index(ZFS_PROP_MIMIC, "mimic", 0, + PROP_INHERIT, ZFS_TYPE_FILESYSTEM, "off | hfs | apfs | ntfs", + "COM.APPLE.MIMIC_HFS", mimic_table, sfeatures); + zprop_register_index(ZFS_PROP_DEVDISK, "devdisk", 0, + PROP_INHERIT, ZFS_TYPE_FILESYSTEM, "poolonly | on | off", + "COM.APPLE.DEVDISK", devdisk_table, sfeatures); + /* readonly number properties */ zprop_register_number(ZFS_PROP_USED, "used", 0, PROP_READONLY, ZFS_TYPE_DATASET, "", "USED", B_FALSE, sfeatures);