void osd_fini(void) { #ifdef HAVE_LDISKFS_OSD ldiskfs_fini(); #endif /* HAVE_LDISKFS_OSD */ #ifdef HAVE_ZFS_OSD zfs_fini(); #endif /* HAVE_ZFS_OSD */ }
int zfs_module_stop(__unused kmod_info_t *ki, __unused void *data) { if (zfs_active_fs_count != 0 || spa_busy() || zvol_busy() || vfs_fsremove(zfs_vfsconf) != 0) { return KERN_FAILURE; /* ZFS Still busy! */ } zfs_fini(); printf("zfs_module_stop: memory footprint %d (kalloc %d, kernel %d)\n", zfs_footprint.current, zfs_kallocmap_size, zfs_kernelmap_size); return KERN_SUCCESS; }
int zfs_init(void) { int ret = 0; /* If the ZFS libs are not installed, don't print an error to avoid * spamming ldiskfs users. An error message will still be printed if * someone tries to do some real work involving a ZFS backend */ handle_libzfs = dlopen("libzfs.so", RTLD_LAZY); if (handle_libzfs == NULL) return EINVAL; handle_nvpair = dlopen("libnvpair.so", RTLD_LAZY); if (handle_nvpair == NULL) { ret = EINVAL; goto out; } ret = zfs_populate_symbols(); if (ret) goto out; if (libzfs_load_module("zfs") != 0) { /* The ZFS modules are not installed */ ret = EINVAL; goto out; } g_zfs = libzfs_init(); if (g_zfs == NULL) { fprintf(stderr, "Failed to initialize ZFS library\n"); ret = EINVAL; } out: osd_zfs_setup = 1; if (ret) zfs_fini(); return ret; }