From 0125518d6d0a0fce63998fc898c203255ad73700 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Sat, 20 Apr 2013 22:23:36 +0200 Subject: [PATCH] clvmd: preserve foreground mode across restart Keep clvmd in foreground when restarted. Useful for testing. --- daemons/clvmd/clvmd-command.c | 8 ++++++-- daemons/clvmd/clvmd.c | 5 +++++ daemons/clvmd/clvmd.h | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/daemons/clvmd/clvmd-command.c b/daemons/clvmd/clvmd-command.c index c5cd4618a..5d93f38bc 100644 --- a/daemons/clvmd/clvmd-command.c +++ b/daemons/clvmd/clvmd-command.c @@ -383,7 +383,7 @@ static int restart_clvmd(void) } while (hn); /* clvmd + locks (-E uuid) + debug (-d X) + NULL */ - if (!(argv = malloc((max_locks * 2 + 5) * sizeof(*argv)))) + if (!(argv = malloc((max_locks * 2 + 6) * sizeof(*argv)))) goto_out; /* @@ -391,13 +391,17 @@ static int restart_clvmd(void) */ argv[argc++] = "clvmd"; - /* Propogate debug options */ + /* Propagate debug options */ if (clvmd_get_debug()) { if (dm_snprintf(debug_arg, sizeof(debug_arg), "-d%u", clvmd_get_debug()) < 0) goto_out; argv[argc++] = debug_arg; } + /* Propagate foreground options */ + if (clvmd_get_foreground()) + argv[argc++] = "-f"; + argv[argc++] = "-I"; argv[argc++] = clops->name; diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c index 54cf1acf1..c649bbe77 100644 --- a/daemons/clvmd/clvmd.c +++ b/daemons/clvmd/clvmd.c @@ -249,6 +249,11 @@ debug_t clvmd_get_debug(void) return debug; } +int clvmd_get_foreground(void) +{ + return foreground_mode; +} + static const char *decode_cmd(unsigned char cmdl) { static char buf[128]; diff --git a/daemons/clvmd/clvmd.h b/daemons/clvmd/clvmd.h index 5bad43aca..67ea41e34 100644 --- a/daemons/clvmd/clvmd.h +++ b/daemons/clvmd/clvmd.h @@ -119,6 +119,7 @@ extern void debuglog(const char *fmt, ... ) void clvmd_set_debug(debug_t new_de); debug_t clvmd_get_debug(void); +int clvmd_get_foreground(void); int sync_lock(const char *resource, int mode, int flags, int *lockid); int sync_unlock(const char *resource, int lockid);