diff -Naur linux-2.5.71/drivers/md/dm-ioctl.c linux-2.5.71-evms-2.0.1/drivers/md/dm-ioctl.c --- linux-2.5.71/drivers/md/dm-ioctl.c 2003-06-16 09:48:19.000000000 -0500 +++ linux-2.5.71-evms-2.0.1/drivers/md/dm-ioctl.c 2003-06-16 09:47:29.000000000 -0500 @@ -399,7 +399,7 @@ * Round up the ptr to the next 'align' boundary. Obviously * 'align' must be a power of 2. */ -static inline void *align_ptr(void *ptr, unsigned int align) +static inline void *align_ptr(void *ptr, unsigned long align) { align--; return (void *) (((unsigned long) (ptr + align)) & ~align); @@ -884,7 +884,16 @@ return -ENXIO; } + if (param->flags & DM_SUSPEND_FLAG) { + dm_suspend(md); + } + r = dm_swap_table(md, t); + + if (param->flags & DM_SUSPEND_FLAG) { + dm_resume(md); + } + if (r) { dm_put(md); dm_table_put(t); diff -Naur linux-2.5.71/drivers/md/dm-table.c linux-2.5.71-evms-2.0.1/drivers/md/dm-table.c --- linux-2.5.71/drivers/md/dm-table.c 2003-06-16 09:48:19.000000000 -0500 +++ linux-2.5.71-evms-2.0.1/drivers/md/dm-table.c 2003-06-16 09:47:29.000000000 -0500 @@ -746,7 +746,7 @@ q->seg_boundary_mask = t->limits.seg_boundary_mask; } -unsigned int dm_table_get_num_targets(struct dm_table *t) +int dm_table_get_num_targets(struct dm_table *t) { return t->num_targets; } diff -Naur linux-2.5.71/drivers/md/dm.h linux-2.5.71-evms-2.0.1/drivers/md/dm.h --- linux-2.5.71/drivers/md/dm.h 2003-06-16 09:48:18.000000000 -0500 +++ linux-2.5.71-evms-2.0.1/drivers/md/dm.h 2003-06-16 09:47:29.000000000 -0500 @@ -100,7 +100,7 @@ struct dm_target *dm_table_get_target(struct dm_table *t, unsigned int index); struct dm_target *dm_table_find_target(struct dm_table *t, sector_t sector); void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q); -unsigned int dm_table_get_num_targets(struct dm_table *t); +int dm_table_get_num_targets(struct dm_table *t); struct list_head *dm_table_get_devices(struct dm_table *t); int dm_table_get_mode(struct dm_table *t); void dm_table_add_wait_queue(struct dm_table *t, wait_queue_t *wq); diff -Naur linux-2.5.71/include/linux/dm-ioctl.h linux-2.5.71-evms-2.0.1/include/linux/dm-ioctl.h --- linux-2.5.71/include/linux/dm-ioctl.h 2003-06-16 09:48:19.000000000 -0500 +++ linux-2.5.71-evms-2.0.1/include/linux/dm-ioctl.h 2003-06-16 09:47:47.000000000 -0500 @@ -46,11 +46,11 @@ uint32_t data_start; /* offset to start of data * relative to start of this struct */ - uint32_t target_count; /* in/out */ - uint32_t open_count; /* out */ + int32_t target_count; /* in/out */ + int32_t open_count; /* out */ uint32_t flags; /* in/out */ - __kernel_dev_t dev; /* in/out */ + uint64_t dev; /* in/out */ char name[DM_NAME_LEN]; /* device name */ char uuid[DM_UUID_LEN]; /* unique identifier for @@ -62,9 +62,9 @@ * dm_ioctl. */ struct dm_target_spec { - int32_t status; /* used when reading from kernel only */ uint64_t sector_start; - uint32_t length; + uint64_t length; + int32_t status; /* used when reading from kernel only */ /* * Offset in bytes (from the start of this struct) to @@ -85,9 +85,9 @@ * Used to retrieve the target dependencies. */ struct dm_target_deps { - uint32_t count; - - __kernel_dev_t dev[0]; /* out */ + uint32_t count; /* Array size */ + uint32_t padding; /* unused */ + uint64_t dev[0]; /* out */ }; /* @@ -129,10 +129,10 @@ #define DM_TARGET_STATUS _IOWR(DM_IOCTL, DM_TARGET_STATUS_CMD, struct dm_ioctl) #define DM_TARGET_WAIT _IOWR(DM_IOCTL, DM_TARGET_WAIT_CMD, struct dm_ioctl) -#define DM_VERSION_MAJOR 1 +#define DM_VERSION_MAJOR 3 #define DM_VERSION_MINOR 0 -#define DM_VERSION_PATCHLEVEL 6 -#define DM_VERSION_EXTRA "-ioctl (2002-10-15)" +#define DM_VERSION_PATCHLEVEL 0 +#define DM_VERSION_EXTRA "-ioctl (2003-03-28)" /* Status bits */ #define DM_READONLY_FLAG 0x00000001 --- diff/drivers/md/dm-ioctl.c 2003-06-11 10:31:17.000000000 +0100 +++ source/drivers/md/dm-ioctl.c 2003-06-11 10:32:11.000000000 +0100 @@ -560,7 +560,6 @@ int r; struct dm_table *t; struct mapped_device *md; - unsigned int minor = 0; r = check_name(param->name); if (r) @@ -577,9 +576,10 @@ } if (param->flags & DM_PERSISTENT_DEV_FLAG) - minor = minor(to_kdev_t(param->dev)); + r = dm_create_with_minor(minor(to_kdev_t(param->dev)), t, &md); + else + r = dm_create(t, &md); - r = dm_create(minor, t, &md); if (r) { dm_table_put(t); return r; --- diff/drivers/md/dm.c 2003-06-11 10:31:41.000000000 +0100 +++ source/drivers/md/dm.c 2003-06-11 10:32:54.000000000 +0100 @@ -569,7 +569,7 @@ /* * Allocate and initialise a blank device with a given minor. */ -static struct mapped_device *alloc_dev(unsigned int minor) +static struct mapped_device *alloc_dev(unsigned int minor, int persistent) { int r; struct mapped_device *md = kmalloc(sizeof(*md), GFP_KERNEL); @@ -580,7 +580,7 @@ } /* get a minor number for the dev */ - r = (minor < 0) ? next_free_minor(&minor) : specific_minor(minor); + r = persistent ? specific_minor(minor) : next_free_minor(&minor); if (r < 0) { kfree(md); return NULL; @@ -660,13 +660,13 @@ /* * Constructor for a new device. */ -int dm_create(unsigned int minor, struct dm_table *table, - struct mapped_device **result) +static int create_aux(unsigned int minor, int persistent, + struct dm_table *table, struct mapped_device **result) { int r; struct mapped_device *md; - md = alloc_dev(minor); + md = alloc_dev(minor, persistent); if (!md) return -ENXIO; @@ -681,6 +681,17 @@ return 0; } +int dm_create(struct dm_table *table, struct mapped_device **result) +{ + return create_aux(0, 0, table, result); +} + +int dm_create_with_minor(unsigned int minor, + struct dm_table *table, struct mapped_device **result) +{ + return create_aux(minor, 1, table, result); +} + void dm_get(struct mapped_device *md) { atomic_inc(&md->holders); --- diff/drivers/md/dm.h 2003-06-11 10:31:27.000000000 +0100 +++ source/drivers/md/dm.h 2003-06-11 10:32:11.000000000 +0100 @@ -51,8 +51,9 @@ * Functions for manipulating a struct mapped_device. * Drop the reference with dm_put when you finish with the object. *---------------------------------------------------------------*/ -int dm_create(unsigned int minor, struct dm_table *table, - struct mapped_device **md); +int dm_create(struct dm_table *table, struct mapped_device **md); +int dm_create_with_minor(unsigned int minor, struct dm_table *table, + struct mapped_device **md); /* * Reference counting for md.