Skip to content

Commit

Permalink
Plumb property mimic for ntfs
Browse files Browse the repository at this point in the history
Signed-off-by: Jorgen Lundman <lundman@lundman.net>
  • Loading branch information
lundman committed May 19, 2024
1 parent 197d54e commit bd9f8b4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
1 change: 1 addition & 0 deletions include/os/windows/zfs/sys/zfs_vfsops_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ struct zfsvfs {
avl_tree_t z_hardlinks; /* linkid hash avl tree for vget */
avl_tree_t z_hardlinks_linkid; /* sorted on linkid */
krwlock_t z_hardlinks_lock; /* lock to access z_hardlinks */
uint64_t z_mimic; /* zfs? ntfs ? */
#endif
uint64_t z_replay_eof; /* New end of file - replay only */
sa_attr_type_t *z_attr_table; /* SA attr mapping->id */
Expand Down
23 changes: 2 additions & 21 deletions module/os/windows/zfs/zfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,14 +332,9 @@ static void
mimic_changed_cb(void *arg, uint64_t newval)
{
zfsvfs_t *zfsvfs = arg;
struct vfsstatfs *vfsstatfs;
vfsstatfs = vfs_statfs(zfsvfs->z_vfs);

if (newval == 0) {
// strlcpy(vfsstatfs->f_fstypename, "zfs", MFSTYPENAMELEN);
} else {
// strlcpy(vfsstatfs->f_fstypename, "hfs", MFSTYPENAMELEN);
}
if (zfsvfs != NULL)
zfsvfs->z_mimic = newval;
}

static int
Expand Down Expand Up @@ -942,8 +937,6 @@ zfs_domount(struct mount *vfsp, dev_t mount_dev, char *osname,
{
int error = 0;
zfsvfs_t *zfsvfs;
uint64_t mimic = 0;
// struct timeval tv;

ASSERT(vfsp);
ASSERT(osname);
Expand Down Expand Up @@ -975,18 +968,6 @@ zfs_domount(struct mount *vfsp, dev_t mount_dev, char *osname,
* because that's where other Solaris filesystems put it.
*/

error = dsl_prop_get_integer(osname, "com.apple.mimic", &mimic, NULL);

/*
* If we are readonly (ie, waiting for rootmount) we need to reply
* honestly, so launchd runs fsck_zfs and mount_zfs
*/
if (mimic /* == ZFS_MIMIC_NTFS */) {
struct vfsstatfs *vfsstatfs;
vfsstatfs = vfs_statfs(vfsp);
strlcpy(vfsstatfs->f_fstypename, "ntfs", MFSTYPENAMELEN);
}

/*
* Set features for file system.
*/
Expand Down
5 changes: 4 additions & 1 deletion module/os/windows/zfs/zfs_vnops_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -2309,7 +2309,10 @@ query_volume_information(PDEVICE_OBJECT DeviceObject, PIRP Irp,
FIELD_OFFSET(FILE_FS_ATTRIBUTE_INFORMATION, FileSystemName);

UNICODE_STRING name;
RtlInitUnicodeString(&name, L"NTFS");
if (zfsvfs->z_mimic == ZFS_MIMIC_OFF)
RtlInitUnicodeString(&name, L"ZFS");
else
RtlInitUnicodeString(&name, L"NTFS");

space = MIN(space, name.Length);
ffai->FileSystemNameLength = name.Length;
Expand Down

0 comments on commit bd9f8b4

Please sign in to comment.