Difference between revisions of "Zfs.exports"
From OpenZFS on OS X
(Created page with " == zfs.exports == We used to list functions from XNU's private.exports, and using a codeless kext let's us call them. With 2.0 re-port, we no longer use zfs.exports, but it ...") |
m |
||
Line 6: | Line 6: | ||
_cpu_number | _cpu_number | ||
− | + | ||
− | Comment: Used to spread out lock contention, we use the lock at active-core-index | + | Comment: Used to spread out lock contention, we use the lock at active-core-index |
− | Alternative: None, only using [0] | + | Alternative: None, only using [0] |
− | Result: performance penalty | + | Result: performance penalty |
_fp_lookup | _fp_lookup | ||
Line 16: | Line 16: | ||
_fo_read | _fo_read | ||
_fo_write | _fo_write | ||
− | + | ||
− | Comment: "zfs send" and "zfs recv" will either do IO on a file (vnode) or pipe. There is no | + | Comment: "zfs send" and "zfs recv" will either do IO on a file (vnode) or pipe. There is no |
way to do IO on a pipe in a kext without private.exports. | way to do IO on a pipe in a kext without private.exports. | ||
− | Alternative: userland will mknod /tmp/.pipe, spawn a relay helper, and open(/tmp/.pipe) which passes | + | Alternative: userland will mknod /tmp/.pipe, spawn a relay helper, and open(/tmp/.pipe) which passes |
a vnode to kernel. This works, but is complicated, both setting up pipes, and cleaning up. Especially with | a vnode to kernel. This works, but is complicated, both setting up pipes, and cleaning up. Especially with | ||
SIGINT involved. It would be nice to do pipe IO in kext. | SIGINT involved. It would be nice to do pipe IO in kext. | ||
− | Result: Complicated code, but already working. Pipes love to deadlock, so corner cases could exist. | + | Result: Complicated code, but already working. Pipes love to deadlock, so corner cases could exist. |
_hostname | _hostname | ||
− | + | ||
− | Comment: uses hostname for diagnostic messages, history logs and multihost mounting (failover would | + | Comment: uses hostname for diagnostic messages, history logs and multihost mounting (failover would |
display which host stopped and which host took over.) | display which host stopped and which host took over.) | ||
− | Alternative: None. Some work arounds could be done, like passing hostname from userland. Hashing hostid as string. | + | Alternative: None. Some work arounds could be done, like passing hostname from userland. Hashing hostid as string. |
− | Result: user confusion to which host was in use. (Until work around) | + | Result: user confusion to which host was in use. (Until work around) |
_virtual_space_start | _virtual_space_start | ||
Line 38: | Line 38: | ||
_vm_page_speculative_count | _vm_page_speculative_count | ||
_vm_pool_low | _vm_pool_low | ||
− | + | ||
− | Comment: used to detect memory pressure well before jettison. | + | Comment: used to detect memory pressure well before jettison. |
− | Alternative: implement with optional hardcap limit, mach_vm_pressure_level_monitor and | + | Alternative: implement with optional hardcap limit, mach_vm_pressure_level_monitor and |
mach_vm_pressure_monitor. | mach_vm_pressure_monitor. | ||
− | Result: Hopefully can be made to run the same, without stutter. | + | Result: Hopefully can be made to run the same, without stutter. |
_VFS_ROOT | _VFS_ROOT | ||
_rootvnode | _rootvnode | ||
− | + | ||
− | Comment: Used with boot to know when root has been mounted. vfs_rootvnode() | + | Comment: Used with boot to know when root has been mounted. vfs_rootvnode() |
does not check for NULL and will just panic. | does not check for NULL and will just panic. | ||
− | Alternative: None, It would be better if vfs_rootvnode() would not panic. | + | Alternative: None, It would be better if vfs_rootvnode() would not panic. |
− | Result: No boot support. | + | Result: No boot support. |
_cache_purgevfs | _cache_purgevfs | ||
− | + | ||
− | Comment: Used to drop all cache entires for a mount, for example "zfs rollback". | + | Comment: Used to drop all cache entires for a mount, for example "zfs rollback". |
− | Alternative: Implemented with vnode_iterate(cache_purge_negatives() cache_purge()). Working. | + | Alternative: Implemented with vnode_iterate(cache_purge_negatives() cache_purge()). Working. |
− | Result: None. Happy to live without. | + | Result: None. Happy to live without. |
_vfs_context_kernel | _vfs_context_kernel | ||
− | Comment: Used at times when it is correct to use kernel context. Like hfs.kext does as well. | + | Comment: Used at times when it is correct to use kernel context. Like hfs.kext does as well. |
− | Alternative: None | + | Alternative: None |
− | Result: No idea, seems to run any way | + | Result: No idea, seems to run any way |
_vnode_lookupat | _vnode_lookupat | ||
− | Comment: Look up a "file" from a directory is useful. | + | |
− | Alternative: Implemented with vn_getpath() strcat("/file" and vnode_lookup(). | + | Comment: Look up a "file" from a directory is useful. |
− | Result: Some string work in kernel, not "that" expensive. Still, vnode_lookupat would be nice. | + | Alternative: Implemented with vn_getpath() strcat("/file" and vnode_lookup(). |
+ | Result: Some string work in kernel, not "that" expensive. Still, vnode_lookupat would be nice. | ||
_kvtophys | _kvtophys | ||
__mh_execute_header | __mh_execute_header | ||
_gLoadedKextSummaries | _gLoadedKextSummaries | ||
− | + | ||
− | Comment: Used only in debug/panic. To lookup symbols when dumping stack. | + | Comment: Used only in debug/panic. To lookup symbols when dumping stack. |
− | Alternatives: None, and even harder with arm64's PAC. Can live without. | + | Alternatives: None, and even harder with arm64's PAC. Can live without. |
− | Result: Stack dumps with addresses only, use lldb to resolve symbols. | + | Result: Stack dumps with addresses only, use lldb to resolve symbols. |
_kauth_cred_getgroups | _kauth_cred_getgroups | ||
− | + | ||
− | Comment: Getting a list of other groups, to check for permission. | + | Comment: Getting a list of other groups, to check for permission. |
− | Alternative: Get list of permissions, and compare with _kauth_cred_ismember_gid | + | Alternative: Get list of permissions, and compare with _kauth_cred_ismember_gid |
− | Result: No difference, just #ifdef in upstream | + | Result: No difference, just #ifdef in upstream |
_cpuid_info | _cpuid_info | ||
− | Comment: Get CPU features, sse, avx, aes etc. | + | |
− | Alternative: inline asm { cpuid }, and create own bit checks. | + | Comment: Get CPU features, sse, avx, aes etc. |
− | Result: None, just a shame to not be able to use XNU existing API. | + | Alternative: inline asm { cpuid }, and create own bit checks. |
+ | Result: None, just a shame to not be able to use XNU existing API. |
Revision as of 09:08, 13 April 2021
zfs.exports
We used to list functions from XNU's private.exports, and using a codeless kext let's us call them. With 2.0 re-port, we no longer use zfs.exports, but it would be nice to have some calls back.
_cpu_number Comment: Used to spread out lock contention, we use the lock at active-core-index Alternative: None, only using [0] Result: performance penalty
_fp_lookup _fp_drop _fp_drop_written _fo_read _fo_write Comment: "zfs send" and "zfs recv" will either do IO on a file (vnode) or pipe. There is no
way to do IO on a pipe in a kext without private.exports.
Alternative: userland will mknod /tmp/.pipe, spawn a relay helper, and open(/tmp/.pipe) which passes
a vnode to kernel. This works, but is complicated, both setting up pipes, and cleaning up. Especially with SIGINT involved. It would be nice to do pipe IO in kext.
Result: Complicated code, but already working. Pipes love to deadlock, so corner cases could exist.
_hostname Comment: uses hostname for diagnostic messages, history logs and multihost mounting (failover would
display which host stopped and which host took over.)
Alternative: None. Some work arounds could be done, like passing hostname from userland. Hashing hostid as string. Result: user confusion to which host was in use. (Until work around)
_virtual_space_start _virtual_space_end _vm_page_free_wanted _vm_page_free_count _vm_page_free_min _vm_page_speculative_count _vm_pool_low Comment: used to detect memory pressure well before jettison. Alternative: implement with optional hardcap limit, mach_vm_pressure_level_monitor and
mach_vm_pressure_monitor.
Result: Hopefully can be made to run the same, without stutter.
_VFS_ROOT _rootvnode Comment: Used with boot to know when root has been mounted. vfs_rootvnode()
does not check for NULL and will just panic.
Alternative: None, It would be better if vfs_rootvnode() would not panic. Result: No boot support.
_cache_purgevfs Comment: Used to drop all cache entires for a mount, for example "zfs rollback". Alternative: Implemented with vnode_iterate(cache_purge_negatives() cache_purge()). Working. Result: None. Happy to live without.
_vfs_context_kernel Comment: Used at times when it is correct to use kernel context. Like hfs.kext does as well. Alternative: None Result: No idea, seems to run any way
_vnode_lookupat Comment: Look up a "file" from a directory is useful. Alternative: Implemented with vn_getpath() strcat("/file" and vnode_lookup(). Result: Some string work in kernel, not "that" expensive. Still, vnode_lookupat would be nice.
_kvtophys __mh_execute_header _gLoadedKextSummaries Comment: Used only in debug/panic. To lookup symbols when dumping stack. Alternatives: None, and even harder with arm64's PAC. Can live without. Result: Stack dumps with addresses only, use lldb to resolve symbols.
_kauth_cred_getgroups Comment: Getting a list of other groups, to check for permission. Alternative: Get list of permissions, and compare with _kauth_cred_ismember_gid Result: No difference, just #ifdef in upstream
_cpuid_info Comment: Get CPU features, sse, avx, aes etc. Alternative: inline asm { cpuid }, and create own bit checks. Result: None, just a shame to not be able to use XNU existing API.