#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
+extern const char Name[];
+
/* general information that might be extracted from a superblock */
struct mdinfo {
mdu_array_info_t array;
int mode;
int symlinks;
int names;
+ int bblist;
struct supertype *supertype;
};
-#define Name "mdadm"
-
enum mode {
ASSEMBLE=1,
BUILD,
Dump,
Restore,
Action,
+ Nodes,
};
enum prefix_standard {
char *backup_file;
int invalid_backup;
char *action;
+ int nodes;
};
struct shape {
void (*sync_metadata)(struct supertype *st);
void (*process_update)(struct supertype *st,
struct metadata_update *update);
- void (*prepare_update)(struct supertype *st,
+ /* Prepare updates allocates extra memory that might be
+ * needed. If the update cannot be understood, return 0.
+ */
+ int (*prepare_update)(struct supertype *st,
struct metadata_update *update);
/* activate_spare will check if the array is degraded and, if it
/* for external backup area */
int (*recover_backup)(struct supertype *st, struct mdinfo *info);
+ /* validate container after assemble */
+ int (*validate_container)(struct mdinfo *info);
+
int swapuuid; /* true if uuid is bigending rather than hostendian */
int external;
const char *name; /* canonical metadata name */
*/
int devcnt;
int retry_soon;
+ int nodes;
struct mdinfo *devs;
unsigned long long size);
extern int get_mdp_major(void);
+extern int get_maj_min(char *dev, int *major, int *minor);
extern int dev_open(char *dev, int flags);
extern int open_dev(char *devnm);
extern void reopen_mddev(int mdfd);
#ifdef DEBUG
#define dprintf(fmt, arg...) \
+ fprintf(stderr, "%s: %s: "fmt, Name, __func__, ##arg)
+#define dprintf_cont(fmt, arg...) \
fprintf(stderr, fmt, ##arg)
#else
#define dprintf(fmt, arg...) \
+ ({ if (0) fprintf(stderr, "%s: %s: " fmt, Name, __func__, ##arg); 0; })
+#define dprintf_cont(fmt, arg...) \
({ if (0) fprintf(stderr, fmt, ##arg); 0; })
#endif
#include <assert.h>
return ret;
}
-#define pr_err(fmt ...) fprintf(stderr, Name ": " fmt)
+#ifdef DEBUG
+#define pr_err(fmt, args...) fprintf(stderr, "%s: %s: "fmt, Name, __func__, ##args)
+#else
+#define pr_err(fmt, args...) fprintf(stderr, "%s: "fmt, Name, ##args)
+#endif
#define cont_err(fmt ...) fprintf(stderr, " " fmt)
void *xmalloc(size_t len);