dmraid.h   dmraid.h 
skipping to change at line 26 skipping to change at line 26
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
/* FIXME: avoid more library internals. */ /* FIXME: avoid more library internals. */
#include <dmraid/lib_context.h> #include <dmraid/lib_context.h>
#include <dmraid/display.h> #include <dmraid/display.h>
#include <dmraid/format.h> #include <dmraid/format.h>
#include <dmraid/metadata.h> #include <dmraid/metadata.h>
#include <dmraid/reconfig.h> #include <dmraid/reconfig.h>
#include <dmraid/dmreg.h> #include <dmraid/dmreg.h>
/*
* Library init/exit
*/
extern struct lib_context *libdmraid_init(int argc, char **argv);
extern void libdmraid_exit(struct lib_context *lc);
/* /*
* Retrieve version identifiers. * Retrieve version identifiers.
*/ */
extern int dm_version(struct lib_context *lc, char *version, size_t size); extern int dm_version(struct lib_context *lc, char *version, size_t size);
extern const char *libdmraid_date(struct lib_context *lc);
extern const char *libdmraid_version(struct lib_context *lc);
/* /*
* Dealing with formats. * Dealing with formats.
*/ */
extern int check_valid_format(struct lib_context *lc, char *fmt); extern int check_valid_format(struct lib_context *lc, char *fmt);
/* /*
* Dealing with devices. * Dealing with devices.
*/ */
extern unsigned int count_devices(struct lib_context *lc, enum dev_type typ e);
extern int discover_devices(struct lib_context *lc, char **devnodes); extern int discover_devices(struct lib_context *lc, char **devnodes);
extern void discover_raid_devices(struct lib_context *lc, char **devices);
extern void discover_partitions(struct lib_context *lc);
extern int write_dev(struct lib_context *lc, struct raid_dev *rd, int erase
);
/*
* Erase ondisk metadata.
*/
extern int erase_metadata(struct lib_context *lc);
/* /*
* Dealing with RAID sets. * Dealing with RAID sets.
*/ */
extern const char *get_set_type(struct lib_context *lc, void *rs);
extern const char *get_set_name(struct lib_context *lc, void *rs);
extern int group_set(struct lib_context *lc, char **name);
extern char *libdmraid_make_table(struct lib_context *lc, struct raid_set * rs); extern char *libdmraid_make_table(struct lib_context *lc, struct raid_set * rs);
enum activate_type { enum activate_type {
A_ACTIVATE, A_ACTIVATE,
A_DEACTIVATE, A_DEACTIVATE,
A_RELOAD,
}; };
extern void process_sets(struct lib_context *lc,
int (*func) (struct lib_context * lc, void *rs,
int arg), int arg, enum set_type type)
;
extern int change_set(struct lib_context *lc, enum activate_type what, extern int change_set(struct lib_context *lc, enum activate_type what,
void *rs); void *rs);
/* /*
* Memory allocation * Memory allocation
*/ */
#ifdef DEBUG_MALLOC #ifdef DEBUG_MALLOC
extern void *_dbg_malloc(size_t size, struct lib_context *lc, extern void *_dbg_malloc(size_t size, struct lib_context *lc,
const char *who, unsigned int line); const char *who, unsigned int line);
extern void *_dbg_realloc(void *ptr, size_t size, struct lib_context *lc, extern void *_dbg_realloc(void *ptr, size_t size, struct lib_context *lc,
const char *who, unsigned int line); const char *who, unsigned int line);
extern void *_dbg_strdup(void *ptr, struct lib_context *lc, extern void *_dbg_strdup(const void *ptr, struct lib_context *lc,
const char *who, unsigned int line); const char *who, unsigned int line);
extern void _dbg_free(void *ptr, struct lib_context *lc, extern void _dbg_free(void *ptr, struct lib_context *lc,
const char *who, unsigned int line); const char *who, unsigned int line);
#define dbg_malloc(size) _dbg_malloc((size), lc, __func__, __ LINE__) #define dbg_malloc(size) _dbg_malloc((size), lc, __func__, __ LINE__)
#define dbg_realloc(ptr, size) _dbg_realloc((ptr), (size), lc, \ #define dbg_realloc(ptr, size) _dbg_realloc((ptr), (size), lc, \
__func__, __LINE__) __func__, __LINE__)
#define dbg_strdup(ptr) _dbg_strdup((ptr), lc, __func__, __L INE__) #define dbg_strdup(ptr) _dbg_strdup((ptr), lc, __func__, __L INE__)
#define dbg_strndup(ptr, len) _dbg_strndup((ptr), len, lc, __func_ _, __LINE__) #define dbg_strndup(ptr, len) _dbg_strndup((ptr), len, lc, __func_ _, __LINE__)
#define dbg_free(ptr) _dbg_free((ptr), lc, __func__, __LIN E__) #define dbg_free(ptr) _dbg_free((ptr), lc, __func__, __LIN E__)
#else #else
extern void *_dbg_malloc(size_t size); extern void *_dbg_malloc(size_t size);
extern void *_dbg_realloc(void *ptr, size_t size); extern void *_dbg_realloc(void *ptr, size_t size);
extern void *_dbg_strdup(void *ptr); extern void *_dbg_strdup(const void *ptr);
extern void *_dbg_strndup(void *ptr, size_t len); extern void *_dbg_strndup(const void *ptr, size_t len);
extern void _dbg_free(void *ptr); extern void _dbg_free(void *ptr);
#define dbg_malloc _dbg_malloc #define dbg_malloc _dbg_malloc
#define dbg_realloc _dbg_realloc #define dbg_realloc _dbg_realloc
#define dbg_strdup _dbg_strdup #define dbg_strdup _dbg_strdup
#define dbg_strndup _dbg_strndup #define dbg_strndup _dbg_strndup
#define dbg_free _dbg_free #define dbg_free _dbg_free
#endif /* #ifdef DEBUG_MALLOC */ #endif /* #ifdef DEBUG_MALLOC */
 End of changes. 9 change blocks. 
