summaryrefslogtreecommitdiffstats
path: root/mdadm.h
diff options
context:
space:
mode:
authorMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>2024-11-04 15:08:30 +0100
committerMariusz Tkaczyk <mtkaczyk@kernel.org>2024-12-16 10:11:31 +0100
commit42db5429cba52c7d86db965100873928e29c512b (patch)
treec009623d3d286b8a3596a8d5c554d77c604c8111 /mdadm.h
parentIncremental: Document workaround (diff)
downloadmdadm-42db5429cba52c7d86db965100873928e29c512b.tar.xz
mdadm-42db5429cba52c7d86db965100873928e29c512b.zip
sysfs: functions for writing md/<memb>/state
Add dedicated enum to reflect possible values for mentioned file. Not all values are mapped. Add map to present sysfs keywords. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Diffstat (limited to 'mdadm.h')
-rw-r--r--mdadm.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/mdadm.h b/mdadm.h
index ebb2ca18..218056c8 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -807,9 +807,28 @@ enum sysfs_read_flags {
#define SYSFS_MAX_BUF_SIZE 64
+/**
+ * Defines md/<disk>/state possible values.
+ * Note that remove can't be read-back from the file.
+ *
+ * This is not complete list.
+ */
+typedef enum memb_state {
+ MEMB_STATE_EXTERNAL_BBL,
+ MEMB_STATE_BLOCKED,
+ MEMB_STATE_SPARE,
+ MEMB_STATE_WRITE_MOSTLY,
+ MEMB_STATE_IN_SYNC,
+ MEMB_STATE_FAULTY,
+ MEMB_STATE_REMOVE,
+ MEMB_STATE_UNKNOWN
+} memb_state_t;
+char *map_memb_state(memb_state_t state);
+
extern mdadm_status_t sysfs_write_descriptor(const int fd, const char *value,
const ssize_t len, int *errno_p);
extern mdadm_status_t write_attr(const char *value, const int fd);
+extern mdadm_status_t sysfs_set_memb_state_fd(int fd, memb_state_t state, int *err);
extern void sysfs_get_container_devnm(struct mdinfo *mdi, char *buf);
extern int sysfs_open(char *devnm, char *devname, char *attr);