# endif
#endif
+#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <time.h>
int gid;
int autof;
int mode;
- int symlinks;
int names;
int bblist;
struct supertype *supertype;
BackupFile,
HomeHost,
AutoHomeHost,
- Symlinks,
AutoDetect,
Waitclean,
DetailPlatform,
ConsistencyPolicy,
};
+enum update_opt {
+ UOPT_NAME = 1,
+ UOPT_PPL,
+ UOPT_NO_PPL,
+ UOPT_BITMAP,
+ UOPT_NO_BITMAP,
+ UOPT_SUBARRAY_ONLY,
+ UOPT_SPARC22,
+ UOPT_SUPER_MINOR,
+ UOPT_SUMMARIES,
+ UOPT_RESYNC,
+ UOPT_UUID,
+ UOPT_HOMEHOST,
+ UOPT_HOME_CLUSTER,
+ UOPT_NODES,
+ UOPT_DEVICESIZE,
+ UOPT_BBL,
+ UOPT_NO_BBL,
+ UOPT_FORCE_NO_BBL,
+ UOPT_METADATA,
+ UOPT_REVERT_RESHAPE,
+ UOPT_LAYOUT_ORIGINAL,
+ UOPT_LAYOUT_ALTERNATE,
+ UOPT_LAYOUT_UNSPECIFIED,
+ UOPT_BYTEORDER,
+ UOPT_HELP,
+ UOPT_USER_ONLY,
+ /*
+ * Code specific options, cannot be set by the user
+ */
+ UOPT_SPEC_FORCE_ONE,
+ UOPT_SPEC_FORCE_ARRAY,
+ UOPT_SPEC_ASSEMBLE,
+ UOPT_SPEC_LINEAR_GROW_NEW,
+ UOPT_SPEC_LINEAR_GROW_UPDATE,
+ UOPT_SPEC__RESHAPE_PROGRESS,
+ UOPT_SPEC_WRITEMOSTLY,
+ UOPT_SPEC_READWRITE,
+ UOPT_SPEC_FAILFAST,
+ UOPT_SPEC_NOFAILFAST,
+ UOPT_SPEC_REVERT_RESHAPE_NOBACKUP,
+ UOPT_UNDEFINED
+};
+extern void fprint_update_options(FILE *outf, enum update_opt update_mode);
+
enum prefix_standard {
JEDEC,
IEC
int assume_clean;
int write_behind;
unsigned long long size;
+ unsigned long long data_offset;
int consistency_policy;
};
extern int map_name(mapping_t *map, char *name);
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[], update_options[];
extern char *map_dev_preferred(int major, int minor, int create,
char *prefer);
* it will resume going in the opposite direction.
*/
int (*update_super)(struct supertype *st, struct mdinfo *info,
- char *update,
+ enum update_opt update,
char *devname, int verbose,
int uuid_set, char *homehost);
/* Permit subarray's to be deleted from inactive containers */
int (*kill_subarray)(struct supertype *st,
char *subarray_id); /* optional */
- /* Permit subarray's to be modified */
+ /**
+ * update_subarray() - Permit subarray to be modified.
+ * @st: Supertype.
+ * @subarray: Subarray name.
+ * @update: Update option.
+ * @ident: Optional identifiers.
+ */
int (*update_subarray)(struct supertype *st, char *subarray,
- char *update, struct mddev_ident *ident); /* optional */
+ enum update_opt update, struct mddev_ident *ident);
/* Check if reshape is supported for this external format.
* st is obtained from super_by_fd() where st->subarray[0] is
* initialized to indicate if reshape is being performed at the
struct context *c, struct shape *s);
extern int Grow_reshape(char *devname, int fd,
struct mddev_dev *devlist,
- unsigned long long data_offset,
struct context *c, struct shape *s);
extern int Grow_restart(struct supertype *st, struct mdinfo *info,
int *fdlist, int cnt, char *backup_file, int verbose);
char *name, int *uuid,
int subdevs, struct mddev_dev *devlist,
struct shape *s,
- struct context *c,
- unsigned long long data_offset);
+ struct context *c);
extern int Detail(char *dev, struct context *c);
extern int Detail_Platform(struct superswitch *ss, int scan, int verbose, int export, char *controller_path);
extern bool is_dev_alive(char *path);
extern int get_mdp_major(void);
extern int get_maj_min(char *dev, int *major, int *minor);
+extern bool is_bit_set(int *val, unsigned char index);
extern int dev_open(char *dev, int flags);
extern int open_dev(char *devnm);
extern void reopen_mddev(int mdfd);
extern void manage_fork_fds(int close_all);
extern int continue_via_systemd(char *devnm, char *service_name);
+extern void ident_init(struct mddev_ident *ident);
+
extern int parse_auto(char *str, char *msg, int config);
extern struct mddev_ident *conf_get_ident(char *dev);
extern struct mddev_dev *conf_get_devs(void);
extern char *stat2kname(struct stat *st);
extern char *fd2kname(int fd);
extern char *stat2devnm(struct stat *st);
+bool stat_is_md_dev(struct stat *st);
extern char *fd2devnm(int fd);
extern void udev_block(char *devnm);
extern void udev_unblock(void);
extern int cluster_release_dlmlock(void);
extern void set_dlm_hooks(void);
+#define MSEC_TO_NSEC(msec) ((msec) * 1000000)
+#define USEC_TO_NSEC(usec) ((usec) * 1000)
+extern void sleep_for(unsigned int sec, long nsec, bool wake_after_interrupt);
+
#define _ROUND_UP(val, base) (((val) + (base) - 1) & ~(base - 1))
#define ROUND_UP(val, base) _ROUND_UP(val, (typeof(val))(base))
#define ROUND_UP_PTR(ptr, base) ((typeof(ptr)) \
#define dprintf_cont(fmt, arg...) \
({ if (0) fprintf(stderr, fmt, ##arg); 0; })
#endif
-#include <assert.h>
-#include <stdarg.h>
+
static inline int xasprintf(char **strp, const char *fmt, ...) {
va_list ap;
int ret;
* This is true for native and DDF, IMSM allows 16.
*/
#define MD_NAME_MAX 32
+
+/**
+ * is_container() - check if @level is &LEVEL_CONTAINER
+ * @level: level value
+ *
+ * return:
+ * 1 if level is equal to &LEVEL_CONTAINER, 0 otherwise.
+ */
+static inline int is_container(const int level)
+{
+ if (level == LEVEL_CONTAINER)
+ return 1;
+ return 0;
+}