diff mbox

[2/3] scsi_dh: Provide set_params interface in emc device handler

Message ID 20090702031320.28354.96958.sendpatchset@chandra-ubuntu (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Chandra Seetharaman July 2, 2009, 3:13 a.m. UTC
Handle the parameters provided by user thru multipath.

This handler expects only 2 parameters and their value can either be 0 or 1.

This code originates from the old dm-emc.c file. Appropriate changes have
been made to make it work in the new design.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
---
 drivers/scsi/device_handler/scsi_dh_emc.c |   56 ++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Comments

Eddie Williams July 20, 2009, 1 p.m. UTC | #1
On Wed, 2009-07-01 at 20:13 -0700, Chandra Seetharaman wrote:
> Handle the parameters provided by user thru multipath.
> 
> This handler expects only 2 parameters and their value can either be 0 or 1.
> 
> This code originates from the old dm-emc.c file. Appropriate changes have
> been made to make it work in the new design.
> 
> Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
> ---
>  drivers/scsi/device_handler/scsi_dh_emc.c |   56 ++++++++++++++++++++++++++++++
>  1 file changed, 56 insertions(+)
> 
> Index: linux-2.6.31-rc1/drivers/scsi/device_handler/scsi_dh_emc.c
> ===================================================================
> --- linux-2.6.31-rc1.orig/drivers/scsi/device_handler/scsi_dh_emc.c
> +++ linux-2.6.31-rc1/drivers/scsi/device_handler/scsi_dh_emc.c
> @@ -561,6 +561,61 @@ done:
>  
>  	return result;
>  }
> +/*
> + * params - parameters in the following format
> + *      "no_of_params\0param1\0param2\0param3\0...\0"
> + *      for example, string for 2 parameters with value 10 and 21
> + *      is specified as "2\010\021\0".
> + */
> +static int clariion_set_params(struct scsi_device *sdev, const char *params)
> +{
> +	struct clariion_dh_data *csdev = get_clariion_data(sdev);
> +	unsigned int hr = 0, st = 0, argc;
> +	char *p = params;

This throws a compiler warning resolved with a type cast:
	char *p = (char *)params;



--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
Chandra Seetharaman July 21, 2009, 1:02 a.m. UTC | #2
I will reroll the patch with this fix and ported to the latest RC.
On Mon, 2009-07-20 at 09:00 -0400, Eddie Williams wrote:
> On Wed, 2009-07-01 at 20:13 -0700, Chandra Seetharaman wrote:
> > Handle the parameters provided by user thru multipath.
> > 
> > This handler expects only 2 parameters and their value can either be 0 or 1.
> > 
> > This code originates from the old dm-emc.c file. Appropriate changes have
> > been made to make it work in the new design.
> > 
> > Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
> > ---
> >  drivers/scsi/device_handler/scsi_dh_emc.c |   56 ++++++++++++++++++++++++++++++
> >  1 file changed, 56 insertions(+)
> > 
> > Index: linux-2.6.31-rc1/drivers/scsi/device_handler/scsi_dh_emc.c
> > ===================================================================
> > --- linux-2.6.31-rc1.orig/drivers/scsi/device_handler/scsi_dh_emc.c
> > +++ linux-2.6.31-rc1/drivers/scsi/device_handler/scsi_dh_emc.c
> > @@ -561,6 +561,61 @@ done:
> >  
> >  	return result;
> >  }
> > +/*
> > + * params - parameters in the following format
> > + *      "no_of_params\0param1\0param2\0param3\0...\0"
> > + *      for example, string for 2 parameters with value 10 and 21
> > + *      is specified as "2\010\021\0".
> > + */
> > +static int clariion_set_params(struct scsi_device *sdev, const char *params)
> > +{
> > +	struct clariion_dh_data *csdev = get_clariion_data(sdev);
> > +	unsigned int hr = 0, st = 0, argc;
> > +	char *p = params;
> 
> This throws a compiler warning resolved with a type cast:
> 	char *p = (char *)params;
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
Asim Zia July 21, 2009, 4:02 a.m. UTC | #3
unsubscribe linux-scsi





On Tue, Jul 21, 2009 at 6:02 AM, Chandra Seetharaman <sekharan@us.ibm.com>wrote:

>
> I will reroll the patch with this fix and ported to the latest RC.
>  On Mon, 2009-07-20 at 09:00 -0400, Eddie Williams wrote:
> > On Wed, 2009-07-01 at 20:13 -0700, Chandra Seetharaman wrote:
> > > Handle the parameters provided by user thru multipath.
> > >
> > > This handler expects only 2 parameters and their value can either be 0
> or 1.
> > >
> > > This code originates from the old dm-emc.c file. Appropriate changes
> have
> > > been made to make it work in the new design.
> > >
> > > Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
> > > ---
> > >  drivers/scsi/device_handler/scsi_dh_emc.c |   56
> ++++++++++++++++++++++++++++++
> > >  1 file changed, 56 insertions(+)
> > >
> > > Index: linux-2.6.31-rc1/drivers/scsi/device_handler/scsi_dh_emc.c
> > > ===================================================================
> > > --- linux-2.6.31-rc1.orig/drivers/scsi/device_handler/scsi_dh_emc.c
> > > +++ linux-2.6.31-rc1/drivers/scsi/device_handler/scsi_dh_emc.c
> > > @@ -561,6 +561,61 @@ done:
> > >
> > >     return result;
> > >  }
> > > +/*
> > > + * params - parameters in the following format
> > > + *      "no_of_params\0param1\0param2\0param3\0...\0"
> > > + *      for example, string for 2 parameters with value 10 and 21
> > > + *      is specified as "2\010\021\0".
> > > + */
> > > +static int clariion_set_params(struct scsi_device *sdev, const char
> *params)
> > > +{
> > > +   struct clariion_dh_data *csdev = get_clariion_data(sdev);
> > > +   unsigned int hr = 0, st = 0, argc;
> > > +   char *p = params;
> >
> > This throws a compiler warning resolved with a type cast:
> >       char *p = (char *)params;
> >
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
>
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox

Patch

Index: linux-2.6.31-rc1/drivers/scsi/device_handler/scsi_dh_emc.c
===================================================================
--- linux-2.6.31-rc1.orig/drivers/scsi/device_handler/scsi_dh_emc.c
+++ linux-2.6.31-rc1/drivers/scsi/device_handler/scsi_dh_emc.c
@@ -561,6 +561,61 @@  done:
 
 	return result;
 }
