#define DEFAULT_BITMAP_DELAY 5
#define DEFAULT_MAX_WRITE_BEHIND 256
-/* VAR_RUN is where pid and socket files used for communicating
- * with mdmon normally live. It should be /var/run, but if
- * it is too hard to remount /var/run as read-only rather than
- * unmounting it at shutdown time, then it should be
- * redefined to some place that comfortably persists until
- * final shutdown, possibly in /dev if that is a tmpfs.
- * Note: VAR_RUN does not need to be writable at shutdown,
- * only during boot when "mdmon --takeover" is run.
- */
-#ifndef VAR_RUN
-#define VAR_RUN "/var/run/mdadm"
-#endif /* VAR_RUN */
-/* ALT_RUN should be somewhere that persists across the pivotroot
+/* MAP_DIR should be somewhere that persists across the pivotroot
* from early boot to late boot.
- * If you don't have /lib/init/rw you might want to use /dev/.something
+ * Currently /dev seems to be the only option on most distros.
+ */
+#ifndef MAP_DIR
+#define MAP_DIR "/dev/.mdadm"
+#endif /* MAP_DIR */
+/* MAP_FILE is what we name the map file we put in MAP_DIR, in case you
+ * want something other than the default of "map"
*/
-#ifndef ALT_RUN
-#define ALT_RUN "/lib/init/rw/mdadm"
-#endif /* ALT_RUN */
-#ifndef ALT_MAPFILE
-#define ALT_MAPFILE "map"
-#endif /* ALT_MAPFILE */
+#ifndef MAP_FILE
+#define MAP_FILE "map"
+#endif /* MAP_FILE */
+/* MDMON_DIR is where pid and socket files used for communicating
+ * with mdmon normally live. It *should* be /var/run, but when
+ * mdmon is needed at early boot then it needs to write there prior
+ * to /var/run being mounted read/write, and it also then needs to
+ * persist beyond when /var/run is mounter read-only. So, to be
+ * safe, the default is somewhere that is read/write early in the
+ * boot process and stays up as long as possible during shutdown.
+ */
+#ifndef MDMON_DIR
+#define MDMON_DIR "/dev/.mdadm/"
+#endif /* MDMON_DIR */
#include "md_u.h"
#include "md_p.h"
unsigned long safe_mode_delay; /* ms delay to mark clean */
int new_level, delta_disks, new_layout, new_chunk;
int errors;
- int cache_size; /* size of raid456 stripe cache*/
+ unsigned long cache_size; /* size of raid456 stripe cache*/
int mismatch_cnt;
char text_version[50];
void *update_private; /* for passing metadata-format
int uuid[4];
char name[33];
- unsigned int super_minor;
+ int super_minor;
char *devices; /* comma separated list of device
* names with wild cards
*/
int level;
- unsigned int raid_disks;
- unsigned int spare_disks;
+ int raid_disks;
+ int spare_disks;
struct supertype *st;
int autof; /* 1 for normal, 2 for partitioned */
char *spare_group;
int resync; /* 1 if resync, 0 if recovery */
int devcnt;
int raid_disks;
- int chunk_size;
char * metadata_version;
struct dev_member {
char *name;
* when hot-adding a spare.
*/
int (*add_to_super)(struct supertype *st, mdu_disk_info_t *dinfo,
- int fd, char *devname);
+ int fd, char *devname);
+ /* update the metadata to delete a device,
+ * when hot-removing.
+ */
+ int (*remove_from_super)(struct supertype *st, mdu_disk_info_t *dinfo);
/* Write metadata to one device when fixing problems or adding
* a new device.
extern unsigned long calc_csum(void *super, int bytes);
extern int enough(int level, int raid_disks, int layout, int clean,
char *avail, int avail_disks);
+extern int enough_fd(int fd);
extern int ask(char *mesg);
extern unsigned long long get_component_size(int fd);
extern void remove_partitions(int fd);
extern int open_subarray(char *dev, struct supertype *st, int quiet);
extern struct superswitch *version_to_superswitch(char *vers);
-extern char *pid_dir;
extern int mdmon_running(int devnum);
extern int mdmon_pid(int devnum);
extern int check_env(char *name);