* [Drbd-dev] Modifying the usermode helper program executed by DRBD
@ 2007-06-27 19:12 Graham, Simon
2007-06-29 8:47 ` Philipp Reisner
0 siblings, 1 reply; 2+ messages in thread
From: Graham, Simon @ 2007-06-27 19:12 UTC (permalink / raw)
To: drbd-dev
[-- Attachment #1.1: Type: text/plain, Size: 584 bytes --]
Currently, the DRBD driver is hardcoded to execute "/sbin/drbdadm" as
the usermode helper program - this means that it is not possible to have
drbdadm installed in a different location or to replace it with another
program (such as a different front end to drbdsetup).
To enable this, I've created a simple patch which adds a sysfs file
/sys/module/drbd/parameters/usermode_helper which can be updated with
the path to the executable to be run as the usermode helper - the
default value of this is "/sbin/drbdadm" so the default behavior is
unchanged.
Simon
[-- Attachment #1.2: Type: text/html, Size: 2381 bytes --]
[-- Attachment #2: drbd-usermode-helper.patch --]
[-- Type: application/octet-stream, Size: 1714 bytes --]
Index: src/drbd/drbd_nl.c
===================================================================
--- src/drbd/drbd_nl.c (revision 15638)
+++ src/drbd/drbd_nl.c (working copy)
@@ -164,7 +164,7 @@
int drbd_khelper(drbd_dev *mdev, char* cmd)
{
char mb[12];
- char *argv[] = {"/sbin/drbdadm", cmd, mb, NULL };
+ char *argv[] = {usermode_helper, cmd, mb, NULL };
static char *envp[] = { "HOME=/",
"TERM=linux",
"PATH=/sbin:/usr/sbin:/bin:/usr/bin",
@@ -172,8 +172,10 @@
snprintf(mb,12,"minor-%d",mdev_to_minor(mdev));
+ INFO("helper command: %s %s\n",usermode_helper,cmd);
+
drbd_bcast_ev_helper(mdev,cmd);
- return call_usermodehelper("/sbin/drbdadm",argv,envp,1);
+ return call_usermodehelper(usermode_helper,argv,envp,1);
}
drbd_disks_t drbd_try_outdate_peer(drbd_dev *mdev)
Index: src/drbd/drbd_main.c
===================================================================
--- src/drbd/drbd_main.c (revision 15638)
+++ src/drbd/drbd_main.c (working copy)
@@ -119,6 +119,14 @@
module_param(trace_devs,int,0644);
#endif
+
+// Module parameter for setting the user mode helper program
+// to run. Default is /sbin/drbdadm
+
+char usermode_helper[80] = "/sbin/drbdadm";
+
+module_param_string(usermode_helper, usermode_helper, sizeof(usermode_helper), 0644);
+
// global panic flag
volatile int drbd_did_panic = 0;
Index: src/drbd/drbd_int.h
===================================================================
--- src/drbd/drbd_int.h (revision 15638)
+++ src/drbd/drbd_int.h (working copy)
@@ -51,6 +51,8 @@
extern int fault_devs;
#endif
+extern char usermode_helper[];
+
#include <linux/major.h>
#ifdef DRBD_MAJOR
# warning "FIXME. DRBD_MAJOR is now officially defined in major.h"
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [Drbd-dev] Modifying the usermode helper program executed by DRBD
2007-06-27 19:12 [Drbd-dev] Modifying the usermode helper program executed by DRBD Graham, Simon
@ 2007-06-29 8:47 ` Philipp Reisner
0 siblings, 0 replies; 2+ messages in thread
From: Philipp Reisner @ 2007-06-29 8:47 UTC (permalink / raw)
To: drbd-dev
On Wednesday 27 June 2007 21:12:56 Graham, Simon wrote:
> Currently, the DRBD driver is hardcoded to execute "/sbin/drbdadm" as
> the usermode helper program - this means that it is not possible to have
> drbdadm installed in a different location or to replace it with another
> program (such as a different front end to drbdsetup).
>
>
>
> To enable this, I've created a simple patch which adds a sysfs file
> /sys/module/drbd/parameters/usermode_helper which can be updated with
> the path to the executable to be run as the usermode helper - the
> default value of this is "/sbin/drbdadm" so the default behavior is
> unchanged.
>
>
Ack, it is in. Thanks!
-Phil
--
: Dipl-Ing Philipp Reisner Tel +43-1-8178292-50 :
: LINBIT Information Technologies GmbH Fax +43-1-8178292-82 :
: Vivenotgasse 48, 1120 Vienna, Austria http://www.linbit.com :
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-06-29 8:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-27 19:12 [Drbd-dev] Modifying the usermode helper program executed by DRBD Graham, Simon
2007-06-29 8:47 ` Philipp Reisner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.