This commit is contained in:
Andrew Innes 2024-08-22 10:27:20 +02:00 committed by GitHub
commit 4afb477a8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 165 additions and 3 deletions

View File

@ -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

View File

@ -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;

View File

@ -1871,7 +1871,12 @@
<enumerator name='ZFS_PROP_SNAPSHOTS_CHANGED' value='95'/>
<enumerator name='ZFS_PROP_PREFETCH' value='96'/>
<enumerator name='ZFS_PROP_VOLTHREADING' value='97'/>
<enumerator name='ZFS_NUM_PROPS' value='98'/>
<enumerator name='ZFS_PROP_BROWSE' value='98'/>
<enumerator name='ZFS_PROP_IGNOREOWNER' value='99'/>
<enumerator name='ZFS_PROP_LASTUNMOUNT' value='100'/>
<enumerator name='ZFS_PROP_MIMIC' value='101'/>
<enumerator name='ZFS_PROP_DEVDISK' value='102'/>
<enumerator name='ZFS_NUM_PROPS' value='103'/>
</enum-decl>
<typedef-decl name='zfs_prop_t' type-id='4b000d60' id='58603c44'/>
<enum-decl name='zprop_source_t' naming-typedef-id='a2256d42' id='5903f80e'>
@ -5939,7 +5944,9 @@
<enumerator name='ZFS_IOC_USERNS_DETACH' value='23174'/>
<enumerator name='ZFS_IOC_SET_BOOTENV' value='23175'/>
<enumerator name='ZFS_IOC_GET_BOOTENV' value='23176'/>
<enumerator name='ZFS_IOC_LAST' value='23177'/>
<enumerator name='ZFS_IOC_PROXY_DATASET' value='23177'/>
<enumerator name='ZFS_IOC_PROXY_REMOVE' value='23178'/>
<enumerator name='ZFS_IOC_LAST' value='23179'/>
</enum-decl>
<typedef-decl name='zfs_ioc_t' type-id='12033f13' id='5b35941c'/>
<enum-decl name='zpool_wait_activity_t' naming-typedef-id='73446457' id='849338e3'>

View File

@ -1455,7 +1455,9 @@
<enumerator name='ZFS_IOC_USERNS_DETACH' value='23174'/>
<enumerator name='ZFS_IOC_SET_BOOTENV' value='23175'/>
<enumerator name='ZFS_IOC_GET_BOOTENV' value='23176'/>
<enumerator name='ZFS_IOC_LAST' value='23177'/>
<enumerator name='ZFS_IOC_PROXY_DATASET' value='23177'/>
<enumerator name='ZFS_IOC_PROXY_REMOVE' value='23178'/>
<enumerator name='ZFS_IOC_LAST' value='23179'/>
</enum-decl>
<typedef-decl name='zfs_ioc_t' type-id='12033f13' id='5b35941c'/>
<enum-decl name='zpool_wait_activity_t' naming-typedef-id='73446457' id='849338e3'>

View File

@ -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 \

94
man/man7/zfsprops-macos.7 Normal file
View File

@ -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 <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
.\" Copyright (c) 2011, Pawel Jakub Dawidek <pjd@FreeBSD.org>
.\" Copyright (c) 2012, Glen Barber <gjb@FreeBSD.org>
.\" Copyright (c) 2012, Bryan Drewery <bdrewery@FreeBSD.org>
.\" Copyright (c) 2013, Steven Hartland <smh@FreeBSD.org>
.\" 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 <delphij@FreeBSD.org>
.\" 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

View File

@ -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, "<snapshot>[,...]",
"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, "<size>", "USED", B_FALSE, sfeatures);