From 774ed5fc39de36570bb053ea562f600caabe4b66 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Thu, 1 Dec 2005 23:11:41 +0000 Subject: [PATCH] Export dm_task_update_nodes. Use names instead of numbers in messages when ioctls fail. --- WHATS_NEW_DM | 2 ++ libdm/.exported_symbols | 1 + libdm/ioctl/libdm-iface.c | 29 +++++++++++++++++++---------- libdm/libdevmapper.h | 6 ++++++ 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 538853bc3..687cab4a1 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,7 @@ Version 1.02.02 - ============================= + Export dm_task_update_nodes. + Use names instead of numbers in messages when ioctls fail. Version 1.02.01 - 23 Nov 2005 ============================= diff --git a/libdm/.exported_symbols b/libdm/.exported_symbols index 898c06e1c..337b96d61 100644 --- a/libdm/.exported_symbols +++ b/libdm/.exported_symbols @@ -26,6 +26,7 @@ dm_task_suppress_identical_reload dm_task_add_target dm_task_no_open_count dm_task_skip_lockfs +dm_task_update_nodes dm_task_run dm_get_next_target dm_set_dev_dir diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c index 3f2e59211..4999509f0 100644 --- a/libdm/ioctl/libdm-iface.c +++ b/libdm/ioctl/libdm-iface.c @@ -672,11 +672,13 @@ static int _dm_task_run_v1(struct dm_task *dmt) #ifdef DM_IOCTLS else if (ioctl(_control_fd, command, dmi) < 0) { if (_log_suppress) - log_verbose("device-mapper ioctl cmd %d failed: %s", - _IOC_NR(command), strerror(errno)); + log_verbose("device-mapper: %s ioctl failed: %s", + _cmd_data_v1[dmt->type].name, + strerror(errno)); else - log_error("device-mapper ioctl cmd %d failed: %s", - _IOC_NR(command), strerror(errno)); + log_error("device-mapper: %s ioctl failed: %s", + _cmd_data_v1[dmt->type].name, + strerror(errno)); goto bad; } #else /* Userspace alternative for testing */ @@ -1454,13 +1456,15 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command, dmi->flags &= ~DM_EXISTS_FLAG; /* FIXME */ else { if (_log_suppress) - log_verbose("device-mapper ioctl " - "cmd %d failed: %s", - _IOC_NR(command), strerror(errno)); + log_verbose("device-mapper: %s ioctl " + "failed: %s", + _cmd_data_v4[dmt->type].name, + strerror(errno)); else - log_error("device-mapper ioctl " - "cmd %d failed: %s", - _IOC_NR(command), strerror(errno)); + log_error("device-mapper: %s ioctl " + "failed: %s", + _cmd_data_v4[dmt->type].name, + strerror(errno)); dm_free(dmi); return NULL; } @@ -1470,6 +1474,11 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command, return dmi; } +void dm_task_update_nodes(void) +{ + update_devs(); +} + int dm_task_run(struct dm_task *dmt) { struct dm_ioctl *dmi; diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h index 1a7710c45..2d13ef476 100644 --- a/libdm/libdevmapper.h +++ b/libdm/libdevmapper.h @@ -169,6 +169,12 @@ void *dm_get_next_target(struct dm_task *dmt, */ int dm_task_run(struct dm_task *dmt); +/* + * Call this to make or remove the device nodes associated with previously + * issued commands. + */ +void dm_task_update_nodes(void); + /* * Configure the device-mapper directory */