]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - bcache.h
bcacheadm: set disk-failed command
[bcachefs-tools-debian] / bcache.h
index 07e9733c743f1e2c87adc999949f78fe5f2b0e74..0133befd222fd52482d5e246223f2654d8f57b5b 100644 (file)
--- a/bcache.h
+++ b/bcache.h
@@ -22,7 +22,7 @@ typedef __s64 s64;
 
 #define SB_START               (SB_SECTOR * 512)
 #define MAX_PATH               256
-
+#define MAX_DEVS               MAX_CACHES_PER_SET
 
 #define max(x, y) ({                           \
        typeof(x) _max1 = (x);                  \
@@ -30,12 +30,6 @@ typedef __s64        s64;
        (void) (&_max1 == &_max2);              \
        _max1 > _max2 ? _max1 : _max2; })
 
-struct add_msg {
-       char *const *devs;
-       char *uuid;
-       int tier;
-};
-
 extern const char * const cache_state[];
 extern const char * const replacement_policies[];
 extern const char * const csum_types[];
@@ -63,16 +57,60 @@ long strtoul_or_die(const char *, size_t, const char *);
 void show_super_backingdev(struct cache_sb *, bool);
 void show_super_cache(struct cache_sb *, bool);
 
+enum sysfs_attr {SET_ATTR, CACHE_ATTR, INTERNAL_ATTR};
+
+static const char *set_attrs[] = {
+       "btree_flush_delay",
+       "btree_scan_ratelimit",
+       "bucket_reserve_percent",
+       "cache_reserve_percent",
+       "checksum_type",
+       "congested_read_threshold_us",
+       "congested_write_threshold_us",
+       "data_replicas",
+       "errors",
+       "foreground_target_percent",
+       "gc_sector_percent",
+       "journal_delay_ms",
+       "meta_replicas",
+       "sector_reserve_percent",
+       "tiering_percent",
+       NULL
+};
+
+static const char *cache_attrs[] = {
+       "cache_replacement_policy",
+       "discard",
+       "state",
+       "tier",
+       NULL
+};
+
+static const char *internal_attrs[] = {
+       "btree_shrinker_disabled",
+       "copy_gc_enabled",
+       "foreground_write_rate",
+       "tiering_enabled",
+       "tiering_rate",
+       NULL
+};
+
+enum sysfs_attr sysfs_attr_type(char *attr);
+void sysfs_attr_list();
+
 struct cache_sb *query_dev(char *, bool, bool, bool, char *dev_uuid);
 char *list_cachesets(char *, bool);
 char *parse_array_to_list(char *const *);
 char *register_bcache(char *const *);
 char *unregister_bcache(char *const *);
 char *probe(char *, int);
-char *read_stat_dir(DIR *, char *, char *, bool);
+char *read_stat_dir(DIR *, char *, char *, char *);
 char *find_matching_uuid(char *, char *, const char*);
 char *add_devices(char *const *, char *);
 char *remove_device(const char *, bool);
+char *bcache_get_capacity(const char *, const char *, bool);
+char *dev_name(const char *);
+char *device_set_failed(const char *dev_uuid, const char *set_uuid);
 
 #define csum_set(i, type)                                              \
 ({                                                                     \