27 lines changed or deleted 4 lines changed or added


 format.h   format.h 
skipping to change at line 53 skipping to change at line 53
rd_remove, rd_remove,
}; };
struct event_rd { struct event_rd {
struct raid_set *rs; struct raid_set *rs;
struct raid_dev *rd; struct raid_dev *rd;
enum rd_action action; enum rd_action action;
}; };
/* /*
* List of event handler functions to call for the metadata format handler.
*
* Return 1 for event taken, RAID device write necessary.
* Return 0 for error and/or write unnecessary.
*/
struct event_handlers {
/* Handle IO error */
int (*io) (struct lib_context * lc, struct event_io * e_io);
/* Handle RAID device add/remove. */
int (*rd) (struct lib_context * lc, struct event_rd * e_rd);
};
/*
* Hot-spare search types list: it can be searched locally/globally * Hot-spare search types list: it can be searched locally/globally
*/ */
enum scope { enum hot_spare_scope {
t_scope_local = 0x01, t_scope_local = 0x01,
t_scope_global = 0x02 t_scope_global = 0x02
}; };
/* Metadata Handler commands */ /* Metadata Handler commands */
enum handler_commands { enum handler_commands {
UPDATE_REBUILD_STATE, UPDATE_REBUILD_STATE,
GET_REBUILD_STATE, GET_REBUILD_STATE,
GET_REBUILD_DRIVE, GET_REBUILD_DRIVE,
GET_REBUILD_DRIVE_NO, GET_REBUILD_DRIVE_NO,
skipping to change at line 131 skipping to change at line 117
/* /*
* Write RAID metadata to a device deunifying it * Write RAID metadata to a device deunifying it
* or erase ondisk metadata if erase != 0. * or erase ondisk metadata if erase != 0.
*/ */
int (*write) (struct lib_context * lc, struct raid_dev * rd, int era se); int (*write) (struct lib_context * lc, struct raid_dev * rd, int era se);
/* /*
* delete RAID metadata to devices. * delete RAID metadata to devices.
*/ */
int (*c_delete) (struct lib_context * lc, struct raid_set * rs); int (*delete) (struct lib_context * lc, struct raid_set * rs);
/* /*
* create RAID metadata to devices. * create RAID metadata to devices.
*/ */
int (*create) (struct lib_context * lc, struct raid_set * rs); int (*create) (struct lib_context * lc, struct raid_set * rs);
/* /*
* Group a RAID device into a set. * Group a RAID device into a set.
*/ */
struct raid_set *(*group) (struct lib_context * lc, struct raid_set *(*group) (struct lib_context * lc,
skipping to change at line 155 skipping to change at line 141
* Check consistency of the RAID set metadata. * Check consistency of the RAID set metadata.
*/ */
int (*check) (struct lib_context * lc, struct raid_set * rs); int (*check) (struct lib_context * lc, struct raid_set * rs);
/* Metadata handler. */ /* Metadata handler. */
int (*metadata_handler) (struct lib_context * lc, int (*metadata_handler) (struct lib_context * lc,
enum handler_commands command, enum handler_commands command,
struct handler_info * info, void *ptr); struct handler_info * info, void *ptr);
/* /*
* Event handlers (eg, I/O error).
*/
struct event_handlers *events;
/*
* Hot-spare disk search scope * Hot-spare disk search scope
*/ */
enum scope scope; enum hot_spare_scope scope;
/* /*
* Display RAID disk metadata native. * Display RAID disk metadata native.
*/ */
void (*log) (struct lib_context * lc, struct raid_dev * rd); void (*log) (struct lib_context * lc, struct raid_dev * rd);
}; };
/* Chain of registered format handlers (needed for library context). */ /* Chain of registered format handlers (needed for library context). */
struct format_list { struct format_list {
struct list_head list; struct list_head list;
struct dmraid_format *fmt; struct dmraid_format *fmt;
skipping to change at line 239 skipping to change at line 221
const char *who, unsigned int n); const char *who, unsigned int n);
extern void *alloc_private(struct lib_context *lc, const char *who, extern void *alloc_private(struct lib_context *lc, const char *who,
size_t size); size_t size);
extern void *alloc_private_and_read(struct lib_context *lc, const char *who , extern void *alloc_private_and_read(struct lib_context *lc, const char *who ,
size_t size, char *path, loff_t offset); size_t size, char *path, loff_t offset);
extern struct raid_set *join_superset(struct lib_context *lc, extern struct raid_set *join_superset(struct lib_context *lc,
char *(*f_name) (struct lib_context * lc, char *(*f_name) (struct lib_context * lc,
struct raid_dev * rd, struct raid_dev * rd,
unsigned int subset), unsigned int subset),
void (*f_create) (struct raid_set * void (*f_create) (struct raid_set *
super, void *c_priva te), super, void *private ),
int (*f_set_sort) (struct list_head * int (*f_set_sort) (struct list_head *
pos, pos,
struct list_head * struct list_head *
c_new), new),
struct raid_set *rs, struct raid_dev * rd); struct raid_set *rs, struct raid_dev * rd);
extern int register_format_handler(struct lib_context *lc, extern int register_format_handler(struct lib_context *lc,
struct dmraid_format *fmt); struct dmraid_format *fmt);
extern int write_metadata(struct lib_context *lc, const char *handler, extern int write_metadata(struct lib_context *lc, const char *handler,
struct raid_dev *rd, int meta_index, int erase); struct raid_dev *rd, int meta_index, int erase);
extern int log_zero_sectors(struct lib_context *lc, char *path, extern int log_zero_sectors(struct lib_context *lc, char *path,
const char *handler); const char *handler);
#define to_disk to_cpu #define to_disk to_cpu
 End of changes. 7 change blocks. 
24 lines changed or deleted 6 lines changed or added


