/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#ifndef _LIBZFS_H
/*
* Default device paths
*/
+#define DISK_ROOT "/dev"
+#define UDISK_ROOT "/dev/disk"
-#if defined(__sun__) || defined(__sun)
-#define DISK_ROOT "/dev/dsk"
-#define RDISK_ROOT "/dev/rdsk"
-#define UDISK_ROOT RDISK_ROOT
-#define FIRST_SLICE "s0"
-#define BACKUP_SLICE "s2"
-#endif
-
-#ifdef __linux__
-#define DISK_ROOT "/dev"
-#define RDISK_ROOT DISK_ROOT
-#define UDISK_ROOT "/dev/disk"
-#define FIRST_SLICE "1"
-#define BACKUP_SLICE ""
-#endif
+#define DEFAULT_IMPORT_PATH_SIZE 7
+extern char *zpool_default_import_path[DEFAULT_IMPORT_PATH_SIZE];
/*
* libzfs errors
extern int zpool_scan(zpool_handle_t *, pool_scan_func_t);
extern int zpool_clear(zpool_handle_t *, const char *, nvlist_t *);
extern int zpool_reguid(zpool_handle_t *);
+extern int zpool_reopen(zpool_handle_t *);
extern int zpool_vdev_online(zpool_handle_t *, const char *, int,
vdev_state_t *);
ZPOOL_STATUS_BAD_LOG, /* cannot read log chain(s) */
/*
+ * If the pool has unsupported features but can still be opened in
+ * read-only mode, its status is ZPOOL_STATUS_UNSUP_FEAT_WRITE. If the
+ * pool has unsupported features but cannot be opened at all, its
+ * status is ZPOOL_STATUS_UNSUP_FEAT_READ.
+ */
+ ZPOOL_STATUS_UNSUP_FEAT_READ, /* unsupported features for read */
+ ZPOOL_STATUS_UNSUP_FEAT_WRITE, /* unsupported features for write */
+
+ /*
* These faults have no corresponding message ID. At the time we are
* checking the status, the original reason for the FMA fault (I/O or
* checksum errors) has been lost.
* requiring administrative attention. There is no corresponding
* message ID.
*/
- ZPOOL_STATUS_VERSION_OLDER, /* older on-disk version */
+ ZPOOL_STATUS_VERSION_OLDER, /* older legacy on-disk version */
+ ZPOOL_STATUS_FEAT_DISABLED, /* supported features are disabled */
ZPOOL_STATUS_RESILVERING, /* device being resilvered */
ZPOOL_STATUS_OFFLINE_DEV, /* device online */
ZPOOL_STATUS_REMOVED_DEV, /* removed device */
* Statistics and configuration functions.
*/
extern nvlist_t *zpool_get_config(zpool_handle_t *, nvlist_t **);
+extern nvlist_t *zpool_get_features(zpool_handle_t *);
extern int zpool_refresh_stats(zpool_handle_t *, boolean_t *);
extern int zpool_get_errlog(zpool_handle_t *, nvlist_t **);
char *altroot);
extern int zpool_import_props(libzfs_handle_t *, nvlist_t *, const char *,
nvlist_t *, int);
+extern void zpool_print_unsup_feat(nvlist_t *config);
/*
* Search for pools to import
uint64_t *propvalue);
extern int zfs_prop_get_written(zfs_handle_t *zhp, const char *propname,
char *propbuf, int proplen, boolean_t literal);
+extern int zfs_prop_get_feature(zfs_handle_t *zhp, const char *propname,
+ char *buf, size_t len);
extern int zfs_get_snapused_int(zfs_handle_t *firstsnap, zfs_handle_t *lastsnap,
uint64_t *usedp);
extern uint64_t getprop_uint64(zfs_handle_t *, zfs_prop_t, char **);
#define ZFS_MOUNTPOINT_NONE "none"
#define ZFS_MOUNTPOINT_LEGACY "legacy"
+#define ZFS_FEATURE_DISABLED "disabled"
+#define ZFS_FEATURE_ENABLED "enabled"
+#define ZFS_FEATURE_ACTIVE "active"
+
+#define ZFS_UNSUPPORTED_INACTIVE "inactive"
+#define ZFS_UNSUPPORTED_READONLY "readonly"
+
/*
* zpool property management
*/
extern int zpool_expand_proplist(zpool_handle_t *, zprop_list_t **);
+extern int zpool_prop_get_feature(zpool_handle_t *, const char *, char *,
+ size_t);
extern const char *zpool_prop_default_string(zpool_prop_t);
extern uint64_t zpool_prop_default_numeric(zpool_prop_t);
extern const char *zpool_prop_column_name(zpool_prop_t);
extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *);
extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t, nvlist_t *);
extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t);
-extern int zfs_rename(zfs_handle_t *, const char *, boolean_t);
+extern int zfs_rename(zfs_handle_t *, const char *, boolean_t, boolean_t);
typedef struct sendflags {
/* print informational messages (ie, -v was specified) */
/* parsable verbose output (ie. -P) */
boolean_t parsable;
+
+ /* show progress (ie. -v) */
+ boolean_t progress;
} sendflags_t;
typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *);
extern boolean_t zfs_dataset_exists(libzfs_handle_t *, const char *,
zfs_type_t);
extern int zfs_spa_version(zfs_handle_t *, int *);
-extern void zfs_append_partition(const char *path, char *buf, size_t buflen);
+extern int zfs_append_partition(char *path, size_t max_len);
extern int zfs_resolve_shortname(const char *name, char *path, size_t pathlen);
+extern int zfs_strcmp_pathname(char *name, char *cmp_name, int wholedisk);
/*
* Mount support functions.