linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch for chassis_id exras module
@ 2004-06-05  1:06 Sabharwal, Atul
  2004-06-07 16:52 ` Sabharwal, Atul
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Sabharwal, Atul @ 2004-06-05  1:06 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 283 bytes --]

Hi Greg,

Please find attached a patch for the extras module chassis_id.  The
patch removes an
Extra field "host number" from the provisioning table. Also corrected
the license
Header and removed some dead code.

Please apply it to your distribution.

Thanks,

Atul



[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 6957 bytes --]

diff -Nur chassis_id.org/Makefile chassis_id.new/Makefile
--- chassis_id.org/Makefile	2004-04-21 14:39:10.000000000 -0700
+++ chassis_id.new/Makefile	2004-06-04 17:53:44.868933912 -0700
@@ -1,19 +1,26 @@
-#
-#   **
-#   ** (C) 2003 Intel Corporation
-#   **          Atul Sabharwal <atul.sabharwal@intel.com>
-#   **
-#   ** $Id: Makefile,v 1.3 2004/03/22 23:54:54 atul Exp $
-#   **
-#   ** Distributed under the terms of the GNU Public License, v2.0 or
-#   ** later.
-#   **
-#   ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper;
-#   ** with his permission, they have been re-licensed GPL, and his
-#   ** copyright still applies on them. 
-#   **
-#   */
-#
+#  * 
+#  * Makefile
+#  *
+#  * Copyright (C) 2003, 2004 Intel Corporation.  All rights reserved.
+#  *
+#  * This program is free software; you can redistribute it and/or
+#  * modify it under the terms of the GNU General Public
+#  * License as published by the Free Software Foundation; either
+#  * version 2 of the License, or (at your option) any later version.
+#  *
+#  * This program is distributed in the hope that it will be useful,
+#  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  * General Public License for more details.
+#  *
+#  * You should have received a copy of the GNU General Public
+#  * License along with this program; if not, write to the
+#  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+#  * Boston, MA 021110-1307, USA.
+#  *
+#  * Authors: Atul Sabharwal
+#  *          
+
 CFLAGS = -g 
 TARGET = chassis_id
 
diff -Nur chassis_id.org/chassis_id.c chassis_id.new/chassis_id.c
--- chassis_id.org/chassis_id.c	2004-04-21 14:39:11.000000000 -0700
+++ chassis_id.new/chassis_id.c	2004-06-04 17:54:16.882067176 -0700
@@ -1,15 +1,25 @@
-/* -*-c-*-: 
- **
- ** (C) 2003 Intel Corporation
- **          Atul Sabharwal <atul.sabharwal@intel.com>
- **
- ** Distributed under the terms of the GNU Public License, v2.0 or
- ** later.
- **
- ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper;
- ** with his permission, they have been re-licensed GPL, and his
- ** copyright still applies on them
- **
+/* 
+ * chassis_id.c
+ *
+ * Copyright (C) 2003, 2004 Intel Corporation.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ *
+ * Authors: Atul Sabharwal
+ *          
  */
 
 #include <stdio.h>
@@ -22,33 +32,13 @@
 
 int main(int argc, char **argv, char ** envp)
 {
-	int chassis_num, slot_num, retval, host_num;
+	int chassis_num, slot_num, retval;
 	char disk_snum[255], devpath[255];
 	char *ptr;
 	int disk_index;
 
 	syslog( LOG_PID| LOG_DAEMON| LOG_ERR, "\n%s", "starting chassis_id" );
 
-#if 0
-	ptr = getenv("CHASSIS");
-	if (ptr == NULL)
-		return -ERROR_NO_CHASSIS;
-
-	sscanf(ptr, "%d", &chassis_num);
-	#ifdef DEBUG
-	syslog(LOG_PID| LOG_DAEMON| LOG_ERR, "Chassis %d", chassis_num);
-	#endif
-
-
-	ptr = getenv("SLOT");
-	if (ptr== NULL)
-		return -ERROR_NO_SLOT;
-
-	sscanf(ptr, "%d", &slot_num);
-	#ifdef DEBUG
-	syslog( LOG_PID|LOG_DAEMON| LOG_ERR, "Slot %d", slot_num);
-	#endif
-#endif
 	ptr = getenv("DEVPATH");
 	if (ptr == NULL)
 		return -ERROR_NO_DEVPATH;
@@ -65,7 +55,7 @@
 	getserial_number(devpath, disk_snum);
 
 	/* Now we open the provisioning table t find actual entry for the serial number*/
-	disk_index =  table_find_disk(disk_snum, &host_num, &chassis_num, &slot_num);
+	disk_index =  table_find_disk(disk_snum, &chassis_num, &slot_num);
 	if ( disk_index == -1 ) {
 		// typical provisioning error
 		return -ERROR_NO_DISK;
diff -Nur chassis_id.org/table.c chassis_id.new/table.c
--- chassis_id.org/table.c	2004-04-21 14:39:11.000000000 -0700
+++ chassis_id.new/table.c	2004-06-04 17:55:00.737400152 -0700
@@ -1,17 +1,25 @@
-/* -*-c-*-: 
- **
- ** (C) 2003 Intel Corporation
- **          Atul Sabharwal <atul.sabharwal@intel.com>
- **
- ** $Id: table.c,v 1.4 2004/03/18 21:56:24 atul Exp $
- **
- ** Distributed under the terms of the GNU Public License, v2.0 or
- ** later.
- **
- ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper;
- ** with his permission, they have been re-licensed GPL, and his
- ** copyright still applies on them. 
- **
+/* 
+ * table.c
+ *
+ * Copyright (C) 2003, 2004 Intel Corporation.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ *
+ * Authors: Atul Sabharwal
+ *          
  */
 
 #include <stdio.h>
@@ -22,7 +30,6 @@
 struct provision_record
 {
 	int  id;
-	int  host_num;          //port # or adaptor number
 	int  num_disks;
 	int  chassis_num;
 	int  slot_num;
@@ -51,7 +58,7 @@
 	while (!feof(fp)) {
 		fgets(ptr, 80, fp);	
 		sscanf(ptr, "%d %d %d %d %d %s %s", &ptable[i].id,
-			&ptable[i].host_num, &ptable[i].num_disks, 
+			&ptable[i].num_disks, 
 			&ptable[i].chassis_num, &ptable[i].slot_num,
 			ptable[i].serial_num, ptable[i].name);
 		i++;       
@@ -70,7 +77,6 @@
 
 	for (i = 0; i < ptable_size; i++) {
 		if (strcmp(ptable[i].serial_num, serialnumber) == 0) {
-			*host_num =  ptable[i].host_num;
 			*chassis_num =  ptable[i].chassis_num;
 			*slot_num = ptable[i].slot_num;
 			break;
@@ -91,7 +97,6 @@
 {
 	printf("%d ", ptable[diskindex].chassis_num);
 	printf("%d ", ptable[diskindex].slot_num);
-	printf("%d ", ptable[diskindex].host_num);
 	printf("%s ", ptable[diskindex].name);
 }
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Patch for chassis_id exras module
  2004-06-05  1:06 Patch for chassis_id exras module Sabharwal, Atul
@ 2004-06-07 16:52 ` Sabharwal, Atul
  2004-06-07 23:08 ` Greg KH
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sabharwal, Atul @ 2004-06-07 16:52 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 836 bytes --]

HI Greg,

This is a patch to add a sample rule for the chassis_id module. Please
applyu this
Patch also.

Thanks,

Atul

-------------------------------------------------------------
P.S:  All opinions are my personal opinion(s) & responsibility and do
not represent the view of my employer ( Intel Corporation ).
 

>-----Original Message-----
>From: Sabharwal, Atul 
>Sent: Friday, June 04, 2004 6:06 PM
>To: 'Greg KH'
>Cc: linux-hotplug-devel@lists.sourceforge.net
>Subject: Patch for chassis_id exras module
>
>Hi Greg,
>
>Please find attached a patch for the extras module chassis_id. 
> The patch removes an
>Extra field "host number" from the provisioning table. Also 
>corrected the license
>Header and removed some dead code.
>
>Please apply it to your distribution.
>
>Thanks,
>
>Atul
>
>

[-- Attachment #2: udev.patch --]
[-- Type: application/octet-stream, Size: 528 bytes --]

diff -Nur chassis_id.org1/udev.rules chassis_id.new/udev.rules
--- chassis_id.org1/udev.rules	1969-12-31 16:00:00.000000000 -0800
+++ chassis_id.new/udev.rules	2004-06-07 09:43:24.573109240 -0700
@@ -0,0 +1,7 @@
+# There are a number of modifiers that are allowed to be used in some of the
+# fields.  See the udev man page for a full description of them.
+#
+# See the udev.rules.examples file for more examples of how to create rules
+#
+
+BUS="scsi", PROGRAM="/usr/local/bin/chassis_id", NAME="/chassis%c{1}/slot%c{2}/%c{3}"

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Patch for chassis_id exras module
  2004-06-05  1:06 Patch for chassis_id exras module Sabharwal, Atul
  2004-06-07 16:52 ` Sabharwal, Atul