 lib_context.h   lib_context.h 
skipping to change at line 49 skipping to change at line 49
LC_SETS, LC_SETS,
LC_TEST, LC_TEST,
LC_VERBOSE, LC_VERBOSE,
LC_IGNORELOCKING, LC_IGNORELOCKING,
LC_SEPARATOR, LC_SEPARATOR,
LC_DEVICES, LC_DEVICES,
LC_PARTCHAR, LC_PARTCHAR,
LC_CREATE, LC_CREATE,
LC_REBUILD_SET, LC_REBUILD_SET,
LC_REBUILD_DISK, LC_REBUILD_DISK,
LC_HOT_SPARE_SET, /* Add new options below this one ! */ LC_HOT_SPARE_SET,
LC_IGNOREMONITORING, /* Add new options below this one ! */
LC_OPTIONS_SIZE, /* Must be the last enumerator. */ LC_OPTIONS_SIZE, /* Must be the last enumerator. */
}; };
/* Options access macros. */ /* Options access macros. */
/* Return option counter. */ /* Return option counter. */
#define OPT_COLUMN(lc) (lc_opt(lc, LC_COLUMN)) #define OPT_COLUMN(lc) (lc_opt(lc, LC_COLUMN))
#define OPT_CREATE(lc) (lc_opt(lc, LC_CREATE))
#define OPT_DEBUG(lc) (lc_opt(lc, LC_DEBUG)) #define OPT_DEBUG(lc) (lc_opt(lc, LC_DEBUG))
#define OPT_DEVICES(lc) (lc_opt(lc, LC_DEVICES)) #define OPT_DEVICES(lc) (lc_opt(lc, LC_DEVICES))
#define OPT_DUMP(lc) (lc_opt(lc, LC_DUMP)) #define OPT_DUMP(lc) (lc_opt(lc, LC_DUMP))
#define OPT_GROUP(lc) (lc_opt(lc, LC_GROUP))
#define OPT_FORMAT(lc) (lc_opt(lc, LC_FORMAT)) #define OPT_FORMAT(lc) (lc_opt(lc, LC_FORMAT))
#define OPT_GROUP(lc) (lc_opt(lc, LC_GROUP))
#define OPT_HOT_SPARE_SET(lc) (lc_opt(lc, LC_HOT_SPARE_SET))
#define OPT_IGNORELOCKING(lc) (lc_opt(lc, LC_IGNORELOCKING)) #define OPT_IGNORELOCKING(lc) (lc_opt(lc, LC_IGNORELOCKING))
#define OPT_IGNOREMONITORING(lc) (lc_opt(lc, LC_IGNOREMONITORING))
#define OPT_PARTCHAR(lc) (lc_opt(lc, LC_PARTCHAR))
#define OPT_REBUILD_DISK(lc) (lc_opt(lc, LC_REBUILD_DISK))
#define OPT_SEPARATOR(lc) (lc_opt(lc, LC_SEPARATOR)) #define OPT_SEPARATOR(lc) (lc_opt(lc, LC_SEPARATOR))
#define OPT_SETS(lc) (lc_opt(lc, LC_SETS)) #define OPT_SETS(lc) (lc_opt(lc, LC_SETS))
#define OPT_TEST(lc) (lc_opt(lc, LC_TEST)) #define OPT_TEST(lc) (lc_opt(lc, LC_TEST))
#define OPT_VERBOSE(lc) (lc_opt(lc, LC_VERBOSE)) #define OPT_VERBOSE(lc) (lc_opt(lc, LC_VERBOSE))
#define OPT_PARTCHAR(lc) (lc_opt(lc, LC_PARTCHAR))
#define OPT_CREATE(lc) (lc_opt(lc, LC_CREATE))
#define OPT_HOT_SPARE_SET(lc) (lc_opt(lc, LC_HOT_SPARE_SET))
#define OPT_REBUILD_DISK(lc) (lc_opt(lc, LC_REBUILD_DISK))
/* Return option value. */ /* Return option value. */
#define OPT_STR(lc, o) (lc->options[o].arg.str) #define OPT_STR(lc, o) (lc->options[o].arg.str)
#define OPT_STR_COLUMN(lc) OPT_STR(lc, LC_COLUMN) #define OPT_STR_COLUMN(lc) OPT_STR(lc, LC_COLUMN)
#define OPT_STR_FORMAT(lc) OPT_STR(lc, LC_FORMAT) #define OPT_STR_FORMAT(lc) OPT_STR(lc, LC_FORMAT)
#define OPT_STR_SEPARATOR(lc) OPT_STR(lc, LC_SEPARATOR) #define OPT_STR_SEPARATOR(lc) OPT_STR(lc, LC_SEPARATOR)
#define OPT_STR_PARTCHAR(lc) OPT_STR(lc, LC_PARTCHAR) #define OPT_STR_PARTCHAR(lc) OPT_STR(lc, LC_PARTCHAR)
#define OPT_STR_HOT_SPARE_SET(lc) OPT_STR(lc, LC_HOT_SPARE_SET) #define OPT_STR_HOT_SPARE_SET(lc) OPT_STR(lc, LC_HOT_SPARE_SET)
#define OPT_STR_REBUILD_DISK(lc) OPT_STR(lc, LC_REBUILD_DISK) #define OPT_STR_REBUILD_DISK(lc) OPT_STR(lc, LC_REBUILD_DISK)
skipping to change at line 133 skipping to change at line 135
const char *error; /* For error mappings. */ const char *error; /* For error mappings. */
} path; } path;
}; };
/* Options actions dmraid performs. */ /* Options actions dmraid performs. */
enum action { enum action {
UNDEF = 0x0, UNDEF = 0x0,
ACTIVATE = 0x1, ACTIVATE = 0x1,
DEACTIVATE = 0x2, DEACTIVATE = 0x2,
FORMAT = 0x4, FORMAT = 0x4,
#ifndef DMRAID_MINI
BLOCK_DEVICES = 0x8, BLOCK_DEVICES = 0x8,
COLUMN = 0x10, COLUMN = 0x10,
DBG = 0x20, DBG = 0x20,
DUMP = 0x40, DUMP = 0x40,
DMERASE = 0x80, DMERASE = 0x80,
GROUP = 0x100, GROUP = 0x100,
#endif
HELP = 0x200, HELP = 0x200,
#ifndef DMRAID_MINI
LIST_FORMATS = 0x400, LIST_FORMATS = 0x400,
# ifdef DMRAID_NATIVE_LOG # ifdef DMRAID_NATIVE_LOG
NATIVE_LOG = 0x800, NATIVE_LOG = 0x800,
# endif # endif
#endif
NOPARTITIONS = 0x1000, NOPARTITIONS = 0x1000,
#ifndef DMRAID_MINI
RAID_DEVICES = 0x2000, RAID_DEVICES = 0x2000,
RAID_SETS = 0x4000, RAID_SETS = 0x4000,
TEST = 0x8000, TEST = 0x8000,
VERBOSE = 0x10000, VERBOSE = 0x10000,
ACTIVE = 0x20000, ACTIVE = 0x20000,
INACTIVE = 0x40000, INACTIVE = 0x40000,
SEPARATOR = 0x80000, SEPARATOR = 0x80000,
#endif
VERSION = 0x100000, VERSION = 0x100000,
IGNORELOCKING = 0x200000, IGNORELOCKING = 0x200000,
#ifndef DMRAID_MINI
DEL_SETS = 0x400000, DEL_SETS = 0x400000,
CREATE = 0x800000, CREATE = 0x800000,
REBUILD = 0x1000000, REBUILD = 0x1000000,
SPARE = 0x2000000, SPARE = 0x2000000,
MEDIA = 0x4000000, MEDIA = 0x4000000,
END_REBUILD = 0x8000000, END_REBUILD = 0x8000000,
GET_MEMBERS = 0x10000000, GET_MEMBERS = 0x10000000,
PARTCHAR = 0x20000000, PARTCHAR = 0x20000000,
#endif
RMPARTITIONS = 0x40000000, RMPARTITIONS = 0x40000000,
IGNOREMONITORING = 0x80000000,
}; };
/* Arguments allowed ? */ /* Arguments allowed ? */
enum args { enum args {
NO_ARGS, NO_ARGS,
ARGS, ARGS,
}; };
/* Define which metadata is needed before we can call post functions. */ /* Define which metadata is needed before we can call post functions. */
enum metadata_need { enum metadata_need {
 End of changes. 15 change blocks. 
15 lines changed or deleted 9 lines changed or added


