Print this page
4171 clean up spa_feature_*() interfaces
4172 implement extensible_dataset feature for use by other zpool features
Reviewed by: Max Grossman <max.grossman@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>

@@ -36,39 +36,42 @@
 extern "C" {
 #endif
 
 struct zfeature_info;
 
+typedef enum spa_feature {
+        SPA_FEATURE_NONE = -1,
+        SPA_FEATURE_ASYNC_DESTROY,
+        SPA_FEATURE_EMPTY_BPOBJ,
+        SPA_FEATURE_LZ4_COMPRESS,
+        SPA_FEATURE_MULTI_VDEV_CRASH_DUMP,
+        SPA_FEATURE_SPACEMAP_HISTOGRAM,
+        SPA_FEATURE_EXTENSIBLE_DATASET,
+        SPA_FEATURES
+} spa_feature_t;
+
 typedef struct zfeature_info {
+        spa_feature_t fi_feature;
         const char *fi_uname;   /* User-facing feature name */
         const char *fi_guid;    /* On-disk feature identifier */
         const char *fi_desc;    /* Feature description */
         boolean_t fi_can_readonly; /* Can open pool readonly w/o support? */
         boolean_t fi_mos;       /* Is the feature necessary to read the MOS? */
-        struct zfeature_info **fi_depends; /* array; null terminated */
+        /* array of dependencies, terminated by SPA_FEATURE_NONE */
+        const spa_feature_t *fi_depends;
 } zfeature_info_t;
 
 typedef int (zfeature_func_t)(zfeature_info_t *fi, void *arg);
 
 #define ZFS_FEATURE_DEBUG
 
-enum spa_feature {
-        SPA_FEATURE_ASYNC_DESTROY,
-        SPA_FEATURE_EMPTY_BPOBJ,
-        SPA_FEATURE_LZ4_COMPRESS,
-        SPA_FEATURE_MULTI_VDEV_CRASH_DUMP,
-        SPA_FEATURE_SPACEMAP_HISTOGRAM,
-        SPA_FEATURES
-} spa_feature_t;
-
 extern zfeature_info_t spa_feature_table[SPA_FEATURES];
 
 extern boolean_t zfeature_is_valid_guid(const char *);
 
 extern boolean_t zfeature_is_supported(const char *);
-extern int zfeature_lookup_guid(const char *, zfeature_info_t **res);
-extern int zfeature_lookup_name(const char *, zfeature_info_t **res);
+extern int zfeature_lookup_name(const char *name, spa_feature_t *res);
 
 extern void zpool_feature_init(void);
 
 #ifdef  __cplusplus
 }