From b93ddaf80b8184c1def38a8518b8fdbdd78e73e1 Mon Sep 17 00:00:00 2001 From: "Alasdair G. Kergon" Date: Mon, 15 Nov 2004 04:09:40 -0800 Subject: [PATCH] device-mapper: Add DM_TARGET_MSG Add DM_TARGET_MSG ioctl so data can be passed to a dm target after its table has been loaded. Signed-Off-By: Alasdair G Kergon Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/compat_ioctl.h | 2 ++ include/linux/device-mapper.h | 4 ++++ include/linux/dm-ioctl.h | 21 +++++++++++++++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) (limited to 'include/linux') diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h index c8c2cea10623..ab091956f248 100644 --- a/include/linux/compat_ioctl.h +++ b/include/linux/compat_ioctl.h @@ -140,6 +140,7 @@ COMPATIBLE_IOCTL(DM_TABLE_CLEAR_32) COMPATIBLE_IOCTL(DM_TABLE_DEPS_32) COMPATIBLE_IOCTL(DM_TABLE_STATUS_32) COMPATIBLE_IOCTL(DM_LIST_VERSIONS_32) +COMPATIBLE_IOCTL(DM_TARGET_MSG_32) COMPATIBLE_IOCTL(DM_VERSION) COMPATIBLE_IOCTL(DM_REMOVE_ALL) COMPATIBLE_IOCTL(DM_LIST_DEVICES) @@ -154,6 +155,7 @@ COMPATIBLE_IOCTL(DM_TABLE_CLEAR) COMPATIBLE_IOCTL(DM_TABLE_DEPS) COMPATIBLE_IOCTL(DM_TABLE_STATUS) COMPATIBLE_IOCTL(DM_LIST_VERSIONS) +COMPATIBLE_IOCTL(DM_TARGET_MSG) /* Big K */ COMPATIBLE_IOCTL(PIO_FONT) COMPATIBLE_IOCTL(GIO_FONT) diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index 7abe54e3ee70..a6282ab22b8c 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2001 Sistina Software (UK) Limited. + * Copyright (C) 2004 Red Hat, Inc. All rights reserved. * * This file is released under the LGPL. */ @@ -57,6 +58,8 @@ typedef void (*dm_resume_fn) (struct dm_target *ti); typedef int (*dm_status_fn) (struct dm_target *ti, status_type_t status_type, char *result, unsigned int maxlen); +typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv); + void dm_error(const char *message); /* @@ -82,6 +85,7 @@ struct target_type { dm_suspend_fn suspend; dm_resume_fn resume; dm_status_fn status; + dm_message_fn message; }; struct io_restrictions { diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h index 03f99db7ad7b..a1f659508c30 100644 --- a/include/linux/dm-ioctl.h +++ b/include/linux/dm-ioctl.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited. + * Copyright (C) 2004 Red Hat, Inc. All rights reserved. * * This file is released under the LGPL. */ @@ -76,6 +77,9 @@ * * DM_TABLE_STATUS: * Return the targets status for the 'active' table. + * + * DM_TARGET_MSG: + * Pass a message string to the target at a specific offset of a device. */ /* @@ -178,6 +182,15 @@ struct dm_target_versions { char name[0]; }; +/* + * Used to pass message to a target + */ +struct dm_target_msg { + uint64_t sector; /* Device sector */ + + char message[0]; +}; + /* * If you change this make sure you make the corresponding change * to dm-ioctl.c:lookup_ioctl() @@ -204,6 +217,7 @@ enum { /* Added later */ DM_LIST_VERSIONS_CMD, + DM_TARGET_MSG_CMD, }; /* @@ -232,6 +246,7 @@ typedef char ioctl_struct[308]; #define DM_TABLE_DEPS_32 _IOWR(DM_IOCTL, DM_TABLE_DEPS_CMD, ioctl_struct) #define DM_TABLE_STATUS_32 _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, ioctl_struct) #define DM_LIST_VERSIONS_32 _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, ioctl_struct) +#define DM_TARGET_MSG_32 _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, ioctl_struct) #endif #define DM_IOCTL 0xfd @@ -254,10 +269,12 @@ typedef char ioctl_struct[308]; #define DM_LIST_VERSIONS _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, struct dm_ioctl) +#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl) + #define DM_VERSION_MAJOR 4 -#define DM_VERSION_MINOR 1 +#define DM_VERSION_MINOR 2 #define DM_VERSION_PATCHLEVEL 0 -#define DM_VERSION_EXTRA "-ioctl (2003-12-10)" +#define DM_VERSION_EXTRA "-ioctl (2004-06-08)" /* Status bits */ #define DM_READONLY_FLAG (1 << 0) /* In/Out */ -- cgit v1.2.3