[Stgt-devel] [PATCH] add stgt_device_template example

Mike Christie michaelc at cs.wisc.edu
Tue Aug 23 18:04:07 CEST 2005


FUJITA Tomonori wrote:
> From: Mike Christie <michaelc at cs.wisc.edu>
> Subject: [Stgt-devel] [PATCH] add stgt_device_template example
> Date: Tue, 23 Aug 2005 00:59:16 -0500
> 
> 
>>This adds the beginings of a stgt_device_template for
>>passthrough commands. It will end up using the block
>>layer BLOCK_PC facility to pass the command to the
>>underlying device similar to how we do it for SG_IO
>>and dm-multipath hw_handlers like dm-emc.c.
>>
>>It is not completely hooked in yet. The command
>>handling needs to be done and so does the actual
>>device creation.
> 
> 
> Great! 
> 
> Here are small fixes.
> 
> diff -x CVS -x .svn -x GPATH -x GRTAGS -x GSYMS -x GTAGS -x .config -u --new-file --recursive stgt.new/kernel/stgt.c stgt.work/kernel/stgt.c
> --- stgt.new/kernel/stgt.c	2005-08-23 19:09:04.000000000 +0900
> +++ stgt.work/kernel/stgt.c	2005-08-23 23:47:25.000000000 +0900
> @@ -406,11 +406,14 @@
>  
>  	device->lun = lun;
>  	device->target = target;
> -	if (!strcpy(device->path, path))
> +	device->path = kmalloc(strlen(path) + 1, GFP_KERNEL);
> +	if (!device->path)
>  		goto free_device;
> +	strcpy(device->path, path);
> +	device->path[strlen(path)] = '\0';

oops. I actually meant to put strdup() :)

>  
>  	device->sdt = device_template_get(device_type);
> -	if (device->sdt)
> +	if (!device->sdt)
>  		goto free_path;

oops

>  
>  	device->sdt_data = kmalloc(sizeof(device->sdt->priv_data_size),




More information about the stgt mailing list