From: Olaf Hering <olaf@aepfle.de>
To: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, apw@canonical.com,
jasowang@redhat.com, Evgeniy Polyakov <zbr@ioremap.net>
Subject: Re: [PATCH 1/1] Drivers: hv: Add a new driver to support host initiated backup
Date: Tue, 12 Mar 2013 19:48:39 +0100 [thread overview]
Message-ID: <20130312184839.GA30976@aepfle.de> (raw)
In-Reply-To: <1363114406-30575-1-git-send-email-kys@microsoft.com>
On Tue, Mar 12, K. Y. Srinivasan wrote:
> +static int vss_operate(int operation)
> +{
> + char *fs_op;
> + char cmd[512];
> + char buf[512];
> + FILE *file;
> + char *p;
> + char *x;
> + int error;
> +
> + switch (operation) {
> + case VSS_OP_FREEZE:
> + fs_op = "-f ";
> + break;
> + case VSS_OP_THAW:
> + fs_op = "-u ";
> + break;
> + }
> +
> + sprintf(cmd, "%s", "mount | grep ^/dev/ | awk '{print $3 }'");
I think this can be char cmd[] = "mount | awk '/^\/dev\/ { print $3'";
> + file = popen(cmd, "r");
> + if (file == NULL)
> + return;
> +
> + while ((p = fgets(buf, sizeof(buf), file)) != NULL) {
> + x = strchr(p, '\n');
> + *x = '\0';
> + if (!strncmp(p, "/", sizeof("/")))
> + continue;
> +
> + sprintf(cmd, "%s %s %s", "fsfreeze ", fs_op, p);
> + syslog(LOG_INFO, "VSS cmd is %s\n", cmd);
> + error = system(cmd);
error is not handled here, and it looks like only one error can be
reported anyway.
In case of an error, will the host thaw the filesystems?
> + }
> + pclose(file);
> +
> + sprintf(cmd, "%s %s %s", "fsfreeze ", fs_op, "/");
> + syslog(LOG_INFO, "VSS cmd is %s\n", cmd);
> + error = system(cmd);
> +
> + return error;
> +}
next prev parent reply other threads:[~2013-03-12 18:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-12 18:53 [PATCH 1/1] Drivers: hv: Add a new driver to support host initiated backup K. Y. Srinivasan
2013-03-12 18:48 ` Olaf Hering [this message]
2013-03-12 21:49 ` KY Srinivasan
2013-03-14 9:29 ` Olaf Hering
-- strict thread matches above, loose matches on Subject: below --
2013-03-12 18:29 K. Y. Srinivasan
2013-03-12 18:01 ` KY Srinivasan
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=20130312184839.GA30976@aepfle.de \
--to=olaf@aepfle.de \
--cc=apw@canonical.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=jasowang@redhat.com \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=zbr@ioremap.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox