Revision: 6615
          http://ipcop.svn.sourceforge.net/ipcop/?rev=6615&view=rev
Author:   gespinasse
Date:     2012-05-19 14:03:00 +0000 (Sat, 19 May 2012)
Log Message:
-----------
Use upstream patch to remove sysfs dependency allow us to remove sysfs from 
install (and so from initramfs)

Remove redundant modalias rule to 60-pcmcia.rules, already handled by udev 
(Debian borrowed)

Remove 'passing argument 1 of 'yyerror' discards qualifiers from pointer target 
type' warning adding a const at the proper place

Let compile in verbose mode with V=1, this is easier to check for dependencies

Don't strip using STRIP=true, just to act like other packages
Remove SYMLINK setting on make install (unneeded since 014)

Modified Paths:
--------------
    ipcop/trunk/lfs/pcmciautils
    ipcop/trunk/make.sh
    ipcop/trunk/updates/2.1.0/ROOTFILES.i486-2.1.0
    ipcop/trunk/updates/2.1.0/information.xml
    ipcop/trunk/updates/2.1.0/setup

Added Paths:
-----------
    ipcop/trunk/src/patches/pcmciautils_upstream-2012-03-25.patch

Removed Paths:
-------------
    ipcop/trunk/config/rootfiles/common/sysfsutils
    ipcop/trunk/lfs/sysfsutils

Deleted: ipcop/trunk/config/rootfiles/common/sysfsutils
===================================================================
--- ipcop/trunk/config/rootfiles/common/sysfsutils      2012-05-17 19:35:31 UTC 
(rev 6614)
+++ ipcop/trunk/config/rootfiles/common/sysfsutils      2012-05-19 14:03:00 UTC 
(rev 6615)
@@ -1,14 +0,0 @@
-#lib/libsysfs.la
-lib/libsysfs.so
-lib/libsysfs.so.2
-lib/libsysfs.so.2.0.1
-#lib/libsysfs_pic.a
-#usr/bin/dlist_test
-#usr/bin/get_device
-#usr/bin/get_driver
-#usr/bin/get_module
-#usr/bin/systool
-#usr/include/sysfs
-#usr/include/sysfs/dlist.h
-#usr/include/sysfs/libsysfs.h
-#usr/share/man/man1/systool.1

Modified: ipcop/trunk/lfs/pcmciautils
===================================================================
--- ipcop/trunk/lfs/pcmciautils 2012-05-17 19:35:31 UTC (rev 6614)
+++ ipcop/trunk/lfs/pcmciautils 2012-05-19 14:03:00 UTC (rev 6615)
@@ -82,9 +82,15 @@
 $(TARGET) : $(firstword $(MAKEFILE_LIST)) $(patsubst %,$(DIR_DL)/%,$(objects))
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
+       # Upstream update, mainly remove libsysfs dependency to allow to remove 
libsysfs
+       cd $(DIR_APP) && patch -p1 -i 
$(DIR_PATCHES)/pcmciautils_upstream-2012-03-25.patch
+       # Remove redundant modalias rule to 60-pcmcia.rules, already handled by 
udev (Debian borrowed)
+       cd $(DIR_APP) && sed -i 's| udev/rules-modprobe||' Makefile
+       # Fix warning passing argument 1 of 'yyerror' discards qualifiers from 
pointer target type
+       cd $(DIR_APP) && sed -i '/void yyerror/s/char /const char /g' 
src/yacc_config.y
 
-       cd $(DIR_APP) && make
-       cd $(DIR_APP) && make SYMLINK="/bin/ln -sf" install
+       cd $(DIR_APP) && make V=1 STRIP=true
+       cd $(DIR_APP) && make install
 
        @rm -rf $(DIR_APP)
        @$(POSTBUILD)

Deleted: ipcop/trunk/lfs/sysfsutils
===================================================================
--- ipcop/trunk/lfs/sysfsutils  2012-05-17 19:35:31 UTC (rev 6614)
+++ ipcop/trunk/lfs/sysfsutils  2012-05-19 14:03:00 UTC (rev 6615)
@@ -1,94 +0,0 @@
-###############################################################################
-# This file is part of the IPCop Firewall.                                    #
-#                                                                             #
-# IPCop 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.                                         #
-#                                                                             #
-# IPCop 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 IPCop; if not, write to the Free Software                        #
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA    #
-#                                                                             #
-# Makefiles are based on LFSMake, which is                                    #
-# Copyright (C) 2002 Rod Roard <r...@sunsetsystems.com>                        
#
-#                                                                             #
-# Modifications by:                                                           #
-# ??-12-2003 Mark Wormgoor < m...@wormgoor.com>                               #
-#          - Modified Makefile for IPCop build                                #
-#                                                                             #
-# $Id$
-#                                                                             #
-###############################################################################
-
-###############################################################################
-# Definitions
-###############################################################################
-
-include Config
-
-PKG_NAME   = sysfsutils
-VER        = 2.1.0
-HOST_ARCH  = all
-OTHER_SRC  = yes
-
-THISAPP    = $(PKG_NAME)-$(VER)
-DL_FILE    = $(THISAPP).tar.gz
-DL_FROM    = $(URL_SFNET)/linux-diag
-DIR_APP    = $(DIR_SRC)/$(THISAPP)
-TARGET     = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)
-
-###############################################################################
-# Top-level Rules
-###############################################################################
-
-objects = $(DL_FILE)
-
-$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-
-$(DL_FILE)_MD5 = 14e7dcd0436d2f49aa403f67e1ef7ddc
-
-install : $(TARGET)
-
-check : $(patsubst %,$(DIR_CHK)/%,$(objects))
-
-download :$(patsubst %,$(DIR_DL)/%,$(objects))
-
-md5 : $(subst %,%_MD5,$(objects))
-
-###############################################################################
-# Downloading, checking, md5sum
-###############################################################################
-
-$(patsubst %,$(DIR_CHK)/%,$(objects)) :
-       @$(CHECK)
-
-$(patsubst %,$(DIR_DL)/%,$(objects)) :
-       @$(LOAD)
-
-$(subst %,%_MD5,$(objects)) :
-       @$(MD5)
-
-###############################################################################
-# Installation Details
-###############################################################################
-
-$(TARGET) : $(firstword $(MAKEFILE_LIST)) $(patsubst %,$(DIR_DL)/%,$(objects))
-       @$(PREBUILD)
-       @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
-
-       cd $(DIR_APP) && ./configure    --prefix=/usr \
-                                       --libdir=/lib \
-                                       --with-pic
-       cd $(DIR_APP) && make -j $(PARALLELISM)
-       cd $(DIR_APP) && make install
-       # allow mklibs to reduce shared lib
-       cd /lib && mv -f libsysfs.a libsysfs_pic.a
-
-       @rm -rf $(DIR_APP)
-       @$(POSTBUILD)

Modified: ipcop/trunk/make.sh
===================================================================
--- ipcop/trunk/make.sh 2012-05-17 19:35:31 UTC (rev 6614)
+++ ipcop/trunk/make.sh 2012-05-19 14:03:00 UTC (rev 6615)
@@ -1756,7 +1756,6 @@
        chroot_make glib                # for pkgconfig, cairo
        chroot_make pkg-config
        chroot_make ipcop
-       chroot_make sysfsutils
        chroot_make which
        chroot_make net-tools
        chroot_make libusb

