--- linux-last/include/linux/dm-ioctl.h	Tue Nov  6 14:44:22 2001
+++ linux/include/linux/dm-ioctl.h	Wed Nov  7 09:36:30 2001
@@ -34,16 +34,18 @@
 struct dm_ioctl {
 	unsigned long data_size;	/* the size of this structure */
 	char name[DM_NAME_LEN];
-	int suspend;
-	int open_count;		/* out field */
-	int minor;
 
-	int target_count;
+	int exists;		/* out */
+	int suspend;		/* in/out */
+	int open_count;		/* out */
+	int minor;		/* in/out */
+
+	int target_count;	/* in/out */
 };
 
 /* FIXME: find own numbers, 109 is pinched from LVM */
 #define DM_IOCTL 0xfd
-#define DM_CHAR_MAJOR 109
+#define DM_CHAR_MAJOR 124
 
 #define	DM_CREATE _IOW(DM_IOCTL, 0x00, struct dm_ioctl)
 #define	DM_REMOVE _IOW(DM_IOCTL, 0x01, struct dm_ioctl)
--- linux-last/drivers/md/dm-ioctl.c	Tue Nov  6 16:29:32 2001
+++ linux/drivers/md/dm-ioctl.c	Wed Nov  7 10:13:23 2001
@@ -202,9 +202,26 @@
 	return 0;
 }
 
-static int info(struct dm_ioctl *param)
+static int info(struct dm_ioctl *param, struct dm_ioctl *user)
 {
-	return -EINVAL;
+	struct mapped_device *md = dm_get(param->name);
+
+	if (!md) {
+		param->exists = 0;
+		goto out;
+	}
+
+	param->exists = 1;
+	param->suspend = md->suspended;
+	param->open_count = md->use_count;
+	param->minor = MINOR(md->dev);
+	param->target_count = md->map->num_targets;
+
+ out:
+	if (copy_to_user(user, param, sizeof(*param)))
+		return -EFAULT;
+
+	return 0;
 }
 
 static int ctl_open(struct inode *inode, struct file *file)
@@ -251,7 +268,8 @@
 		break;
 
 	case DM_INFO:
-		r = info(p);
+		r = info(p, (struct dm_ioctl *) a);
+		break;
 
 	default:
 		WARN("dm_ctl_ioctl: unknown command 0x%x\n", command);
