2
* Copyright (C) 2004-2008 Heinz Mauelshagen, Red Hat GmbH.
5
* Copyright (C) 2007, 2009 Intel Corporation. All rights reserved.
6
* November, 2007 - additions for Create, Delete, Rebuild & Raid 10.
7
* April, 2009 - dmreg.h file included
9
* See file LICENSE at the top of this source tree for license information.
17
#include <sys/types.h>
19
/* FIXME: avoid more library internals. */
20
#include <dmraid/lib_context.h>
21
#include <dmraid/display.h>
22
#include <dmraid/format.h>
23
#include <dmraid/metadata.h>
24
#include <dmraid/reconfig.h>
25
#include <dmraid/dmreg.h>
29
extern struct lib_context *libdmraid_init(int argc, char **argv);
30
extern void libdmraid_exit(struct lib_context *lc);
33
* Retrieve version identifiers.
35
extern int dm_version(struct lib_context *lc, char *version, size_t size);
36
extern const char *libdmraid_date(struct lib_context *lc);
37
extern const char *libdmraid_version(struct lib_context *lc);
40
* Dealing with formats.
42
extern int check_valid_format(struct lib_context *lc, char *fmt);
45
* Dealing with devices.
47
extern unsigned int count_devices(struct lib_context *lc, enum dev_type type);
48
extern int discover_devices(struct lib_context *lc, char **devnodes);
49
extern void discover_raid_devices(struct lib_context *lc, char **devices);
50
extern void discover_partitions(struct lib_context *lc);
51
extern int write_dev(struct lib_context *lc, struct raid_dev *rd, int erase);
54
* Erase ondisk metadata.
56
extern int erase_metadata(struct lib_context *lc);
59
* Dealing with RAID sets.
61
extern const char *get_set_type(struct lib_context *lc, void *rs);
62
extern const char *get_set_name(struct lib_context *lc, void *rs);
63
extern int group_set(struct lib_context *lc, char **name);
64
extern char *libdmraid_make_table(struct lib_context *lc, struct raid_set *rs);
71
extern void process_sets(struct lib_context *lc,
72
int (*func) (struct lib_context * lc, void *rs,
73
int arg), int arg, enum set_type type);
74
extern int change_set(struct lib_context *lc, enum activate_type what,
82
extern void *_dbg_malloc(size_t size, struct lib_context *lc,
83
const char *who, unsigned int line);
84
extern void *_dbg_realloc(void *ptr, size_t size, struct lib_context *lc,
85
const char *who, unsigned int line);
86
extern void *_dbg_strdup(void *ptr, struct lib_context *lc,
87
const char *who, unsigned int line);
88
extern void _dbg_free(void *ptr, struct lib_context *lc,
89
const char *who, unsigned int line);
91
#define dbg_malloc(size) _dbg_malloc((size), lc, __func__, __LINE__)
92
#define dbg_realloc(ptr, size) _dbg_realloc((ptr), (size), lc, \
94
#define dbg_strdup(ptr) _dbg_strdup((ptr), lc, __func__, __LINE__)
95
#define dbg_strndup(ptr, len) _dbg_strndup((ptr), len, lc, __func__, __LINE__)
96
#define dbg_free(ptr) _dbg_free((ptr), lc, __func__, __LINE__)
100
extern void *_dbg_malloc(size_t size);
101
extern void *_dbg_realloc(void *ptr, size_t size);
102
extern void *_dbg_strdup(void *ptr);
103
extern void *_dbg_strndup(void *ptr, size_t len);
104
extern void _dbg_free(void *ptr);
106
#define dbg_malloc _dbg_malloc
107
#define dbg_realloc _dbg_realloc
108
#define dbg_strdup _dbg_strdup
109
#define dbg_strndup _dbg_strndup
110
#define dbg_free _dbg_free
112
#endif /* #ifdef DEBUG_MALLOC */