aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorMatthew Macy <[email protected]>2019-11-21 09:32:57 -0800
committerBrian Behlendorf <[email protected]>2019-11-21 09:32:57 -0800
commitda92d5cbb38cea3a860b8a6bb8ee21f9129e7d7c (patch)
treecc2d84b481a30b43d4097603e79a55a1975b0b64 /cmd
parent67a6c3bc9ff401fa04bc41354c5172b51aaed1c9 (diff)
Add zfs_file_* interface, remove vnodes
Provide a common zfs_file_* interface which can be implemented on all platforms to perform normal file access from either the kernel module or the libzpool library. This allows all non-portable vnode_t usage in the common code to be replaced by the new portable zfs_file_t. The associated vnode and kobj compatibility functions, types, and macros have been removed from the SPL. Moving forward, vnodes should only be used in platform specific code when provided by the native operating system. Reviewed-by: Sean Eric Fagan <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Igor Kozhukhov <[email protected]> Reviewed-by: Jorgen Lundman <[email protected]> Signed-off-by: Matt Macy <[email protected]> Closes #9556
Diffstat (limited to 'cmd')
-rw-r--r--cmd/raidz_test/raidz_test.c2
-rw-r--r--cmd/zdb/zdb.c2
-rw-r--r--cmd/zhack/zhack.c3
-rw-r--r--cmd/ztest/ztest.c14
4 files changed, 11 insertions, 10 deletions
diff --git a/cmd/raidz_test/raidz_test.c b/cmd/raidz_test/raidz_test.c
index a05070399..66f36b0d5 100644
--- a/cmd/raidz_test/raidz_test.c
+++ b/cmd/raidz_test/raidz_test.c
@@ -757,7 +757,7 @@ main(int argc, char **argv)
process_options(argc, argv);
- kernel_init(FREAD);
+ kernel_init(SPA_MODE_READ);
/* setup random data because rand() is not reentrant */
rand_data = (int *)umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL);
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
index 7c3ef3ef4..81c9eaf8c 100644
--- a/cmd/zdb/zdb.c
+++ b/cmd/zdb/zdb.c
@@ -6781,7 +6781,7 @@ main(int argc, char **argv)
*/
spa_load_verify_dryrun = B_TRUE;
- kernel_init(FREAD);
+ kernel_init(SPA_MODE_READ);
if (dump_all)
verbose = MAX(verbose, 1);
diff --git a/cmd/zhack/zhack.c b/cmd/zhack/zhack.c
index 57e497f62..bb974133d 100644
--- a/cmd/zhack/zhack.c
+++ b/cmd/zhack/zhack.c
@@ -126,7 +126,8 @@ zhack_import(char *target, boolean_t readonly)
nvlist_t *props;
int error;
- kernel_init(readonly ? FREAD : (FREAD | FWRITE));
+ kernel_init(readonly ? SPA_MODE_READ :
+ (SPA_MODE_READ | SPA_MODE_WRITE));
dmu_objset_register_type(DMU_OST_ZFS, space_delta_cb);
diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
index b886f1e99..dbc5084d0 100644
--- a/cmd/ztest/ztest.c
+++ b/cmd/ztest/ztest.c
@@ -5826,8 +5826,8 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
(long long)vd0->vdev_id, (int)maxfaults);
if (vf != NULL && ztest_random(3) == 0) {
- (void) close(vf->vf_vnode->v_fd);
- vf->vf_vnode->v_fd = -1;
+ (void) close(vf->vf_file->f_fd);
+ vf->vf_file->f_fd = -1;
} else if (ztest_random(2) == 0) {
vd0->vdev_cant_read = B_TRUE;
} else {
@@ -6933,7 +6933,7 @@ ztest_run(ztest_shared_t *zs)
/*
* Open our pool.
*/
- kernel_init(FREAD | FWRITE);
+ kernel_init(SPA_MODE_READ | SPA_MODE_WRITE);
VERIFY0(spa_open(ztest_opts.zo_pool, &spa, FTAG));
metaslab_preload_limit = ztest_random(20) + 1;
ztest_spa = spa;
@@ -7122,7 +7122,7 @@ ztest_freeze(void)
if (ztest_opts.zo_verbose >= 3)
(void) printf("testing spa_freeze()...\n");
- kernel_init(FREAD | FWRITE);
+ kernel_init(SPA_MODE_READ | SPA_MODE_WRITE);
VERIFY3U(0, ==, spa_open(ztest_opts.zo_pool, &spa, FTAG));
VERIFY3U(0, ==, ztest_dataset_open(0));
ztest_spa = spa;
@@ -7189,7 +7189,7 @@ ztest_freeze(void)
/*
* Open and close the pool and dataset to induce log replay.
*/
- kernel_init(FREAD | FWRITE);
+ kernel_init(SPA_MODE_READ | SPA_MODE_WRITE);
VERIFY3U(0, ==, spa_open(ztest_opts.zo_pool, &spa, FTAG));
ASSERT(spa_freeze_txg(spa) == UINT64_MAX);
VERIFY3U(0, ==, ztest_dataset_open(0));
@@ -7262,7 +7262,7 @@ ztest_import(ztest_shared_t *zs)
mutex_init(&ztest_checkpoint_lock, NULL, MUTEX_DEFAULT, NULL);
VERIFY0(pthread_rwlock_init(&ztest_name_lock, NULL));
- kernel_init(FREAD | FWRITE);
+ kernel_init(SPA_MODE_READ | SPA_MODE_WRITE);
searchdirs[0] = ztest_opts.zo_dir;
args.paths = nsearch;
@@ -7308,7 +7308,7 @@ ztest_init(ztest_shared_t *zs)
mutex_init(&ztest_checkpoint_lock, NULL, MUTEX_DEFAULT, NULL);
VERIFY0(pthread_rwlock_init(&ztest_name_lock, NULL));
- kernel_init(FREAD | FWRITE);
+ kernel_init(SPA_MODE_READ | SPA_MODE_WRITE);
/*
* Create the storage pool.