@ 2004-06-07 23:08 ` Greg KH
  2004-06-08  1:36 ` Sabharwal, Atul
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2004-06-07 23:08 UTC (permalink / raw)
  To: linux-hotplug

On Fri, Jun 04, 2004 at 06:06:21PM -0700, Sabharwal, Atul wrote:
> Hi Greg,
> 
> Please find attached a patch for the extras module chassis_id.  The
> patch removes an Extra field "host number" from the provisioning
> table. Also corrected the license Header and removed some dead code.
> 
> Please apply it to your distribution.

Ick, I can't apply this, or your other patch, as I need to be able to
use 'patch -p1' from the main udev directory to be able to apply this
patch with your name as the author.

Care to grab the latest version of udev (026) and send me a patch
against it?

thanks,

greg k-h


-------------------------------------------------------
This SF.Net email is sponsored by: GNOME Foundation
Hackers Unite!  GUADEC: The world's #1 Open Source Desktop Event.
GNOME Users and Developers European Conference, 28-30th June in Norway
http://2004/guadec.org
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Patch for chassis_id exras module
  2004-06-05  1:06 Patch for chassis_id exras module Sabharwal, Atul
  2004-06-07 16:52 ` Sabharwal, Atul
  2004-06-07 23:08 ` Greg KH