Added: ipcop/trunk/src/patches/pcmciautils_upstream-2012-03-25.patch
===================================================================
--- ipcop/trunk/src/patches/pcmciautils_upstream-2012-03-25.patch               
                (rev 0)
+++ ipcop/trunk/src/patches/pcmciautils_upstream-2012-03-25.patch       
2012-05-19 14:03:00 UTC (rev 6615)
@@ -0,0 +1,1248 @@
+there is no 018 tag, use corresponding hash
+git log 26b1a2f41a859db31d73e9cf48e40d267095d482..
+commit 468fb2ebb69f9c10c5055f3647bd54ad62d2b5f9
+Author: Tom Gundersen <t...@jklm.no>
+Date:   Wed Mar 14 14:06:26 2012 +0100
+
+    Makefile: don't hardcode the path to 'install'
+
+    In Arch Linux we currently use /bin/install rather than
+    /usr/bin/install. This change work with both locations and
+    avoids us having to change the Makefile.
+
+    Signed-off-by: Tom Gundersen <t...@jklm.no>
+    Signed-off-by: Dominik Brodowski <li...@dominikbrodowski.net>
+
+commit 645606056ff0c50e4817e3dcd44bb50cb1ac3b92
+Author: Dominik Brodowski <li...@dominikbrodowski.net>
+Date:   Fri Jul 29 18:03:23 2011 +0200
+
+    pccardctl: remove command which is not implemented
+
+    Signed-off-by: Dominik Brodowski <li...@dominikbrodowski.net>
+
+commit 24e11054ec68f713e99b019900a6deaf07d052b7
+Author: Dominik Brodowski <li...@dominikbrodowski.net>
+Date:   Tue Apr 19 08:26:57 2011 +0200
+
+    build: remove ccdv, use kernel quiet/verbose mechanism
+
+    Use the quiet/verbose mechanism found in kernel tools, without
+    relying on the special tool "ccdv"
+
+    Signed-off-by: Dominik Brodowski <li...@dominikbrodowski.net>
+
+commit f31a75997f33c8c1ac291d657eb26ea0a1189459
+Author: Dominik Brodowski <li...@dominikbrodowski.net>
+Date:   Tue Apr 19 08:09:20 2011 +0200
+
+    pcmciautils: remove dependency on libsysfs
+
+    Signed-off-by: Dominik Brodowski <li...@dominikbrodowski.net>
+
+git diff 26b1a2f41a859db31d73e9cf48e40d267095d482 > pcmciautils_upstream.patch
+
+diff --git a/Makefile b/Makefile
+index 0a61d56..ea44bb6 100644
+--- a/Makefile
++++ b/Makefile
+@@ -76,7 +76,7 @@ sbindir =    ${exec_prefix}/sbin
+ mandir =      ${prefix}/usr/share/man
+ udevdir =     ${prefix}/lib/udev
+ 
+-INSTALL = /usr/bin/install -c
++INSTALL = install -c
+ INSTALL_PROGRAM = ${INSTALL}
+ INSTALL_DATA  = ${INSTALL} -m 644
+ INSTALL_SCRIPT = ${INSTALL_PROGRAM}
+@@ -156,12 +156,12 @@ CFLAGS +=        -I$(PWD)/src
+ 
+ CFLAGS += $(WARNINGS) -I$(GCCINCDIR)
+ 
+-LIB_OBJS = -lc -lsysfs
++LIB_OBJS = -lc
+ LIB_PLAIN_OBJS = -lc
+ LIB_PCI_OBJS = -lc -lpci
+ 
+ ifeq ($(strip $(STATIC)),true)
+-      LIB_OBJS = -lsysfs
++      LIB_OBJS = 
+       LIB_PLAIN_OBJS =
+       LIB_PCI_OBJS = -lpci
+       LDFLAGS += -static
+@@ -170,11 +170,11 @@ else
+ endif
+ 
+ ifeq ($(strip $(V)),false)
+-      QUIET=@$(PWD)/build/ccdv
+-      HOST_PROGS=build/ccdv
++      QUIET=@
++      ECHO=@echo
+ else
+       QUIET=
+-      HOST_PROGS=
++      ECHO= @\#
+ endif
+ 
+ # if DEBUG is enabled, then we do not strip or optimize
+@@ -219,48 +219,57 @@ endif
+ UDEV_RULES += udev/rules-end
+ 
+ 
+-all: ccdv $(PCCARDCTL) $(PCMCIA_CHECK_BROKEN_CIS) 
$(PCMCIA_SOCKET_STARTUP_BUILD) udevrules
++all: $(PCCARDCTL) $(PCMCIA_CHECK_BROKEN_CIS) $(PCMCIA_SOCKET_STARTUP_BUILD) 
$(UDEV_RULES_FILE)
+ 
+-ccdv: build/ccdv
+-build/ccdv: build/ccdv.c
+-      @echo "Building ccdv"
+-      @$(HOSTCC) -O1 $< -o $@
+-
+-%.o : %.c ccdv
+-      $(QUIET) $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
++%.o : %.c
++      $(ECHO) "  CC      " $@
++      $(QUIET) $(CC) -c $(CFLAGS) $< -o $@
+ 
+ %.c %.h : %.y
+-      $(YACC) $(YFLAGS) $<
+-      mv y.tab.c $*.c
+-      mv y.tab.h $*.h
++      $(ECHO) "  YACC    " $@
++      $(QUIET) $(YACC) $(YFLAGS) $<
++      $(QUIET) mv y.tab.c $*.c
++      $(QUIET) mv y.tab.h $*.h
+ 
+ $(PCCARDCTL): $(LIBC) src/$(PCCARDCTL).o src/$(PCCARDCTL).c $(OBJS) $(HEADERS)
++      $(ECHO) "  LD      " $@
+       $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) src/$(PCCARDCTL).o $(LIB_OBJS) 
$(ARCH_LIB_OBJS)
++      $(ECHO) "  STRIP   " $@
+       $(QUIET) $(STRIPCMD) $@
+ 
+ $(PCMCIA_CHECK_BROKEN_CIS): $(LIBC) src/$(PCMCIA_CHECK_BROKEN_CIS).o 
src/read-cis.o $(OBJS) $(HEADERS)
++      $(ECHO) "  LD      " $@
+       $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) 
src/$(PCMCIA_CHECK_BROKEN_CIS).o src/read-cis.o $(LIB_PLAIN_OBJS) 
$(ARCH_LIB_OBJS)
++      $(ECHO) "  STRIP   " $@
+       $(QUIET) $(STRIPCMD) $@
+ 
+ $(PCMCIA_SOCKET_STARTUP): $(LIBC) src/startup.o src/yacc_config.o 
src/lex_config.o $(OBJS) $(HEADERS)
++      $(ECHO) "  LD      " $@
+       $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) src/startup.o src/yacc_config.o 
src/lex_config.o $(LIB_OBJS) $(ARCH_LIB_OBJS)
++      $(ECHO) "  STRIP   " $@
+       $(QUIET) $(STRIPCMD) $@
+ 
+ yacc_config.o lex_config.o: %.o: %.c
+-      $(CC) -c -MD -O -pipe $(CPPFLAGS) $<
++      $(ECHO) "  CC      " $@
++      $(QUIET) $(CC) -c -MD -O -pipe $(CFLAGS) $<
+ 
+-debugtools: ccdv $(CBDUMP) $(CISDUMP)
++debugtools: $(CBDUMP) $(CISDUMP)
+ 
+ $(CBDUMP): $(LIBC) debug/cbdump.o
++      $(ECHO) "  LD      " $@
+       $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) debug/$(CBDUMP).o 
$(LIB_PCI_OBJS) $(ARCH_LIB_OBJS)
++      $(ECHO) "  STRIP   " $@
+       $(QUIET) $(STRIPCMD) $@
+ 
+ $(CISDUMP): $(LIBC) src/read-cis.o debug/parse_cis.o debug/dump_cis.o
++      $(ECHO) "  LD      " $@
+       $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) debug/$(CISDUMP).o 
src/read-cis.o debug/parse_cis.o $(LIB_OBJS) $(ARCH_LIB_OBJS)
++      $(ECHO) "  STRIP   " $@
+       $(QUIET) $(STRIPCMD) $@
+ 
+-udevrules:
+-      cat $(UDEV_RULES) | sed -e "s#__UDEVHELPERDIR__#${udevhelperdir}#g" > 
$(UDEV_RULES_FILE)
++$(UDEV_RULES_FILE): $(UDEV_RULES)
++      $(ECHO) "  SED     " $@
++      @cat $(UDEV_RULES) | sed -e "s#__UDEVHELPERDIR__#${udevhelperdir}#g" > 
$@
+ 
+ clean:
+       -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) 
-type f -print \
+@@ -269,7 +278,6 @@ clean:
+       -rm -f $(CBDUMP) $(CISDUMP)
+       -rm -f src/yacc_config.c src/yacc_config.d src/lex_config.c 
src/lex_config.d src/yacc_config.h
+       -rm -f udev/60-pcmcia.rules
+-      -rm -f build/ccdv
+ 
+ install-hotplug:
+       $(INSTALL) -d $(DESTDIR)$(hotplugdir)
+diff --git a/build/ccdv.c b/build/ccdv.c
+deleted file mode 100644
+index e3ae9da..0000000
+--- a/build/ccdv.c
++++ /dev/null
+@@ -1,387 +0,0 @@
+-/* ccdv.c
+- *
+- * Copyright (C) 2002-2003, by Mike Gleason, NcFTP Software.
+- * All Rights Reserved.
+- *
+- * Licensed under the GNU Public License.
+- */
+-#include <unistd.h>
+-#include <sys/types.h>
+-#include <sys/time.h>
+-#include <sys/wait.h>
+-#include <fcntl.h>
+-#include <stdio.h>
+-#include <string.h>
+-#include <stdlib.h>
+-#include <errno.h>
+-
+-#define SETCOLOR_SUCCESS      (gANSIEscapes ? "\033\1331;32m" : "")
+-#define SETCOLOR_FAILURE      (gANSIEscapes ? "\033\1331;31m" : "")
+-#define SETCOLOR_WARNING      (gANSIEscapes ? "\033\1331;33m" : "")
+-#define SETCOLOR_NORMAL               (gANSIEscapes ? "\033\1330;39m" : "")
+-
+-#define TEXT_BLOCK_SIZE 8192
+-#define INDENT 2
+-
+-#define TERMS 
"vt100:vt102:vt220:vt320:xterm:xterm-color:ansi:linux:scoterm:scoansi:dtterm:cons25:cygwin"
+-
+-size_t gNBufUsed = 0, gNBufAllocated = 0;
+-char *gBuf = NULL;
+-int gCCPID;
+-char gAction[200] = "";
+-char gTarget[200] = "";
+-char gAr[32] = "";
+-char gArLibraryTarget[64] = "";
+-int gDumpCmdArgs = 0;
+-char gArgsStr[1000];
+-int gColumns = 80;
+-int gANSIEscapes = 0;
+-int gExitStatus = 95;
+-
+-static void DumpFormattedOutput(void)
+-{
+-      char *cp;
+-      char spaces[8 + 1] = "        ";
+-      char *saved;
+-      int curcol;
+-      int i;
+-
+-      curcol = 0;
+-      saved = NULL;
+-      for (cp = gBuf + ((gDumpCmdArgs == 0) ? strlen(gArgsStr) : 0); ; cp++) {
+-              if (*cp == '\0') {
+-                      if (saved != NULL) {
+-                              cp = saved;
+-                              saved = NULL;
+-                      } else break;
+-              }
+-              if (*cp == '\r')
+-                      continue;
+-              if (*cp == '\t') {
+-                      saved = cp + 1;
+-                      cp = spaces + 8 - (8 - ((curcol - INDENT - 1) % 8));
+-              }
+-              if (curcol == 0) {
+-                      for (i = INDENT; --i >= 0; )
+-                              putchar(' ');
+-                      curcol = INDENT;
+-              }
+-              putchar(*cp);
+-              if (++curcol == (gColumns - 1)) {
+-                      putchar('\n');
+-                      curcol = 0;
+-              } else if (*cp == '\n')
+-                      curcol = 0;
+-      }
+-      free(gBuf);
+-}     /* DumpFormattedOutput */
+-
+-
+-
+-/* Difftime(), only for timeval structures.  */
+-static void TimeValSubtract(struct timeval *tdiff, struct timeval *t1, struct 
timeval *t0)
+-{
+-      tdiff->tv_sec = t1->tv_sec - t0->tv_sec;
+-      tdiff->tv_usec = t1->tv_usec - t0->tv_usec;
+-      if (tdiff->tv_usec < 0) {
+-              tdiff->tv_sec--;
+-              tdiff->tv_usec += 1000000;
+-      }
+-}     /* TimeValSubtract */
+-
+-
+-
+-static void Wait(void)
+-{
+-      int pid2, status;
+-
+-      do {
+-              status = 0;
+-              pid2 = (int) waitpid(gCCPID, &status, 0);
+-      } while (((pid2 >= 0) && (! WIFEXITED(status))) || ((pid2 < 0) && 
(errno == EINTR)));
+-      if (WIFEXITED(status))
+-              gExitStatus = WEXITSTATUS(status);
+-}     /* Wait */
+-
+-
+-
+-static int SlurpProgress(int fd)
+-{
+-      char s1[71];
+-      char *newbuf;
+-      int nready;
+-      size_t ntoread;
+-      ssize_t nread;
+-      struct timeval now, tnext, tleft;
+-      fd_set ss;
+-      fd_set ss2;
+-      const char *trail = "/-\\|", *trailcp;
+-
+-      trailcp = trail;
+-      snprintf(s1, sizeof(s1), "%s%s%s... ", gAction, gTarget[0] ? " " : "", 
gTarget);
+-      printf("\r%-70s%-9s", s1, "");
+-      fflush(stdout);
+-
+-      gettimeofday(&now, NULL);
+-      tnext = now;
+-      tnext.tv_sec++;
+-      tleft.tv_sec = 1;
+-      tleft.tv_usec = 0;
+-      FD_ZERO(&ss2);
+-      FD_SET(fd, &ss2);
+-      for(;;) {
+-              if (gNBufUsed == (gNBufAllocated - 1)) {
+-                      if ((newbuf = (char *) realloc(gBuf, gNBufAllocated + 
TEXT_BLOCK_SIZE)) == NULL) {
+-                              perror("ccdv: realloc");
+-                              return (-1);
+-                      }
+-                      gNBufAllocated += TEXT_BLOCK_SIZE;
+-                      gBuf = newbuf;
+-              }
+-              for (;;) {
+-                      ss = ss2;
+-                      nready = select(fd + 1, &ss, NULL, NULL, &tleft);
+-                      if (nready == 1)
+-                              break;
+-                      if (nready < 0) {
+-                              if (errno != EINTR) {
+-                                      perror("ccdv: select");
+-                                      return (-1);
+-                              }
+-                              continue;
+-                      }
+-                      gettimeofday(&now, NULL);
+-                      if ((now.tv_sec > tnext.tv_sec) || ((now.tv_sec == 
tnext.tv_sec) && (now.tv_usec >= tnext.tv_usec))) {
+-                              tnext = now;
+-                              tnext.tv_sec++;
+-                              tleft.tv_sec = 1;
+-                              tleft.tv_usec = 0;
+-                              printf("\r%-71s%c%-7s", s1, *trailcp, "");
+-                              fflush(stdout);
+-                              if (*++trailcp == '\0')
+-                                      trailcp = trail;
+-                      } else {
+-                              TimeValSubtract(&tleft, &tnext, &now);
+-                      }
+-              }
+-              ntoread = (gNBufAllocated - gNBufUsed - 1);
+-              nread = read(fd, gBuf + gNBufUsed, ntoread);
+-              if (nread < 0) {
+-                      if (errno == EINTR)
+-                              continue;
+-                      perror("ccdv: read");
+-                      return (-1);
+-              } else if (nread == 0) {
+-                      break;
+-              }
+-              gNBufUsed += nread;
+-              gBuf[gNBufUsed] = '\0';
+-      }
+-      snprintf(s1, sizeof(s1), "%s%s%s: ", gAction, gTarget[0] ? " " : "", 
gTarget);
+-      Wait();
+-      if (gExitStatus == 0) {
+-              printf("\r%-70s", s1);
+-              printf("[%s%s%s]", ((gNBufUsed - strlen(gArgsStr)) < 4) ? 
SETCOLOR_SUCCESS : SETCOLOR_WARNING, "OK", SETCOLOR_NORMAL);
+-              printf("%-5s\n", " ");
+-      } else {
+-              printf("\r%-70s", s1);
+-              printf("[%s%s%s]", SETCOLOR_FAILURE, "ERROR", SETCOLOR_NORMAL);
+-              printf("%-2s\n", " ");
+-              gDumpCmdArgs = 1;       /* print cmd when there are errors */
+-      }
+-      fflush(stdout);
+-      return (0);
+-}     /* SlurpProgress */
+-
+-
+-
+-static int SlurpAll(int fd)
+-{
+-      char *newbuf;
+-      size_t ntoread;
+-      ssize_t nread;
+-
+-      printf("%s%s%s.\n", gAction, gTarget[0] ? " " : "", gTarget);
+-      fflush(stdout);
+-
+-      for(;;) {
+-              if (gNBufUsed == (gNBufAllocated - 1)) {
+-                      if ((newbuf = (char *) realloc(gBuf, gNBufAllocated + 
TEXT_BLOCK_SIZE)) == NULL) {
+-                              perror("ccdv: realloc");
+-                              return (-1);
+-                      }
+-                      gNBufAllocated += TEXT_BLOCK_SIZE;
+-                      gBuf = newbuf;
+-              }
+-              ntoread = (gNBufAllocated - gNBufUsed - 1);
+-              nread = read(fd, gBuf + gNBufUsed, ntoread);
+-              if (nread < 0) {
+-                      if (errno == EINTR)
+-                              continue;
+-                      perror("ccdv: read");
+-                      return (-1);
+-              } else if (nread == 0) {
+-                      break;
+-              }
+-              gNBufUsed += nread;
+-              gBuf[gNBufUsed] = '\0';
+-      }
+-      Wait();
+-      gDumpCmdArgs = (gExitStatus != 0);      /* print cmd when there are 
errors */
+-      return (0);
+-}     /* SlurpAll */
+-
+-
+-
+-static const char *Basename(const char *path)
+-{
+-      const char *cp;
+-      cp = strrchr(path, '/');
+-      if (cp == NULL)
+-              return (path);
+-      return (cp + 1);
+-}     /* Basename */
+-
+-
+-
+-static const char * Extension(const char *path)
+-{
+-      const char *cp = path;
+-      cp = strrchr(path, '.');
+-      if (cp == NULL)
+-              return ("");
+-      // printf("Extension='%s'\n", cp);
+-      return (cp);
+-}     /* Extension */
+-
+-
+-
+-static void Usage(void)
+-{
+-      fprintf(stderr, "Usage: ccdv /path/to/cc CFLAGS...\n\n");
+-      fprintf(stderr, "I wrote this to reduce the deluge Make output to make 
finding actual problems\n");
+-      fprintf(stderr, "easier.  It is intended to be invoked from Makefiles, 
like this.  Instead of:\n\n");
+-      fprintf(stderr, "\t.c.o:\n");
+-      fprintf(stderr, "\t\t$(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) $< -c\n");
+-      fprintf(stderr, "\nRewrite your rule so it looks like:\n\n");
+-      fprintf(stderr, "\t.c.o:\n");
+-      fprintf(stderr, "\t\t@ccdv $(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) $< 
-c\n\n");
+-      fprintf(stderr, "ccdv 1.1.0 is Free under the GNU Public License.  
Enjoy!\n");
+-      fprintf(stderr, "  -- Mike Gleason, NcFTP Software 
<http://www.ncftp.com>\n");
+-      exit(96);
+-}     /* Usage */
+-
+-
+-
+-int main(int argc, char **argv)
+-{
+-      int pipe1[2];
+-      int devnull;
+-      char emerg[256];
+-      int fd;
+-      int nread;
+-      int i;
+-      int cc = 0, pch = 0;
+-      const char *quote;
+-
+-      if (argc < 2)
+-              Usage();
+-
+-      snprintf(gAction, sizeof(gAction), "Running %s", Basename(argv[1]));
+-      memset(gArgsStr, 0, sizeof(gArgsStr));
+-      for (i = 1; i < argc; i++) {
+-              // printf("argv[%d]='%s'\n", i, argv[i]);
+-              quote = (strchr(argv[i], ' ') != NULL) ? "\"" : "";
+-              snprintf(gArgsStr + strlen(gArgsStr), sizeof(gArgsStr) - 
strlen(gArgsStr), "%s%s%s%s%s", (i == 1) ? "" : " ", quote, argv[i], quote, (i 
== (argc - 1)) ? "\n" : "");
+-              if ((strcmp(argv[i], "-o") == 0) && ((i + 1) < argc)) {
+-                      if (strcasecmp(Extension(argv[i + 1]), ".o") != 0) {
+-                              strcpy(gAction, "Linking");
+-                              snprintf(gTarget, sizeof(gTarget), "%s", 
Basename(argv[i + 1]));
+-                      }
+-              } else if (strchr("-+", (int) argv[i][0]) != NULL) {
+-                      continue;
+-              } else if (strncasecmp(Extension(argv[i]), ".c", 2) == 0) {
+-                      cc++;
+-                      snprintf(gTarget, sizeof(gTarget), "%s", 
Basename(argv[i]));
+-                      // printf("gTarget='%s'\n", gTarget);
+-              } else if ((strncasecmp(Extension(argv[i]), ".h", 2) == 0) && 
(cc == 0)) {
+-                      pch++;
+-                      snprintf(gTarget, sizeof(gTarget), "%s", 
Basename(argv[i]));
+-              } else if ((i == 1) && (strcmp(Basename(argv[i]), "ar") == 0)) {
+-                      snprintf(gAr, sizeof(gAr), "%s", Basename(argv[i]));
+-              } else if ((gArLibraryTarget[0] == '\0') && 
(strcasecmp(Extension(argv[i]), ".a") == 0)) {
+-                      snprintf(gArLibraryTarget, sizeof(gArLibraryTarget), 
"%s", Basename(argv[i]));
+-              }
+-      }
+-      if ((gAr[0] != '\0') && (gArLibraryTarget[0] != '\0')) {
+-              strcpy(gAction, "Creating library");
+-              snprintf(gTarget, sizeof(gTarget), "%s", gArLibraryTarget);
+-      } else if (pch > 0) {
+-              strcpy(gAction, "Precompiling");
+-      } else if (cc > 0) {
+-              strcpy(gAction, "Compiling");
+-      }
+-
+-      if (pipe(pipe1) < 0) {
+-              perror("ccdv: pipe");
+-              exit(97);
+-      }
+-
+-      (void) close(0);
+-      devnull = open("/dev/null", O_RDWR, 00666);
+-      if ((devnull != 0) && (dup2(devnull, 0) == 0))
+-              close(devnull);
+-
+-      gCCPID = (int) fork();
+-      if (gCCPID < 0) {
+-              (void) close(pipe1[0]);
+-              (void) close(pipe1[1]);
+-              perror("ccdv: fork");
+-              exit(98);
+-      } else if (gCCPID == 0) {
+-              /* Child */
+-              (void) close(pipe1[0]);         /* close read end */
+-              if (pipe1[1] != 1) {            /* use write end on stdout */
+-                      (void) dup2(pipe1[1], 1);
+-                      (void) close(pipe1[1]);
+-              }
+-              (void) dup2(1, 2);              /* use write end on stderr */
+-              execvp(argv[1], argv + 1);
+-              perror(argv[1]);
+-              exit(99);
+-      }
+-
+-      /* parent */
+-      (void) close(pipe1[1]);         /* close write end */
+-      fd = pipe1[0];                  /* use read end */
+-
+-      gColumns = (getenv("COLUMNS") != NULL) ? atoi(getenv("COLUMNS")) : 80;
+-      gANSIEscapes = (getenv("TERM") != NULL) && (strstr(TERMS, 
getenv("TERM")) != NULL);
+-      gBuf = (char *) malloc(TEXT_BLOCK_SIZE);
+-      if (gBuf == NULL) 
+-              goto panic;
+-      gNBufUsed = 0;
+-      gNBufAllocated = TEXT_BLOCK_SIZE;
+-      if (strlen(gArgsStr) < (gNBufAllocated - 1)) {
+-              strcpy(gBuf, gArgsStr);
+-              gNBufUsed = strlen(gArgsStr);
+-      }
+-
+-      if (isatty(1)) {
+-              if (SlurpProgress(fd) < 0)
+-                      goto panic;
+-      } else {
+-              if (SlurpAll(fd) < 0)
+-                      goto panic;
+-      }
+-      DumpFormattedOutput();
+-      exit(gExitStatus);
+-
+-panic:
+-      gDumpCmdArgs = 1;       /* print cmd when there are errors */
+-      DumpFormattedOutput();
+-      while ((nread = read(fd, emerg, (size_t) sizeof(emerg))) > 0)
+-              (void) write(2, emerg, (size_t) nread);
+-      Wait();
+-      exit(gExitStatus);
+-}     /* main */
+diff --git a/doc/mini-howto.txt b/doc/mini-howto.txt
+index 78d8d2b..3e4ecd3 100644
+--- a/doc/mini-howto.txt
++++ b/doc/mini-howto.txt
+@@ -112,8 +112,7 @@ Table of contents:
+   2.3. Dependencies
+   -----------------
+ 
+-   To use any of the PCMCIAutils tools, you need sysfsutils 1.3.0 or
+-   newer. However, if you do not need a resource database, you do not run
++   If you do not need a resource database, you do not run
+    a modular kernel and you are lucky, you might not need any userspace
+    tools at all.
+ 
+diff --git a/man/man8/pccardctl.8 b/man/man8/pccardctl.8
+index 1554a0d..307cfd6 100644
+--- a/man/man8/pccardctl.8
++++ b/man/man8/pccardctl.8
+@@ -29,11 +29,6 @@ commands are accessible.
+ .B status
+ Display the current socket status flags.
+ .TP
+-.B config
+-Display the socket configuration, including power settings, interrupt
+-and I/O window settings, and configuration registers.
+-\-\-not yet implemented
+-.TP
+ .B ident
+ Display card identification information, including product
+ identification strings, manufacturer ID codes, and function ID codes.
+diff --git a/src/pccardctl.c b/src/pccardctl.c
+index 05cb3a0..c3df55d 100644
+--- a/src/pccardctl.c
++++ b/src/pccardctl.c
+@@ -19,12 +19,13 @@
+ #include <libgen.h>
+ #include <locale.h>
+ #include <ctype.h>
+-
+-#include <sysfs/libsysfs.h>
+-
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <fcntl.h>
+ #include <getopt.h>
+ 
+ #define MAX_SOCKET 8
++#define SYSFS_PATH_MAX 255
+ 
+ static const char * const fn[] = {
+       "multifunction",
+@@ -51,87 +52,89 @@ static unsigned int crc32(unsigned char const *p, unsigned 
int len)
+       return crc;
+ }
+ 
++static int sysfs_write_file(const char *fname, const char *value, size_t len)
++{
++      ssize_t numwrite;
++      int fd;
++      int ret = 0;
++
++      fd = open(fname, O_WRONLY);
++      if (fd <= 0)
++              return fd;
++
++      numwrite = write(fd, value, len);
++      if ((numwrite < 1) || ((size_t) numwrite != len))
++              ret = -EIO;
++
++      close(fd);
++      return ret;
++}
+ 
+ static int pccardctl_power_socket(unsigned long socket_no, unsigned int power)
+ {
+-      int ret;
+       char file[SYSFS_PATH_MAX];
+-      struct sysfs_attribute *attr;
+ 
+       snprintf(file, SYSFS_PATH_MAX,
+                "/sys/class/pcmcia_socket/pcmcia_socket%lu/card_pm_state",
+                socket_no);
+ 
+-      attr = sysfs_open_attribute(file);
+-      if (!attr)
+-              return -ENODEV;
+-
+-      ret = sysfs_write_attribute(attr, power ? "off" : "on", power ? 3 : 2);
+-
+-      sysfs_close_attribute(attr);
+-
+-      return ret;
++      return sysfs_write_file(file, power ? "off" : "on", power ? 3 : 2);
+ }
+ 
+ static int pccardctl_echo_one(unsigned long socket_no, const char *in_file)
+ {
+-      int ret;
+       char file[SYSFS_PATH_MAX];
+-      struct sysfs_attribute *attr;
+ 
+       snprintf(file, SYSFS_PATH_MAX,
+               "/sys/class/pcmcia_socket/pcmcia_socket%lu/%s",
+               socket_no, in_file);
+ 
+-      attr = sysfs_open_attribute(file);
+-      if (!attr)
+-              return -ENODEV;
+-
+-      ret = sysfs_write_attribute(attr, "42", 2);
+-
+-      sysfs_close_attribute(attr);
+-
+-      return ret;
++      return sysfs_write_file(file, "42", 2);
+ }
+ 
+ static int pccardctl_socket_exists(unsigned long socket_no)
+ {
+       char file[SYSFS_PATH_MAX];
++      struct stat st;
+ 
+       snprintf(file, SYSFS_PATH_MAX,
+                "/sys/class/pcmcia_socket/pcmcia_socket%lu/card_insert",
+                socket_no);
+ 
+-      return !(sysfs_path_is_file(file));
++      return !stat(file, &st);
+ }
+ 
+-static int read_out_file(char *file, char **output)
++static int sysfs_read_whole_file(char *file, char **output)
+ {
+-      struct sysfs_attribute *attr = sysfs_open_attribute(file);
+-      int ret;
+       char *result = NULL;
++      ssize_t numread;
++      off_t size;
++      int fd, ret = 0;
+ 
+       *output = NULL;
+ 
+-      if (!attr)
+-              return -EIO;
+-      ret = sysfs_read_attribute(attr);
++      fd = open(file, O_RDONLY);
++      if (fd <= 0)
++              return fd;
+ 
+-      if (ret || !attr->value || !attr->len || (attr->len > SYSFS_PATH_MAX))
+-              goto close_out;
++      /* determine size */
++      size = lseek(fd, 0, SEEK_END) + SYSFS_PATH_MAX;
++      result = malloc(size);
++      if (!result) {
++              close(fd);
++              return -ENOMEM;
++      }
+ 
+-      result = malloc(attr->len + 1);
+-      if (result) {
+-              memcpy(result, attr->value, attr->len);
+-              result[attr->len] = '\0';
+-              if (result[attr->len - 1] == '\n')
+-                      result[attr->len - 1] = '\0';
++      lseek(fd, 0, SEEK_SET);
++      numread = read(fd, result, size - 1);
++      if (numread < 1)
++              ret = -EIO;
++      else {
++              result[numread] = '\0';
+               *output = result;
+-      } else
+-              ret = -ENOMEM;
++      }
+ 
+- close_out:
+-      sysfs_close_attribute(attr);
++      close(fd);
+       return ret;
+ }
+ 
+@@ -144,7 +147,7 @@ static int pccardctl_get_string_socket(unsigned long 
socket_no,
+               "/sys/class/pcmcia_socket/pcmcia_socket%lu/%s",
+                socket_no, in_file);
+ 
+-      return read_out_file(file, output);
++      return sysfs_read_whole_file(file, output);
+ }
+ 
+ static int pccardctl_get_string(unsigned long socket_no,
+@@ -155,7 +158,7 @@ static int pccardctl_get_string(unsigned long socket_no,
+       snprintf(file, SYSFS_PATH_MAX, "/sys/bus/pcmcia/devices/%lu.0/%s",
+                socket_no, in_file);
+ 
+-      return read_out_file(file, output);
++      return sysfs_read_whole_file(file, output);
+ }
+ 
+ static int pccardctl_get_one_f(unsigned long socket_no, unsigned int dev,
+@@ -163,17 +166,19 @@ static int pccardctl_get_one_f(unsigned long socket_no, 
unsigned int dev,
+ {
+       char *value;
+       char file[SYSFS_PATH_MAX];
+-      int ret;
++      int ret = 0;
+ 
+       snprintf(file, SYSFS_PATH_MAX, "/sys/bus/pcmcia/devices/%lu.%u/%s",
+                socket_no, dev, in_file);
+-      ret = read_out_file(file, &value);
++      ret = sysfs_read_whole_file(file, &value);
+       if (ret || !value)
+               return -EINVAL;
+ 
+       if (sscanf(value, "0x%X", result) != 1)
+-              return -EIO;
+-      return 0;
++              ret = -EIO;
++
++      free(value);
++      return ret;
+ }
+ 
+ static int pccardctl_get_one(unsigned long socket_no, const char *in_file,
+@@ -187,36 +192,40 @@ static int pccardctl_get_power_device(unsigned long 
socket_no,
+ {
+       char *value;
+       char file[SYSFS_PATH_MAX];
++      int ret = -ENODEV;
+ 
+       snprintf(file, SYSFS_PATH_MAX,
+               "/sys/bus/pcmcia/devices/%lu.%u/pm_state",
+                socket_no, func);
+-      read_out_file(file, &value);
++      sysfs_read_whole_file(file, &value);
+       if (value) {
+               if (!strncmp(value, "off", 3))
+-                      return 1;
+-              return 0;
++                      ret = 1;
++              ret = 0;
++              free(value);
+       }
+ 
+-      return -ENODEV;
++      return ret;
+ }
+ 
+ static int pccardctl_get_power_socket(unsigned long socket_no)
+ {
+       char *value;
+       char file[SYSFS_PATH_MAX];
++      int ret = -ENODEV;
+ 
+       snprintf(file, SYSFS_PATH_MAX,
+               "/sys/class/pcmcia_socket/pcmcia_socket%lu/card_pm_state",
+                socket_no);
+-      read_out_file(file, &value);
++      sysfs_read_whole_file(file, &value);
+       if (value) {
+               if (!strncmp(value, "off", 3))
+-                      return 1;
+-              return 0;
++                      ret = 1;
++              ret = 0;
++              free(value);
+       }
+ 
+-      return -ENODEV;
++      return ret;
+ }
+ 
+ 
+@@ -262,7 +271,6 @@ static int pccardctl_ident(unsigned long socket_no)
+               printf("  function: %d (%s)\n", manf_id, s);
+       }
+ 
+-
+       return 0;
+ }
+ 
+@@ -323,6 +331,8 @@ static int pccardctl_status(unsigned long socket_no)
+ 
+       printf("  %s %s %s", card_voltage, card_type, is_cardbus ?
+               "CardBus card" : "PC Card");
++      free(card_type);
++      free(card_voltage);
+ 
+       susp = pccardctl_get_power_socket(socket_no);
+       if (susp > 0)
+@@ -365,7 +375,7 @@ static int pccardctl_status(unsigned long socket_no)
+ static void print_header(void)
+ {
+       printf("pcmciautils %s\n", PCMCIAUTILS_VERSION);
+-      printf("Copyright (C) 2004-2005 Dominik Brodowski, "
++      printf("Copyright (C) 2004-2011 Dominik Brodowski, "
+               "(C) 1999 David A. Hinds\n");
+       printf("Report errors and bugs to <linux-pcm...@lists.infradead.org>,"
+               "please.\n");
+@@ -380,7 +390,6 @@ static char *cmdname[] = {
+       "reset",
+       "info",
+       "status",
+-      "config",
+       "ident",
+ };
+ 
+@@ -412,7 +421,6 @@ static void lspcmcia_socket_available_resources(unsigned 
long socket_no,
+                                               char *which)
+ {
+       char file[SYSFS_PATH_MAX];
+-      struct sysfs_attribute *attr;
+       int ret, length, first = 0;
+       char *sep;
+       char *result = NULL;
+@@ -421,27 +429,10 @@ static void lspcmcia_socket_available_resources(unsigned 
long socket_no,
+       "/sys/class/pcmcia_socket/pcmcia_socket%lu/available_resources_%s",
+               socket_no, which);
+ 
+-      attr = sysfs_open_attribute(file);
+-      if (!attr)
+-              return;
+-
+-
+-      ret = sysfs_read_attribute(attr);
+-      if (ret)
+-              goto close_out;
+-
+       printf("\t\t\tAvailable %s:\t", which[0] == 'i' ? "ioports" : "iomem");
+ 
+-      if (!attr->value || !attr->len || (attr->len < 5))
+-              goto close_out;
+-
+-      result = malloc(attr->len + 1);
+-      if (result) {
+-              memcpy(result, attr->value, attr->len);
+-              result[attr->len] = '\0';
+-              if (result[attr->len - 1] == '\n')
+-                      result[attr->len - 1] = '\0';
+-      } else
++      ret = sysfs_read_whole_file(file, &result);
++      if (ret)
+               goto close_out;
+ 
+       ret = 0;
+@@ -458,15 +449,13 @@ static void lspcmcia_socket_available_resources(unsigned 
long socket_no,
+                       ret += length + 1;
+               }
+       } while (sep);
+-      if (result) {
+-              printf("%s\n", &result[ret]);
+-              first++;
+-      }
++      printf("%s\n", &result[ret]);
++      first++;
++      free(result);
+ 
+  close_out:
+       if (!first)
+               printf("--none--\n");
+-      sysfs_close_attribute(attr);
+       return;
+ }
+ 
+@@ -479,7 +468,6 @@ static void lspcmcia_socket(unsigned long socket_no, int 
verbose, char *driver)
+       pccardctl_get_string_socket(socket_no,
+                               "available_resources_setup_done", &ready);
+ 
+-
+       printf("\tConfiguration:\tstate: %s\tready: %s\n",
+               pm_state ? "suspended" : "on", ready ? ready : "unknown");
+ 
+@@ -489,6 +477,10 @@ static void lspcmcia_socket(unsigned long socket_no, int 
verbose, char *driver)
+       if (card_voltage && card_vpp && card_vcc)
+               printf("\t\t\tVoltage: %s Vcc: %s Vpp: %s\n",
+                       card_voltage, card_vcc, card_vpp);
++      free(card_voltage);
++      free(card_vpp);
++      free(card_vcc);
++      free(ready);
+ 
+       if (verbose > 1) {
+               char *irq_mask_s;
+@@ -511,7 +503,7 @@ static void lspcmcia_socket(unsigned long socket_no, int 
verbose, char *driver)
+                               printf("none");
+                       printf("\n");
+               }
+-
++              free(irq_mask_s);
+               lspcmcia_socket_available_resources(socket_no, "io");
+               lspcmcia_socket_available_resources(socket_no, "mem");
+       }
+@@ -521,7 +513,6 @@ static void lspcmcia_socket(unsigned long socket_no, int 
verbose, char *driver)
+ static void lspcmcia_device_resources(unsigned long socket_no, int fun)
+ {
+       char file[SYSFS_PATH_MAX];
+-      struct sysfs_attribute *attr;
+       int ret, length;
+       char *sep;
+       char *result = NULL;
+@@ -529,25 +520,9 @@ static void lspcmcia_device_resources(unsigned long 
socket_no, int fun)
+       snprintf(file, SYSFS_PATH_MAX,
+               "/sys/bus/pcmcia/devices/%lu.%u/resources", socket_no, fun);
+ 
+-      attr = sysfs_open_attribute(file);
+-      if (!attr)
+-              return;
+-
+-      ret = sysfs_read_attribute(attr);
++      ret = sysfs_read_whole_file(file, &result);
+       if (ret)
+-              goto close_out;
+-
+-      if (!attr->value || !attr->len || (attr->len < 5))
+-              goto close_out;
+-
+-      result = malloc(attr->len + 1);
+-      if (result) {
+-              memcpy(result, attr->value, attr->len);
+-              result[attr->len] = '\0';
+-              if (result[attr->len - 1] == '\n')
+-                      result[attr->len - 1] = '\0';
+-      } else
+-              goto close_out;
++              return;
+ 
+       ret = 0;
+       printf("\t\t\t");
+@@ -563,11 +538,9 @@ static void lspcmcia_device_resources(unsigned long 
socket_no, int fun)
+                       ret += length + 1;
+               }
+       } while (sep);
+-      if (result)
+-              printf("%s\n", &result[ret]);
++      printf("%s\n", &result[ret]);
+ 
+- close_out:
+-      sysfs_close_attribute(attr);
++      free(result);
+       return;
+ }
+ 
+@@ -620,7 +593,6 @@ static int lspcmcia(unsigned long socket_no, int verbose)
+       if (verbose)
+               lspcmcia_socket(socket_no, verbose, drv);
+ 
+-
+       pccardctl_get_string_socket(socket_no, "card_type", &res);
+       if (!res)
+               return 0;
+@@ -628,8 +600,10 @@ static int lspcmcia(unsigned long socket_no, int verbose)
+       if (!strncmp(res, "32", 2)) {
+               printf("  CardBus card -- see \"lspci\" "
+                       "for more information\n");
++              free(res);
+               return 0;
+       }
++      free(res);
+ 
+       for (i = 0; i < 4; i++) {
+               int function;
+@@ -666,6 +640,7 @@ static int lspcmcia(unsigned long socket_no, int verbose)
+                               pccardctl_get_string(socket_no, file, &res);
+                               if (res)
+                                       printf("%s ", res);
++                              free(res);
+                       }
+                       printf("\n");
+ 
+@@ -694,6 +669,7 @@ static int lspcmcia(unsigned long socket_no, int verbose)
+                                       printf("prod_id(%u): --- (---)\n", j);
+                               if (j < 4)
+                                       printf("\t\t\t");
++                              free(res);
+                       }
+               }
+       }
+@@ -710,7 +686,6 @@ enum {
+       PCCARDCTL_RESET,
+       PCCARDCTL_INFO,
+       PCCARDCTL_STATUS,
+-      PCCARDCTL_CONFIG,
+       PCCARDCTL_IDENT,
+       NCMD
+ };
+@@ -828,11 +803,6 @@ int main(int argc, char **argv)
+               case PCCARDCTL_STATUS:
+                       ret = pccardctl_status(cont);
+                       break;
+-              default:
+-                      fprintf(stderr,
+-                              "command '%s' not yet handled by pccardctl\n",
+-                              cmdname[cmd]);
+-                      return -EAGAIN;
+               }
+ 
+               if (ret && socket_is_set)
+diff --git a/src/read-cis.c b/src/read-cis.c
+index 0c2fb48..7204f69 100644
+--- a/src/read-cis.c
++++ b/src/read-cis.c
+@@ -18,11 +18,10 @@
+ #include <errno.h>
+ #include <syslog.h>
+ 
+-#include <sysfs/libsysfs.h>
+-
+ #include "cistpl.h"
+ 
+ #define MAX_TUPLES                0x200
++#define SYSFS_PATH_MAX 255
+ 
+ #define PATH_TO_SOCKET "/sys/class/pcmcia_socket/"
+ 
+diff --git a/src/startup.c b/src/startup.c
+index ac0ba54..d8e6679 100644
+--- a/src/startup.c
++++ b/src/startup.c
+@@ -15,10 +15,11 @@
+ #include <string.h>
+ #include <errno.h>
+ #include <syslog.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <fcntl.h>
+ #include <unistd.h>
+ 
+-#include <sysfs/libsysfs.h>
+-
+ #include "startup.h"
+ 
+ /* uncomment for debug output */
+@@ -48,6 +49,46 @@ static const char *resource_files[MAX_RESOURCE_FILES] = {
+ 
+ #define PATH_TO_SOCKET "/sys/class/pcmcia_socket/"
+ 
++#define SYSFS_PATH_MAX 255
++
++
++static int sysfs_read_file(const char *fname, char *buf, size_t buflen)
++{
++      ssize_t numread;
++      int fd;
++      int ret = 0;
++
++      fd = open(fname, O_RDONLY);
++      if (fd <= 0)
++              return fd;
++
++      numread = read(fd, buf, buflen - 1);
++      if (numread < 1)
++              ret = -EIO;
++      else
++              buf[numread] = '\0';
++
++      close(fd);
++      return ret;
++}
++
++static int sysfs_write_file(const char *fname, const char *value, size_t len)
++{
++      ssize_t numwrite;
++      int fd;
++      int ret = 0;
++
++      fd = open(fname, O_WRONLY);
++      if (fd <= 0)
++              return fd;
++
++      numwrite = write(fd, value, len);
++      if ((numwrite < 1) || ((size_t) numwrite != len))
++              ret = -EIO;
++
++      close(fd);
++      return ret;
++}
+ 
+ static int add_available_resource(unsigned int socket_no, unsigned int type,
+                                 unsigned int action,
+@@ -55,7 +96,6 @@ static int add_available_resource(unsigned int socket_no, 
unsigned int type,
+ {
+       char file[SYSFS_PATH_MAX];
+       char content[SYSFS_PATH_MAX];
+-      struct sysfs_attribute *attr;
+       int ret;
+       size_t len;
+ 
+@@ -85,44 +125,24 @@ static int add_available_resource(unsigned int socket_no, 
unsigned int type,
+               return -EINVAL;
+       }
+ 
+-      dprintf("content is %s\n", content);
+-
+-      dprintf("file is %s\n", file);
+-
+-      attr = sysfs_open_attribute(file);
+-      if (!attr)
+-              return -ENODEV;
++      dprintf("content is %s, file is %s\n", content, file);
+ 
+-      dprintf("open, len %zu\n", len);
+-
+-      ret = sysfs_write_attribute(attr, content, len);
++      ret = sysfs_write_file(file, content, len);
+ 
+       dprintf("ret is %d\n", ret);
+ 
+-      sysfs_close_attribute(attr);
+-
+       return ret;
+ }
+ 
+ static int setup_done(unsigned int socket_no)
+ {
+-      int ret;
+       char file[SYSFS_PATH_MAX];
+-      struct sysfs_attribute *attr;
+ 
+       snprintf(file, SYSFS_PATH_MAX, PATH_TO_SOCKET
+                "pcmcia_socket%u/available_resources_setup_done",
+                socket_no);
+ 
+-      attr = sysfs_open_attribute(file);
+-      if (!attr)
+-              return -ENODEV;
+-
+-      ret = sysfs_write_attribute(attr, "42", 2);
+-
+-      sysfs_close_attribute(attr);
+-
+-      return ret;
++      return sysfs_write_file(file, "42", 2);
+ }
+ 
+ 
+@@ -130,7 +150,6 @@ static int disallow_irq(unsigned int socket_no, unsigned 
int irq)
+ {
+       char file[SYSFS_PATH_MAX];
+       char content[SYSFS_PATH_MAX];
+-      struct sysfs_attribute *attr;
+       unsigned int mask = 0xfff;
+       unsigned int new_mask;
+       int ret;
+@@ -144,24 +163,13 @@ static int disallow_irq(unsigned int socket_no, unsigned 
int irq)
+                socket_no);
+       dprintf("file is %s\n", file);
+ 
+-      attr = sysfs_open_attribute(file);
+-      if (!attr)
++      ret = sysfs_read_file(file, content, SYSFS_PATH_MAX);
++      if (ret)
+               return -ENODEV;
+ 
+-      dprintf("open, len %zu\n", len);
+-
+-      ret = sysfs_read_attribute(attr);
+-      if (ret) {
+-              ret = -EINVAL;
+-              goto out;
+-      }
+-
+-      if (!attr->value || (attr->len < 6)) {
+-              ret = -EIO;
+-              goto out;
+-      }
+-
+-      ret = sscanf(attr->value, "0x%x\n", &mask);
++      ret = sscanf(content, "0x%x\n", &mask);
++      if (ret != 1)
++              return -EIO;
+ 
+       new_mask = 1 << irq;
+ 
+@@ -171,12 +179,7 @@ static int disallow_irq(unsigned int socket_no, unsigned 
int irq)
+ 
+       dprintf("content is %s\n", content);
+ 
+-      ret = sysfs_write_attribute(attr, content, len);
+-
+- out:
+-      sysfs_close_attribute(attr);
+-
+-      return ret;
++      return sysfs_write_file(file, content, len);
+ }
+ 
+ 

Modified: ipcop/trunk/updates/2.1.0/ROOTFILES.i486-2.1.0
===================================================================
--- ipcop/trunk/updates/2.1.0/ROOTFILES.i486-2.1.0      2012-05-17 19:35:31 UTC 
(rev 6614)
+++ ipcop/trunk/updates/2.1.0/ROOTFILES.i486-2.1.0      2012-05-19 14:03:00 UTC 
(rev 6615)
@@ -433,6 +433,12 @@
 ## openvpn-2.2.2 linked with new openssl lib
 /usr/sbin/openvpn
 ##
+## pcmciautils-018 patched without libsysfs dependency
+/lib/udev/pcmcia-check-broken-cis
+/lib/udev/pcmcia-socket-startup
+/lib/udev/rules.d/60-pcmcia.rules
+/sbin/pccardctl
+##
 ## pcre-8.30
 /usr/lib/libpcre.so.1
 /usr/lib/libpcre.so.1.0.0

Modified: ipcop/trunk/updates/2.1.0/information.xml
===================================================================
--- ipcop/trunk/updates/2.1.0/information.xml   2012-05-17 19:35:31 UTC (rev 
6614)
+++ ipcop/trunk/updates/2.1.0/information.xml   2012-05-19 14:03:00 UTC (rev 
6615)
@@ -3,7 +3,7 @@
         <version>2.1.0</version>
         <releasedate>2012-04-dd</releasedate>
         <size>0</size>
-        <description>httpd, libxml2 and gettext setserial patched&lt;br /&gt;
+        <description>httpd, libxml2, gettext, setserial, pcmciautils 
patched&lt;br /&gt;
             cairo and conntrack-tools recompiled with -O3&lt;br /&gt;
             Add URL filter, xz-5.0.3&lt;br /&gt;
             Language updates.&lt;br /&gt;

Modified: ipcop/trunk/updates/2.1.0/setup
===================================================================
--- ipcop/trunk/updates/2.1.0/setup     2012-05-17 19:35:31 UTC (rev 6614)
+++ ipcop/trunk/updates/2.1.0/setup     2012-05-19 14:03:00 UTC (rev 6615)
@@ -116,6 +116,7 @@
 /bin/rm -f /lib/libip4tc.so.0.0.0
 /bin/rm -f /lib/libip6tc.so.0.0.0
 /bin/rm -f /lib/libproc-3.2.8.so
+/bin/rm -f /lib/libsysfs.so*
 /bin/rm -f /usr/bin/gdlib-config
 /bin/rm -f /usr/lib/libfontconfig.so.1.4.4
 /bin/rm -f /usr/lib/libglib-2.0.so.0.2600.1

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn

Reply via email to