 list.h   list.h 
skipping to change at line 30 skipping to change at line 30
struct list_head *prev; struct list_head *prev;
}; };
#define INIT_LIST_HEAD(a) do { (a)->next = (a)->prev = a; } while(0) #define INIT_LIST_HEAD(a) do { (a)->next = (a)->prev = a; } while(0)
#define LIST_HEAD(a) struct list_head a = { .next = &a, .prev = & a } #define LIST_HEAD(a) struct list_head a = { .next = &a, .prev = & a }
#define list_empty(pos) ((pos)->next == pos) #define list_empty(pos) ((pos)->next == pos)
static inline void static inline void
__list_add(struct list_head *c_new, __list_add(struct list_head *new,
struct list_head *prev, struct list_head *next) struct list_head *prev, struct list_head *next)
{ {
next->prev = c_new; next->prev = new;
c_new->next = next; new->next = next;
c_new->prev = prev; new->prev = prev;
prev->next = c_new; prev->next = new;
} }
/* Add an element 'new' after position 'pos' to a list. */ /* Add an element 'new' after position 'pos' to a list. */
#define list_add(c_new, pos) __list_add(c_new, pos, (pos)->next) #define list_add(new, pos) __list_add(new, pos, (pos)->next)
/* Add an element 'new' before position 'pos' to a list. */ /* Add an element 'new' before position 'pos' to a list. */
#define list_add_tail(c_new, pos) __list_add(c_new, (pos)->prev, pos) #define list_add_tail(new, pos) __list_add(new, (pos)->prev, pos)
/* Delete an element 'pos' from the list. */ /* Delete an element 'pos' from the list. */
#define list_del(pos) { \ #define list_del(pos) { \
(pos)->next->prev = (pos)->prev; \ (pos)->next->prev = (pos)->prev; \
(pos)->prev->next = (pos)->next; \ (pos)->prev->next = (pos)->next; \
(pos)->next = (pos)->prev = 0; \ (pos)->next = (pos)->prev = 0; \
} }
#define list_del_init(pos) { \ #define list_del_init(pos) { \
list_del(pos); \ list_del(pos); \
 End of changes. 4 change blocks. 
