From 8563ab03045e74fb99efc0745562744cb361960b Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Tue, 29 Apr 2003 11:34:23 +0000 Subject: [PATCH] Event number support. --- libdm/.export.sym | 1 + libdm/ioctl/libdevmapper.c | 10 ++++++++++ libdm/ioctl/libdm-targets.h | 1 + libdm/libdevmapper.h | 2 ++ 4 files changed, 14 insertions(+) diff --git a/libdm/.export.sym b/libdm/.export.sym index ed14d5a12..07ce90884 100644 --- a/libdm/.export.sym +++ b/libdm/.export.sym @@ -13,6 +13,7 @@ Base { dm_task_get_uuid; dm_task_set_ro; dm_task_set_newname; + dm_task_set_event_nr; dm_task_set_major; dm_task_set_minor; dm_task_add_target; diff --git a/libdm/ioctl/libdevmapper.c b/libdm/ioctl/libdevmapper.c index 7d3ebc8cf..367c21433 100644 --- a/libdm/ioctl/libdevmapper.c +++ b/libdm/ioctl/libdevmapper.c @@ -128,6 +128,7 @@ static int _dm_task_get_info_v1(struct dm_task *dmt, struct dm_info *info) info->read_only = dmt->dmi.v1->flags & DM_READONLY_FLAG ? 1 : 0; info->target_count = dmt->dmi.v1->target_count; info->open_count = dmt->dmi.v1->open_count; + info->event_nr = 0; info->major = MAJOR(dmt->dmi.v1->dev); info->minor = MINOR(dmt->dmi.v1->dev); @@ -513,6 +514,7 @@ int dm_task_get_info(struct dm_task *dmt, struct dm_info *info) info->read_only = dmt->dmi.v3->flags & DM_READONLY_FLAG ? 1 : 0; info->target_count = dmt->dmi.v3->target_count; info->open_count = dmt->dmi.v3->open_count; + info->event_nr = dmt->dmi.v3->event_nr; info->major = MAJOR(dmt->dmi.v3->dev); info->minor = MINOR(dmt->dmi.v3->dev); @@ -552,6 +554,13 @@ int dm_task_set_newname(struct dm_task *dmt, const char *newname) return 1; } +int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr) +{ + dmt->event_nr = event_nr; + + return 1; +} + struct target *create_target(uint64_t start, uint64_t len, const char *type, const char *params) { @@ -691,6 +700,7 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt) strncpy(dmi->uuid, dmt->uuid, sizeof(dmi->uuid)); dmi->target_count = count; + dmi->event_nr = dmt->event_nr; b = (void *) (dmi + 1); e = (void *) ((char *) dmi + len); diff --git a/libdm/ioctl/libdm-targets.h b/libdm/ioctl/libdm-targets.h index 96f25c402..8c42aa408 100644 --- a/libdm/ioctl/libdm-targets.h +++ b/libdm/ioctl/libdm-targets.h @@ -28,6 +28,7 @@ struct dm_task { struct target *head, *tail; int read_only; + uint32_t event_nr; int major; int minor; union { diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h index 1a865c456..a9148d490 100644 --- a/libdm/libdevmapper.h +++ b/libdm/libdevmapper.h @@ -66,6 +66,7 @@ struct dm_info { int exists; int suspended; int32_t open_count; + uint32_t event_nr; uint32_t major; uint32_t minor; /* minor device number */ int read_only; /* 0:read-write; 1:read-only */ @@ -90,6 +91,7 @@ int dm_task_set_ro(struct dm_task *dmt); int dm_task_set_newname(struct dm_task *dmt, const char *newname); int dm_task_set_minor(struct dm_task *dmt, int minor); int dm_task_set_major(struct dm_task *dmt, int major); +int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr); /* * Use these to prepare for a create or reload.