diff options
author | Kay Sievers <kay.sievers@suse.de> | 2005-09-12 14:28:59 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@suse.de> | 2005-09-12 14:28:59 +0200 |
commit | 852cc0f58dba9d101abf86880aaea4880222de47 (patch) | |
tree | 39a70134cf987aaa45ddf25837d1d87ecc690542 /extras | |
parent | 17d3cb12882f71f19a78beb26054054628423703 (diff) |
remove chassis_id program
Broken and unmaintained!
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Diffstat (limited to 'extras')
-rw-r--r-- | extras/chassis_id/Makefile | 51 | ||||
-rw-r--r-- | extras/chassis_id/README | 28 | ||||
-rw-r--r-- | extras/chassis_id/chassis_id.c | 91 | ||||
-rw-r--r-- | extras/chassis_id/chassis_id.h | 42 | ||||
-rw-r--r-- | extras/chassis_id/install.txt | 49 | ||||
-rw-r--r-- | extras/chassis_id/provision.tbl | 5 | ||||
-rw-r--r-- | extras/chassis_id/table.c | 106 | ||||
-rw-r--r-- | extras/chassis_id/udev.rules | 7 |
8 files changed, 0 insertions, 379 deletions
diff --git a/extras/chassis_id/Makefile b/extras/chassis_id/Makefile deleted file mode 100644 index ae5c95961c..0000000000 --- a/extras/chassis_id/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -# * -# * 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 -# * -# * - -TARGET = chassis_id - -exec_prefix = ${prefix} -sbindir = ${exec_prefix}/sbin -INSTALL = /usr/bin/install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -all: chassis_id - -ifneq ($(strip $(USE_KLIBC)),true) -chassis_id: chassis_id.c table.c - $(QUIET) $(CC) -o $(TARGET) $(CFLAGS) chassis_id.c table.c - -install: all - $(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(sbindir)/$(TARGET) -else -chassis_id: - @echo - @echo "!!! chassis_id is incompatible with klibc !!!" - @echo - @exit 0 - -install: all -endif - -clean: - rm -rf core a.out $(TARGET) - diff --git a/extras/chassis_id/README b/extras/chassis_id/README deleted file mode 100644 index 51add4945e..0000000000 --- a/extras/chassis_id/README +++ /dev/null @@ -1,28 +0,0 @@ - README.txt - ~~~~~~~~~~ -Chassis_id is a callout program which is used to give geographic names to devices. It uses -another callout program scsi_id to determine the serial number of a device and then looks up -the provisioning table based on this key. It retrieves geographic information -( chassis#, slot# and host# ) about the device and prints it to stdout. These fields are -used by udev to create the device entry. - -Using Udev: -~~~~~~~~~~ -Chassis_id gets invoked by udev using the udev as below: - -BUS="scsi", PROGRAM="/usr/local/bin/chassis_id", NAME="/chassis%c{1}/slot%c{2}/host%c{3}/disk-%c{4} - -The provisioning table ( file provision.tbl ) has to be put in /usr/local/bin and as of now has -to be populated manually. This is the only place where the geographic map of devices is kept -in the system. - - -Usage Model: -~~~~~~~~~~~~ -On ATCA based blade architecture systems, blade insertion/removal is common. We create names -in a 3 level deep tree which represent the geographic map of the devices. - - -CONTACT: -~~~~~~~~ -Please feel free to contact atul.sabharwal@intel.com with questions, comments, suggestions. diff --git a/extras/chassis_id/chassis_id.c b/extras/chassis_id/chassis_id.c deleted file mode 100644 index de86087921..0000000000 --- a/extras/chassis_id/chassis_id.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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> -#include <stdlib.h> -#include <syslog.h> - -#include "chassis_id.h" - -//#define DEBUG 1 - -/* Run SCSI id to find serial number of the device */ -static int getserial_number(char * devpath, char * snumber) -{ - FILE *fp; - char vendor[255], model[255], cmd[255]; - int retval; - - sprintf(cmd, "/sbin/scsi_id -s %s -p 0x80", devpath); - - fp = popen(cmd, "r"); - - if (fp == NULL) - return -ERROR_BAD_SNUMBER; - - fscanf(fp, "%s %s %s", vendor, model, snumber); - #ifdef DEBUG - syslog(LOG_PID| LOG_DAEMON| LOG_ERR, "\n%s", snumber ); - #endif - - retval = pclose(fp); - if (retval == -1) - return -ERROR_BAD_SNUMBER; - else - return NO_ERROR; -} - -int main(int argc, char **argv, char **envp) -{ - 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" ); - - ptr = getenv("DEVPATH"); - if (ptr == NULL) - return -ERROR_NO_DEVPATH; - - sscanf(ptr, "%s", &devpath[0]); - #ifdef DEBUG - syslog(LOG_PID|LOG_DAEMON| LOG_ERR, "Devpath %s", devpath); - #endif - - retval = table_init(); - if (retval < 0) - return -ERROR_BAD_TABLE; - - 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, &chassis_num, &slot_num); - if ( disk_index == -1 ) { - // typical provisioning error - return -ERROR_NO_DISK; - } else { - table_select_disk( disk_index ); - } - return 0; -} diff --git a/extras/chassis_id/chassis_id.h b/extras/chassis_id/chassis_id.h deleted file mode 100644 index 1463bd22c7..0000000000 --- a/extras/chassis_id/chassis_id.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 -#define _CHASSIS_ID_H - -//#define DEBUG 1 -#define ERROR 1 -#define ERROR_NO_SLOT 2 -#define ERROR_NO_CHASSIS 3 -#define ERROR_NO_DEVPATH 4 -#define ERROR_BAD_SNUMBER 5 -#define ERROR_NO_DISK 6 -#define ERROR_BAD_TABLE 7 -#define ERROR_BAD_SCAN 8 -#define NO_ERROR 0 - -extern int table_init(void); -extern int table_find_disk(const char *serialnumber , int *chassis_num, int *slot_num); -extern int table_select_disk(int diskindex); - -#endif diff --git a/extras/chassis_id/install.txt b/extras/chassis_id/install.txt deleted file mode 100644 index a567afedcf..0000000000 --- a/extras/chassis_id/install.txt +++ /dev/null @@ -1,49 +0,0 @@ - -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/provision.tbl b/extras/chassis_id/provision.tbl deleted file mode 100644 index c137fd537f..0000000000 --- a/extras/chassis_id/provision.tbl +++ /dev/null @@ -1,5 +0,0 @@ -id host number_of_disks chassis# slot# serial# name -1 1 2 1 2 3BM07NKA000070456Z6B disk1 -2 1 2 1 2 3BM07R68000070456ZCK disk2 -3 2 2 1 3 3EV08ANK00007219JAVA disk3 -4 2 2 1 4 3EV00NZB000072190Y90 disk4 diff --git a/extras/chassis_id/table.c b/extras/chassis_id/table.c deleted file mode 100644 index ee64ecc774..0000000000 --- a/extras/chassis_id/table.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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> -#include <string.h> - -#include "chassis_id.h" - -#define TABLE_SIZE 100 -#define PROVISION_DB "/usr/local/bin/provision.tbl" - -struct provision_record -{ - int id; - int num_disks; - int chassis_num; - int slot_num; - char serial_num[32]; - char name[32]; -} ptable[TABLE_SIZE]; - -int ptable_size; - -/* Initialize the provisioning table by reading the data from special file provision.tbl * - Return error if something does not work appropriately. */ -int table_init(void) -{ - FILE *fp; - char ptr[255]; - int i; - - fp = fopen( PROVISION_DB, "r"); - - if ((fp== NULL) || feof(fp)) - return -1; - - // skip the first line of text which contains descriptive details. - fgets(ptr, 80, fp); - i = 0; - while (!feof(fp)) { - fgets(ptr, 80, fp); - sscanf(ptr, "%d %d %d %d %s %s", &ptable[i].id, - &ptable[i].num_disks, - &ptable[i].chassis_num, &ptable[i].slot_num, - ptable[i].serial_num, ptable[i].name); - i++; - } - - ptable_size = i; - fclose(fp); - return 0; -} - - -/* return -1 when no disk found. Otherwise return index of disk */ -int table_find_disk(const char *serialnumber , int *chassis_num, int *slot_num) -{ - int i; - - for (i = 0; i < ptable_size; i++) { - if (strcmp(ptable[i].serial_num, serialnumber) == 0) { - *chassis_num = ptable[i].chassis_num; - *slot_num = ptable[i].slot_num; - break; - } - } - - if (i == ptable_size) - return -1; - else - return i; -} - -/* This function is primarily there for passing the selected disk entry to udev - * so that it can create descriptive GDN for it. So, for that we need to output - * this data to stdout. - */ -int table_select_disk(int diskindex) -{ - printf("%d ", ptable[diskindex].chassis_num); - printf("%d ", ptable[diskindex].slot_num); - printf("%s ", ptable[diskindex].name); - - return 0; -} - diff --git a/extras/chassis_id/udev.rules b/extras/chassis_id/udev.rules deleted file mode 100644 index b1618c1b0b..0000000000 --- a/extras/chassis_id/udev.rules +++ /dev/null @@ -1,7 +0,0 @@ -# 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}" |