]> git.proxmox.com Git - mirror_zfs.git/blobdiff - include/libzutil.h
Expose libzutil error info in libpc_handle_t
[mirror_zfs.git] / include / libzutil.h
index 0b4075c160164ee213e1757a199c38965d0fda5f..617dd0cd17150231143848eddffdc6a69ba9aca1 100644 (file)
@@ -59,6 +59,15 @@ typedef const struct pool_config_ops {
 _LIBZUTIL_H pool_config_ops_t libzfs_config_ops;
 _LIBZUTIL_H pool_config_ops_t libzpool_config_ops;
 
+typedef enum lpc_error {
+       LPC_SUCCESS = 0,        /* no error -- success */
+       LPC_BADCACHE = 2000,    /* out of memory */
+       LPC_BADPATH,    /* must be an absolute path */
+       LPC_NOMEM,      /* out of memory */
+       LPC_EACCESS,    /* some devices require root privileges */
+       LPC_UNKNOWN
+} lpc_error_t;
+
 typedef struct importargs {
        char **path;            /* a list of paths to search            */
        int paths;              /* number of paths to search            */
@@ -70,10 +79,20 @@ typedef struct importargs {
        nvlist_t *policy;       /* load policy (max txg, rewind, etc.)  */
 } importargs_t;
 
-_LIBZUTIL_H nvlist_t *zpool_search_import(void *, importargs_t *,
-    pool_config_ops_t *);
-_LIBZUTIL_H int zpool_find_config(void *, const char *, nvlist_t **,
-    importargs_t *, pool_config_ops_t *);
+typedef struct libpc_handle {
+       int lpc_error;
+       boolean_t lpc_printerr;
+       boolean_t lpc_open_access_error;
+       boolean_t lpc_desc_active;
+       char lpc_desc[1024];
+       pool_config_ops_t *lpc_ops;
+       void *lpc_lib_handle;
+} libpc_handle_t;
+
+_LIBZUTIL_H const char *libpc_error_description(libpc_handle_t *);
+_LIBZUTIL_H nvlist_t *zpool_search_import(libpc_handle_t *, importargs_t *);
+_LIBZUTIL_H int zpool_find_config(libpc_handle_t *, const char *, nvlist_t **,
+    importargs_t *);
 
 _LIBZUTIL_H const char * const * zpool_default_search_paths(size_t *count);
 _LIBZUTIL_H int zpool_read_label(int, nvlist_t **, int *);