Re: [PATCH 1/1] Drivers: hv: Add a new driver to support host initiated backup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
> +}

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux