chiark / gitweb /
[PATCH] Patch for chassis_id exras module
authoratul.sabharwal@intel.com <atul.sabharwal@intel.com>
Sat, 26 Jun 2004 08:18:08 +0000 (01:18 -0700)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:36:21 +0000 (21:36 -0700)
extras/chassis_id/Makefile
extras/chassis_id/chassis_id.c
extras/chassis_id/chassis_id.h
extras/chassis_id/install.txt [new file with mode: 0644]
extras/chassis_id/table.c
extras/chassis_id/udev.rules [new file with mode: 0644]

index d3152e863c0270e14057e69fde57972713836c46..1b641cafdad8fbdd8310e81894d9d0e95805d689 100644 (file)
@@ -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
 
index 857707eac7efa5e3b2a5b4fd7e595b893595fad5..3fdfa96018e9af4e31c33a81adfaed29853192b9 100644 (file)
@@ -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>
 
 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 @@ int main(int argc, char **argv, char ** envp)
        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;
index 253e603bfddf8df11a02c2efff99077a1faa9dcf..9937e3dfac7e284e653a8886323ecc4e000e13fc 100644 (file)
@@ -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 --git a/extras/chassis_id/install.txt b/extras/chassis_id/install.txt
new file mode 100644 (file)
index 0000000..a567afe
--- /dev/null
@@ -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.
index e619fa9ef32ef9dd6cf81f8c419092f423262f84..f4689ae24361980af0c7f30d2db4b3939026d8c0 100644 (file)
@@ -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 @@ int table_init()
        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 @@ int table_find_disk( char * serialnumber , int * host_num, int * chassis_num, in
 
        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 @@ int table_select_disk( int diskindex )
 {
        printf("%d ", ptable[diskindex].chassis_num);
        printf("%d ", ptable[diskindex].slot_num);
-       printf("%d ", ptable[diskindex].host_num);
        printf("%s ", ptable[diskindex].name);
 }
 
diff --git a/extras/chassis_id/udev.rules b/extras/chassis_id/udev.rules
new file mode 100644 (file)
index 0000000..b1618c1
--- /dev/null
@@ -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}"