- Subject: [PATCH] 2/6: Low-level code to interface with dm and support patch 3
- From: Adam DiCarlo <bikko@xxxxxxxxxx>
- Date: Wed, 30 Aug 2006 14:28:05 -0700
- User-agent: Thunderbird 1.5.0.5 (X11/20060728)
Signed-off-by: Adam DiCarlo <bikko@xxxxxxxxxx>
Signed-off-by: James Simshaw <simshawj@xxxxxxxxxx>
Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
--- ORIGINAL/lib/activate/devmapper.c 2006-03-29 05:18:43.000000000 -0800
+++ PATCHED/lib/activate/devmapper.c 2006-08-03 14:46:25.000000000 -0700
@@ -148,6 +148,68 @@ static int check_table(struct lib_contex
return handle_table(lc, NULL, table, get_target_list());
}
+/* Suspend a mapped device. */
+int dm_suspend(struct lib_context *lc, struct raid_set *rs)
+{
+ int ret = 0;
+ struct dm_task *dmt;
+
+ _init_dm();
+
+ /* Suspend <dev_name> */
+ ret = (dmt = dm_task_create(DM_DEVICE_SUSPEND)) &&
+ dm_task_set_name(dmt, rs->name) &&
+ dm_task_run(dmt);
+
+ _exit_dm(dmt);
+
+ return ret;
+}
+
+/* Resume a mapped device. */
+int dm_resume(struct lib_context *lc, struct raid_set *rs)
+{
+ int ret = 0;
+ struct dm_task *dmt;
+
+ _init_dm();
+
+ /* Suspend <dev_name> */
+ ret = (dmt = dm_task_create(DM_DEVICE_RESUME)) &&
+ dm_task_set_name(dmt, rs->name) &&
+ dm_task_run(dmt);
+
+ _exit_dm(dmt);
+
+ return ret;
+}
+
+/* Reload a mapped device. */
+int dm_reload(struct lib_context *lc, struct raid_set *rs, char *table)
+{
+ int ret = 0;
+ struct dm_task *dmt;
+
+ _init_dm();
+
+ /* Create <dev_name> */
+ ret = (dmt = dm_task_create(DM_DEVICE_RELOAD)) &&
+ dm_task_set_name(dmt, rs->name) &&
+ parse_table(lc, dmt, table) &&
+ dm_task_run(dmt);
+
+ /*
+ * In case device creation failed, check if target
+ * isn't registered with the device-mapper core
+ */
+ if (!ret)
+ check_table(lc, table);
+
+ _exit_dm(dmt);
+
+ return ret;
+}
+
/* Create a mapped device. */
int dm_create(struct lib_context *lc, struct raid_set *rs, char *table)
{
--- ORIGINAL/lib/activate/devmapper.h 2005-05-23 05:39:55.000000000 -0700
+++ PATCHED/lib/activate/devmapper.h 2006-08-03 14:46:25.000000000 -0700
@@ -13,5 +13,8 @@ int dm_create(struct lib_context *lc, st
int dm_remove(struct lib_context *lc, struct raid_set *rs);
int dm_status(struct lib_context *lc, struct raid_set *rs);
int dm_version(struct lib_context *lc, char *version, size_t size);
+int dm_suspend(struct lib_context *lc, struct raid_set *rs);
+int dm_resume(struct lib_context *lc, struct raid_set *rs);
+int dm_reload(struct lib_context *lc, struct raid_set *rs, char *table);
#endif
--- ORIGINAL/include/dmraid/dmraid.h 2006-02-17 08:11:21.000000000 -0800
+++ PATCHED/include/dmraid/dmraid.h 2006-08-03 14:46:23.000000000 -0700
@@ -17,6 +17,7 @@
#include <dmraid/display.h>
#include <dmraid/format.h>
#include <dmraid/metadata.h>
+#include <dmraid/reconfig.h>
/*
* Library init/exit
--- ORIGINAL/lib/internal.h 2006-07-26 01:16:18.000000000 -0700
+++ PATCHED/lib/internal.h 2006-08-03 14:46:26.000000000 -0700
@@ -35,6 +35,7 @@
#include <dmraid/format.h>
#include <dmraid/metadata.h>
#include "activate/activate.h"
+#include <dmraid/reconfig.h>
#ifndef u_int16_t
#define u_int16_t uint16_t
_______________________________________________
Ataraid-list mailing list
Ataraid-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/ataraid-list
[Linux RAID]
[Linux IDE]
[Linux SCSI]
[Kernel]
[Linux Books]
[Linux Admin]
[GFS]
[RPM]
[Photos]
[Yosemite Photos]
[Yosemite News]
[AMD 64]