summaryrefslogtreecommitdiff
path: root/extras/chassis_id
diff options
context:
space:
mode:
authoratul.sabharwal@intel.com <atul.sabharwal@intel.com>2004-06-26 01:18:08 -0700
committerGreg KH <gregkh@suse.de>2005-04-26 21:36:21 -0700
commitc5d046b6c7f4dbd2072933b792f95f2793b28178 (patch)
tree45fe9e42555d58f067363b8712b3d34497b816f7 /extras/chassis_id
parent57218a087303505b01fb20cbe4c6961bd13fe411 (diff)
[PATCH] Patch for chassis_id exras module
Diffstat (limited to 'extras/chassis_id')
-rw-r--r--extras/chassis_id/Makefile38
-rw-r--r--extras/chassis_id/chassis_id.c57
-rw-r--r--extras/chassis_id/chassis_id.h33
-rw-r--r--extras/chassis_id/install.txt49
-rw-r--r--extras/chassis_id/table.c40
-rw-r--r--extras/chassis_id/udev.rules7
6 files changed, 144 insertions, 80 deletions
diff --git a/extras/chassis_id/Makefile b/extras/chassis_id/Makefile
index d3152e863c..1b641cafda 100644
--- a/extras/chassis_id/Makefile
+++ b/extras/chassis_id/Makefile
@@ -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 --git a/extras/chassis_id/chassis_id.c b/extras/chassis_id/chassis_id.c
index 857707eac7..3fdfa96018 100644
--- a/extras/chassis_id/chassis_id.c
+++ b/extras/chassis_id/chassis_id.c
@@ -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 @@ 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;
diff --git a/extras/chassis_id/chassis_id.h b/extras/chassis_id/chassis_id.h
index 253e603bfd..9937e3dfac 100644
--- a/extras/chassis_id/chassis_id.h
+++ b/extras/chassis_id/chassis_id.h
@@ -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
index 0000000000..a567afedcf
--- /dev/null
+++ b/extras/chassis_id/install.txt
@@ -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 --git a/extras/chassis_id/table.c b/extras/chassis_id/table.c
index e619fa9ef3..f4689ae243 100644
--- a/extras/chassis_id/table.c
+++ b/extras/chassis_id/table.c
@@ -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
index 0000000000..b1618c1b0b
--- /dev/null
+++ b/extras/chassis_id/udev.rules
@@ -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}"