mdadm.h (mdadm-4.1) | : | mdadm.h (mdadm-4.2) | ||
---|---|---|---|---|
skipping to change at line 48 | skipping to change at line 48 | |||
#include <stdint.h> | #include <stdint.h> | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#include <time.h> | #include <time.h> | |||
#include <sys/time.h> | #include <sys/time.h> | |||
#include <getopt.h> | #include <getopt.h> | |||
#include <fcntl.h> | #include <fcntl.h> | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <errno.h> | #include <errno.h> | |||
#include <string.h> | #include <string.h> | |||
#include <syslog.h> | #include <syslog.h> | |||
#ifdef __GLIBC__ | #include <stdbool.h> | |||
/* Newer glibc requires sys/sysmacros.h directly for makedev() */ | /* Newer glibc requires sys/sysmacros.h directly for makedev() */ | |||
#include <sys/sysmacros.h> | #include <sys/sysmacros.h> | |||
#endif | ||||
#ifdef __dietlibc__ | #ifdef __dietlibc__ | |||
#include <strings.h> | #include <strings.h> | |||
/* dietlibc has deprecated random and srandom!! */ | /* dietlibc has deprecated random and srandom!! */ | |||
#define random rand | #define random rand | |||
#define srandom srand | #define srandom srand | |||
#endif | #endif | |||
#ifdef NO_COROSYNC | #ifdef NO_COROSYNC | |||
#define CS_OK 1 | #define CS_OK 1 | |||
typedef uint64_t cmap_handle_t; | typedef uint64_t cmap_handle_t; | |||
skipping to change at line 134 | skipping to change at line 133 | |||
#endif /* MDMON_DIR */ | #endif /* MDMON_DIR */ | |||
/* FAILED_SLOTS is where to save files storing recent removal of array | /* FAILED_SLOTS is where to save files storing recent removal of array | |||
* member in order to allow future reuse of disk inserted in the same | * member in order to allow future reuse of disk inserted in the same | |||
* slot for array recovery | * slot for array recovery | |||
*/ | */ | |||
#ifndef FAILED_SLOTS_DIR | #ifndef FAILED_SLOTS_DIR | |||
#define FAILED_SLOTS_DIR "/run/mdadm/failed-slots" | #define FAILED_SLOTS_DIR "/run/mdadm/failed-slots" | |||
#endif /* FAILED_SLOTS */ | #endif /* FAILED_SLOTS */ | |||
#ifndef MDMON_SERVICE | ||||
#define MDMON_SERVICE "mdmon" | ||||
#endif /* MDMON_SERVICE */ | ||||
#ifndef GROW_SERVICE | ||||
#define GROW_SERVICE "mdadm-grow-continue" | ||||
#endif /* GROW_SERVICE */ | ||||
#include "md_u.h" | #include "md_u.h" | |||
#include "md_p.h" | #include "md_p.h" | |||
#include "bitmap.h" | #include "bitmap.h" | |||
#include "msg.h" | #include "msg.h" | |||
#include <endian.h> | #include <endian.h> | |||
/* Redhat don't like to #include <asm/byteorder.h>, and | /* Redhat don't like to #include <asm/byteorder.h>, and | |||
* some time include <linux/byteorder/xxx_endian.h> isn't enough, | * some time include <linux/byteorder/xxx_endian.h> isn't enough, | |||
* and there is no standard conversion function so... */ | * and there is no standard conversion function so... */ | |||
/* And dietlibc doesn't think byteswap is ok, so.. */ | /* And dietlibc doesn't think byteswap is ok, so.. */ | |||
skipping to change at line 195 | skipping to change at line 202 | |||
#define __cpu_to_be64(_x) (unsigned long long)(_x) | #define __cpu_to_be64(_x) (unsigned long long)(_x) | |||
#define __be16_to_cpu(_x) (unsigned int)(_x) | #define __be16_to_cpu(_x) (unsigned int)(_x) | |||
#define __be32_to_cpu(_x) (unsigned int)(_x) | #define __be32_to_cpu(_x) (unsigned int)(_x) | |||
#define __be64_to_cpu(_x) (unsigned long long)(_x) | #define __be64_to_cpu(_x) (unsigned long long)(_x) | |||
#else | #else | |||
# error "unknown endianness." | # error "unknown endianness." | |||
#endif | #endif | |||
#endif /* __KLIBC__ */ | #endif /* __KLIBC__ */ | |||
/* | /* | |||
* Partially stolen from include/linux/unaligned/packed_struct.h | ||||
*/ | ||||
struct __una_u16 { __u16 x; } __attribute__ ((packed)); | ||||
struct __una_u32 { __u32 x; } __attribute__ ((packed)); | ||||
static inline __u16 __get_unaligned16(const void *p) | ||||
{ | ||||
const struct __una_u16 *ptr = (const struct __una_u16 *)p; | ||||
return ptr->x; | ||||
} | ||||
static inline __u32 __get_unaligned32(const void *p) | ||||
{ | ||||
const struct __una_u32 *ptr = (const struct __una_u32 *)p; | ||||
return ptr->x; | ||||
} | ||||
static inline void __put_unaligned16(__u16 val, void *p) | ||||
{ | ||||
struct __una_u16 *ptr = (struct __una_u16 *)p; | ||||
ptr->x = val; | ||||
} | ||||
static inline void __put_unaligned32(__u32 val, void *p) | ||||
{ | ||||
struct __una_u32 *ptr = (struct __una_u32 *)p; | ||||
ptr->x = val; | ||||
} | ||||
/* | ||||
* Check at compile time that something is of a particular type. | * Check at compile time that something is of a particular type. | |||
* Always evaluates to 1 so you may use it easily in comparisons. | * Always evaluates to 1 so you may use it easily in comparisons. | |||
*/ | */ | |||
#define typecheck(type,x) \ | #define typecheck(type,x) \ | |||
({ type __dummy; \ | ({ type __dummy; \ | |||
typeof(x) __dummy2; \ | typeof(x) __dummy2; \ | |||
(void)(&__dummy == &__dummy2); \ | (void)(&__dummy == &__dummy2); \ | |||
1; \ | 1; \ | |||
}) | }) | |||
skipping to change at line 348 | skipping to change at line 385 | |||
enum { | enum { | |||
ARRAY_CLEAR, | ARRAY_CLEAR, | |||
ARRAY_INACTIVE, | ARRAY_INACTIVE, | |||
ARRAY_SUSPENDED, | ARRAY_SUSPENDED, | |||
ARRAY_READONLY, | ARRAY_READONLY, | |||
ARRAY_READ_AUTO, | ARRAY_READ_AUTO, | |||
ARRAY_CLEAN, | ARRAY_CLEAN, | |||
ARRAY_ACTIVE, | ARRAY_ACTIVE, | |||
ARRAY_WRITE_PENDING, | ARRAY_WRITE_PENDING, | |||
ARRAY_ACTIVE_IDLE, | ARRAY_ACTIVE_IDLE, | |||
ARRAY_BROKEN, | ||||
ARRAY_UNKNOWN_STATE, | ARRAY_UNKNOWN_STATE, | |||
} array_state; | } array_state; | |||
struct md_bb bb; | struct md_bb bb; | |||
}; | }; | |||
struct createinfo { | struct createinfo { | |||
int uid; | int uid; | |||
int gid; | int gid; | |||
int autof; | int autof; | |||
int mode; | int mode; | |||
skipping to change at line 415 | skipping to change at line 453 | |||
Symlinks, | Symlinks, | |||
AutoDetect, | AutoDetect, | |||
Waitclean, | Waitclean, | |||
DetailPlatform, | DetailPlatform, | |||
KillSubarray, | KillSubarray, | |||
UpdateSubarray, | UpdateSubarray, | |||
IncrementalPath, | IncrementalPath, | |||
NoSharing, | NoSharing, | |||
HelpOptions, | HelpOptions, | |||
Brief, | Brief, | |||
NoDevices, | ||||
ManageOpt, | ManageOpt, | |||
Add, | Add, | |||
AddSpare, | AddSpare, | |||
AddJournal, | AddJournal, | |||
Remove, | Remove, | |||
Fail, | Fail, | |||
Replace, | Replace, | |||
With, | With, | |||
MiscOpt, | MiscOpt, | |||
WaitOpt, | WaitOpt, | |||
skipping to change at line 525 | skipping to change at line 564 | |||
/* fields needed by different users of this structure */ | /* fields needed by different users of this structure */ | |||
int assembled; /* set when assembly succeeds */ | int assembled; /* set when assembly succeeds */ | |||
}; | }; | |||
}; | }; | |||
struct context { | struct context { | |||
int readonly; | int readonly; | |||
int runstop; | int runstop; | |||
int verbose; | int verbose; | |||
int brief; | int brief; | |||
int no_devices; | ||||
int force; | int force; | |||
char *homehost; | char *homehost; | |||
int require_homehost; | int require_homehost; | |||
char *prefer; | char *prefer; | |||
int export; | int export; | |||
int test; | int test; | |||
char *subarray; | char *subarray; | |||
char *update; | char *update; | |||
int scan; | int scan; | |||
int SparcAdjust; | int SparcAdjust; | |||
skipping to change at line 600 | skipping to change at line 640 | |||
struct dev_member { | struct dev_member { | |||
char *name; | char *name; | |||
struct dev_member *next; | struct dev_member *next; | |||
} *members; | } *members; | |||
struct mdstat_ent *next; | struct mdstat_ent *next; | |||
}; | }; | |||
extern struct mdstat_ent *mdstat_read(int hold, int start); | extern struct mdstat_ent *mdstat_read(int hold, int start); | |||
extern void mdstat_close(void); | extern void mdstat_close(void); | |||
extern void free_mdstat(struct mdstat_ent *ms); | extern void free_mdstat(struct mdstat_ent *ms); | |||
extern void mdstat_wait(int seconds); | extern int mdstat_wait(int seconds); | |||
extern void mdstat_wait_fd(int fd, const sigset_t *sigmask); | extern void mdstat_wait_fd(int fd, const sigset_t *sigmask); | |||
extern int mddev_busy(char *devnm); | extern int mddev_busy(char *devnm); | |||
extern struct mdstat_ent *mdstat_by_component(char *name); | extern struct mdstat_ent *mdstat_by_component(char *name); | |||
extern struct mdstat_ent *mdstat_by_subdev(char *subdev, char *container); | extern struct mdstat_ent *mdstat_by_subdev(char *subdev, char *container); | |||
struct map_ent { | struct map_ent { | |||
struct map_ent *next; | struct map_ent *next; | |||
char devnm[32]; | char devnm[32]; | |||
char metadata[20]; | char metadata[20]; | |||
int uuid[4]; | int uuid[4]; | |||
skipping to change at line 650 | skipping to change at line 690 | |||
GET_SAFEMODE = (1 << 9), | GET_SAFEMODE = (1 << 9), | |||
GET_BITMAP_LOCATION = (1 << 10), | GET_BITMAP_LOCATION = (1 << 10), | |||
GET_DEVS = (1 << 20), /* gets role, major, minor */ | GET_DEVS = (1 << 20), /* gets role, major, minor */ | |||
GET_OFFSET = (1 << 21), | GET_OFFSET = (1 << 21), | |||
GET_SIZE = (1 << 22), | GET_SIZE = (1 << 22), | |||
GET_STATE = (1 << 23), | GET_STATE = (1 << 23), | |||
GET_ERROR = (1 << 24), | GET_ERROR = (1 << 24), | |||
GET_ARRAY_STATE = (1 << 25), | GET_ARRAY_STATE = (1 << 25), | |||
GET_CONSISTENCY_POLICY = (1 << 26), | GET_CONSISTENCY_POLICY = (1 << 26), | |||
GET_DEVS_ALL = (1 << 27), | ||||
}; | }; | |||
/* If fd >= 0, get the array it is open on, | /* If fd >= 0, get the array it is open on, | |||
* else use devnm. | * else use devnm. | |||
*/ | */ | |||
extern int sysfs_open(char *devnm, char *devname, char *attr); | extern int sysfs_open(char *devnm, char *devname, char *attr); | |||
extern int sysfs_init(struct mdinfo *mdi, int fd, char *devnm); | extern int sysfs_init(struct mdinfo *mdi, int fd, char *devnm); | |||
extern void sysfs_init_dev(struct mdinfo *mdi, dev_t devid); | extern void sysfs_init_dev(struct mdinfo *mdi, dev_t devid); | |||
extern void sysfs_free(struct mdinfo *sra); | extern void sysfs_free(struct mdinfo *sra); | |||
extern struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options); | extern struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options); | |||
skipping to change at line 734 | skipping to change at line 775 | |||
char *src_buf); | char *src_buf); | |||
#ifndef Sendmail | #ifndef Sendmail | |||
#define Sendmail "/usr/lib/sendmail -t" | #define Sendmail "/usr/lib/sendmail -t" | |||
#endif | #endif | |||
#define SYSLOG_FACILITY LOG_DAEMON | #define SYSLOG_FACILITY LOG_DAEMON | |||
extern char *map_num(mapping_t *map, int num); | extern char *map_num(mapping_t *map, int num); | |||
extern int map_name(mapping_t *map, char *name); | extern int map_name(mapping_t *map, char *name); | |||
extern mapping_t r5layout[], r6layout[], pers[], modes[], faultylayout[]; | extern mapping_t r0layout[], r5layout[], r6layout[], | |||
pers[], modes[], faultylayout[]; | ||||
extern mapping_t consistency_policies[], sysfs_array_states[]; | extern mapping_t consistency_policies[], sysfs_array_states[]; | |||
extern char *map_dev_preferred(int major, int minor, int create, | extern char *map_dev_preferred(int major, int minor, int create, | |||
char *prefer); | char *prefer); | |||
static inline char *map_dev(int major, int minor, int create) | static inline char *map_dev(int major, int minor, int create) | |||
{ | { | |||
return map_dev_preferred(major, minor, create, NULL); | return map_dev_preferred(major, minor, create, NULL); | |||
} | } | |||
/** | ||||
* is_fd_valid() - check file descriptor. | ||||
* @fd: file descriptor. | ||||
* | ||||
* The function checks if @fd is nonnegative integer and shall be used only | ||||
* to verify open() result. | ||||
*/ | ||||
static inline int is_fd_valid(int fd) | ||||
{ | ||||
return (fd > -1); | ||||
} | ||||
/** | ||||
* close_fd() - verify, close and unset file descriptor. | ||||
* @fd: pointer to file descriptor. | ||||
* | ||||
* The function closes and invalidates file descriptor if appropriative. It | ||||
* ignores incorrect file descriptor quitely to simplify error handling. | ||||
*/ | ||||
static inline void close_fd(int *fd) | ||||
{ | ||||
if (is_fd_valid(*fd) && close(*fd) == 0) | ||||
*fd = -1; | ||||
} | ||||
struct active_array; | struct active_array; | |||
struct metadata_update; | struct metadata_update; | |||
/* 'struct reshape' records the intermediate states of | /* 'struct reshape' records the intermediate states of | |||
* a general reshape. | * a general reshape. | |||
* The starting geometry is converted to the 'before' geometry | * The starting geometry is converted to the 'before' geometry | |||
* by at most an atomic level change. They could be the same. | * by at most an atomic level change. They could be the same. | |||
* Similarly the 'after' geometry is converted to the final | * Similarly the 'after' geometry is converted to the final | |||
* geometry by at most a level change. | * geometry by at most a level change. | |||
* Note that 'before' and 'after' must have the same level. | * Note that 'before' and 'after' must have the same level. | |||
skipping to change at line 818 | skipping to change at line 885 | |||
void (*examine_super)(struct supertype *st, char *homehost); | void (*examine_super)(struct supertype *st, char *homehost); | |||
void (*brief_examine_super)(struct supertype *st, int verbose); | void (*brief_examine_super)(struct supertype *st, int verbose); | |||
void (*brief_examine_subarrays)(struct supertype *st, int verbose); | void (*brief_examine_subarrays)(struct supertype *st, int verbose); | |||
void (*export_examine_super)(struct supertype *st); | void (*export_examine_super)(struct supertype *st); | |||
int (*examine_badblocks)(struct supertype *st, int fd, char *devname); | int (*examine_badblocks)(struct supertype *st, int fd, char *devname); | |||
int (*copy_metadata)(struct supertype *st, int from, int to); | int (*copy_metadata)(struct supertype *st, int from, int to); | |||
/* Used to report details of an active array. | /* Used to report details of an active array. | |||
* ->load_super was possibly given a 'component' string. | * ->load_super was possibly given a 'component' string. | |||
*/ | */ | |||
void (*detail_super)(struct supertype *st, char *homehost); | void (*detail_super)(struct supertype *st, char *homehost, | |||
void (*brief_detail_super)(struct supertype *st); | char *subarray); | |||
void (*brief_detail_super)(struct supertype *st, char *subarray); | ||||
void (*export_detail_super)(struct supertype *st); | void (*export_detail_super)(struct supertype *st); | |||
/* Optional: platform hardware / firmware details */ | /* Optional: platform hardware / firmware details */ | |||
int (*detail_platform)(int verbose, int enumerate_only, char *controller_ path); | int (*detail_platform)(int verbose, int enumerate_only, char *controller_ path); | |||
int (*export_detail_platform)(int verbose, char *controller_path); | int (*export_detail_platform)(int verbose, char *controller_path); | |||
/* Used: | /* Used: | |||
* to get uuid to storing in bitmap metadata | * to get uuid to storing in bitmap metadata | |||
* and 'reshape' backup-data metadata | * and 'reshape' backup-data metadata | |||
* To see if a device is being re-added to an array it was part of. | * To see if a device is being re-added to an array it was part of. | |||
skipping to change at line 927 | skipping to change at line 995 | |||
/* Write all metadata for this array. | /* Write all metadata for this array. | |||
*/ | */ | |||
int (*write_init_super)(struct supertype *st); | int (*write_init_super)(struct supertype *st); | |||
/* Check if metadata read from one device is compatible with an array, | /* Check if metadata read from one device is compatible with an array, | |||
* used when assembling an array, or pseudo-assembling was with | * used when assembling an array, or pseudo-assembling was with | |||
* "--examine --brief" | * "--examine --brief" | |||
* If "st" has not yet been loaded the superblock from, "tst" is | * If "st" has not yet been loaded the superblock from, "tst" is | |||
* moved in, otherwise the superblock in 'st' is compared with | * moved in, otherwise the superblock in 'st' is compared with | |||
* 'tst'. | * 'tst'. | |||
*/ | */ | |||
int (*compare_super)(struct supertype *st, struct supertype *tst); | int (*compare_super)(struct supertype *st, struct supertype *tst, | |||
int verbose); | ||||
/* Load metadata from a single device. If 'devname' is not NULL | /* Load metadata from a single device. If 'devname' is not NULL | |||
* print error messages as appropriate */ | * print error messages as appropriate */ | |||
int (*load_super)(struct supertype *st, int fd, char *devname); | int (*load_super)(struct supertype *st, int fd, char *devname); | |||
/* 'fd' is a 'container' md array - load array metadata from the | /* 'fd' is a 'container' md array - load array metadata from the | |||
* whole container. | * whole container. | |||
*/ | */ | |||
int (*load_container)(struct supertype *st, int fd, char *devname); | int (*load_container)(struct supertype *st, int fd, char *devname); | |||
/* If 'arg' is a valid name of this metadata type, allocate and | /* If 'arg' is a valid name of this metadata type, allocate and | |||
* return a 'supertype' for the particular minor version */ | * return a 'supertype' for the particular minor version */ | |||
struct supertype * (*match_metadata_desc)(char *arg); | struct supertype * (*match_metadata_desc)(char *arg); | |||
skipping to change at line 967 | skipping to change at line 1036 | |||
* update the metadata to record this. The array may be newly | * update the metadata to record this. The array may be newly | |||
* created, in which case data_size may be updated, or it might | * created, in which case data_size may be updated, or it might | |||
* already exist. Metadata handler can know if init_super | * already exist. Metadata handler can know if init_super | |||
* has been called, but not write_init_super. | * has been called, but not write_init_super. | |||
* 0: Success | * 0: Success | |||
* -Exxxx: On error | * -Exxxx: On error | |||
*/ | */ | |||
int (*add_internal_bitmap)(struct supertype *st, int *chunkp, | int (*add_internal_bitmap)(struct supertype *st, int *chunkp, | |||
int delay, int write_behind, | int delay, int write_behind, | |||
unsigned long long size, int may_change, int m ajor); | unsigned long long size, int may_change, int m ajor); | |||
/* Perform additional setup required to activate a bitmap. | ||||
*/ | ||||
int (*set_bitmap)(struct supertype *st, struct mdinfo *info); | ||||
/* Seek 'fd' to start of write-intent-bitmap. Must be an | /* Seek 'fd' to start of write-intent-bitmap. Must be an | |||
* md-native format bitmap | * md-native format bitmap | |||
*/ | */ | |||
int (*locate_bitmap)(struct supertype *st, int fd, int node_num); | int (*locate_bitmap)(struct supertype *st, int fd, int node_num); | |||
/* if add_internal_bitmap succeeded for existing array, this | /* if add_internal_bitmap succeeded for existing array, this | |||
* writes it out. | * writes it out. | |||
*/ | */ | |||
int (*write_bitmap)(struct supertype *st, int fd, enum bitmap_update upda te); | int (*write_bitmap)(struct supertype *st, int fd, enum bitmap_update upda te); | |||
/* Free the superblock and any other allocated data */ | /* Free the superblock and any other allocated data */ | |||
void (*free_super)(struct supertype *st); | void (*free_super)(struct supertype *st); | |||
skipping to change at line 1007 | skipping to change at line 1079 | |||
char *subdev, unsigned long long *freesize, | char *subdev, unsigned long long *freesize, | |||
int consistency_policy, int verbose); | int consistency_policy, int verbose); | |||
/* Return a linked list of 'mdinfo' structures for all arrays | /* Return a linked list of 'mdinfo' structures for all arrays | |||
* in the container. For non-containers, it is like | * in the container. For non-containers, it is like | |||
* getinfo_super with an allocated mdinfo.*/ | * getinfo_super with an allocated mdinfo.*/ | |||
struct mdinfo *(*container_content)(struct supertype *st, char *subarray) ; | struct mdinfo *(*container_content)(struct supertype *st, char *subarray) ; | |||
/* query the supertype for default geometry */ | /* query the supertype for default geometry */ | |||
void (*default_geometry)(struct supertype *st, int *level, int *layout, i nt *chunk); /* optional */ | void (*default_geometry)(struct supertype *st, int *level, int *layout, i nt *chunk); /* optional */ | |||
/* Permit subarray's to be deleted from inactive containers */ | /* Permit subarray's to be deleted from inactive containers */ | |||
int (*kill_subarray)(struct supertype *st); /* optional */ | int (*kill_subarray)(struct supertype *st, | |||
char *subarray_id); /* optional */ | ||||
/* Permit subarray's to be modified */ | /* Permit subarray's to be modified */ | |||
int (*update_subarray)(struct supertype *st, char *subarray, | int (*update_subarray)(struct supertype *st, char *subarray, | |||
char *update, struct mddev_ident *ident); /* optio nal */ | char *update, struct mddev_ident *ident); /* optio nal */ | |||
/* Check if reshape is supported for this external format. | /* Check if reshape is supported for this external format. | |||
* st is obtained from super_by_fd() where st->subarray[0] is | * st is obtained from super_by_fd() where st->subarray[0] is | |||
* initialized to indicate if reshape is being performed at the | * initialized to indicate if reshape is being performed at the | |||
* container or subarray level | * container or subarray level | |||
*/ | */ | |||
#define APPLY_METADATA_CHANGES 1 | #define APPLY_METADATA_CHANGES 1 | |||
#define ROLLBACK_METADATA_CHANGES 0 | #define ROLLBACK_METADATA_CHANGES 0 | |||
skipping to change at line 1033 | skipping to change at line 1106 | |||
int direction, | int direction, | |||
int verbose); /* optional */ | int verbose); /* optional */ | |||
int (*manage_reshape)( /* optional */ | int (*manage_reshape)( /* optional */ | |||
int afd, struct mdinfo *sra, struct reshape *reshape, | int afd, struct mdinfo *sra, struct reshape *reshape, | |||
struct supertype *st, unsigned long blocks, | struct supertype *st, unsigned long blocks, | |||
int *fds, unsigned long long *offsets, | int *fds, unsigned long long *offsets, | |||
int dests, int *destfd, unsigned long long *destoffsets); | int dests, int *destfd, unsigned long long *destoffsets); | |||
/* for mdmon */ | /* for mdmon */ | |||
int (*open_new)(struct supertype *c, struct active_array *a, | int (*open_new)(struct supertype *c, struct active_array *a, | |||
char *inst); | int inst); | |||
/* Tell the metadata handler the current state of the array. | /* Tell the metadata handler the current state of the array. | |||
* This covers whether it is known to be consistent (no pending writes) | * This covers whether it is known to be consistent (no pending writes) | |||
* and how far along a resync is known to have progressed | * and how far along a resync is known to have progressed | |||
* (in a->resync_start). | * (in a->resync_start). | |||
* resync status is really irrelevant if the array is not consistent, | * resync status is really irrelevant if the array is not consistent, | |||
* but some metadata (DDF!) have a place to record the distinction. | * but some metadata (DDF!) have a place to record the distinction. | |||
* If 'consistent' is '2', then the array can mark it dirty if a | * If 'consistent' is '2', then the array can mark it dirty if a | |||
* resync/recovery/whatever is required, or leave it clean if not. | * resync/recovery/whatever is required, or leave it clean if not. | |||
* Return value is 0 dirty (not consistent) and 1 if clean. | * Return value is 0 dirty (not consistent) and 1 if clean. | |||
skipping to change at line 1250 | skipping to change at line 1323 | |||
}; | }; | |||
extern char rule_policy[], rule_part[]; | extern char rule_policy[], rule_part[]; | |||
extern char rule_path[], rule_type[]; | extern char rule_path[], rule_type[]; | |||
extern char type_part[], type_disk[]; | extern char type_part[], type_disk[]; | |||
extern void policyline(char *line, char *type); | extern void policyline(char *line, char *type); | |||
extern void policy_add(char *type, ...); | extern void policy_add(char *type, ...); | |||
extern void policy_free(void); | extern void policy_free(void); | |||
extern struct dev_policy *path_policy(char *path, char *type); | extern struct dev_policy *path_policy(char **paths, char *type); | |||
extern struct dev_policy *disk_policy(struct mdinfo *disk); | extern struct dev_policy *disk_policy(struct mdinfo *disk); | |||
extern struct dev_policy *devid_policy(int devid); | extern struct dev_policy *devid_policy(int devid); | |||
extern void dev_policy_free(struct dev_policy *p); | extern void dev_policy_free(struct dev_policy *p); | |||
//extern void pol_new(struct dev_policy **pol, char *name, char *val, char *meta data); | //extern void pol_new(struct dev_policy **pol, char *name, char *val, char *meta data); | |||
extern void pol_add(struct dev_policy **pol, char *name, char *val, char *metada ta); | extern void pol_add(struct dev_policy **pol, char *name, char *val, char *metada ta); | |||
extern struct dev_policy *pol_find(struct dev_policy *pol, char *name); | extern struct dev_policy *pol_find(struct dev_policy *pol, char *name); | |||
enum policy_action { | enum policy_action { | |||
act_default, | act_default, | |||
skipping to change at line 1294 | skipping to change at line 1367 | |||
extern void domainlist_add_dev(struct domainlist **dom, int devid, | extern void domainlist_add_dev(struct domainlist **dom, int devid, | |||
const char *metadata); | const char *metadata); | |||
extern void domain_free(struct domainlist *dl); | extern void domain_free(struct domainlist *dl); | |||
extern void domain_merge(struct domainlist **domp, struct dev_policy *pol, | extern void domain_merge(struct domainlist **domp, struct dev_policy *pol, | |||
const char *metadata); | const char *metadata); | |||
void domain_add(struct domainlist **domp, char *domain); | void domain_add(struct domainlist **domp, char *domain); | |||
extern void policy_save_path(char *id_path, struct map_ent *array); | extern void policy_save_path(char *id_path, struct map_ent *array); | |||
extern int policy_check_path(struct mdinfo *disk, struct map_ent *array); | extern int policy_check_path(struct mdinfo *disk, struct map_ent *array); | |||
extern void sysfs_rules_apply(char *devnm, struct mdinfo *dev); | ||||
extern void sysfsline(char *line); | ||||
#if __GNUC__ < 3 | #if __GNUC__ < 3 | |||
struct stat64; | struct stat64; | |||
#endif | #endif | |||
#define HAVE_NFTW we assume | #define HAVE_NFTW we assume | |||
#define HAVE_FTW | #define HAVE_FTW | |||
#ifdef __UCLIBC__ | #ifdef __UCLIBC__ | |||
# include <features.h> | # include <features.h> | |||
# ifndef __UCLIBC_HAS_LFS__ | # ifndef __UCLIBC_HAS_LFS__ | |||
skipping to change at line 1412 | skipping to change at line 1488 | |||
struct supertype *st); | struct supertype *st); | |||
extern void RebuildMap(void); | extern void RebuildMap(void); | |||
extern int IncrementalScan(struct context *c, char *devnm); | extern int IncrementalScan(struct context *c, char *devnm); | |||
extern int IncrementalRemove(char *devname, char *path, int verbose); | extern int IncrementalRemove(char *devname, char *path, int verbose); | |||
extern int CreateBitmap(char *filename, int force, char uuid[16], | extern int CreateBitmap(char *filename, int force, char uuid[16], | |||
unsigned long chunksize, unsigned long daemon_sleep, | unsigned long chunksize, unsigned long daemon_sleep, | |||
unsigned long write_behind, | unsigned long write_behind, | |||
unsigned long long array_size, | unsigned long long array_size, | |||
int major); | int major); | |||
extern int ExamineBitmap(char *filename, int brief, struct supertype *st); | extern int ExamineBitmap(char *filename, int brief, struct supertype *st); | |||
extern int IsBitmapDirty(char *filename); | ||||
extern int Write_rules(char *rule_name); | extern int Write_rules(char *rule_name); | |||
extern int bitmap_update_uuid(int fd, int *uuid, int swap); | extern int bitmap_update_uuid(int fd, int *uuid, int swap); | |||
/* calculate the size of the bitmap given the array size and bitmap chunksize */ | /* calculate the size of the bitmap given the array size and bitmap chunksize */ | |||
static inline unsigned long long | static inline unsigned long long | |||
bitmap_bits(unsigned long long array_size, unsigned long chunksize) | bitmap_bits(unsigned long long array_size, unsigned long chunksize) | |||
{ | { | |||
return (array_size * 512 + chunksize - 1) / chunksize; | return (array_size * 512 + chunksize - 1) / chunksize; | |||
} | } | |||
skipping to change at line 1440 | skipping to change at line 1517 | |||
int md_get_array_info(int fd, struct mdu_array_info_s *array); | int md_get_array_info(int fd, struct mdu_array_info_s *array); | |||
int md_set_array_info(int fd, struct mdu_array_info_s *array); | int md_set_array_info(int fd, struct mdu_array_info_s *array); | |||
int md_get_disk_info(int fd, struct mdu_disk_info_s *disk); | int md_get_disk_info(int fd, struct mdu_disk_info_s *disk); | |||
extern int get_linux_version(void); | extern int get_linux_version(void); | |||
extern int mdadm_version(char *version); | extern int mdadm_version(char *version); | |||
extern unsigned long long parse_size(char *size); | extern unsigned long long parse_size(char *size); | |||
extern int parse_uuid(char *str, int uuid[4]); | extern int parse_uuid(char *str, int uuid[4]); | |||
extern int is_near_layout_10(int layout); | extern int is_near_layout_10(int layout); | |||
extern int parse_layout_10(char *layout); | extern int parse_layout_10(char *layout); | |||
extern int parse_layout_faulty(char *layout); | extern int parse_layout_faulty(char *layout); | |||
extern long parse_num(char *num); | extern int parse_num(int *dest, char *num); | |||
extern int parse_cluster_confirm_arg(char *inp, char **devname, int *slot); | extern int parse_cluster_confirm_arg(char *inp, char **devname, int *slot); | |||
extern int check_ext2(int fd, char *name); | extern int check_ext2(int fd, char *name); | |||
extern int check_reiser(int fd, char *name); | extern int check_reiser(int fd, char *name); | |||
extern int check_raid(int fd, char *name); | extern int check_raid(int fd, char *name); | |||
extern int check_partitions(int fd, char *dname, | extern int check_partitions(int fd, char *dname, | |||
unsigned long long freesize, | unsigned long long freesize, | |||
unsigned long long size); | unsigned long long size); | |||
extern int fstat_is_blkdev(int fd, char *devname, dev_t *rdev); | extern int fstat_is_blkdev(int fd, char *devname, dev_t *rdev); | |||
extern int stat_is_blkdev(char *devname, dev_t *rdev); | extern int stat_is_blkdev(char *devname, dev_t *rdev); | |||
extern bool is_dev_alive(char *path); | ||||
extern int get_mdp_major(void); | extern int get_mdp_major(void); | |||
extern int get_maj_min(char *dev, int *major, int *minor); | extern int get_maj_min(char *dev, int *major, int *minor); | |||
extern int dev_open(char *dev, int flags); | extern int dev_open(char *dev, int flags); | |||
extern int open_dev(char *devnm); | extern int open_dev(char *devnm); | |||
extern void reopen_mddev(int mdfd); | extern void reopen_mddev(int mdfd); | |||
extern int open_dev_flags(char *devnm, int flags); | extern int open_dev_flags(char *devnm, int flags); | |||
extern int open_dev_excl(char *devnm); | extern int open_dev_excl(char *devnm); | |||
extern int is_standard(char *dev, int *nump); | extern int is_standard(char *dev, int *nump); | |||
extern int same_dev(char *one, char *two); | extern int same_dev(char *one, char *two); | |||
extern int compare_paths (char* path1,char* path2); | extern int compare_paths (char* path1,char* path2); | |||
extern void enable_fds(int devices); | extern void enable_fds(int devices); | |||
extern void manage_fork_fds(int close_all); | ||||
extern int continue_via_systemd(char *devnm, char *service_name); | ||||
extern int parse_auto(char *str, char *msg, int config); | extern int parse_auto(char *str, char *msg, int config); | |||
extern struct mddev_ident *conf_get_ident(char *dev); | extern struct mddev_ident *conf_get_ident(char *dev); | |||
extern struct mddev_dev *conf_get_devs(void); | extern struct mddev_dev *conf_get_devs(void); | |||
extern int conf_test_dev(char *devname); | extern int conf_test_dev(char *devname); | |||
extern int conf_test_metadata(const char *version, struct dev_policy *pol, int i s_homehost); | extern int conf_test_metadata(const char *version, struct dev_policy *pol, int i s_homehost); | |||
extern struct createinfo *conf_get_create_info(void); | extern struct createinfo *conf_get_create_info(void); | |||
extern void set_conffile(char *file); | extern void set_conffile(char *file); | |||
extern char *conf_get_mailaddr(void); | extern char *conf_get_mailaddr(void); | |||
extern char *conf_get_mailfrom(void); | extern char *conf_get_mailfrom(void); | |||
extern char *conf_get_program(void); | extern char *conf_get_program(void); | |||
extern char *conf_get_homehost(int *require_homehostp); | extern char *conf_get_homehost(int *require_homehostp); | |||
extern char *conf_get_homecluster(void); | extern char *conf_get_homecluster(void); | |||
extern int conf_get_monitor_delay(void); | ||||
extern char *conf_line(FILE *file); | extern char *conf_line(FILE *file); | |||
extern char *conf_word(FILE *file, int allow_key); | extern char *conf_word(FILE *file, int allow_key); | |||
extern void print_quoted(char *str); | extern void print_quoted(char *str); | |||
extern void print_escape(char *str); | extern void print_escape(char *str); | |||
extern int use_udev(void); | extern int use_udev(void); | |||
extern unsigned long GCD(unsigned long a, unsigned long b); | extern unsigned long GCD(unsigned long a, unsigned long b); | |||
extern int conf_name_is_free(char *name); | extern int conf_name_is_free(char *name); | |||
extern int conf_verify_devnames(struct mddev_ident *array_list); | extern int conf_verify_devnames(struct mddev_ident *array_list); | |||
extern int devname_matches(char *name, char *match); | extern int devname_matches(char *name, char *match); | |||
extern struct mddev_ident *conf_match(struct supertype *st, | extern struct mddev_ident *conf_match(struct supertype *st, | |||
skipping to change at line 1725 | skipping to change at line 1806 | |||
#ifdef __TINYC__ | #ifdef __TINYC__ | |||
#undef minor | #undef minor | |||
#undef major | #undef major | |||
#undef makedev | #undef makedev | |||
#define minor(x) ((x)&0xff) | #define minor(x) ((x)&0xff) | |||
#define major(x) (((x)>>8)&0xff) | #define major(x) (((x)>>8)&0xff) | |||
#define makedev(M,m) (((M)<<8) | (m)) | #define makedev(M,m) (((M)<<8) | (m)) | |||
#endif | #endif | |||
enum r0layout { | ||||
RAID0_ORIG_LAYOUT = 1, | ||||
RAID0_ALT_MULTIZONE_LAYOUT = 2, | ||||
}; | ||||
/* for raid4/5/6 */ | /* for raid4/5/6 */ | |||
#define ALGORITHM_LEFT_ASYMMETRIC 0 | #define ALGORITHM_LEFT_ASYMMETRIC 0 | |||
#define ALGORITHM_RIGHT_ASYMMETRIC 1 | #define ALGORITHM_RIGHT_ASYMMETRIC 1 | |||
#define ALGORITHM_LEFT_SYMMETRIC 2 | #define ALGORITHM_LEFT_SYMMETRIC 2 | |||
#define ALGORITHM_RIGHT_SYMMETRIC 3 | #define ALGORITHM_RIGHT_SYMMETRIC 3 | |||
/* Define non-rotating (raid4) algorithms. These allow | /* Define non-rotating (raid4) algorithms. These allow | |||
* conversion of raid4 to raid5. | * conversion of raid4 to raid5. | |||
*/ | */ | |||
#define ALGORITHM_PARITY_0 4 /* P or P,Q are initial devices */ | #define ALGORITHM_PARITY_0 4 /* P or P,Q are initial devices */ | |||
skipping to change at line 1775 | skipping to change at line 1861 | |||
/* Define PATH_MAX in case we don't use glibc or standard library does | /* Define PATH_MAX in case we don't use glibc or standard library does | |||
* not have PATH_MAX defined. Assume max path length is 4K characters. | * not have PATH_MAX defined. Assume max path length is 4K characters. | |||
*/ | */ | |||
#ifndef PATH_MAX | #ifndef PATH_MAX | |||
#define PATH_MAX 4096 | #define PATH_MAX 4096 | |||
#endif | #endif | |||
#define RESYNC_NONE -1 | #define RESYNC_NONE -1 | |||
#define RESYNC_DELAYED -2 | #define RESYNC_DELAYED -2 | |||
#define RESYNC_PENDING -3 | #define RESYNC_PENDING -3 | |||
#define RESYNC_UNKNOWN -4 | #define RESYNC_REMOTE -4 | |||
#define RESYNC_UNKNOWN -5 | ||||
/* When using "GET_DISK_INFO" it isn't certain how high | /* When using "GET_DISK_INFO" it isn't certain how high | |||
* we need to check. So we impose an absolute limit of | * we need to check. So we impose an absolute limit of | |||
* MAX_DISKS. This needs to be much more than the largest | * MAX_DISKS. This needs to be much more than the largest | |||
* number of devices any metadata can support. Currently | * number of devices any metadata can support. Currently | |||
* v1.x can support 1920 | * v1.x can support 1920 | |||
*/ | */ | |||
#define MAX_DISKS 4096 | #define MAX_DISKS 4096 | |||
/* Sometimes the 'size' value passed needs to mean "Maximum". | /* Sometimes the 'size' value passed needs to mean "Maximum". | |||
* In those cases with use MAX_SIZE | * In those cases with use MAX_SIZE | |||
*/ | */ | |||
#define MAX_SIZE 1 | #define MAX_SIZE 1 | |||
/* We want to use unsigned numbers for sector counts, but need | /* We want to use unsigned numbers for sector counts, but need | |||
* a value for 'invalid'. Use '1'. | * a value for 'invalid'. Use '1'. | |||
*/ | */ | |||
#define INVALID_SECTORS 1 | #define INVALID_SECTORS 1 | |||
/* And another special number needed for --data_offset=variable */ | /* And another special number needed for --data_offset=variable */ | |||
#define VARIABLE_OFFSET 3 | #define VARIABLE_OFFSET 3 | |||
/** | ||||
* This is true for native and DDF, IMSM allows 16. | ||||
*/ | ||||
#define MD_NAME_MAX 32 | ||||
End of changes. 26 change blocks. | ||||
12 lines changed or deleted | 99 lines changed or added |