From: Milan Broz <mbroz@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 3/3] fix metadata backup description for long lived process
Date: Tue, 10 Mar 2009 18:41:30 +0100 [thread overview]
Message-ID: <49B6A64A.9070103@redhat.com> (raw)
Fix metadata backup description for long lived process.
If backup is run from clvmd (or long lived process),
the *before* and *after* makes no sense, because
commandline is always "clvmd" :-)
Signed-off-by: Milan Broz <mbroz@redhat.com>
---
lib/format_text/archiver.c | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/lib/format_text/archiver.c b/lib/format_text/archiver.c
index a3efc3e..861d9f6 100644
--- a/lib/format_text/archiver.c
+++ b/lib/format_text/archiver.c
@@ -75,27 +75,30 @@ void archive_enable(struct cmd_context *cmd, int flag)
cmd->archive_params->enabled = flag;
}
-static char *_build_desc(struct dm_pool *mem, const char *line, int before)
+static char *_build_desc(struct cmd_context *cmd, int before)
{
- size_t len = strlen(line) + 32;
+ size_t len = strlen(cmd->cmd_line) + 32;
char *buffer;
+ int ret;
- if (!(buffer = dm_pool_zalloc(mem, strlen(line) + 32)))
+ if (!(buffer = dm_pool_zalloc(cmd->mem, strlen(cmd->cmd_line) + 32)))
return_NULL;
- if (snprintf(buffer, len,
+ if (cmd->is_long_lived)
+ ret = snprintf(buffer, len, "Created by %s", cmd->cmd_line);
+ else
+ ret = snprintf(buffer, len,
"Created %s executing '%s'",
- before ? "*before*" : "*after*", line) < 0)
- return_NULL;
+ before ? "*before*" : "*after*", cmd->cmd_line);
- return buffer;
+ return (ret < 0) ? NULL : buffer;
}
static int __archive(struct volume_group *vg)
{
char *desc;
- if (!(desc = _build_desc(vg->cmd->mem, vg->cmd->cmd_line, 1)))
+ if (!(desc = _build_desc(vg->cmd, 1)))
return_0;
return archive_vg(vg, vg->cmd->archive_params->dir, desc,
@@ -190,7 +193,7 @@ static int __backup(struct volume_group *vg)
char name[PATH_MAX];
char *desc;
- if (!(desc = _build_desc(vg->cmd->mem, vg->cmd->cmd_line, 0)))
+ if (!(desc = _build_desc(vg->cmd, 0)))
return_0;
if (dm_snprintf(name, sizeof(name), "%s/%s",
reply other threads:[~2009-03-10 17:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49B6A64A.9070103@redhat.com \
--to=mbroz@redhat.com \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.