@ 2004-06-08  1:36 ` Sabharwal, Atul
  2004-06-17 19:26 ` Martin Hicks
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sabharwal, Atul @ 2004-06-08  1:36 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 397 bytes --]


>Ick, I can't apply this, or your other patch, as I need to be able to
>use 'patch -p1' from the main udev directory to be able to apply this
>patch with your name as the author.
>
>Care to grab the latest version of udev (026) and send me a patch
>against it?
>

I took the udev 26 version and created a single new patch. Let me
Know if there are some problems. 

Thanks,

Atul


[-- Attachment #2: chassis_id.patch --]
[-- Type: application/octet-stream, Size: 11331 bytes --]

diff -Nur udev-026/extras/chassis_id/chassis_id.c udev-026.new/extras/chassis_id/chassis_id.c
--- udev-026/extras/chassis_id/chassis_id.c	2004-06-07 15:44:28.000000000 -0700
+++ udev-026.new/extras/chassis_id/chassis_id.c	2004-06-07 18:25:05.488625800 -0700
@@ -1,15 +1,24 @@
-/* -*-c-*-: 
- **
- ** (C) 2003 Intel Corporation
- **          Atul Sabharwal <atul.sabharwal@intel.com>
- **
- ** Distributed under the terms of the GNU Public License, v2.0 or
- ** later.
- **
- ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper;
- ** with his permission, they have been re-licensed GPL, and his
- ** copyright still applies on them
- **
+/* 
+ * chassis_id.c
+ *
+ * Copyright (C) 2004 Intel Corporation.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v 2.0 as published by the Free Software Foundation; 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ *
+ * Authors: Atul Sabharwal
+ *          
  */
 
 #include <stdio.h>
@@ -22,33 +31,13 @@
 
 int main(int argc, char **argv, char ** envp)
 {
-	int chassis_num, slot_num, retval, host_num;
+	int chassis_num, slot_num, retval;
 	char disk_snum[255], devpath[255];
 	char *ptr;
 	int disk_index;
 
 	syslog( LOG_PID| LOG_DAEMON| LOG_ERR, "\n%s", "starting chassis_id" );
 
-#if 0
-	ptr = getenv("CHASSIS");
-	if (ptr == NULL)
-		return -ERROR_NO_CHASSIS;
-
-	sscanf(ptr, "%d", &chassis_num);
-	#ifdef DEBUG
-	syslog(LOG_PID| LOG_DAEMON| LOG_ERR, "Chassis %d", chassis_num);
-	#endif
-
-
-	ptr = getenv("SLOT");
-	if (ptr== NULL)
-		return -ERROR_NO_SLOT;
-
-	sscanf(ptr, "%d", &slot_num);
-	#ifdef DEBUG
-	syslog( LOG_PID|LOG_DAEMON| LOG_ERR, "Slot %d", slot_num);
-	#endif
-#endif
 	ptr = getenv("DEVPATH");
 	if (ptr == NULL)
 		return -ERROR_NO_DEVPATH;
@@ -65,7 +54,7 @@
 	getserial_number(devpath, disk_snum);
 
 	/* Now we open the provisioning table t find actual entry for the serial number*/
-	disk_index =  table_find_disk(disk_snum, &host_num, &chassis_num, &slot_num);
+	disk_index =  table_find_disk(disk_snum, &chassis_num, &slot_num);
 	if ( disk_index == -1 ) {
 		// typical provisioning error
 		return -ERROR_NO_DISK;
diff -Nur udev-026/extras/chassis_id/chassis_id.h udev-026.new/extras/chassis_id/chassis_id.h
--- udev-026/extras/chassis_id/chassis_id.h	2004-06-07 15:44:27.000000000 -0700
+++ udev-026.new/extras/chassis_id/chassis_id.h	2004-06-07 18:24:55.189191552 -0700
@@ -1,15 +1,24 @@
-/* -*-c-*-: 
- **
- ** (C) 2003 Intel Corporation
- **          Atul Sabharwal <atul.sabharwal@intel.com>
- **
- ** Distributed under the terms of the GNU Public License, v2.0 or
- ** later.
- **
- ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper;
- ** with his permission, they have been re-licensed GPL, and his
- ** copyright still applies on them. 
- **
+/* 
+ * chassis_id.h
+ *
+ * Copyright (C) 2004 Intel Corporation.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v 2.0 as published by the Free Software Foundation; 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ *
+ * Authors: Atul Sabharwal
+ *          
  */
 
 #ifndef _CHASSIS_ID_H
diff -Nur udev-026/extras/chassis_id/install.txt udev-026.new/extras/chassis_id/install.txt
--- udev-026/extras/chassis_id/install.txt	1969-12-31 16:00:00.000000000 -0800
+++ udev-026.new/extras/chassis_id/install.txt	2004-06-07 18:21:05.574098352 -0700
@@ -0,0 +1,49 @@
+
+Udev does not come pre-installed on a Linux system. Hence, we need to do the following before
+a Linux system is ready ::
+
+Steps:
+~~~~~
+1.  Install libsysfs shared libraries by installing sysfsutils-0.4.0.
+
+2.  Download latest version of udev from www.kernel.org site. It is
+    under repository->utils->kernel path chain.
+
+    Do make and make install so as to install udev. To install scsi_id,
+    go into extras/scsi_id folder to compile scsi_id. Typically, this
+    would be in /sbin folder.  Now, change scsi_id.cfg and set the
+    global option to work with all devices ( -g) and comment out the
+    black list option ( -b ).
+
+3.  Download chassis_id callout code and compile. Install chassis_id and
+    provision.tbl file in /usr/local/bin.
+
+4.  In /etc/rc.sysinit, add mount command to mount the sys memory file
+    system. ( mount -t sysfs sys /sys ). The /sys is necessary as
+    lot of the software components expect it to be in /sys.
+
+5.  Now, in /etc/udev/udev.rules, install the udev rules file. This
+    is the GDN config file which is used by udev to create folders
+    in the form chasis<N>/slot<M>/port<O>/disk<P>.
+
+6.  Now, you are almost there. Refer to PROVISIONING file.
+
+
+PROVISIONING:
+1.  For GDN, the provisioning file is in the format :
+   <id>  <host>   <number_of_disks>     <chassis#>    <slot#>  <serial#>  <name>
+
+   <host>            SCSI host on which the device is connected
+   <Number of disks> how many disks on this blade ?
+   <chassis#>        chassis Number
+   <slot#>           Physical slot number
+   <serial#>         Serial Number for the disk
+   <name>            Name of the disk device.
+
+2.  To fill the provisioning table, the user needs to collect this information and
+    fill provision.tbl.
+
+    The serial number is found from the command scsi_id -p 0x80 -s <device name>.
+
+    The host number is availble from the sys file system. The chassis & slot
+    are visual data and should be enetered into provision.tbl.
diff -Nur udev-026/extras/chassis_id/Makefile udev-026.new/extras/chassis_id/Makefile
--- udev-026/extras/chassis_id/Makefile	2004-06-07 15:44:27.000000000 -0700
+++ udev-026.new/extras/chassis_id/Makefile	2004-06-07 18:26:57.149650744 -0700
@@ -1,19 +1,25 @@
-#
-#   **
-#   ** (C) 2003 Intel Corporation
-#   **          Atul Sabharwal <atul.sabharwal@intel.com>
-#   **
-#   ** $Id: Makefile,v 1.3 2004/03/22 23:54:54 atul Exp $
-#   **
-#   ** Distributed under the terms of the GNU Public License, v2.0 or
-#   ** later.
-#   **
-#   ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper;
-#   ** with his permission, they have been re-licensed GPL, and his
-#   ** copyright still applies on them. 
-#   **
-#   */
-#
+# * 
+# * Makefile
+# *
+# * Copyright (C) 2004 Intel Corporation.  All rights reserved.
+# *
+# * This program is free software; you can redistribute it and/or
+# * modify it under the terms of the GNU General Public
+# * License v2.0 as published by the Free Software Foundation; 
+# *
+# * This program is distributed in the hope that it will be useful,
+# * but WITHOUT ANY WARRANTY; without even the implied warranty of
+# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# * General Public License for more details.
+# *
+# * You should have received a copy of the GNU General Public
+# * License along with this program; if not, write to the
+# * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# * Boston, MA 021110-1307, USA.
+# *
+# * Authors: Atul Sabharwal
+# *          
+# *
 CFLAGS = -g 
 TARGET = chassis_id
 
diff -Nur udev-026/extras/chassis_id/table.c udev-026.new/extras/chassis_id/table.c
--- udev-026/extras/chassis_id/table.c	2004-06-07 15:44:28.000000000 -0700
+++ udev-026.new/extras/chassis_id/table.c	2004-06-07 18:25:32.675492768 -0700
@@ -1,17 +1,24 @@
-/* -*-c-*-: 
- **
- ** (C) 2003 Intel Corporation
- **          Atul Sabharwal <atul.sabharwal@intel.com>
- **
- ** $Id: table.c,v 1.4 2004/03/18 21:56:24 atul Exp $
- **
- ** Distributed under the terms of the GNU Public License, v2.0 or
- ** later.
- **
- ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper;
- ** with his permission, they have been re-licensed GPL, and his
- ** copyright still applies on them. 
- **
+/* 
+ * table.c
+ *
+ * Copyright (C) 2004 Intel Corporation.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2.0 as published by the Free Software Foundation; 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ *
+ * Authors: Atul Sabharwal
+ *          
  */
 
 #include <stdio.h>
@@ -22,7 +29,6 @@
 struct provision_record
 {
 	int  id;
-	int  host_num;          //port # or adaptor number
 	int  num_disks;
 	int  chassis_num;
 	int  slot_num;
@@ -51,7 +57,7 @@
 	while (!feof(fp)) {
 		fgets(ptr, 80, fp);	
 		sscanf(ptr, "%d %d %d %d %d %s %s", &ptable[i].id,
-			&ptable[i].host_num, &ptable[i].num_disks, 
+			&ptable[i].num_disks, 
 			&ptable[i].chassis_num, &ptable[i].slot_num,
 			ptable[i].serial_num, ptable[i].name);
 		i++;       
@@ -70,7 +76,6 @@
 
 	for (i = 0; i < ptable_size; i++) {
 		if (strcmp(ptable[i].serial_num, serialnumber) == 0) {
-			*host_num =  ptable[i].host_num;
 			*chassis_num =  ptable[i].chassis_num;
 			*slot_num = ptable[i].slot_num;
 			break;
@@ -91,7 +96,6 @@
 {
 	printf("%d ", ptable[diskindex].chassis_num);
 	printf("%d ", ptable[diskindex].slot_num);
-	printf("%d ", ptable[diskindex].host_num);
 	printf("%s ", ptable[diskindex].name);
 }
 
diff -Nur udev-026/extras/chassis_id/udev.rules udev-026.new/extras/chassis_id/udev.rules
--- udev-026/extras/chassis_id/udev.rules	1969-12-31 16:00:00.000000000 -0800
+++ udev-026.new/extras/chassis_id/udev.rules	2004-06-07 18:20:17.259443296 -0700
@@ -0,0 +1,7 @@
+# There are a number of modifiers that are allowed to be used in some of the
+# fields.  See the udev man page for a full description of them.
+#
+# See the udev.rules.examples file for more examples of how to create rules
+#
+
+BUS="scsi", PROGRAM="/usr/local/bin/chassis_id", NAME="/chassis%c{1}/slot%c{2}/%c{3}"

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Patch for chassis_id exras module
  2004-06-05  1:06 Patch for chassis_id exras module Sabharwal, Atul
                   ` (2 preceding siblings ...)
  2004-06-08  1:36 ` Sabharwal, Atul
@ 2004-06-17 19:26 ` Martin Hicks
  2004-06-17 19:53 ` Sabharwal, Atul
  2004-06-26  0:30 ` Greg KH
  5 siblings, 0 replies; 7+ messages in thread
From: Martin Hicks @ 2004-06-17 19:26 UTC (permalink / raw)
  To: linux-hotplug



On Mon, Jun 07, 2004 at 06:36:49PM -0700, Sabharwal, Atul wrote:
> 
> >Ick, I can't apply this, or your other patch, as I need to be able to
> >use 'patch -p1' from the main udev directory to be able to apply this
> >patch with your name as the author.
> >
> >Care to grab the latest version of udev (026) and send me a patch
> >against it?
> >
> 
> I took the udev 26 version and created a single new patch. Let me
> Know if there are some problems. 

step away from the windows box.  You're mangling the patch with DOS line
endings...

mh

-- 
Martin Hicks || mort@bork.org || PGP/GnuPG: 0x4C7F2BEE


-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Patch for chassis_id exras module
  2004-06-05  1:06 Patch for chassis_id exras module Sabharwal, Atul
                   ` (3 preceding siblings ...)
  2004-06-17 19:26 ` Martin Hicks
@ 2004-06-17 19:53 ` Sabharwal, Atul
  2004-06-26  0:30 ` Greg KH
  5 siblings, 0 replies; 7+ messages in thread
From: Sabharwal, Atul @ 2004-06-17 19:53 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 1225 bytes --]

Here is the patch attached in Linux format. Alternately, use dos2unix on
the
Prior version.

Thanks,

Atul

-------------------------------------------------------------
P.S:  All opinions are my personal opinion(s) & responsibility and do
not represent the view of my employer ( Intel Corporation ).
 

>-----Original Message-----
>From: Martin Hicks [mailto:mort@bork.org] 
>Sent: Thursday, June 17, 2004 12:27 PM
>To: Sabharwal, Atul
>Cc: Greg KH; linux-hotplug-devel@lists.sourceforge.net
>Subject: Re: Patch for chassis_id exras module
>
>
>
>On Mon, Jun 07, 2004 at 06:36:49PM -0700, Sabharwal, Atul wrote:
>> 
>> >Ick, I can't apply this, or your other patch, as I need to 
>be able to
>> >use 'patch -p1' from the main udev directory to be able to 
>apply this
>> >patch with your name as the author.
>> >
>> >Care to grab the latest version of udev (026) and send me a patch
>> >against it?
>> >
>> 
>> I took the udev 26 version and created a single new patch. Let me
>> Know if there are some problems. 
>
>step away from the windows box.  You're mangling the patch 
>with DOS line
>endings...
>
>mh
>
>-- 
>Martin Hicks || mort@bork.org || PGP/GnuPG: 0x4C7F2BEE
>
>

[-- Attachment #2: unified.patch --]
[-- Type: application/octet-stream, Size: 8092 bytes --]

diff -Nur udev-026/extras/chassis_id/chassis_id.c udev-026.new/extras/chassis_id/chassis_id.c
--- udev-026/extras/chassis_id/chassis_id.c	2004-06-07 15:44:28.000000000 -0700
+++ udev-026.new/extras/chassis_id/chassis_id.c	2004-06-07 18:19:59.364163792 -0700
@@ -1,15 +1,25 @@
-/* -*-c-*-: 
- **
- ** (C) 2003 Intel Corporation
- **          Atul Sabharwal <atul.sabharwal@intel.com>
- **
- ** Distributed under the terms of the GNU Public License, v2.0 or
- ** later.
- **
- ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper;
- ** with his permission, they have been re-licensed GPL, and his
- ** copyright still applies on them
- **
+/* 
+ * chassis_id.c
+ *
+ * Copyright (C) 2003, 2004 Intel Corporation.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ *
+ * Authors: Atul Sabharwal
+ *          
  */
 
 #include <stdio.h>
@@ -22,33 +32,13 @@
 
 int main(int argc, char **argv, char ** envp)
 {
-	int chassis_num, slot_num, retval, host_num;
+	int chassis_num, slot_num, retval;
 	char disk_snum[255], devpath[255];
 	char *ptr;
 	int disk_index;
 
 	syslog( LOG_PID| LOG_DAEMON| LOG_ERR, "\n%s", "starting chassis_id" );
 
-#if 0
-	ptr = getenv("CHASSIS");
-	if (ptr == NULL)
-		return -ERROR_NO_CHASSIS;
-
-	sscanf(ptr, "%d", &chassis_num);
-	#ifdef DEBUG
-	syslog(LOG_PID| LOG_DAEMON| LOG_ERR, "Chassis %d", chassis_num);
-	#endif
-
-
-	ptr = getenv("SLOT");
-	if (ptr== NULL)
-		return -ERROR_NO_SLOT;
-
-	sscanf(ptr, "%d", &slot_num);
-	#ifdef DEBUG
-	syslog( LOG_PID|LOG_DAEMON| LOG_ERR, "Slot %d", slot_num);
-	#endif
-#endif
 	ptr = getenv("DEVPATH");
 	if (ptr == NULL)
 		return -ERROR_NO_DEVPATH;
@@ -65,7 +55,7 @@
 	getserial_number(devpath, disk_snum);
 
 	/* Now we open the provisioning table t find actual entry for the serial number*/
-	disk_index =  table_find_disk(disk_snum, &host_num, &chassis_num, &slot_num);
+	disk_index =  table_find_disk(disk_snum, &chassis_num, &slot_num);
 	if ( disk_index == -1 ) {
 		// typical provisioning error
 		return -ERROR_NO_DISK;
diff -Nur udev-026/extras/chassis_id/install.txt udev-026.new/extras/chassis_id/install.txt
--- udev-026/extras/chassis_id/install.txt	1969-12-31 16:00:00.000000000 -0800
+++ udev-026.new/extras/chassis_id/install.txt	2004-06-07 18:21:05.574098352 -0700
@@ -0,0 +1,49 @@
+
+Udev does not come pre-installed on a Linux system. Hence, we need to do the following before
+a Linux system is ready ::
+
+Steps:
+~~~~~
+1.  Install libsysfs shared libraries by installing sysfsutils-0.4.0.
+
+2.  Download latest version of udev from www.kernel.org site. It is
+    under repository->utils->kernel path chain.
+
+    Do make and make install so as to install udev. To install scsi_id,
+    go into extras/scsi_id folder to compile scsi_id. Typically, this
+    would be in /sbin folder.  Now, change scsi_id.cfg and set the
+    global option to work with all devices ( -g) and comment out the
+    black list option ( -b ).
+
+3.  Download chassis_id callout code and compile. Install chassis_id and
+    provision.tbl file in /usr/local/bin.
+
+4.  In /etc/rc.sysinit, add mount command to mount the sys memory file
+    system. ( mount -t sysfs sys /sys ). The /sys is necessary as
+    lot of the software components expect it to be in /sys.
+
+5.  Now, in /etc/udev/udev.rules, install the udev rules file. This
+    is the GDN config file which is used by udev to create folders
+    in the form chasis<N>/slot<M>/port<O>/disk<P>.
+
+6.  Now, you are almost there. Refer to PROVISIONING file.
+
+
+PROVISIONING:
+1.  For GDN, the provisioning file is in the format :
+   <id>  <host>   <number_of_disks>     <chassis#>    <slot#>  <serial#>  <name>
+
+   <host>            SCSI host on which the device is connected
+   <Number of disks> how many disks on this blade ?
+   <chassis#>        chassis Number
+   <slot#>           Physical slot number
+   <serial#>         Serial Number for the disk
+   <name>            Name of the disk device.
+
+2.  To fill the provisioning table, the user needs to collect this information and
+    fill provision.tbl.
+
+    The serial number is found from the command scsi_id -p 0x80 -s <device name>.
+
+    The host number is availble from the sys file system. The chassis & slot
+    are visual data and should be enetered into provision.tbl.
diff -Nur udev-026/extras/chassis_id/table.c udev-026.new/extras/chassis_id/table.c
--- udev-026/extras/chassis_id/table.c	2004-06-07 15:44:28.000000000 -0700
+++ udev-026.new/extras/chassis_id/table.c	2004-06-07 18:20:11.994243728 -0700
@@ -1,17 +1,25 @@
-/* -*-c-*-: 
- **
- ** (C) 2003 Intel Corporation
- **          Atul Sabharwal <atul.sabharwal@intel.com>
- **
- ** $Id: table.c,v 1.4 2004/03/18 21:56:24 atul Exp $
- **
- ** Distributed under the terms of the GNU Public License, v2.0 or
- ** later.
- **
- ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper;
- ** with his permission, they have been re-licensed GPL, and his
- ** copyright still applies on them. 
- **
+/* 
+ * table.c
+ *
+ * Copyright (C) 2003, 2004 Intel Corporation.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ *
+ * Authors: Atul Sabharwal
+ *          
  */
 
 #include <stdio.h>
@@ -22,7 +30,6 @@
 struct provision_record
 {
 	int  id;
-	int  host_num;          //port # or adaptor number
 	int  num_disks;
 	int  chassis_num;
 	int  slot_num;
@@ -51,7 +58,7 @@
 	while (!feof(fp)) {
 		fgets(ptr, 80, fp);	
 		sscanf(ptr, "%d %d %d %d %d %s %s", &ptable[i].id,
-			&ptable[i].host_num, &ptable[i].num_disks, 
+			&ptable[i].num_disks, 
 			&ptable[i].chassis_num, &ptable[i].slot_num,
 			ptable[i].serial_num, ptable[i].name);
 		i++;       
@@ -70,7 +77,6 @@
 
 	for (i = 0; i < ptable_size; i++) {
 		if (strcmp(ptable[i].serial_num, serialnumber) == 0) {
-			*host_num =  ptable[i].host_num;
 			*chassis_num =  ptable[i].chassis_num;
 			*slot_num = ptable[i].slot_num;
 			break;
@@ -91,7 +97,6 @@
 {
 	printf("%d ", ptable[diskindex].chassis_num);
 	printf("%d ", ptable[diskindex].slot_num);
-	printf("%d ", ptable[diskindex].host_num);
 	printf("%s ", ptable[diskindex].name);
 }
 
diff -Nur udev-026/extras/chassis_id/udev.rules udev-026.new/extras/chassis_id/udev.rules
--- udev-026/extras/chassis_id/udev.rules	1969-12-31 16:00:00.000000000 -0800
+++ udev-026.new/extras/chassis_id/udev.rules	2004-06-07 18:20:17.259443296 -0700
@@ -0,0 +1,7 @@
+# There are a number of modifiers that are allowed to be used in some of the
+# fields.  See the udev man page for a full description of them.
+#
+# See the udev.rules.examples file for more examples of how to create rules
+#
+
+BUS="scsi", PROGRAM="/usr/local/bin/chassis_id", NAME="/chassis%c{1}/slot%c{2}/%c{3}"

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Patch for chassis_id exras module
  2004-06-05  1:06 Patch for chassis_id exras module Sabharwal, Atul
                   ` (4 preceding siblings ...)
  2004-06-17 19:53 ` Sabharwal, Atul
@ 2004-06-26  0:30 ` Greg KH
  5 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2004-06-26  0:30 UTC (permalink / raw)
  To: linux-hotplug

On Mon, Jun 07, 2004 at 06:36:49PM -0700, Sabharwal, Atul wrote:
> 
> >Ick, I can't apply this, or your other patch, as I need to be able to
> >use 'patch -p1' from the main udev directory to be able to apply this
> >patch with your name as the author.
> >
> >Care to grab the latest version of udev (026) and send me a patch
> >against it?
> >
> 
> I took the udev 26 version and created a single new patch. Let me
> Know if there are some problems. 

Applied, thanks.

greg k-h


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-06-26  0:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-05  1:06 Patch for chassis_id exras module Sabharwal, Atul
2004-06-07 16:52 ` Sabharwal, Atul
2004-06-07 23:08 ` Greg KH
2004-06-08  1:36 ` Sabharwal, Atul
2004-06-17 19:26 ` Martin Hicks
2004-06-17 19:53 ` Sabharwal, Atul
2004-06-26  0:30 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).