summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mdadm.h8
-rw-r--r--mdmon.h8
-rw-r--r--sysfs.c5
3 files changed, 12 insertions, 9 deletions
diff --git a/mdadm.h b/mdadm.h
index 8b6baa6..7a39187 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -844,6 +844,14 @@ static inline int is_subarray(char *vers)
return (*vers == '/' || *vers == '-');
}
+#ifdef DEBUG
+#define dprintf(fmt, arg...) \
+ fprintf(stderr, fmt, ##arg)
+#else
+#define dprintf(fmt, arg...) \
+ ({ if (0) fprintf(stderr, fmt, ##arg); 0; })
+#endif
+
#define LEVEL_MULTIPATH (-4)
#define LEVEL_LINEAR (-1)
#define LEVEL_FAULTY (-5)
diff --git a/mdmon.h b/mdmon.h
index e5b2a72..62f34f7 100644
--- a/mdmon.h
+++ b/mdmon.h
@@ -1,11 +1,3 @@
-#ifdef DEBUG
-#define dprintf(fmt, arg...) \
- fprintf(stderr, fmt, ##arg)
-#else
-#define dprintf(fmt, arg...) \
- ({ if (0) fprintf(stderr, fmt, ##arg); 0; })
-#endif
-
enum array_state { clear, inactive, suspended, readonly, read_auto,
clean, active, write_pending, active_idle, bad_word};
diff --git a/sysfs.c b/sysfs.c
index 727e250..291a1dc 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -389,8 +389,11 @@ int sysfs_set_str(struct mdinfo *sra, struct mdinfo *dev,
return -1;
n = write(fd, val, strlen(val));
close(fd);
- if (n != strlen(val))
+ if (n != strlen(val)) {
+ dprintf(Name ": failed to write '%s' to '%s' (%s)\n",
+ val, fname, strerror(errno));
return -1;
+ }
return 0;
}