1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-29 15:22:30 +03:00

cleanup: dmeventd abstract lvm2cmd interface

Keep  lvm2cmd  interface hidden inside dmeventd_lvm
and use regular 1/0 return codes, this we may
avoid using lvm2cmd.h in other lvm2 plugins.
This commit is contained in:
Zdenek Kabelac 2014-04-15 23:11:03 +02:00
parent 6448428d05
commit 6b701c3a48
5 changed files with 7 additions and 11 deletions

View File

@ -143,7 +143,7 @@ struct dm_pool *dmeventd_lvm2_pool(void)
int dmeventd_lvm2_run(const char *cmdline)
{
return lvm2_run(_lvm_handle, cmdline);
return (lvm2_run(_lvm_handle, cmdline) == LVM2_COMMAND_SUCCEEDED);
}
int dmeventd_lvm2_command(struct dm_pool *mem, char *buffer, size_t size,

View File

@ -14,7 +14,6 @@
#include "lib.h"
#include "lvm2cmd.h"
#include "libdevmapper-event.h"
#include "dmeventd_lvm.h"
#include "defaults.h"
@ -144,9 +143,9 @@ static int _remove_failed_devices(const char *device)
r = dmeventd_lvm2_run(cmd_str);
syslog(LOG_INFO, "Repair of mirrored device %s %s.", device,
(r == LVM2_COMMAND_SUCCEEDED) ? "finished successfully" : "failed");
(r) ? "finished successfully" : "failed");
return (r == LVM2_COMMAND_SUCCEEDED) ? 0 : -1;
return (r) ? 0 : -1;
}
void process_event(struct dm_task *dmt,

View File

@ -14,7 +14,6 @@
#include "lib.h"
#include "lvm2cmd.h"
#include "libdevmapper-event.h"
#include "dmeventd_lvm.h"
@ -40,10 +39,10 @@ static int run_repair(const char *device)
r = dmeventd_lvm2_run(cmd_str);
if (r != LVM2_COMMAND_SUCCEEDED)
if (!r)
syslog(LOG_INFO, "Repair of RAID device %s failed.", device);
return (r == LVM2_COMMAND_SUCCEEDED) ? 0 : -1;
return (r) ? 0 : -1;
}
static int _process_raid_event(char *params, const char *device)

View File

@ -14,7 +14,6 @@
#include "lib.h"
#include "lvm2cmd.h"
#include "libdevmapper-event.h"
#include "dmeventd_lvm.h"
@ -82,7 +81,7 @@ static int _run(const char *cmd, ...)
static int _extend(const char *cmd)
{
return dmeventd_lvm2_run(cmd) == LVM2_COMMAND_SUCCEEDED;
return dmeventd_lvm2_run(cmd);
}
static void _umount(const char *device, int major, int minor)

View File

@ -14,7 +14,6 @@
#include "lib.h"
#include "lvm2cmd.h"
#include "libdevmapper-event.h"
#include "dmeventd_lvm.h"
@ -147,7 +146,7 @@ static int _extend(struct dso_state *state)
#if THIN_DEBUG
syslog(LOG_INFO, "dmeventd executes: %s.\n", state->cmd_str);
#endif
return (dmeventd_lvm2_run(state->cmd_str) == LVM2_COMMAND_SUCCEEDED);
return dmeventd_lvm2_run(state->cmd_str);
}
static int _run(const char *cmd, ...)