[sheepdog] [PATCH v2 5/7] collie: add new commands to manipulate multi-disks

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Wed Apr 3 04:22:17 CEST 2013


At Fri, 29 Mar 2013 13:49:42 +0800,
Liu Yuan wrote:
> 
> +
> +static int do_plug_unplug(char *disks, bool plug)
> +{
> +	struct sd_req hdr;
> +	struct sd_rsp *rsp = (struct sd_rsp *)&hdr;
> +	int fd, ret;
> +
> +	fd = connect_to(sdhost, sdport);
> +	if (fd < 0) {
> +		fprintf(stderr, "Failed to connect %s:%d\n", sdhost, sdport);
> +		return EXIT_FAILURE;
> +	}
> +
> +	if (plug)
> +		sd_init_req(&hdr, SD_OP_MD_PLUG);
> +	else
> +		sd_init_req(&hdr, SD_OP_MD_UNPLUG);
> +	hdr.flags = SD_FLAG_CMD_WRITE;
> +	hdr.data_length = strlen(disks);

Should be strlen(disks) + 1 to include the terminating '\0' character.

Thanks,

Kazutaka



More information about the sheepdog mailing list