7 lines changed or deleted 7 lines changed or added


 locking.h   locking.h 
skipping to change at line 22 skipping to change at line 22
struct resource { struct resource {
char *name; char *name;
}; };
/* Locking abstraction. */ /* Locking abstraction. */
struct lib_context; struct lib_context;
struct locking { struct locking {
const char *name; const char *name;
int (*lock)(struct lib_context *lc, struct resource *res); int (*lock)(struct lib_context *lc, struct resource *res);
void (*unlock)(struct lib_context *lc, struct resource *res); void (*unlock)(struct lib_context *lc, struct resource *res);
void *c_private; /* Private context. */ void *private; /* Private context. */
}; };
extern int init_locking(struct lib_context *lc); extern int init_locking(struct lib_context *lc);
extern int lock_resource(struct lib_context *lc, struct resource *res); extern int lock_resource(struct lib_context *lc, struct resource *res);
extern void unlock_resource(struct lib_context *lc, struct resource *res); extern void unlock_resource(struct lib_context *lc, struct resource *res);
#endif #endif
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 metadata.h   metadata.h 
skipping to change at line 159 skipping to change at line 159
uint64_t offset; /* Data offset on device. */ uint64_t offset; /* Data offset on device. */
uint64_t sectors; /* Length of the segment to map. */ uint64_t sectors; /* Length of the segment to map. */
unsigned int areas; /* # of metadata areas on the device. */ unsigned int areas; /* # of metadata areas on the device. */
struct meta_areas *meta_areas; /* Dynamic array of metadata areas. */ struct meta_areas *meta_areas; /* Dynamic array of metadata areas. */
/* /*
* For format handler use (eg, to keep references between calls). * For format handler use (eg, to keep references between calls).
* *
* WARNING: non pointer members need to get zeroed before exit, * WARNING: non pointer members need to get zeroed before exit,
* because the metadata layer frees c_private->ptr on clean up. * because the metadata layer frees private->ptr on cleanup .
*/ */
union { union {
void *ptr; void *ptr;
uint32_t n32; uint32_t n32;
uint64_t n64; uint64_t n64;
} c_private; } private;
}; };
/* /*
* Abstracted (hierarchical) RAID set. * Abstracted (hierarchical) RAID set.
* *
* Can be used to form a tree of subsets with arbitrary depths. * Can be used to form a tree of subsets with arbitrary depths.
* Defines RAID attributes for the set as a whole (eg: RAID0, Status). * Defines RAID attributes for the set as a whole (eg: RAID0, Status).
*/ */
enum flags { enum flags {
f_maximize = 0x01, /* If set, maximize set capacity, f_maximize = 0x01, /* If set, maximize set capacity,
skipping to change at line 227 skipping to change at line 227
extern const char *get_type(struct lib_context *lc, enum type type); extern const char *get_type(struct lib_context *lc, enum type type);
extern const char *get_dm_type(struct lib_context *lc, enum type type); extern const char *get_dm_type(struct lib_context *lc, enum type type);
extern const char *get_set_type(struct lib_context *lc, void *rs); extern const char *get_set_type(struct lib_context *lc, void *rs);
extern const char *get_status(struct lib_context *lc, enum status status); extern const char *get_status(struct lib_context *lc, enum status status);
extern uint64_t total_sectors(struct lib_context *lc, struct raid_set *rs); extern uint64_t total_sectors(struct lib_context *lc, struct raid_set *rs);
extern struct dev_info *alloc_dev_info(struct lib_context *lc, char *path); extern struct dev_info *alloc_dev_info(struct lib_context *lc, char *path);
extern void free_dev_info(struct lib_context *lc, struct dev_info *di); extern void free_dev_info(struct lib_context *lc, struct dev_info *di);
extern struct raid_dev *alloc_raid_dev(struct lib_context *lc, const char * who); extern struct raid_dev *alloc_raid_dev(struct lib_context *lc, const char * who);
extern void free_raid_dev(struct lib_context *lc, struct raid_dev **rd); extern void free_raid_dev(struct lib_context *lc, struct raid_dev **rd);
extern void list_add_sorted(struct lib_context *lc, extern void list_add_sorted(struct lib_context *lc,
struct list_head *to, struct list_head *c_new, struct list_head *to, struct list_head *new,
int (*sort) (struct list_head * pos, int (*sort) (struct list_head * pos,
struct list_head * c_new)); struct list_head * new));
extern struct raid_set *alloc_raid_set(struct lib_context *lc, const char * who); extern struct raid_set *alloc_raid_set(struct lib_context *lc, const char * who);
extern unsigned int count_sets(struct lib_context *lc, struct list_head *li st); extern unsigned int count_sets(struct lib_context *lc, struct list_head *li st);
extern unsigned int count_devs(struct lib_context *lc, struct raid_set *rs, extern unsigned int count_devs(struct lib_context *lc, struct raid_set *rs,
enum count_type type); enum count_type type);
extern void free_raid_set(struct lib_context *lc, struct raid_set *rs); extern void free_raid_set(struct lib_context *lc, struct raid_set *rs);
extern struct dev_info *find_disk(struct lib_context *lc, const char *dp);
extern struct raid_set *find_set(struct lib_context *lc, extern struct raid_set *find_set(struct lib_context *lc,
struct list_head *list, const char *name, struct list_head *list, const char *name,
enum find where); enum find where);
extern struct raid_set *find_or_alloc_raid_set(struct lib_context *lc, extern struct raid_set *find_or_alloc_raid_set(struct lib_context *lc,
char *name, enum find where, char *name, enum find where,
struct raid_dev *rd, struct raid_dev *rd,
struct list_head *list, struct list_head *list,
void (*create) (struct raid_s et void (*create) (struct raid_s et
* super, * super,
void *c_priva void *private
te), ),
void *c_private); void *private);
#define NO_RD NULL #define NO_RD NULL
#define NO_LIST NULL #define NO_LIST NULL
#define NO_CREATE NULL #define NO_CREATE NULL
#define NO_CREATE_ARG NULL #define NO_CREATE_ARG NULL
extern const char *get_set_name(struct lib_context *lc, void *rs); extern const char *get_set_name(struct lib_context *lc, void *rs);
extern int group_set(struct lib_context *lc, char **name); extern int group_set(struct lib_context *lc, char **name);
enum set_type { enum set_type {
SETS, SETS,
PARTITIONS, PARTITIONS,
skipping to change at line 276 skipping to change at line 277
extern int dso_get_members(struct lib_context *lc, int arg); extern int dso_get_members(struct lib_context *lc, int arg);
extern unsigned int count_devices(struct lib_context *lc, enum dev_type typ e); extern unsigned int count_devices(struct lib_context *lc, enum dev_type typ e);
extern enum status rd_status(struct states *states, unsigned int status, extern enum status rd_status(struct states *states, unsigned int status,
enum compare cmp); enum compare cmp);
extern enum type rd_type(struct types *types, unsigned int type); extern enum type rd_type(struct types *types, unsigned int type);
extern void file_metadata(struct lib_context *lc, const char *handler, extern void file_metadata(struct lib_context *lc, const char *handler,
char *path, void *data, size_t size, uint64_t offs et); char *path, void *data, size_t size, uint64_t offs et);
extern void file_dev_size(struct lib_context *lc, const char *handler, extern void file_dev_size(struct lib_context *lc, const char *handler,
struct dev_info *di); struct dev_info *di);
extern int write_dev(struct lib_context *lc, struct raid_dev *rd, int erase ); extern int write_dev(struct lib_context *lc, struct raid_dev *rd, int erase );
/*
* Erase ondisk metadata.
*/
extern int erase_metadata(struct lib_context *lc); extern int erase_metadata(struct lib_context *lc);
extern int delete_raidsets(struct lib_context *lc); extern int delete_raidsets(struct lib_context *lc);
extern int lib_perform(struct lib_context *lc, enum action action, extern int lib_perform(struct lib_context *lc, enum action action,
struct prepost *p, char **argv); struct prepost *p, char **argv);
#endif #endif
 End of changes. 7 change blocks. 
7 lines changed or deleted 11 lines changed or added


