summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-12-06 20:48:47 +0100
committerDominik Brodowski <brodo@isilmar.linta.de>2005-12-06 20:49:20 +0100
commit3391f7ca880834cde194b3adadd3e3c6f7c31bcb (patch)
tree22ab5131f822635126f8a746f171a1e4cc440c5d
parent5fd7dc6aeb61ef772225b20650efc03dfe123c6b (diff)
downloadpcmciautils-3391f7ca880834cde194b3adadd3e3c6f7c31bcb.tar.gz
Release of pcmciautils-005 (2005-07-03)
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
-rw-r--r--Makefile11
-rw-r--r--src/pcmcia-modalias.c149
-rw-r--r--src/yacc_config.h35
3 files changed, 9 insertions, 186 deletions
diff --git a/Makefile b/Makefile
index d7f4791..46e5590 100644
--- a/Makefile
+++ b/Makefile
@@ -40,7 +40,7 @@ PCMCIA_SOCKET_STARTUP = pcmcia-socket-startup
CBDUMP = cbdump
CISDUMP = dump_cis
-VERSION = 004
+VERSION = 005
#INSTALL_DIR = /usr/local/sbin
RELEASE_NAME = pcmciautils-$(VERSION)
@@ -108,6 +108,7 @@ WARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
WARNINGS += -Wshadow
CFLAGS := -pipe
+YFLAGS := -d
HEADERS = \
src/cistpl.h \
@@ -172,6 +173,12 @@ ccdv:
.c.o:
$(QUIET) $(CC) $(CFLAGS) -c -o $@ $<
+
+%.c %.h : %.y
+ $(YACC) $(YFLAGS) $<
+ mv y.tab.c $*.c
+ mv y.tab.h $*.h
+
$(PCCARDCTL): $(LIBC) src/$(PCCARDCTL).o $(OBJS) $(HEADERS)
$(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) src/$(PCCARDCTL).o $(LIB_OBJS) $(ARCH_LIB_OBJS)
@@ -203,7 +210,7 @@ clean:
| xargs rm -f
-rm -f $(PCCARDCTL) $(PCMCIA_CHECK_BROKEN_CIS) $(PCMCIA_SOCKET_STARTUP)
-rm -f $(CBDUMP) $(CISDUMP)
- -rm -f src/yacc_config.c src/yacc_config.d src/lex_config.c src/lex_config.d
+ -rm -f src/yacc_config.c src/yacc_config.d src/lex_config.c src/lex_config.d src/yacc_config.h
-rm -f build/ccdv
install-hotplug:
diff --git a/src/pcmcia-modalias.c b/src/pcmcia-modalias.c
deleted file mode 100644
index 6403872..0000000
--- a/src/pcmcia-modalias.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * pcmcia-modalias - generate a MODULE_ALIAS string appropriate for already insterted PCMCIA cards
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * (C) 2005 Dominik Brodowski <linux@brodo.de>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <syslog.h>
-
-#include <sysfs/libsysfs.h>
-
-
-#define PATH_TO_DEVICE "/sys/bus/pcmcia/devices/"
-
-
-unsigned int crc32(unsigned char const *p, unsigned int len)
-{
- int i;
- unsigned int crc = 0;
- while (len--) {
- crc ^= *p++;
- for (i = 0; i < 8; i++)
- crc = (crc >> 1) ^ ((crc & 1) ? 0xedb88320 : 0);
- }
- return crc;
-}
-
-static unsigned int get_one_hash(char *device, unsigned int prod_id_nr) {
- char file[SYSFS_PATH_MAX];
- char value[SYSFS_PATH_MAX];
- int ret;
-
- snprintf(file, SYSFS_PATH_MAX, PATH_TO_DEVICE "%s/prod_id%d", device, prod_id_nr);
-
- ret = sysfs_read_attribute_value(file, value, SYSFS_PATH_MAX);
- if (ret)
- return 0;
-
- if (strlen(value) < 2)
- return 0;
-
- return crc32(value, strlen(value) - 1);
-}
-
-
-static unsigned int read_one(char *device, char *name) {
- char file[SYSFS_PATH_MAX];
- char value[SYSFS_PATH_MAX];
- unsigned int value2;
- int ret;
-
- snprintf(file, SYSFS_PATH_MAX, PATH_TO_DEVICE "%s/%s", device, name);
-
- ret = sysfs_read_attribute_value(file, value, SYSFS_PATH_MAX);
- if (ret)
- return 0;
-
- ret = sscanf(value, "0x%X", &value2);
- if (ret != 1)
- return 0;
-
- return value2;
-}
-
-static int extract_modalias_string(char *device) {
- char modalias_string[SYSFS_PATH_MAX]; /* that's more than enough */
- int pos = 0;
- unsigned int value;
- unsigned int tmp, tmp2;
-
- value = read_one(device, "manf_id");
- pos += snprintf(&modalias_string[pos], SYSFS_PATH_MAX - pos,
- "pcmcia:m%04X", value);
- if (pos > (SYSFS_PATH_MAX - 10))
- return -ENOMEM;
-
- value = read_one(device, "card_id");
- pos += snprintf(&modalias_string[pos], SYSFS_PATH_MAX - pos,
- "c%04X", value);
- if (pos > (SYSFS_PATH_MAX - 10))
- return -ENOMEM;
-
- value = read_one(device, "func_id");
- pos += snprintf(&modalias_string[pos], SYSFS_PATH_MAX - pos,
- "f%02X", value);
- if (pos > (SYSFS_PATH_MAX - 10))
- return -ENOMEM;
-
- tmp2 = sscanf(device, "%d.%d", &tmp, &value);
- if (tmp2 != 2)
- return -EIO;
- pos += snprintf(&modalias_string[pos], SYSFS_PATH_MAX - pos,
- "fn%02X", value);
- if (pos > (SYSFS_PATH_MAX - 10))
- return -ENOMEM;
-
- value = read_one(device, "function");
- pos += snprintf(&modalias_string[pos], SYSFS_PATH_MAX - pos,
- "pfn%02X", value);
- if (pos > (SYSFS_PATH_MAX - 10))
- return -ENOMEM;
-
- value = get_one_hash(device, 1);
- pos += snprintf(&modalias_string[pos], SYSFS_PATH_MAX - pos,
- "pa%08X", value);
- if (pos > (SYSFS_PATH_MAX - 10))
- return -ENOMEM;
-
- value = get_one_hash(device, 2);
- pos += snprintf(&modalias_string[pos], SYSFS_PATH_MAX - pos,
- "pb%08X", value);
- if (pos > (SYSFS_PATH_MAX - 10))
- return -ENOMEM;
-
- value = get_one_hash(device, 3);
- pos += snprintf(&modalias_string[pos], SYSFS_PATH_MAX - pos,
- "pc%08X", value);
- if (pos > (SYSFS_PATH_MAX - 10))
- return -ENOMEM;
-
- value = get_one_hash(device, 4);
- pos += snprintf(&modalias_string[pos], SYSFS_PATH_MAX - pos,
- "pd%08X", value);
- if (pos > (SYSFS_PATH_MAX - 10))
- return -ENOMEM;
-
-
- printf("%s\n", modalias_string);
-
- return 0;
-}
-
-int main(int argc, char **argv)
-{
- if (argc != 2)
- return -EINVAL;
-
- extract_modalias_string(argv[1]);
-
- return 0;
-}
diff --git a/src/yacc_config.h b/src/yacc_config.h
deleted file mode 100644
index 25bfc94..0000000
--- a/src/yacc_config.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#define DEVICE 257
-#define CARD 258
-#define ANONYMOUS 259
-#define TUPLE 260
-#define MANFID 261
-#define VERSION 262
-#define FUNCTION 263
-#define PCI 264
-#define BIND 265
-#define CIS 266
-#define TO 267
-#define NEEDS_MTD 268
-#define MODULE 269
-#define OPTS 270
-#define CLASS 271
-#define REGION 272
-#define JEDEC 273
-#define DTYPE 274
-#define DEFAULT 275
-#define MTD 276
-#define INCLUDE 277
-#define EXCLUDE 278
-#define RESERVE 279
-#define IRQ_NO 280
-#define PORT 281
-#define MEMORY 282
-#define STRING 283
-#define NUMBER 284
-#define SOURCE 285
-typedef union {
- char *str;
- u_long num;
- struct adjust_list_t *adjust;
-} YYSTYPE;
-extern YYSTYPE yylval;