1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-10-01 21:44:22 +03:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Alasdair Kergon
ed43dc842b A setgeometry implementation. [untested] 2006-02-20 23:55:58 +00:00
Alasdair Kergon
49d4db6cd2 post-release 2006-02-08 23:24:02 +00:00
Alasdair Kergon
ea80ab2cae post-release
fix dmeventd build
2006-02-08 23:23:19 +00:00
12 changed files with 96 additions and 6 deletions

View File

@@ -1 +1 @@
2.02.02-cvs (2006-02-07)
2.02.03-cvs (2006-02-08)

View File

@@ -1,3 +1,7 @@
Version 2.02.03 -
===================================
Fix dmeventd build.
Version 2.02.02 - 7th February 2006
===================================
Add %.so: %.a make template rule.

View File

@@ -1,3 +1,7 @@
Version 1.02.04 -
============================
Add setgeometry.
Version 1.02.03 - 7 Feb 2006
============================
Add exported functions to set uid, gid and mode.

View File

@@ -16,7 +16,7 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
CFLAGS += -I${top_srcdir}/tools -I${top_srcdir}/include
INCLUDES += -I${top_srcdir}/tools
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper -llvm2cmd
SOURCES = dmeventd_mirror.c
@@ -32,5 +32,5 @@ include $(top_srcdir)/make.tmpl
install: libdevmapper-event-lvm2mirror.$(LIB_SUFFIX)
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
$(libdir)/$<.$(LIB_VERSION)
$(LN_S) -f $(libdir)/$<.$(LIB_VERSION) $(libdir)/$<
$(LN_S) -f $<.$(LIB_VERSION) $(libdir)/$<

View File

@@ -16,7 +16,7 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
CFLAGS += -I${top_srcdir}/tools -I${top_srcdir}/include
INCLUDES += -I${top_srcdir}/tools
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper -llvm2cmd
SOURCES = dmeventd_mirror.c
@@ -32,5 +32,5 @@ include $(top_srcdir)/make.tmpl
install: libdevmapper-event-lvm2mirror.$(LIB_SUFFIX)
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
$(libdir)/$<.$(LIB_VERSION)
$(LN_S) -f $(libdir)/$<.$(LIB_VERSION) $(libdir)/$<
$(LN_S) -f $<.$(LIB_VERSION) $(libdir)/$<

View File

@@ -108,3 +108,4 @@ dm_hash_get_data
dm_hash_get_first
dm_hash_get_next
dm_set_selinux_context
dm_task_set_geometry

View File

@@ -116,6 +116,7 @@ static struct cmd_data _cmd_data_v1[] = {
{ "mknodes", 0, {4, 0, 0} },
{ "versions", 0, {4, 1, 0} },
{ "message", 0, {4, 2, 0} },
{ "setgeometry",0, {4, 6, 0} },
};
/* *INDENT-ON* */

View File

@@ -103,6 +103,9 @@ static struct cmd_data _cmd_data_v4[] = {
#ifdef DM_TARGET_MSG
{"message", DM_TARGET_MSG, {4, 2, 0}},
#endif
#ifdef DM_DEV_SET_GEOMETRY
{"setgeometry", DM_DEV_SET_GEOMETRY, {4, 6, 0}},
#endif
};
/* *INDENT-ON* */
@@ -1001,6 +1004,23 @@ int dm_task_set_sector(struct dm_task *dmt, uint64_t sector)
return 1;
}
int dm_task_set_geometry(struct dm_task *dmt, const char *cylinders, const char *heads, const char *sectors, const char *start)
{
size_t len = strlen(cylinders) + 1 + strlen(heads) + 1 + strlen(sectors) + 1 + strlen(start) + 1;
if (!(dmt->geometry = dm_malloc(len))) {
log_error("dm_task_set_geometry: dm_malloc failed");
return 0;
}
if (sprintf(dmt->geometry, "%s %s %s %s", cylinders, heads, sectors, start) < 0) {
log_error("dm_task_set_geometry: sprintf failed");
return 0;
}
return 1;
}
int dm_task_no_open_count(struct dm_task *dmt)
{
dmt->no_open_count = 1;
@@ -1123,11 +1143,26 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
return NULL;
}
if (count && dmt->geometry) {
log_error("targets and geometry are incompatible");
return NULL;
}
if (dmt->newname && (dmt->sector || dmt->message)) {
log_error("message and newname are incompatible");
return NULL;
}
if (dmt->newname && dmt->geometry) {
log_error("geometry and newname are incompatible");
return NULL;
}
if (dmt->geometry && (dmt->sector || dmt->message)) {
log_error("geometry and message are incompatible");
return NULL;
}
if (dmt->sector && !dmt->message) {
log_error("message is required with sector");
return NULL;
@@ -1139,6 +1174,9 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
if (dmt->message)
len += sizeof(struct dm_target_msg) + strlen(dmt->message) + 1;
if (dmt->geometry)
len += strlen(dmt->geometry) + 1;
/*
* Give len a minimum size so that we have space to store
* dependencies or status information.
@@ -1205,6 +1243,9 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
strcpy(tmsg->message, dmt->message);
}
if (dmt->geometry)
strcpy(b, dmt->geometry);
return dmi;
bad:

View File

@@ -50,6 +50,7 @@ struct dm_task {
} dmi;
char *newname;
char *message;
char *geometry;
uint64_t sector;
int no_open_count;
int skip_lockfs;

View File

@@ -80,7 +80,9 @@ enum {
DM_DEVICE_LIST_VERSIONS,
DM_DEVICE_TARGET_MSG
DM_DEVICE_TARGET_MSG,
DM_DEVICE_SET_GEOMETRY
};
struct dm_task;
@@ -145,6 +147,7 @@ int dm_task_set_uid(struct dm_task *dmt, uid_t uid);
int dm_task_set_gid(struct dm_task *dmt, gid_t gid);
int dm_task_set_mode(struct dm_task *dmt, mode_t mode);
int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr);
int dm_task_set_geometry(struct dm_task *dmt, const char *cylinders, const char *heads, const char *sectors, const char *start);
int dm_task_set_message(struct dm_task *dmt, const char *message);
int dm_task_set_sector(struct dm_task *dmt, uint64_t sector);
int dm_task_no_open_count(struct dm_task *dmt);

View File

@@ -510,3 +510,4 @@ out:
dm_task_destroy(dmt);
return r;
}

View File

@@ -508,6 +508,39 @@ static int _message(int argc, char **argv, void *data)
return r;
}
static int _setgeometry(int argc, char **argv, void *data)
{
int r = 0;
struct dm_task *dmt;
if (!(dmt = dm_task_create(DM_DEVICE_SET_GEOMETRY)))
return 0;
if (_switches[UUID_ARG] || _switches[MAJOR_ARG]) {
if (!_set_task_device(dmt, NULL, 0))
goto out;
} else {
if (!_set_task_device(dmt, argv[1], 0))
goto out;
argc--;
argv++;
}
if (!dm_task_set_geometry(dmt, argv[1], argv[2], argv[3], argv[4]))
goto out;
/* run the task */
if (!dm_task_run(dmt))
goto out;
r = 1;
out:
dm_task_destroy(dmt);
return r;
}
static int _version(int argc, char **argv, void *data)
{
char version[80];
@@ -1326,6 +1359,7 @@ static struct command _commands[] = {
{"mknodes", "[<device>]", 0, 1, _mknodes},
{"targets", "", 0, 0, _targets},
{"version", "", 0, 0, _version},
{"setgeometry", "<device> <cyl> <head> <sect> <start>", 5, 5, _setgeometry},
{NULL, NULL, 0, 0, NULL}
};