+/*
+ * params - parameters in the following format
+ *      "no_of_params\0param1\0param2\0param3\0...\0"
+ *      for example, string for 2 parameters with value 10 and 21
+ *      is specified as "2\010\021\0".
+ */
+static int clariion_set_params(struct scsi_device *sdev, const char *params)
+{
+	struct clariion_dh_data *csdev = get_clariion_data(sdev);
+	unsigned int hr = 0, st = 0, argc;
+	char *p = params;
+	int result = SCSI_DH_OK;
+
+	if ((sscanf(params, "%u", &argc) != 1) || (argc != 2))
+		return -EINVAL;
+
+	while (*p++)
+		;
+	if ((sscanf(p, "%u", &st) != 1) || (st > 1))
+		return -EINVAL;
+
+	while (*p++)
+		;
+	if ((sscanf(p, "%u", &hr) != 1) || (hr > 1))
+		return -EINVAL;
+
+	if (st)
+		csdev->flags |= CLARIION_SHORT_TRESPASS;
+	else
+		csdev->flags &= ~CLARIION_SHORT_TRESPASS;
+
+	if (hr)
+		csdev->flags |= CLARIION_HONOR_RESERVATIONS;
+	else
+		csdev->flags &= ~CLARIION_HONOR_RESERVATIONS;
+
+	/*
+	 * If this path is owned, we have to send a trespass command
+	 * with the new parameters. If not, simply return. Next trespass
+	 * command would use the parameters.
+	 */
+	if (csdev->lun_state != CLARIION_LUN_OWNED)
+		goto done;
+
+	csdev->lun_state = CLARIION_LUN_UNINITIALIZED;
+	result = send_trespass_cmd(sdev, csdev);
+	if (result != SCSI_DH_OK)
+		goto done;
+
+	/* Update status */
+	result = clariion_send_inquiry(sdev, csdev);
+
+done:
+	return result;
+}
 
 static const struct scsi_dh_devlist clariion_dev_list[] = {
 	{"DGC", "RAID"},
@@ -581,6 +636,7 @@  static struct scsi_device_handler clarii
 	.check_sense	= clariion_check_sense,
 	.activate	= clariion_activate,
 	.prep_fn	= clariion_prep_fn,
+	.set_params	= clariion_set_params,
 };
 
 /*