summaryrefslogtreecommitdiff
path: root/mdadm.h
diff options
context:
space:
mode:
Diffstat (limited to 'mdadm.h')
-rw-r--r--mdadm.h63
1 files changed, 44 insertions, 19 deletions
diff --git a/mdadm.h b/mdadm.h
index 91d27139..fc1fd318 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -129,12 +129,12 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
#if !defined(__KLIBC__)
#if BYTE_ORDER == LITTLE_ENDIAN
-#define __cpu_to_le16(_x) (_x)
-#define __cpu_to_le32(_x) (_x)
-#define __cpu_to_le64(_x) (_x)
-#define __le16_to_cpu(_x) (_x)
-#define __le32_to_cpu(_x) (_x)
-#define __le64_to_cpu(_x) (_x)
+#define __cpu_to_le16(_x) (unsigned int)(_x)
+#define __cpu_to_le32(_x) (unsigned int)(_x)
+#define __cpu_to_le64(_x) (unsigned long long)(_x)
+#define __le16_to_cpu(_x) (unsigned int)(_x)
+#define __le32_to_cpu(_x) (unsigned int)(_x)
+#define __le64_to_cpu(_x) (unsigned long long)(_x)
#define __cpu_to_be16(_x) bswap_16(_x)
#define __cpu_to_be32(_x) bswap_32(_x)
@@ -150,12 +150,12 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
#define __le32_to_cpu(_x) bswap_32(_x)
#define __le64_to_cpu(_x) bswap_64(_x)
-#define __cpu_to_be16(_x) (_x)
-#define __cpu_to_be32(_x) (_x)
-#define __cpu_to_be64(_x) (_x)
-#define __be16_to_cpu(_x) (_x)
-#define __be32_to_cpu(_x) (_x)
-#define __be64_to_cpu(_x) (_x)
+#define __cpu_to_be16(_x) (unsigned int)(_x)
+#define __cpu_to_be32(_x) (unsigned int)(_x)
+#define __cpu_to_be64(_x) (unsigned long long)(_x)
+#define __be16_to_cpu(_x) (unsigned int)(_x)
+#define __be32_to_cpu(_x) (unsigned int)(_x)
+#define __be64_to_cpu(_x) (unsigned long long)(_x)
#else
# error "unknown endianness."
#endif
@@ -178,6 +178,8 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
(void) (&_max1 == &_max2); \
_max1 > _max2 ? _max1 : _max2; })
+#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
+
/* general information that might be extracted from a superblock */
struct mdinfo {
mdu_array_info_t array;
@@ -256,6 +258,7 @@ struct createinfo {
int mode;
int symlinks;
int names;
+ int bblist;
struct supertype *supertype;
};
@@ -309,6 +312,7 @@ enum special_options {
Brief,
ManageOpt,
Add,
+ AddSpare,
Remove,
Fail,
Replace,
@@ -339,6 +343,7 @@ enum special_options {
ExamineBB,
Dump,
Restore,
+ Action,
};
enum prefix_standard {
@@ -412,6 +417,7 @@ struct context {
int freeze_reshape;
char *backup_file;
int invalid_backup;
+ char *action;
};
struct shape {
@@ -582,9 +588,12 @@ extern int reshape_open_backup_file(char *backup,
long blocks,
int *fdlist,
unsigned long long *offsets,
+ char *sysfs_name,
int restart);
extern unsigned long compute_backup_blocks(int nchunk, int ochunk,
unsigned int ndata, unsigned int odata);
+extern char *locate_backup(char *name);
+extern char *make_backup(char *name);
extern int save_stripes(int *source, unsigned long long *offsets,
int raid_disks, int chunk_size, int level, int layout,
@@ -921,7 +930,10 @@ extern struct superswitch {
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
@@ -952,6 +964,9 @@ extern struct superswitch {
/* 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 */
@@ -1169,7 +1184,7 @@ struct stat64;
extern int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s);
extern int Manage_ro(char *devname, int fd, int readonly);
-extern int Manage_run(char *devname, int fd, int quiet);
+extern int Manage_run(char *devname, int fd, struct context *c);
extern int Manage_stop(char *devname, int fd, int quiet,
int will_retry);
extern int Manage_subdevs(char *devname, int fd,
@@ -1187,13 +1202,13 @@ extern int Grow_restart(struct supertype *st, struct mdinfo *info,
int *fdlist, int cnt, char *backup_file, int verbose);
extern int Grow_continue(int mdfd, struct supertype *st,
struct mdinfo *info, char *backup_file,
- int freeze_reshape);
+ int forked, int freeze_reshape);
extern int restore_backup(struct supertype *st,
struct mdinfo *content,
int working_disks,
int spares,
- char *backup_file,
+ char **backup_filep,
int verbose);
extern int Grow_continue_command(char *devname, int fd,
char *backup_file, int verbose);
@@ -1231,11 +1246,12 @@ extern int Kill_subarray(char *dev, char *subarray, int verbose);
extern int Update_subarray(char *dev, char *subarray, char *update, struct mddev_ident *ident, int quiet);
extern int Wait(char *dev);
extern int WaitClean(char *dev, int sock, int verbose);
+extern int SetAction(char *dev, char *action);
-extern int Incremental(char *devname, struct context *c,
+extern int Incremental(struct mddev_dev *devlist, struct context *c,
struct supertype *st);
extern void RebuildMap(void);
-extern int IncrementalScan(int verbose, char *devnm);
+extern int IncrementalScan(struct context *c, char *devnm);
extern int IncrementalRemove(char *devname, char *path, int verbose);
extern int CreateBitmap(char *filename, int force, char uuid[16],
unsigned long chunksize, unsigned long daemon_sleep,
@@ -1267,8 +1283,10 @@ extern int check_partitions(int fd, char *dname,
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);
extern int open_dev_flags(char *devnm, int flags);
extern int open_dev_excl(char *devnm);
extern int is_standard(char *dev, int *nump);
@@ -1328,7 +1346,11 @@ extern void append_metadata_update(struct supertype *st, void *buf, int len);
extern int assemble_container_content(struct supertype *st, int mdfd,
struct mdinfo *content,
struct context *c,
- char *chosen_name);
+ char *chosen_name, int *result);
+#define INCR_NO 1
+#define INCR_UNSAFE 2
+#define INCR_ALREADY 4
+#define INCR_YES 8
extern struct mdinfo *container_choose_spares(struct supertype *st,
unsigned long long min_size,
struct domainlist *domlist,
@@ -1451,6 +1473,9 @@ char *xstrdup(const char *str);
#define LEVEL_CONTAINER (-100)
#define LEVEL_UNSUPPORTED (-200)
+/* the kernel does know about this one ... */
+#define LEVEL_NONE (-1000000)
+
/* faulty stuff */
#define WriteTransient 0