diff --git a/common.go b/common.go index 81a4e6d..f23aac7 100644 --- a/common.go +++ b/common.go @@ -144,7 +144,9 @@ const ( // Pool properties. Enumerates available ZFS pool properties. Use it to access // pool properties either to read or set soecific property. const ( - PoolPropName Prop = iota + PoolPropCont Prop = iota - 2 + PoolPropInval + PoolPropName PoolPropSize PoolPropCapacity PoolPropAltroot @@ -171,6 +173,8 @@ const ( PoolPropLeaked PoolPropMaxBlockSize PoolPropTName + PoolPropMaxNodeSize + PoolPropMultiHost PoolNumProps ) @@ -181,7 +185,9 @@ const ( * the property table in module/zcommon/zfs_prop.c. */ const ( - DatasetPropType Prop = iota + DatasetPropCont Prop = iota - 2 + DatasetPropBad + DatasetPropType DatasetPropCreation DatasetPropUsed DatasetPropAvailable @@ -207,7 +213,7 @@ const ( DatasetPropSnapdir DatasetPropPrivate /* not exposed to user, temporary */ DatasetPropAclinherit - DatasetPropCreatetxg /* not exposed to the user */ + DatasetPropCreateTXG /* not exposed to the user */ DatasetPropName /* not exposed to the user */ DatasetPropCanmount DatasetPropIscsioptions /* not exposed to the user */ @@ -240,12 +246,14 @@ const ( DatasetPropDedup DatasetPropMlslabel DatasetPropSync + DatasetPropDnodeSize DatasetPropRefratio DatasetPropWritten DatasetPropClones DatasetPropLogicalused DatasetPropLogicalreferenced DatasetPropInconsistent /* not exposed to the user */ + DatasetPropVolmode DatasetPropFilesystemLimit DatasetPropSnapshotLimit DatasetPropFilesystemCount @@ -259,6 +267,17 @@ const ( DatasetPropRelatime DatasetPropRedundantMetadata DatasetPropOverlay + DatasetPropPrevSnap + DatasetPropReceiveResumeToken + DatasetPropEncryption + DatasetPropKeyLocation + DatasetPropKeyFormat + DatasetPropPBKDF2Salt + DatasetPropPBKDF2Iters + DatasetPropEncryptionRoot + DatasetPropKeyGUID + DatasetPropKeyStatus + DatasetPropRemapTXG /* not exposed to the user */ DatasetNumProps ) diff --git a/sendrecv.go b/sendrecv.go index 89937de..bd118e1 100644 --- a/sendrecv.go +++ b/sendrecv.go @@ -261,7 +261,7 @@ func (d *Dataset) Receive(inf *os.File, flags RecvFlags) (err error) { defer C.free(unsafe.Pointer(cflags)) dest := C.CString(dpath) defer C.free(unsafe.Pointer(dest)) - ec := C.zfs_receive(C.libzfsHandle, dest, cflags, C.int(inf.Fd()), nil) + ec := C.zfs_receive(C.libzfsHandle, dest, nil, cflags, C.int(inf.Fd()), nil) if ec != 0 { err = fmt.Errorf("ZFS receive of %s failed. %s", C.GoString(dest), LastError().Error()) } diff --git a/zpool.c b/zpool.c index d592be4..e23f126 100644 --- a/zpool.c +++ b/zpool.c @@ -2,7 +2,11 @@ * using libzfs from go language, and make go code shorter and more readable. */ +typedef unsigned long int rlim64_t; + #include +#include + #include #include #include @@ -189,7 +193,7 @@ property_list_ptr read_zpool_property(zpool_list_ptr pool, int prop) { property_list_ptr list = new_property_list(); r = zpool_get_prop(pool->zph, prop, - list->value, INT_MAX_VALUE, &source); + list->value, INT_MAX_VALUE, &source, B_FALSE); if (r == 0) { // strcpy(list->name, zpool_prop_to_name(prop)); zprop_source_tostr(list->source, source); @@ -491,11 +495,15 @@ nvlist_ptr get_zpool_vdev_tree(nvlist_ptr nv) { nvlist_ptr go_zpool_search_import(libzfs_handle_ptr zfsh, int paths, char **path, boolean_t do_scan) { importargs_t idata = { 0 }; + nvlist_ptr pools = NULL; idata.path = path; idata.paths = paths; // idata.scan = 0; - return zpool_search_import(zfsh, &idata); + thread_init(); + pools = zpool_search_import(zfsh, &idata); + thread_fini(); + return pools; } diff --git a/zpool.go b/zpool.go index 6d00056..a7b3f30 100644 --- a/zpool.go +++ b/zpool.go @@ -1,5 +1,6 @@ package zfs +// #cgo CFLAGS: -D__USE_LARGEFILE64=1 // #include // #include // #include "common.h" @@ -361,7 +362,7 @@ func poolSearchImport(q string, searchpaths []string, guid bool) (name string, C.strings_setat(cpaths, C.int(i), csPath) } - pools := C.zpool_find_import(C.libzfsHandle, C.int(numofp), cpaths) + pools := C.go_zpool_search_import(C.libzfsHandle, C.int(numofp), cpaths, C.B_FALSE) defer C.nvlist_free(pools) elem = C.nvlist_next_nvpair(pools, elem) diff --git a/zpool_test.go b/zpool_test.go index 72e9aff..05dc12f 100644 --- a/zpool_test.go +++ b/zpool_test.go @@ -543,7 +543,7 @@ func TestPool_VDevTree(t *testing.T) { // TODO: Add test cases. { name: "test1", - fields: fields{"NETSTOR"}, + fields: fields{"TESTPOOL"}, wantErr: false, }, }