mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Add option to compile without ioctl for testing.
This commit is contained in:
parent
4608bcdccf
commit
3d2aecf0ae
@ -1,5 +1,6 @@
|
||||
Version 1.01.01 -
|
||||
=============================
|
||||
Add option to compile without ioctl for testing.
|
||||
Fix DM_LIB_VERSION sed.
|
||||
|
||||
Version 1.01.00 - 17 Jan 2005
|
||||
|
@ -22,7 +22,12 @@ SOURCES = libdm-common.c libdm-file.c $(interface)/libdm-iface.c
|
||||
INCLUDES = -I$(interface)
|
||||
|
||||
LIB_STATIC = $(interface)/libdevmapper.a
|
||||
|
||||
ifeq ("@LIB_SUFFIX@","dylib")
|
||||
LIB_SHARED = $(interface)/libdevmapper.dylib
|
||||
else
|
||||
LIB_SHARED = $(interface)/libdevmapper.so
|
||||
endif
|
||||
|
||||
CFLAGS += -DDEVICE_UID=@DEVICE_UID@ -DDEVICE_GID=@DEVICE_GID@ \
|
||||
-DDEVICE_MODE=@DEVICE_MODE@
|
||||
@ -41,7 +46,8 @@ endif
|
||||
install: $(INSTALL_TYPE)
|
||||
|
||||
install_dynamic: install_@interface@
|
||||
$(LN_S) -f libdevmapper.so.$(LIB_VERSION) $(libdir)/libdevmapper.so
|
||||
$(LN_S) -f libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION) \
|
||||
$(libdir)/libdevmapper.$(LIB_SUFFIX)
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 444 libdevmapper.h \
|
||||
$(includedir)/libdevmapper.h
|
||||
|
||||
@ -50,13 +56,13 @@ install_static: install_@interface@_static
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 444 libdevmapper.h \
|
||||
$(includedir)/libdevmapper.h
|
||||
|
||||
install_fs: fs/libdevmapper.so
|
||||
install_fs: fs/libdevmapper.$(LIB_SUFFIX)
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
|
||||
$(libdir)/libdevmapper.so.$(LIB_VERSION)
|
||||
$(libdir)/libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION)
|
||||
|
||||
install_ioctl: ioctl/libdevmapper.so
|
||||
install_ioctl: ioctl/libdevmapper.$(LIB_SUFFIX)
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
|
||||
$(libdir)/libdevmapper.so.$(LIB_VERSION)
|
||||
$(libdir)/libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION)
|
||||
|
||||
install_ioctl_static: ioctl/libdevmapper.a
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
|
||||
|
@ -30,13 +30,14 @@
|
||||
#ifdef linux
|
||||
# include "kdev_t.h"
|
||||
# include <linux/limits.h>
|
||||
# include <linux/dm-ioctl.h>
|
||||
#else
|
||||
# define MAJOR(x) major((x))
|
||||
# define MINOR(x) minor((x))
|
||||
# define MKDEV(x,y) makedev((x),(y))
|
||||
#endif
|
||||
|
||||
#include <linux/dm-ioctl.h>
|
||||
|
||||
/*
|
||||
* Ensure build compatibility.
|
||||
* The hard-coded versions here are the highest present
|
||||
@ -228,6 +229,7 @@ static int _create_control(const char *control, uint32_t major, uint32_t minor)
|
||||
|
||||
static int _open_control(void)
|
||||
{
|
||||
#ifdef DM_IOCTLS
|
||||
char control[PATH_MAX];
|
||||
uint32_t major = 0, minor;
|
||||
|
||||
@ -253,6 +255,9 @@ static int _open_control(void)
|
||||
error:
|
||||
log_error("Failure to communicate with kernel device-mapper driver.");
|
||||
return 0;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
void dm_task_destroy(struct dm_task *dmt)
|
||||
@ -608,7 +613,9 @@ static int _dm_task_run_v1(struct dm_task *dmt)
|
||||
if (dmt->type == DM_DEVICE_LIST) {
|
||||
if (!_dm_names_v1(dmi))
|
||||
goto bad;
|
||||
} else if (ioctl(_control_fd, command, dmi) < 0) {
|
||||
}
|
||||
#ifdef DM_IOCTLS
|
||||
else if (ioctl(_control_fd, command, dmi) < 0) {
|
||||
if (_log_suppress)
|
||||
log_verbose("device-mapper ioctl cmd %d failed: %s",
|
||||
_IOC_NR(command), strerror(errno));
|
||||
@ -617,6 +624,8 @@ static int _dm_task_run_v1(struct dm_task *dmt)
|
||||
_IOC_NR(command), strerror(errno));
|
||||
goto bad;
|
||||
}
|
||||
#else /* Userspace alternative for testing */
|
||||
#endif
|
||||
|
||||
if (dmi->flags & DM_BUFFER_FULL_FLAG)
|
||||
/* FIXME Increase buffer size and retry operation (if query) */
|
||||
@ -1313,22 +1322,26 @@ int dm_task_run(struct dm_task *dmt)
|
||||
dmi->name, dmi->uuid, dmt->newname ? dmt->newname : "",
|
||||
dmt->no_open_count ? 'N' : 'O',
|
||||
dmt->sector, dmt->message ? dmt->message : "");
|
||||
#ifdef DM_IOCTLS
|
||||
if (ioctl(_control_fd, command, dmi) < 0) {
|
||||
if (errno == ENXIO && ((dmt->type == DM_DEVICE_INFO) ||
|
||||
(dmt->type == DM_DEVICE_MKNODES))) {
|
||||
(dmt->type == DM_DEVICE_MKNODES)))
|
||||
dmi->flags &= ~DM_EXISTS_FLAG; /* FIXME */
|
||||
goto ignore_error;
|
||||
}
|
||||
else {
|
||||
if (_log_suppress)
|
||||
log_verbose("device-mapper ioctl cmd %d failed: %s",
|
||||
log_verbose("device-mapper ioctl "
|
||||
"cmd %d failed: %s",
|
||||
_IOC_NR(command), strerror(errno));
|
||||
else
|
||||
log_error("device-mapper ioctl cmd %d failed: %s",
|
||||
log_error("device-mapper ioctl "
|
||||
"cmd %d failed: %s",
|
||||
_IOC_NR(command), strerror(errno));
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
#else /* Userspace alternative for testing */
|
||||
#endif
|
||||
|
||||
ignore_error:
|
||||
switch (dmt->type) {
|
||||
case DM_DEVICE_CREATE:
|
||||
add_dev_node(dmt->dev_name, MAJOR(dmi->dev), MINOR(dmi->dev),
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <linux/dm-ioctl.h>
|
||||
|
||||
#ifdef HAVE_SELINUX
|
||||
|
@ -19,7 +19,10 @@
|
||||
#include <sys/file.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#ifdef linux
|
||||
# include <malloc.h>
|
||||
#endif
|
||||
|
||||
static int _create_dir_recursive(const char *dir)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user