1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-14 13:34:43 +03:00

Check for libsepol.

Add some cflow & scope support.
Separate out DEFS from CFLAGS.
Remove inlines and use unique function names.
This commit is contained in:
Alasdair Kergon 2006-04-19 15:33:07 +00:00
parent d81e3d0bad
commit 8a2fc58645
48 changed files with 2316 additions and 1351 deletions

View File

@ -57,3 +57,13 @@ po.pofile: tools.pofile daemons.pofile dmeventd.pofile
pofile: po.pofile
endif
ifneq ("@CFLOW_CMD@", "")
tools.cflow: lib.cflow
cflow: tools.cflow
endif
ifneq ("@CSCOPE_CMD@", "")
cscope.out: tools
@CSCOPE_CMD@ -b -R
all: cscope.out
endif

View File

@ -1,5 +1,9 @@
Version 2.02.04 -
=================================
Check for libsepol.
Add some cflow & scope support.
Separate out DEFS from CFLAGS.
Remove inlines and use unique function names.
Version 2.02.03 - 14th April 2006
=================================

2650
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -65,6 +65,8 @@ AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PATH_PROG(CFLOW_CMD, cflow)
AC_PATH_PROG(CSCOPE_CMD, cscope)
################################################################################
dnl -- Checks for header files.
@ -150,7 +152,7 @@ AC_ARG_ENABLE(lvm1_fallback, [ --enable-lvm1_fallback Use this to fall back an
AC_MSG_RESULT($LVM1_FALLBACK)
if test x$LVM1_FALLBACK = xyes; then
CFLAGS="$CFLAGS -DLVM1_FALLBACK"
LVM_DEFS="$LVM_DEFS -DLVM1_FALLBACK"
fi
################################################################################
@ -170,7 +172,7 @@ if [[ "x$LVM1" != xnone -a "x$LVM1" != xinternal -a "x$LVM1" != xshared ]];
fi;
if test x$LVM1 = xinternal; then
CFLAGS="$CFLAGS -DLVM1_INTERNAL"
LVM_DEFS="$LVM_DEFS -DLVM1_INTERNAL"
fi
################################################################################
@ -190,7 +192,7 @@ if [[ "x$POOL" != xnone -a "x$POOL" != xinternal -a "x$POOL" != xshared ]];
fi;
if test x$POOL = xinternal; then
CFLAGS="$CFLAGS -DPOOL_INTERNAL"
LVM_DEFS="$LVM_DEFS -DPOOL_INTERNAL"
fi
################################################################################
@ -209,7 +211,7 @@ if [[ "x$CLUSTER" != xnone -a "x$CLUSTER" != xinternal -a "x$CLUSTER" != xshared
fi;
if test x$CLUSTER = xinternal; then
CFLAGS="$CFLAGS -DCLUSTER_LOCKING_INTERNAL"
LVM_DEFS="$LVM_DEFS -DCLUSTER_LOCKING_INTERNAL"
fi
################################################################################
@ -229,7 +231,7 @@ if [[ "x$SNAPSHOTS" != xnone -a "x$SNAPSHOTS" != xinternal -a "x$SNAPSHOTS" != x
fi;
if test x$SNAPSHOTS = xinternal; then
CFLAGS="$CFLAGS -DSNAPSHOT_INTERNAL"
LVM_DEFS="$LVM_DEFS -DSNAPSHOT_INTERNAL"
fi
################################################################################
@ -249,7 +251,7 @@ if [[ "x$MIRRORS" != xnone -a "x$MIRRORS" != xinternal -a "x$MIRRORS" != xshared
fi;
if test x$MIRRORS = xinternal; then
CFLAGS="$CFLAGS -DMIRRORED_INTERNAL"
LVM_DEFS="$LVM_DEFS -DMIRRORED_INTERNAL"
fi
################################################################################
@ -267,7 +269,7 @@ READLINE=$enableval, READLINE=no)
AC_MSG_RESULT($READLINE)
if test x$READLINE = xyes; then
CFLAGS="$CFLAGS -DREADLINE_SUPPORT"
LVM_DEFS="$LVM_DEFS -DREADLINE_SUPPORT"
fi
################################################################################
@ -305,6 +307,8 @@ AC_MSG_RESULT($DEBUG)
dnl -- Normally turn off optimisation for debug builds
if test x$DEBUG = xyes; then
COPTIMISE_FLAG=
else
CSCOPE_CMD=
fi
################################################################################
@ -323,7 +327,7 @@ DEVMAPPER=$enableval)
AC_MSG_RESULT($DEVMAPPER)
if test x$DEVMAPPER = xyes; then
CFLAGS="$CFLAGS -DDEVMAPPER_SUPPORT"
LVM_DEFS="$LVM_DEFS -DDEVMAPPER_SUPPORT"
fi
################################################################################
@ -334,7 +338,7 @@ ODIRECT=$enableval)
AC_MSG_RESULT($ODIRECT)
if test x$ODIRECT = xyes; then
CFLAGS="$CFLAGS -DO_DIRECT_SUPPORT"
LVM_DEFS="$LVM_DEFS -DO_DIRECT_SUPPORT"
fi
################################################################################
@ -345,7 +349,7 @@ CMDLIB=$enableval, CMDLIB=no)
AC_MSG_RESULT($CMDLIB)
if test x$CMDLIB = xyes; then
CFLAGS="$CFLAGS -DCMDLIB"
LVM_DEFS="$LVM_DEFS -DCMDLIB"
fi
################################################################################
@ -370,7 +374,7 @@ AC_MSG_ERROR(
fi
if test x$DMEVENTD = xyes; then
CFLAGS="$CFLAGS -DDMEVENTD"
LVM_DEFS="$LVM_DEFS -DDMEVENTD"
fi
################################################################################
dnl -- Mess with default exec_prefix
@ -407,7 +411,7 @@ dnl -- Check for dlopen
AC_CHECK_LIB(dl, dlopen, HAVE_LIBDL=yes, HAVE_LIBDL=no)
if [[ "x$HAVE_LIBDL" = xyes ]]; then
CFLAGS="$CFLAGS -DHAVE_LIBDL"
LVM_DEFS="$LVM_DEFS -DHAVE_LIBDL"
LIBS="-ldl $LIBS"
else
HAVE_LIBDL=no
@ -424,14 +428,22 @@ Features cannot be 'shared' when building statically
fi
################################################################################
dnl -- Check for is_selinux_enabled
dnl -- Check for selinux
if test x$SELINUX = xyes; then
AC_MSG_CHECKING(for sepol_check_context function)
AC_CHECK_LIB(sepol, sepol_check_context, HAVE_SEPOL=yes, HAVE_SEPOL=no)
AC_MSG_RESULT($HAVE_SEPOL)
if test x$HAVE_SEPOL = xyes; then
LIBS="-lsepol $LIBS"
fi
AC_MSG_CHECKING(for is_selinux_enabled function)
AC_CHECK_LIB(selinux, is_selinux_enabled, HAVE_SELINUX=yes, HAVE_SELINUX=no)
AC_MSG_RESULT($HAVE_SELINUX)
if test x$HAVE_SELINUX = xyes; then
CFLAGS="$CFLAGS -DHAVE_SELINUX"
LVM_DEFS="$LVM_DEFS -DHAVE_SELINUX"
LIBS="-lselinux $LIBS"
else
AC_MSG_WARN(Disabling selinux)
@ -440,7 +452,7 @@ fi
################################################################################
dnl -- Check for getopt
AC_CHECK_HEADERS(getopt.h, CFLAGS="$CFLAGS -DHAVE_GETOPTLONG")
AC_CHECK_HEADERS(getopt.h, LVM_DEFS="$LVM_DEFS -DHAVE_GETOPTLONG")
################################################################################
dnl -- Check for readline (Shamelessly copied from parted 1.4.17)
@ -455,7 +467,7 @@ Note: if you are using precompiled packages you will also need the development
package as well (which may be called readline-devel or something similar).
)
)
AC_CHECK_FUNC(rl_completion_matches, CFLAGS="$CFLAGS -DHAVE_RL_COMPLETION_MATCHES")
AC_CHECK_FUNC(rl_completion_matches, LVM_DEFS="$LVM_DEFS -DHAVE_RL_COMPLETION_MATCHES")
fi
@ -536,7 +548,7 @@ fi
AC_PATH_PROG(MODPROBE_CMD, modprobe)
if test x$MODPROBE_CMD != x; then
CFLAGS="$CFLAGS -DMODPROBE_CMD=\\\"$MODPROBE_CMD\\\""
LVM_DEFS="$LVM_DEFS -DMODPROBE_CMD=\\\"$MODPROBE_CMD\\\""
fi
################################################################################
@ -556,6 +568,7 @@ AC_SUBST(MIRRORS)
AC_SUBST(OWNER)
AC_SUBST(GROUP)
AC_SUBST(CFLAGS)
AC_SUBST(LVM_DEFS)
AC_SUBST(COPTIMISE_FLAG)
AC_SUBST(CLDFLAGS)
AC_SUBST(CLDWHOLEARCHIVE)
@ -581,6 +594,8 @@ AC_SUBST(CLVMD)
AC_SUBST(CLUSTER)
AC_SUBST(FSADM)
AC_SUBST(DMEVENTD)
AC_SUBST(CFLOW_CMD)
AC_SUBST(CSCOPE_CMD)
################################################################################
dnl -- First and last lines should not contain files to generate in order to

View File

@ -35,19 +35,19 @@ ifeq ("@CLVMD@", "all")
endif
ifeq ("@DEBUG@", "yes")
CFLAGS += -DDEBUG
DEFS += -DDEBUG
endif
ifeq ("$(GULM)", "yes")
SOURCES += clvmd-gulm.c tcp-comms.c
LMLIBS += -lccs -lgulm
CFLAGS += -DUSE_GULM
DEFS += -DUSE_GULM
endif
ifeq ("$(CMAN)", "yes")
SOURCES += clvmd-cman.c
LMLIBS += -ldlm -lcman
CFLAGS += -DUSE_CMAN
DEFS += -DUSE_CMAN
endif
TARGETS = \
@ -63,7 +63,8 @@ ifeq ("@DEVMAPPER@", "yes")
LVMLIBS += -ldevmapper
endif
CFLAGS += -D_REENTRANT -fno-strict-aliasing
DEFS += -D_REENTRANT
CFLAGS += -fno-strict-aliasing
include $(top_srcdir)/make.tmpl

View File

@ -41,3 +41,5 @@ install:
install_cluster:
cflow:

View File

@ -38,6 +38,7 @@ SOURCES =\
commands/toolcontext.c \
config/config.c \
datastruct/btree.c \
datastruct/list.c \
datastruct/str_list.c \
device/dev-cache.c \
device/dev-io.c \
@ -141,5 +142,14 @@ LIB_STATIC = liblvm.a
$(SUBDIRS): $(LIB_STATIC)
CLEAN_TARGETS += liblvm.cflow
include $(top_srcdir)/make.tmpl
liblvm.cflow: $(SOURCES)
set -e; (echo -n "SOURCES += "; \
echo $(SOURCES) | \
sed "s/^/ /;s/ / $(top_srcdir)\/lib\//g;s/$$//"; \
) > $@
cflow: liblvm.cflow

View File

@ -85,7 +85,7 @@ char *build_dlid(struct dev_manager *dm, const char *lvid, const char *layer)
return _build_dlid(dm->mem, lvid, layer);
}
static inline int _read_only_lv(struct logical_volume *lv)
static int _read_only_lv(struct logical_volume *lv)
{
return (!(lv->vg->status & LVM_WRITE) || !(lv->status & LVM_WRITE));
}

View File

@ -107,7 +107,7 @@ void *btree_get_data(struct btree_iter *it)
return ((struct node *) it)->data;
}
static inline struct node *_left(struct node *n)
static struct node *_left(struct node *n)
{
while (n->l)
n = n->l;

View File

@ -33,107 +33,61 @@ struct list {
* The list head's next and previous pointers point back to itself.
*/
#define LIST_INIT(name) struct list name = { &(name), &(name) }
static inline void list_init(struct list *head)
{
head->n = head->p = head;
}
void list_init(struct list *head);
/*
* Insert an element before 'head'.
* If 'head' is the list head, this adds an element to the end of the list.
*/
static inline void list_add(struct list *head, struct list *elem)
{
assert(head->n);
elem->n = head;
elem->p = head->p;
head->p->n = elem;
head->p = elem;
}
void list_add(struct list *head, struct list *elem);
/*
* Insert an element after 'head'.
* If 'head' is the list head, this adds an element to the front of the list.
*/
static inline void list_add_h(struct list *head, struct list *elem)
{
assert(head->n);
elem->n = head->n;
elem->p = head;
head->n->p = elem;
head->n = elem;
}
void list_add_h(struct list *head, struct list *elem);
/*
* Delete an element from its list.
* Note that this doesn't change the element itself - it may still be safe
* to follow its pointers.
*/
static inline void list_del(struct list *elem)
{
elem->n->p = elem->p;
elem->p->n = elem->n;
}
void list_del(struct list *elem);
/*
* Is the list empty?
*/
static inline int list_empty(struct list *head)
{
return head->n == head;
}
int list_empty(struct list *head);
/*
* Is this the first element of the list?
*/
static inline int list_start(struct list *head, struct list *elem)
{
return elem->p == head;
}
int list_start(struct list *head, struct list *elem);
/*
* Is this the last element of the list?
*/
static inline int list_end(struct list *head, struct list *elem)
{
return elem->n == head;
}
int list_end(struct list *head, struct list *elem);
/*
* Return first element of the list or NULL if empty
*/
static inline struct list *list_first(struct list *head)
{
return (list_empty(head) ? NULL : head->n);
}
struct list *list_first(struct list *head);
/*
* Return last element of the list or NULL if empty
*/
static inline struct list *list_last(struct list *head)
{
return (list_empty(head) ? NULL : head->p);
}
struct list *list_last(struct list *head);
/*
* Return the previous element of the list, or NULL if we've reached the start.
*/
static inline struct list *list_prev(struct list *head, struct list *elem)
{
return (list_start(head, elem) ? NULL : elem->p);
}
struct list *list_prev(struct list *head, struct list *elem);
/*
* Return the next element of the list, or NULL if we've reached the end.
*/
static inline struct list *list_next(struct list *head, struct list *elem)
{
return (list_end(head, elem) ? NULL : elem->n);
}
struct list *list_next(struct list *head, struct list *elem);
/*
* Given the address v of an instance of 'struct list' called 'head'
@ -244,15 +198,6 @@ static inline struct list *list_next(struct list *head, struct list *elem)
/*
* Return the number of elements in a list by walking it.
*/
static inline unsigned int list_size(const struct list *head)
{
unsigned int s = 0;
const struct list *v;
list_iterate(v, head)
s++;
return s;
}
unsigned int list_size(const struct list *head);
#endif

View File

@ -479,7 +479,7 @@ static void _check_closed(struct device *dev)
log_err("Device '%s' has been left open.", dev_name(dev));
}
static inline void _check_for_open_devices(void)
static void _check_for_open_devices(void)
{
dm_hash_iter(_cache.names, (dm_hash_iterate_fn) _check_closed);
}
@ -664,7 +664,7 @@ void dev_iter_destroy(struct dev_iter *iter)
dm_free(iter);
}
static inline struct device *_iter_next(struct dev_iter *iter)
static struct device *_iter_next(struct dev_iter *iter)
{
struct device *d = btree_get_data(iter->current);
iter->current = btree_next(iter->current);
@ -682,3 +682,14 @@ struct device *dev_iter_get(struct dev_iter *iter)
return NULL;
}
int dev_fd(struct device *dev)
{
return dev->fd;
}
const char *dev_name(const struct device *dev)
{
return (dev) ? list_item(dev->aliases.n, struct str_list)->str :
"unknown device";
}

View File

@ -74,10 +74,8 @@ int dev_close_immediate(struct device *dev);
void dev_close_all(void);
int dev_test_excl(struct device *dev);
static inline int dev_fd(struct device *dev)
{
return dev->fd;
}
int dev_fd(struct device *dev);
const char *dev_name(const struct device *dev);
int dev_read(struct device *dev, uint64_t offset, size_t len, void *buffer);
int dev_write(struct device *dev, uint64_t offset, size_t len, void *buffer);
@ -88,12 +86,6 @@ void dev_flush(struct device *dev);
struct device *dev_create_file(const char *filename, struct device *dev,
struct str_list *alias, int use_malloc);
static inline const char *dev_name(const struct device *dev)
{
return (dev) ? list_item(dev->aliases.n, struct str_list)->str :
"unknown device";
}
/* Return a valid device name from the alias list; NULL otherwise */
const char *dev_name_confirmed(struct device *dev, int quiet);

View File

@ -24,12 +24,12 @@
#include "lvm-string.h"
#include "activate.h"
static const char *_name(const struct lv_segment *seg)
static const char *_errseg_name(const struct lv_segment *seg)
{
return seg->segtype->name;
}
static int _merge_segments(struct lv_segment *seg1, struct lv_segment *seg2)
static int _errseg_merge_segments(struct lv_segment *seg1, struct lv_segment *seg2)
{
seg1->len += seg2->len;
seg1->area_len += seg2->area_len;
@ -38,7 +38,7 @@ static int _merge_segments(struct lv_segment *seg1, struct lv_segment *seg2)
}
#ifdef DEVMAPPER_SUPPORT
static int _add_target_line(struct dev_manager *dm, struct dm_pool *mem,
static int _errseg_add_target_line(struct dev_manager *dm, struct dm_pool *mem,
struct config_tree *cft, void **target_state,
struct lv_segment *seg,
struct dm_tree_node *node, uint64_t len,
@ -47,34 +47,34 @@ static int _add_target_line(struct dev_manager *dm, struct dm_pool *mem,
return dm_tree_node_add_error_target(node, len);
}
static int _target_present(void)
static int _errseg_target_present(void)
{
static int checked = 0;
static int present = 0;
static int _errseg_checked = 0;
static int _errseg_present = 0;
/* Reported truncated in older kernels */
if (!checked &&
if (!_errseg_checked &&
(target_present("error", 0) || target_present("erro", 0)))
present = 1;
_errseg_present = 1;
checked = 1;
return present;
_errseg_checked = 1;
return _errseg_present;
}
#endif
static void _destroy(const struct segment_type *segtype)
static void _errseg_destroy(const struct segment_type *segtype)
{
dm_free((void *) segtype);
}
static struct segtype_handler _error_ops = {
name:_name,
merge_segments:_merge_segments,
name:_errseg_name,
merge_segments:_errseg_merge_segments,
#ifdef DEVMAPPER_SUPPORT
add_target_line:_add_target_line,
target_present:_target_present,
add_target_line:_errseg_add_target_line,
target_present:_errseg_target_present,
#endif
destroy:_destroy,
destroy:_errseg_destroy,
};
struct segment_type *init_error_segtype(struct cmd_context *cmd)

View File

@ -33,7 +33,7 @@ static int _and_p(struct dev_filter *f, struct device *dev)
return 1;
}
static void _destroy(struct dev_filter *f)
static void _composite_destroy(struct dev_filter *f)
{
struct dev_filter **filters = (struct dev_filter **) f->private;
@ -70,7 +70,7 @@ struct dev_filter *composite_filter_create(int n, struct dev_filter **filters)
}
cft->passes_filter = _and_p;
cft->destroy = _destroy;
cft->destroy = _composite_destroy;
cft->private = filters_copy;
return cft;

View File

@ -217,7 +217,7 @@ static int _lookup_p(struct dev_filter *f, struct device *dev)
return (l == PF_BAD_DEVICE) ? 0 : 1;
}
static void _destroy(struct dev_filter *f)
static void _persistent_destroy(struct dev_filter *f)
{
struct pfilter *pf = (struct pfilter *) f->private;
@ -258,7 +258,7 @@ struct dev_filter *persistent_filter_create(struct dev_filter *real,
}
f->passes_filter = _lookup_p;
f->destroy = _destroy;
f->destroy = _persistent_destroy;
f->private = pf;
return f;

View File

@ -191,7 +191,7 @@ static int _accept_p(struct dev_filter *f, struct device *dev)
return !rejected;
}
static void _destroy(struct dev_filter *f)
static void _regex_destroy(struct dev_filter *f)
{
struct rfilter *rf = (struct rfilter *) f->private;
dm_pool_destroy(rf->mem);
@ -226,7 +226,7 @@ struct dev_filter *regex_filter_create(struct config_value *patterns)
}
f->passes_filter = _accept_p;
f->destroy = _destroy;
f->destroy = _regex_destroy;
f->private = rf;
return f;

View File

@ -88,7 +88,7 @@ static struct dev_set *_dev_set_create(struct dm_pool *mem, const char *sys_bloc
return ds;
}
static inline unsigned _hash_dev(dev_t dev)
static unsigned _hash_dev(dev_t dev)
{
return (major(dev) ^ minor(dev)) & (SET_BUCKETS - 1);
}

View File

@ -269,7 +269,7 @@ static int _read_uuids(struct disk_list *data)
return 1;
}
static inline int _check_lvd(struct lv_disk *lvd)
static int _check_lvd(struct lv_disk *lvd)
{
return !(lvd->lv_name[0] == '\0');
}

View File

@ -173,7 +173,7 @@ static struct volume_group *_build_vg(struct format_instance *fid,
return NULL;
}
static struct volume_group *_vg_read(struct format_instance *fid,
static struct volume_group *_format1_vg_read(struct format_instance *fid,
const char *vg_name,
struct metadata_area *mda)
{
@ -264,7 +264,7 @@ static int _flatten_vg(struct format_instance *fid, struct dm_pool *mem,
return 1;
}
static int _vg_write(struct format_instance *fid, struct volume_group *vg,
static int _format1_vg_write(struct format_instance *fid, struct volume_group *vg,
struct metadata_area *mda)
{
struct dm_pool *mem = dm_pool_create("lvm1 vg_write", 1024 * 10);
@ -287,7 +287,7 @@ static int _vg_write(struct format_instance *fid, struct volume_group *vg,
return r;
}
static int _pv_read(const struct format_type *fmt, const char *pv_name,
static int _format1_pv_read(const struct format_type *fmt, const char *pv_name,
struct physical_volume *pv, struct list *mdas)
{
struct dm_pool *mem = dm_pool_create("lvm1 pv_read", 1024);
@ -326,7 +326,7 @@ static int _pv_read(const struct format_type *fmt, const char *pv_name,
return r;
}
static int _pv_setup(const struct format_type *fmt,
static int _format1_pv_setup(const struct format_type *fmt,
uint64_t pe_start, uint32_t extent_count,
uint32_t extent_size,
int pvmetadatacopies,
@ -364,7 +364,7 @@ static int _pv_setup(const struct format_type *fmt,
return 1;
}
static int _lv_setup(struct format_instance *fid, struct logical_volume *lv)
static int _format1_lv_setup(struct format_instance *fid, struct logical_volume *lv)
{
uint64_t max_size = UINT_MAX;
@ -386,7 +386,7 @@ static int _lv_setup(struct format_instance *fid, struct logical_volume *lv)
return 1;
}
static int _pv_write(const struct format_type *fmt, struct physical_volume *pv,
static int _format1_pv_write(const struct format_type *fmt, struct physical_volume *pv,
struct list *mdas, int64_t sector)
{
struct dm_pool *mem;
@ -449,7 +449,7 @@ static int _pv_write(const struct format_type *fmt, struct physical_volume *pv,
return 0;
}
static int _vg_setup(struct format_instance *fid, struct volume_group *vg)
static int _format1_vg_setup(struct format_instance *fid, struct volume_group *vg)
{
/* just check max_pv and max_lv */
if (!vg->max_lv || vg->max_lv >= MAX_LV)
@ -484,7 +484,7 @@ static int _vg_setup(struct format_instance *fid, struct volume_group *vg)
return 1;
}
static int _segtype_supported (struct format_instance *fid,
static int _format1_segtype_supported(struct format_instance *fid,
struct segment_type *segtype)
{
if (!(segtype->flags & SEG_FORMAT1_SUPPORT)) {
@ -496,11 +496,11 @@ static int _segtype_supported (struct format_instance *fid,
}
static struct metadata_area_ops _metadata_format1_ops = {
vg_read:_vg_read,
vg_write:_vg_write,
vg_read:_format1_vg_read,
vg_write:_format1_vg_write,
};
static struct format_instance *_create_instance(const struct format_type *fmt,
static struct format_instance *_format1_create_instance(const struct format_type *fmt,
const char *vgname,
const char *vgid,
void *private)
@ -530,26 +530,26 @@ static struct format_instance *_create_instance(const struct format_type *fmt,
return fid;
}
static void _destroy_instance(struct format_instance *fid)
static void _format1_destroy_instance(struct format_instance *fid)
{
return;
}
static void _destroy(const struct format_type *fmt)
static void _format1_destroy(const struct format_type *fmt)
{
dm_free((void *) fmt);
}
static struct format_handler _format1_ops = {
pv_read:_pv_read,
pv_setup:_pv_setup,
pv_write:_pv_write,
lv_setup:_lv_setup,
vg_setup:_vg_setup,
segtype_supported:_segtype_supported,
create_instance:_create_instance,
destroy_instance:_destroy_instance,
destroy:_destroy,
pv_read:_format1_pv_read,
pv_setup:_format1_pv_setup,
pv_write:_format1_pv_write,
lv_setup:_format1_lv_setup,
vg_setup:_format1_vg_setup,
segtype_supported:_format1_segtype_supported,
create_instance:_format1_create_instance,
destroy_instance:_format1_destroy_instance,
destroy:_format1_destroy,
};
#ifdef LVM1_INTERNAL

View File

@ -19,16 +19,18 @@
/*
* Only works with powers of 2.
*/
static inline uint32_t _round_up(uint32_t n, uint32_t size)
static uint32_t _round_up(uint32_t n, uint32_t size)
{
size--;
return (n + size) & ~size;
}
static inline uint32_t _div_up(uint32_t n, uint32_t size)
/* Unused.
static uint32_t _div_up(uint32_t n, uint32_t size)
{
return _round_up(n, size) / size;
}
*/
/*
* Each chunk of metadata should be aligned to

View File

@ -30,7 +30,7 @@ static void _not_supported(const char *op)
op);
}
static int _can_handle(struct labeller *l, char *buf, uint64_t sector)
static int _lvm1_can_handle(struct labeller *l, char *buf, uint64_t sector)
{
struct pv_disk *pvd = (struct pv_disk *) buf;
uint32_t version;
@ -48,13 +48,13 @@ static int _can_handle(struct labeller *l, char *buf, uint64_t sector)
return 0;
}
static int _write(struct label *label, char *buf)
static int _lvm1_write(struct label *label, char *buf)
{
_not_supported("write");
return 0;
}
static int _read(struct labeller *l, struct device *dev, char *buf,
static int _lvm1_read(struct labeller *l, struct device *dev, char *buf,
struct label **label)
{
struct pv_disk *pvd = (struct pv_disk *) buf;
@ -85,31 +85,31 @@ static int _read(struct labeller *l, struct device *dev, char *buf,
return 1;
}
static int _initialise_label(struct labeller *l, struct label *label)
static int _lvm1_initialise_label(struct labeller *l, struct label *label)
{
strcpy(label->type, "LVM1");
return 1;
}
static void _destroy_label(struct labeller *l, struct label *label)
static void _lvm1_destroy_label(struct labeller *l, struct label *label)
{
return;
}
static void _destroy(struct labeller *l)
static void _lvm1_destroy(struct labeller *l)
{
dm_free(l);
}
struct label_ops _lvm1_ops = {
can_handle:_can_handle,
write:_write,
read:_read,
verify:_can_handle,
initialise_label:_initialise_label,
destroy_label:_destroy_label,
destroy:_destroy
can_handle:_lvm1_can_handle,
write:_lvm1_write,
read:_lvm1_read,
verify:_lvm1_can_handle,
initialise_label:_lvm1_initialise_label,
destroy_label:_lvm1_destroy_label,
destroy:_lvm1_destroy
};
struct labeller *lvm1_labeller_create(struct format_type *fmt)

View File

@ -169,7 +169,7 @@ static struct volume_group *_build_vg_from_pds(struct format_instance
return vg;
}
static struct volume_group *_vg_read(struct format_instance *fid,
static struct volume_group *_pool_vg_read(struct format_instance *fid,
const char *vg_name,
struct metadata_area *mda)
{
@ -206,7 +206,7 @@ static struct volume_group *_vg_read(struct format_instance *fid,
return vg;
}
static int _pv_setup(const struct format_type *fmt,
static int _pool_pv_setup(const struct format_type *fmt,
uint64_t pe_start, uint32_t extent_count,
uint32_t extent_size,
int pvmetadatacopies,
@ -216,7 +216,7 @@ static int _pv_setup(const struct format_type *fmt,
return 1;
}
static int _pv_read(const struct format_type *fmt, const char *pv_name,
static int _pool_pv_read(const struct format_type *fmt, const char *pv_name,
struct physical_volume *pv, struct list *mdas)
{
struct dm_pool *mem = dm_pool_create("pool pv_read", 1024);
@ -262,11 +262,11 @@ static int _pv_read(const struct format_type *fmt, const char *pv_name,
/* *INDENT-OFF* */
static struct metadata_area_ops _metadata_format_pool_ops = {
vg_read:_vg_read,
vg_read:_pool_vg_read,
};
/* *INDENT-ON* */
static struct format_instance *_create_instance(const struct format_type *fmt,
static struct format_instance *_pool_create_instance(const struct format_type *fmt,
const char *vgname,
const char *vgid,
void *private)
@ -298,23 +298,23 @@ static struct format_instance *_create_instance(const struct format_type *fmt,
return fid;
}
static void _destroy_instance(struct format_instance *fid)
static void _pool_destroy_instance(struct format_instance *fid)
{
return;
}
static void _destroy(const struct format_type *fmt)
static void _pool_destroy(const struct format_type *fmt)
{
dm_free((void *) fmt);
}
/* *INDENT-OFF* */
static struct format_handler _format_pool_ops = {
pv_read:_pv_read,
pv_setup:_pv_setup,
create_instance:_create_instance,
destroy_instance:_destroy_instance,
destroy:_destroy,
pv_read:_pool_pv_read,
pv_setup:_pool_pv_setup,
create_instance:_pool_create_instance,
destroy_instance:_pool_destroy_instance,
destroy:_pool_destroy,
};
/* *INDENT-ON */

View File

@ -23,13 +23,13 @@
#include <sys/stat.h>
#include <fcntl.h>
static void _not_supported(const char *op)
static void _pool_not_supported(const char *op)
{
log_error("The '%s' operation is not supported for the pool labeller.",
op);
}
static int _can_handle(struct labeller *l, char *buf, uint64_t sector)
static int _pool_can_handle(struct labeller *l, char *buf, uint64_t sector)
{
struct pool_disk pd;
@ -50,13 +50,13 @@ static int _can_handle(struct labeller *l, char *buf, uint64_t sector)
return 0;
}
static int _write(struct label *label, char *buf)
static int _pool_write(struct label *label, char *buf)
{
_not_supported("write");
_pool_not_supported("write");
return 0;
}
static int _read(struct labeller *l, struct device *dev, char *buf,
static int _pool_read(struct labeller *l, struct device *dev, char *buf,
struct label **label)
{
struct pool_list pl;
@ -64,31 +64,31 @@ static int _read(struct labeller *l, struct device *dev, char *buf,
return read_pool_label(&pl, l, dev, buf, label);
}
static int _initialise_label(struct labeller *l, struct label *label)
static int _pool_initialise_label(struct labeller *l, struct label *label)
{
strcpy(label->type, "POOL");
return 1;
}
static void _destroy_label(struct labeller *l, struct label *label)
static void _pool_destroy_label(struct labeller *l, struct label *label)
{
return;
}
static void _destroy(struct labeller *l)
static void _label_pool_destroy(struct labeller *l)
{
dm_free(l);
}
struct label_ops _pool_ops = {
can_handle:_can_handle,
write:_write,
read:_read,
verify:_can_handle,
initialise_label:_initialise_label,
destroy_label:_destroy_label,
destroy:_destroy
can_handle:_pool_can_handle,
write:_pool_write,
read:_pool_read,
verify:_pool_can_handle,
initialise_label:_pool_initialise_label,
destroy_label:_pool_destroy_label,
destroy:_label_pool_destroy
};
struct labeller *pool_labeller_create(struct format_type *fmt)

View File

@ -87,7 +87,7 @@ static int _split_vg(const char *filename, char *vgname, size_t vg_size,
return 1;
}
static void _insert_file(struct list *head, struct archive_file *b)
static void _insert_archive_file(struct list *head, struct archive_file *b)
{
struct archive_file *bf = NULL;
@ -107,7 +107,7 @@ static void _insert_file(struct list *head, struct archive_file *b)
list_add_h(&bf->list, &b->list);
}
static char *_join(struct dm_pool *mem, const char *dir, const char *name)
static char *_join_file_to_dir(struct dm_pool *mem, const char *dir, const char *name)
{
if (!dm_pool_begin_object(mem, 32) ||
!dm_pool_grow_object(mem, dir, strlen(dir)) ||
@ -161,7 +161,7 @@ static struct list *_scan_archive(struct dm_pool *mem,
if (strcmp(vgname, vgname_found))
continue;
if (!(path = _join(mem, dir, dirent[i]->d_name))) {
if (!(path = _join_file_to_dir(mem, dir, dirent[i]->d_name))) {
stack;
goto out;
}
@ -181,7 +181,7 @@ static struct list *_scan_archive(struct dm_pool *mem,
/*
* Insert it to the correct part of the list.
*/
_insert_file(results, af);
_insert_archive_file(results, af);
}
out:
@ -360,7 +360,7 @@ int backup_list(struct cmd_context *cmd, const char *dir, const char *vgname)
{
struct archive_file af;
if (!(af.path = _join(cmd->mem, dir, vgname))) {
if (!(af.path = _join_file_to_dir(cmd->mem, dir, vgname))) {
stack;
return 0;
}

View File

@ -354,8 +354,7 @@ static int _print_vg(struct formatter *f, struct volume_group *vg)
* Get the pv%d name from the formatters hash
* table.
*/
static inline const char *_get_pv_name(struct formatter *f,
struct physical_volume *pv)
static const char *_get_pv_name(struct formatter *f, struct physical_volume *pv)
{
return (pv) ? (const char *)
dm_hash_lookup(f->pv_names, dev_name(pv->dev)) : "Missing";

View File

@ -39,7 +39,7 @@
#define FMT_TEXT_NAME "lvm2"
#define FMT_TEXT_ALIAS "text"
static struct format_instance *_create_text_instance(const struct format_type
static struct format_instance *_text_create_text_instance(const struct format_type
*fmt, const char *vgname,
const char *vgid,
void *context);
@ -69,7 +69,7 @@ struct text_context {
* NOTE: Currently there can be only one vg per text file.
*/
static int _vg_setup(struct format_instance *fid, struct volume_group *vg)
static int _text_vg_setup(struct format_instance *fid, struct volume_group *vg)
{
if (vg->extent_size & (vg->extent_size - 1)) {
log_error("Extent size must be power of 2");
@ -79,7 +79,7 @@ static int _vg_setup(struct format_instance *fid, struct volume_group *vg)
return 1;
}
static int _lv_setup(struct format_instance *fid, struct logical_volume *lv)
static int _text_lv_setup(struct format_instance *fid, struct logical_volume *lv)
{
/******** FIXME Any LV size restriction?
uint64_t max_size = UINT_MAX;
@ -859,7 +859,7 @@ static int _scan_file(const struct format_type *fmt)
}
/* FIXME stat file to see if it's changed */
fid = _create_text_instance(fmt, NULL, NULL,
fid = _text_create_text_instance(fmt, NULL, NULL,
NULL);
if ((vg = _vg_read_file_name(fid, vgname,
path)))
@ -979,7 +979,7 @@ static int _scan_raw(const struct format_type *fmt)
return 1;
}
static int _scan(const struct format_type *fmt)
static int _text_scan(const struct format_type *fmt)
{
return (_scan_file(fmt) & _scan_raw(fmt));
}
@ -1125,7 +1125,7 @@ static int _mda_setup(const struct format_type *fmt,
/* Only for orphans */
/* Set label_sector to -1 if rewriting existing label into same sector */
static int _pv_write(const struct format_type *fmt, struct physical_volume *pv,
static int _text_pv_write(const struct format_type *fmt, struct physical_volume *pv,
struct list *mdas, int64_t label_sector)
{
struct label *label;
@ -1250,7 +1250,7 @@ static int _add_raw(struct list *raw_list, struct device_area *dev_area)
return 1;
}
static int _pv_read(const struct format_type *fmt, const char *pv_name,
static int _text_pv_read(const struct format_type *fmt, const char *pv_name,
struct physical_volume *pv, struct list *mdas)
{
struct label *label;
@ -1332,7 +1332,7 @@ static int _pv_read(const struct format_type *fmt, const char *pv_name,
return 1;
}
static void _destroy_instance(struct format_instance *fid)
static void _text_destroy_instance(struct format_instance *fid)
{
return;
}
@ -1357,7 +1357,7 @@ static void _free_raws(struct list *raw_list)
}
}
static void _destroy(const struct format_type *fmt)
static void _text_destroy(const struct format_type *fmt)
{
if (fmt->private) {
_free_dirs(&((struct mda_lists *) fmt->private)->dirs);
@ -1394,7 +1394,7 @@ static struct metadata_area_ops _metadata_text_raw_ops = {
};
/* pvmetadatasize in sectors */
static int _pv_setup(const struct format_type *fmt,
static int _text_pv_setup(const struct format_type *fmt,
uint64_t pe_start, uint32_t extent_count,
uint32_t extent_size,
int pvmetadatacopies,
@ -1411,7 +1411,7 @@ static int _pv_setup(const struct format_type *fmt,
/* FIXME if vg, adjust start/end of pe area to avoid mdas! */
/* FIXME Cope with pvchange */
/* FIXME Merge code with _create_text_instance */
/* FIXME Merge code with _text_create_text_instance */
/* If new vg, add any further mdas on this PV to the fid's mda list */
if (vg) {
@ -1479,7 +1479,7 @@ static int _pv_setup(const struct format_type *fmt,
}
/* NULL vgname means use only the supplied context e.g. an archive file */
static struct format_instance *_create_text_instance(const struct format_type
static struct format_instance *_text_create_text_instance(const struct format_type
*fmt, const char *vgname,
const char *vgid,
void *context)
@ -1649,15 +1649,15 @@ void *create_text_context(struct cmd_context *cmd, const char *path,
}
static struct format_handler _text_handler = {
scan:_scan,
pv_read:_pv_read,
pv_setup:_pv_setup,
pv_write:_pv_write,
vg_setup:_vg_setup,
lv_setup:_lv_setup,
create_instance:_create_text_instance,
destroy_instance:_destroy_instance,
destroy:_destroy
scan:_text_scan,
pv_read:_text_pv_read,
pv_setup:_text_pv_setup,
pv_write:_text_pv_write,
vg_setup:_text_vg_setup,
lv_setup:_text_lv_setup,
create_instance:_text_create_text_instance,
destroy_instance:_text_destroy_instance,
destroy:_text_destroy
};
static int _add_dir(const char *dir, struct list *dir_list)

View File

@ -35,12 +35,12 @@ const char *text_vgname_import(const struct format_type *fmt,
struct text_vg_ve