 misc.h   misc.h 
/* /*
* Copyright (C) 2004-2005 Heinz Mauelshagen, Red Hat GmbH. * Copyright (C) 2004-2010 Heinz Mauelshagen, Red Hat GmbH.
* All rights reserved. * All rights reserved.
* *
* Copyright (C) 2007 Intel Corporation. All rights reserved. * Copyright (C) 2007 Intel Corporation. All rights reserved.
* November, 2007 - additions for Create, Delete, Rebuild & Raid 10. * November, 2007 - additions for Create, Delete, Rebuild & Raid 10.
* *
* See file LICENSE at the top of this source tree for license information. * See file LICENSE at the top of this source tree for license information.
*/ */
#ifndef _MISC_H_ #ifndef _MISC_H_
#define _MISC_H_ #define _MISC_H_
#define DM_ASSERT(__cond) do { if (!(__cond)) { printf("ASSERT file:%s line :%d fuction:%s cond: %s\n", __FILE__, __LINE__, __FUNCTION__, #__cond); } } while(0); #define DM_ASSERT(__cond) do { if (!(__cond)) { printf("ASSERT file:%s line :%d fuction:%s cond: %s\n", __FILE__, __LINE__, __FUNCTION__, #__cond); } } while(0);
/*
* Library init/exit
*/
extern struct lib_context *libdmraid_init(int argc, char **argv); extern struct lib_context *libdmraid_init(int argc, char **argv);
extern void libdmraid_exit(struct lib_context *lc); extern void libdmraid_exit(struct lib_context *lc);
extern void sysfs_workaround(struct lib_context *lc); extern void sysfs_workaround(struct lib_context *lc);
extern void mk_alpha(struct lib_context *lc, char *str, size_t len); extern void mk_alpha(struct lib_context *lc, char *str, size_t len);
extern void mk_alphanum(struct lib_context *lc, char *str, size_t len);
extern char *get_basename(struct lib_context *lc, char *str); extern char *get_basename(struct lib_context *lc, char *str);
extern char *get_dirname(struct lib_context *lc, char *str); extern char *get_dirname(struct lib_context *lc, const char *str);
extern char *remove_white_space(struct lib_context *lc, char *str, size_t l en); extern char *remove_white_space(struct lib_context *lc, char *str, size_t l en);
extern void remove_tail_space(char *str); extern void remove_tail_space(char *str);
extern char *remove_delimiter(char *ptr, char c); extern char *remove_delimiter(char *ptr, char c);
extern void add_delimiter(char **ptr, char c); extern void add_delimiter(char **ptr, char c);
extern char *replace_delimiter(char *str, char delim, char c); extern char *replace_delimiter(char *str, char delim, char c);
extern int mk_dir(struct lib_context *lc, const char *dir); extern int mk_dir(struct lib_context *lc, const char *dir);
extern int read_file(struct lib_context *lc, const char *who, char *path, extern int read_file(struct lib_context *lc, const char *who, char *path,
void *buffer, size_t size, loff_t offset); void *buffer, size_t size, loff_t offset);
 End of changes. 4 change blocks. 
2 lines changed or deleted 6 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/