]> git.neil.brown.name Git - history.git/commitdiff
Import 2.1.78pre3 2.1.78pre3
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:14:22 +0000 (15:14 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:14:22 +0000 (15:14 -0500)
39 files changed:
Makefile
Rules.make
arch/i386/config.in
arch/i386/defconfig
drivers/block/ide-cd.c
drivers/cdrom/cdrom.c
drivers/cdrom/cdu31a.c
drivers/cdrom/mcdx.c
drivers/cdrom/sbpcd.c
drivers/cdrom/sbpcd.h
drivers/char/ftape/compressor/Makefile
drivers/net/CONFIG
drivers/net/Makefile
drivers/scsi/Makefile
drivers/sound/ad1848.c
drivers/sound/gus_wave.c
drivers/sound/ics2101.c
drivers/sound/lowlevel/Makefile
drivers/sound/os.h
drivers/sound/pas2_mixer.c
drivers/sound/sb_mixer.c
fs/ncpfs/Makefile
fs/proc/link.c
include/linux/cdrom.h
include/linux/config.h
include/linux/fs.h
include/linux/hfs_fs.h
include/linux/uts.h [new file with mode: 0644]
init/version.c
kernel/Makefile
scripts/Makefile
scripts/Menuconfig
scripts/checkconfig.pl [new file with mode: 0644]
scripts/depend.awk [deleted file]
scripts/header.tk
scripts/hfiles.sh [deleted file]
scripts/mkdep.c
scripts/split-include.c [new file with mode: 0644]
scripts/tkgen.c

index 4dd081e5ee84b0784b8e60bd2f5aa2c5933d2e4d..f07be525c02e90db78eed634382f0b418cd19e4a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -209,19 +209,23 @@ symlinks:
                mkdir include/linux/modules; \
        fi
 
-oldconfig: symlinks
+oldconfig: symlinks scripts/split-include
        $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
+       scripts/split-include include/linux/autoconf.h include/config
 
-xconfig: symlinks
+xconfig: symlinks scripts/split-include
        $(MAKE) -C scripts kconfig.tk
        wish -f scripts/kconfig.tk
+       scripts/split-include include/linux/autoconf.h include/config
 
-menuconfig: include/linux/version.h symlinks 
+menuconfig: include/linux/version.h symlinks scripts/split-include
        $(MAKE) -C scripts/lxdialog all
        $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
+       scripts/split-include include/linux/autoconf.h include/config
 
-config: symlinks
+config: symlinks scripts/split-include
        $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
+       scripts/split-include include/linux/autoconf.h include/config
 
 linuxsubdirs: dummy
        set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done
@@ -339,8 +343,9 @@ endif
 
 clean: archclean
        rm -f kernel/ksyms.lst include/linux/compile.h
-       rm -f core `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print`
-       rm -f core `find . -type f -name 'core' -print`
+       rm -f `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print`
+       rm -f `find . -type f -name 'core' -print`
+       rm -f `find . -name '.*.flags' -print`
        rm -f vmlinux System.map
        rm -f .tmp*
        rm -f drivers/char/consolemap_deftbl.c drivers/char/conmakehash
@@ -361,8 +366,9 @@ mrproper: clean
        rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog
        rm -f .menuconfig.log
        rm -f include/asm
+       rm -rf include/config
        rm -f .depend `find . -name .depend -print`
-       rm -f .hdepend scripts/mkdep
+       rm -f .hdepend scripts/mkdep scripts/split-include
        rm -f $(TOPDIR)/include/linux/modversions.h
        rm -rf $(TOPDIR)/include/linux/modules
        rm -rf modules
@@ -380,10 +386,9 @@ sums:
        find . -type f -print | sort | xargs sum > .SUMS
 
 dep-files: scripts/mkdep archdep include/linux/version.h
-       scripts/mkdep init/*.c > .tmpdepend
+       scripts/mkdep init/*.c > .depend
        scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
        set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep; done
-       mv .tmpdepend .depend
 
 MODVERFILE :=
 
@@ -393,6 +398,9 @@ endif
 
 depend dep: dep-files $(MODVERFILE)
 
+checkconfig:
+       perl -w scripts/checkconfig.pl `find $(FINDHPATH) $(SUBDIRS) -name '*.[hcS]' -print | sort`
+
 ifdef CONFIGURATION
 ..$(CONFIGURATION):
        @echo
@@ -421,3 +429,6 @@ include Rules.make
 
 scripts/mkdep: scripts/mkdep.c
        $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
+
+scripts/split-include: scripts/split-include.c
+       $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c
index 87845cb40215ead4160759d664bf6aa42e70672b..8f7da991f891d66567907bf1d86531ee97722d9b 100644 (file)
@@ -45,13 +45,18 @@ first_rule: sub_dirs
 #
 
 %.s: %.c
-       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -S $< -o $@
+       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -S $< -o $@
 
 %.i: %.c
-       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -E $< > $@
+       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -E $< > $@
 
 %.o: %.c
-       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -c -o $@ $<
+       @ ( \
+           echo 'ifeq ($(strip $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@)),$$(strip $$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@)))' ; \
+           echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \
+           echo 'endif' \
+       ) > .$@.flags
 
 %.o: %.s
        $(AS) $(ASFLAGS) $(EXTRA_CFLAGS) -o $@ $<
@@ -66,29 +71,39 @@ all_targets: $(O_TARGET) $(L_TARGET)
 #
 ifdef O_TARGET
 ALL_O = $(OX_OBJS) $(O_OBJS)
-$(O_TARGET): $(ALL_O) $(TOPDIR)/include/linux/config.h
+$(O_TARGET): $(ALL_O)
        rm -f $@
 ifneq "$(strip $(ALL_O))" ""
        $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(ALL_O)
 else
        $(AR) rcs $@
 endif
+       @ ( \
+           echo 'ifeq ($(strip $(EXTRA_LDFLAGS) $(ALL_O)),$$(strip $$(EXTRA_LDFLAGS) $$(ALL_O)))' ; \
+           echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \
+           echo 'endif' \
+       ) > .$@.flags
 endif # O_TARGET
 
 #
 # Rule to compile a set of .o files into one .a file
 #
 ifdef L_TARGET
-$(L_TARGET): $(LX_OBJS) $(L_OBJS) $(TOPDIR)/include/linux/config.h
+$(L_TARGET): $(LX_OBJS) $(L_OBJS)
        rm -f $@
        $(AR) $(EXTRA_ARFLAGS) rcs $@ $(LX_OBJS) $(L_OBJS)
+       @ ( \
+           echo 'ifeq ($(strip $(EXTRA_ARFLAGS) $(LX_OBJS) $(L_OBJS)),$$(strip $$(EXTRA_ARFLAGS) $$(LX_OBJS) $$(L_OBJS)))' ; \
+           echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \
+           echo 'endif' \
+       ) > .$@.flags
 endif
 
 #
 # This make dependencies quickly
 #
 fastdep: dummy
-       $(TOPDIR)/scripts/mkdep *.[chS] > .depend
+       $(TOPDIR)/scripts/mkdep $(wildcard *.[chS] local.h.master) > .depend
 ifdef ALL_SUB_DIRS
        set -e; for i in $(ALL_SUB_DIRS); do $(MAKE) -C $$i fastdep; done
 endif
@@ -131,7 +146,7 @@ endif
 ifneq "$(strip $(ALL_MOBJS))" ""
        echo $(PDWN)
        cd $$TOPDIR/modules; for i in $(ALL_MOBJS); do \
-           ln -sf ../$(PDWN)/$$i .; done
+           ln -sf ../$(PDWN)/$$i $$i; done
 endif
 
 #
@@ -198,19 +213,54 @@ endif # CONFIG_MODVERSIONS
 
 ifneq "$(strip $(SYMTAB_OBJS))" ""
 $(SYMTAB_OBJS): $(TOPDIR)/include/linux/modversions.h $(SYMTAB_OBJS:.o=.c)
-       $(CC) $(CFLAGS) -DEXPORT_SYMTAB -c $(@:.o=.c)
+       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB -c $(@:.o=.c)
+       @ ( \
+           echo 'ifeq ($(strip $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB),$$(strip $$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@) -DEXPORT_SYMTAB))' ; \
+           echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \
+           echo 'endif' \
+       ) > .$@.flags
 endif
 
 endif # CONFIG_MODULES
 
 
 #
-# include dependency files they exist
+# include dependency files if they exist
 #
-ifeq (.depend,$(wildcard .depend))
+ifneq ($(wildcard .depend),)
 include .depend
 endif
 
-ifeq ($(TOPDIR)/.hdepend,$(wildcard $(TOPDIR)/.hdepend))
+ifneq ($(wildcard $(TOPDIR)/.hdepend),)
 include $(TOPDIR)/.hdepend
 endif
+
+#
+# Find files whose flags have changed and force recompilation.
+# For safety, this works in the converse direction:
+#   every file is forced, except those whose flags are positively up-to-date.
+#
+FILES_FLAGS_UP_TO_DATE :=
+
+FILES_FLAGS_EXIST := $(wildcard .*.flags)
+ifneq ($(FILES_FLAGS_EXIST),)
+include $(FILES_FLAGS_EXIST)
+endif
+
+FILES_FLAGS_CHANGED := $(strip \
+    $(filter-out $(FILES_FLAGS_UP_TO_DATE), \
+       $(O_TARGET) $(O_OBJS) $(OX_OBJS) \
+       $(L_TARGET) $(L_OBJS) $(LX_OBJS) \
+       $(M_OBJS) $(MX_OBJS) \
+       $(MI_OBJS) $(MIX_OBJS) \
+       ))
+
+# A kludge: .S files don't get flag dependencies (yet),
+#   because that will involve changing a lot of Makefiles.
+FILES_FLAGS_CHANGED := $(strip \
+    $(filter-out $(patsubst %.S, %.o, $(wildcard *.S)), \
+    $(FILES_FLAGS_CHANGED)))
+
+ifneq ($(FILES_FLAGS_CHANGED),)
+$(FILES_FLAGS_CHANGED): dummy
+endif
index 48010abb5acc4f3bd63cfab5aad13da5fd4d3a1d..b9abec5a2b1e9bf37e10e83914cdd8a1fdac55db 100644 (file)
@@ -109,10 +109,10 @@ fi
 endmenu
 
 # Conditionally compile in the Uniform CD-ROM driver
-if [ "$CONFIG_BLK_DEV_IDECD" = "y" -o "$CONFIG_BLK_DEV_SR" = "y" -o "$CONFIG_SBPCD" = "y" -o "$CONFIG_MCD" = "y" -o "$CONFIG_CM206" = "y" -o "$CONFIG_CDU31A" = "y" ]; then
+if [ "$CONFIG_BLK_DEV_IDECD" = "y" -o "$CONFIG_BLK_DEV_SR" = "y" -o "$CONFIG_SBPCD" = "y" -o "$CONFIG_MCD" = "y" -o "$CONFIG_MCDX" = "y" -o "$CONFIG_CM206" = "y" -o "$CONFIG_CDU31A" = "y" ]; then
   define_bool CONFIG_CDROM y
 else
-  if [ "$CONFIG_BLK_DEV_IDECD" = "m" -o "$CONFIG_BLK_DEV_SR" = "m" -o "$CONFIG_SBPCD" = "m" -o "$CONFIG_MCD" = "m" -o "$CONFIG_CM206" = "m" -o "$CONFIG_CDU31A" = "m" ]; then
+  if [ "$CONFIG_BLK_DEV_IDECD" = "m" -o "$CONFIG_BLK_DEV_SR" = "m" -o "$CONFIG_SBPCD" = "m" -o "$CONFIG_MCD" = "m" -o "$CONFIG_MCDX" = "m" -o "$CONFIG_CM206" = "m" -o "$CONFIG_CDU31A" = "m" ]; then
     define_bool CONFIG_CDROM m
   else
     define_bool CONFIG_CDROM n
index d21db83e17c8a06d705d2189651fdf6147131cb0..48a8d585c9c3af87dd2a46fa6c412a4391a14bc0 100644 (file)
@@ -237,6 +237,7 @@ CONFIG_LOCKD=y
 # CONFIG_NTFS_FS is not set
 # CONFIG_SYSV_FS is not set
 # CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
 # CONFIG_ROMFS_FS is not set
 CONFIG_AUTOFS_FS=y
 # CONFIG_UFS_FS is not set
index 7432abd1231247ab16149f0df2b39ea7c9b5f13e..13d6df9f6e02e5d159969b9bde943c5f6d51227f 100644 (file)
  *     unless you have a patch to fix it.  I am working on it...)
  * -Implement ide_cdrom_select_speed using the generic cdrom interface
  * -Fix ide_cdrom_reset so that it works (it does nothing right now)
- *
- * MOSTLY DONE LIST:
- *  Query the drive to find what features are available
- *   before trying to use them.
+ * -Query the drive to find what features are available before trying to
+ *   use them (like trying to close the tray in drives that can't).
  *
  *
  * ----------------------------------
  * 4.07  Dec 17, 1997  -- fallback to set pc->stat on "tray open"
  * 4.08  Dec 18, 1997  -- spew less noise when tray is empty
  *                     -- fix speed display for ACER 24X, 18X
+ * 4.09  Jan 04, 1998  -- fix handling of the last block so we return
+ *                         an end of file instead of an I/O error (Gadi)
  *
  *************************************************************************/
 
-#define IDECD_VERSION "4.07"
+#define IDECD_VERSION "4.09"
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -1663,7 +1663,7 @@ cdrom_read_toc (ide_drive_t *drive,
        if (stat) toc->capacity = 0x1fffff;
 
        HWIF(drive)->gd->sizes[drive->select.b.unit << PARTN_BITS]
-               = toc->capacity * SECTORS_PER_FRAME;
+               = (toc->capacity * SECTORS_PER_FRAME) >> (BLOCK_SIZE_BITS - 9);
        drive->part[0].nr_sects = toc->capacity * SECTORS_PER_FRAME;
 
        /* Remember that we've read this stuff. */
index 72079074f32ccac4f00793775752af1cbf9f04ba..23ece7e7260ab7d1f6a54eaa90bfd7ef2be94d87 100644 (file)
@@ -1,6 +1,6 @@
 /* linux/drivers/cdrom/cdrom.c. 
    Copyright (c) 1996, 1997 David A. van Leeuwen.
-   Copyright (c) 1997 Erik Andersen (andersee@debian.org)
+   Copyright (c) 1997, 1998 Erik Andersen (andersee@debian.org)
 
    May be copied or modified under the terms of the GNU General Public
    License.  See linux/COPYING for more information.
 #include <asm/uaccess.h>
 
 
-#define VERSION "$Id: cdrom.c,v 2.1 1997/12/28 15:11:47 david Exp $"
-#define REVISION "$Revision: 2.1 $"
+#define VERSION "$Id: cdrom.c,v 2.11 1998/01/04 01:11:18 erik Exp $"
+#define REVISION "Revision: 2.11"
 #define FM_WRITE       0x2                 /* file mode write bit */
 
-/* When VERBOSE_STATUS_INFO is not defined, the debugging printks don't 
-   get compiled in */
-#define VERBOSE_STATUS_INFO
-
 /* I use an error-log mask to give fine grain control over the type of
    error messages dumped to the system logs.  The available masks include: */
 #define CD_WARNING     0x1
 #define CD_DO_IOCTL    0x4
 #define CD_OPEN                0x8
 #define CD_CLOSE       0x10
+#define CD_COUNT_TRACKS 0x20
+
+/* When VERBOSE_STATUS_INFO is not defined, the debugging printks don't 
+   get compiled in at all */
+#define VERBOSE_STATUS_INFO
 
 #define ERRLOGMASK (CD_WARNING) 
-/* #define ERRLOGMASK (CD_WARNING|CD_OPEN|CD_CLOSE) */
+/* #define ERRLOGMASK (CD_WARNING|CD_OPEN|CD_COUNT_TRACKS|CD_CLOSE) */
 /* #define ERRLOGMASK (CD_WARNING|CD_REG_UNREG|CD_DO_IOCTL|CD_OPEN|CD_CLOSE) */
 
 #ifdef VERBOSE_STATUS_INFO
@@ -480,7 +481,7 @@ void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype* tracks)
        tracks->cdi=0;
        tracks->xa=0;
        tracks->error=0;
-       cdinfo(CD_OPEN, "entering cdrom_count_tracks\n"); 
+       cdinfo(CD_COUNT_TRACKS, "entering cdrom_count_tracks\n"); 
         if (!(cdi->ops->capability & CDC_PLAY_AUDIO)) { 
                 tracks->error=CDS_NO_INFO;
                 return;
@@ -508,10 +509,10 @@ void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype* tracks)
                        tracks->data++;
                } else
                    tracks->audio++;
-               cdinfo(CD_OPEN, "track %d: format=%d, ctrl=%d\n",
+               cdinfo(CD_COUNT_TRACKS, "track %d: format=%d, ctrl=%d\n",
                       i, entry.cdte_format, entry.cdte_ctrl);
        }       
-       cdinfo(CD_OPEN, "disc has %d tracks: %d=audio %d=data %d=Cd-I %d=XA\n", 
+       cdinfo(CD_COUNT_TRACKS, "disc has %d tracks: %d=audio %d=data %d=Cd-I %d=XA\n", 
                header.cdth_trk1, tracks->audio, tracks->data, 
                tracks->cdi, tracks->xa);
 }      
index 231e00548b5b3e6d59485acfa9f15abb4663bf40..7434242585bb209b2b948e2a62b40289bd17cdd9 100644 (file)
@@ -416,7 +416,8 @@ static int scd_drive_status(struct cdrom_device_info *cdi, int slot_nr)
      return -EINVAL;
   }
 
-  return sony_spun_up ? CDS_DISC_OK : CDS_DRIVE_NOT_READY;
+  /*return sony_spun_up ? CDS_DISC_OK : CDS_DRIVE_NOT_READY;*/
+  return sony_spun_up ? CDS_DISC_OK : CDS_TRAY_OPEN;
 }
 
 static inline void
@@ -1085,7 +1086,7 @@ handle_sony_cd_attention(void)
    volatile int val;
 
 
-#if DEBUG
+#if 0*DEBUG
    printk("Entering handle_sony_cd_attention\n");
 #endif
    if (is_attention())
@@ -1166,7 +1167,7 @@ handle_sony_cd_attention(void)
    }
 
    num_consecutive_attentions = 0;
-#if DEBUG
+#if 0*DEBUG
    printk("Leaving handle_sony_cd_attention at %d\n", __LINE__);
 #endif
    return(0);
@@ -2835,8 +2836,11 @@ static int scd_tray_move(struct cdrom_device_info *cdi, int position)
 
     sony_audio_status = CDROM_AUDIO_INVALID;
     return do_sony_cd_cmd_chk("EJECT",SONY_EJECT_CMD, NULL, 0, res_reg, &res_size);
-  } else
-  return 0;
+  } else {
+    if (0 == scd_spinup())
+      sony_spun_up = 1;
+    return 0;
+  }
 }
 
 /*
@@ -3230,7 +3234,6 @@ scd_open(struct cdrom_device_info *cdi, int openmode)
             printk("CDU31A: Unable to set XA params: 0x%2.2x\n", res_reg[1]);
          }
          sony_xa_mode = 1;
-printk("sony_xa_mode is set\n");
       }
       /* A non-XA disk.  Set the parms back if necessary. */
       else if (sony_xa_mode)
@@ -3247,7 +3250,6 @@ printk("sony_xa_mode is set\n");
             printk("CDU31A: Unable to reset XA params: 0x%2.2x\n", res_reg[1]);
          }
          sony_xa_mode = 0;
-printk("sony_xa_mode is reset\n");
       }
 
       sony_spun_up = 1;
@@ -3293,7 +3295,7 @@ static struct cdrom_device_ops scd_dops = {
   scd_reset,                  /* hard reset */
   scd_audio_ioctl,            /* audio ioctl */
   scd_dev_ioctl,              /* device-specific ioctl */
-  CDC_OPEN_TRAY | CDC_LOCK | CDC_SELECT_SPEED | CDC_MULTI_SESSION | 
+  CDC_OPEN_TRAY | CDC_CLOSE_TRAY | CDC_LOCK | CDC_SELECT_SPEED | CDC_MULTI_SESSION | 
   CDC_MULTI_SESSION | CDC_MCN | CDC_MEDIA_CHANGED | CDC_PLAY_AUDIO |
   CDC_RESET | CDC_IOCTLS | CDC_DRIVE_STATUS, /* capability */
   1,                            /* number of minor devices */
@@ -3571,6 +3573,7 @@ cdu31a_init(void))
       cdu31a_abort_timer.function = handle_abort_timeout;
 
       scd_info.mask = deficiency;
+      strncpy(scd_info.name, "cdu31a", sizeof(scd_info.name));
 
       if (register_cdrom(&scd_info))
       {
index f46388d068366eea9b0d7b749a1c51b07046d549..9fc316e17fc5ff3ac3fe82be64be2c71f06dc38a 100644 (file)
@@ -75,9 +75,6 @@ static const char *mcdx_c_version
 #define        mcdx_drive_map mcdx
 #include "mcdx.h"
 
-#define MCDX_QUIET 0
-
-
 #ifndef HZ
 #error HZ not defined
 #endif
@@ -288,7 +285,7 @@ static struct cdrom_device_ops mcdx_dops = {
   NULL,                       /* hard reset */
   mcdx_audio_ioctl,            /* audio ioctl */
   NULL,                  /* device-specific ioctl */
-  CDC_OPEN_TRAY | CDC_MEDIA_CHANGED | CDC_PLAY_AUDIO
+  CDC_OPEN_TRAY | CDC_LOCK | CDC_MEDIA_CHANGED | CDC_PLAY_AUDIO
   | CDC_DRIVE_STATUS, /* capability */
   0,                            /* number of minor devices */
 };
index 08de5a79412d4639179cb1a6beb162b5c66ae529..62396576a9ed1e82233429d0fbdedd392cc9d202 100644 (file)
@@ -550,7 +550,6 @@ static struct cdrom_tocentry tocentry;
 static struct cdrom_subchnl SC;
 static struct cdrom_volctrl volctrl;
 static struct cdrom_read_audio read_audio;
-static struct cdrom_multisession ms_info;
 
 static unsigned char msgnum=0;
 static char msgbuf[80];
@@ -2297,12 +2296,52 @@ static int cc_CloseTray(void)
        }
        i=cmd_out();
        msg(DBG_LCS,"p_door_closed bit %d after\n", st_door_closed);
+
+       i=cc_ReadError();
+       flags_cmd_out |= f_respo2;
+       cc_ReadStatus(); /* command: give 1-byte status */
+       i=ResponseStatus();
+       if (famT_drive&&(i<0))
+       {
+               cc_DriveReset();
+               i=ResponseStatus();
+#if 0
+                sbp_sleep(HZ);
+#endif 0
+               i=ResponseStatus();
+       }
+       if (i<0)
+       {
+               msg(DBG_INF,"sbpcd cc_CloseTray: ResponseStatus timed out (%d).\n",i);
+       }
+       if (!(famT_drive))
+       {
+               if (!st_spinning)
+               {
+                       cc_SpinUp();
+                       if (st_check) i=cc_ReadError();
+                       flags_cmd_out |= f_respo2;
+                       cc_ReadStatus();
+                       i=ResponseStatus();
+               } else {
+               }
+       }
+       i=DiskInfo();
        return (i);
 }
 
 static int sbpcd_tray_move(struct cdrom_device_info *cdi, int position)
 {
-  return position ? cc_CloseTray() : 0; 
+  int i;
+  i = MINOR(cdi->dev);
+
+  switch_drive(i);
+  if (position == 1) {
+    cc_SpinDown();
+  } else {
+    return cc_CloseTray();
+  }
+  return 0;
 }
 
 /*==========================================================================*/
@@ -2768,11 +2807,13 @@ static int cc_ReadTocDescr(void)
                if (famLV_drive) D_S[d].CDsize_frm=D_S[d].size_blk+1;
        }
        D_S[d].diskstate_flags |= toc_bit;
-       msg(DBG_TOC,"TocDesc: %02X %02X %02X %08X\n",
+       msg(DBG_TOC,"TocDesc: xa %02X firstt %02X lastt %02X size %08X firstses %02X lastsess %02X\n",
            D_S[d].xa_byte,
            D_S[d].n_first_track,
            D_S[d].n_last_track,
-           D_S[d].size_msf);
+           D_S[d].size_msf,
+           D_S[d].first_session,
+           D_S[d].last_session);
        return (0);
 }
 /*==========================================================================*/
@@ -3886,6 +3927,7 @@ static int DiskInfo(void)
        msg(DBG_000,"DiskInfo entered.\n");
        for (j=1;j<LOOP_COUNT;j++)
        {
+#if 0
                i=SetSpeed();
                if (i<0)
                {
@@ -3898,10 +3940,14 @@ static int DiskInfo(void)
                        msg(DBG_INF,"DiskInfo: cc_ModeSense returns %d\n", i);
                        continue;
                }
+#endif
                i=cc_ReadCapacity();
                if (i>=0) break;
                msg(DBG_INF,"DiskInfo: ReadCapacity #%d returns %d\n", j, i);
+#if 0
                i=cc_DriveReset();
+#endif
+               if (!fam0_drive && j == 2) break;
        }
        if (j==LOOP_COUNT) return (-33); /* give up */
        
@@ -3946,12 +3992,36 @@ static int DiskInfo(void)
 
 static int sbpcd_drive_status(struct cdrom_device_info *cdi, int slot_nr)
 {
-  if (CDSL_CURRENT != slot_nr) {
-     /* we have no changer support */
-     return -EINVAL;
-  }
+       int st;
+
+       if (CDSL_CURRENT != slot_nr) {
+                /* we have no changer support */
+                return -EINVAL;
+       }
+
+        cc_ReadStatus();
+       st=ResponseStatus();
+       if (st<0)
+       {
+               msg(DBG_INF,"sbpcd_drive_status: timeout.\n");
+               return (0);
+       }
+       msg(DBG_000,"Drive Status: door_locked =%d.\n", st_door_locked);
+       msg(DBG_000,"Drive Status: door_closed =%d.\n", st_door_closed);
+       msg(DBG_000,"Drive Status: caddy_in =%d.\n", st_caddy_in);
+       msg(DBG_000,"Drive Status: disk_ok =%d.\n", st_diskok);
+       msg(DBG_000,"Drive Status: spinning =%d.\n", st_spinning);
+       msg(DBG_000,"Drive Status: busy =%d.\n", st_busy);
+#if 0
+  if (!(D_S[MINOR(cdi->dev)].status_bits & p_door_closed)) return CDS_TRAY_OPEN;
+  if (D_S[MINOR(cdi->dev)].status_bits & p_disk_ok) return CDS_DISC_OK;
+  if (D_S[MINOR(cdi->dev)].status_bits & p_disk_in) return CDS_DRIVE_NOT_READY;
 
-  return D_S[d].status_bits & p1_disk_ok ? CDS_DISC_OK : CDS_DRIVE_NOT_READY;
+  return CDS_NO_DISC;
+#else
+  if (D_S[MINOR(cdi->dev)].status_bits & p_spinning) return CDS_DISC_OK;
+  return CDS_TRAY_OPEN;
+#endif
 }
 
 
@@ -4082,13 +4152,13 @@ static int sbp_status(void)
 static int sbpcd_get_last_session(struct cdrom_device_info *cdi, struct cdrom_multisession *ms_infp)
 {
        ms_infp->addr_format = CDROM_LBA;
-       ms_infp->addr.lba    = D_S[d].lba_multi;
-       if (D_S[d].f_multisession)
+       ms_infp->addr.lba    = D_S[MINOR(cdi->dev)].lba_multi;
+       if (D_S[MINOR(cdi->dev)].f_multisession)
                ms_infp->xa_flag=1; /* valid redirection address */
        else
                ms_infp->xa_flag=0; /* invalid redirection address */
 
-       return  1;
+       return  0;
 }
 
 /*==========================================================================*/
@@ -4304,8 +4374,30 @@ static int sbpcd_dev_ioctl(struct cdrom_device_info *cdi, u_int cmd,
                                error_flag=0;
                                p = D_S[d].aud_buf;
                                if (sbpro_type==1) OUT(CDo_sel_i_d,1);
-                               if (do_16bit) insw(CDi_data, p, read_audio.nframes*(CD_FRAMESIZE_RAW>>1));
-                               else insb(CDi_data, p, read_audio.nframes*CD_FRAMESIZE_RAW);
+                               if (do_16bit)
+                               {
+                                       u_short *p2 = (u_short *) p;
+
+                                       for (; (u_char *) p2 < D_S[d].aud_buf + read_audio.nframes*CD_FRAMESIZE_RAW;)
+                                       {
+                                               if ((inb_p(CDi_status)&s_not_data_ready)) continue;
+
+                                               /* get one sample */
+                                               *p2++ = inw_p(CDi_data);
+                                               *p2++ = inw_p(CDi_data);
+                                       }
+                               } else {
+                                       for (; p < D_S[d].aud_buf + read_audio.nframes*CD_FRAMESIZE_RAW;)
+                                       {
+                                               if ((inb_p(CDi_status)&s_not_data_ready)) continue;
+
+                                               /* get one sample */
+                                               *p++ = inb_p(CDi_data);
+                                               *p++ = inb_p(CDi_data);
+                                               *p++ = inb_p(CDi_data);
+                                               *p++ = inb_p(CDi_data);
+                                       }
+                               }
                                if (sbpro_type==1) OUT(CDo_sel_i_d,0);
                                data_retrying = 0;
                        }
@@ -4388,28 +4480,6 @@ static int sbpcd_dev_ioctl(struct cdrom_device_info *cdi, u_int cmd,
                if(arg > 0xff) RETURN_UP(-EINVAL);
                read_ahead[MAJOR(cdi->dev)] = arg;
                RETURN_UP(0);
-#if 0
-       case CDROMEJECT:
-               msg(DBG_IOC,"ioctl: CDROMEJECT entered.\n");
-               if (fam0_drive) return (0);
-               if (D_S[d].open_count>1) RETURN_UP(-EBUSY);
-               i=UnLockDoor();
-               D_S[d].open_count=-9; /* to get it locked next time again */
-               i=cc_SpinDown();
-               msg(DBG_IOX,"ioctl: cc_SpinDown returned %d.\n", i);
-               msg(DBG_TEA,"ioctl: cc_SpinDown returned %d.\n", i);
-               if (i<0) RETURN_UP(-EIO);
-               D_S[d].CD_changed=0xFF;
-               D_S[d].diskstate_flags=0;
-               D_S[d].audio_state=0;
-               RETURN_UP(0);
-
-       case CDROMEJECT_SW:
-               msg(DBG_IOC,"ioctl: CDROMEJECT_SW entered.\n");
-               if (fam0_drive) RETURN_UP(0);
-               D_S[d].f_eject=arg;
-               RETURN_UP(0);
-#endif         
        default:
                msg(DBG_IOC,"ioctl: unknown function request %04X\n", cmd);
                RETURN_UP(-EINVAL);
@@ -5242,54 +5312,13 @@ static int sbp_data(struct request *req)
 static int sbpcd_open(struct cdrom_device_info *cdi, int purpose)
 {
        int i;
-       
+
        i = MINOR(cdi->dev);
-       if ((i<0) || (i>=NR_SBPCD) || (D_S[i].drv_id==-1))
-       {
-               msg(DBG_INF, "open: bad device: %04X\n", cdi->dev);
-               return (-ENXIO);             /* no such drive */
-       }
-       
+
        MOD_INC_USE_COUNT;
        down(&ioctl_read_sem);
        switch_drive(i);
-       
-       i=cc_ReadError();
-       flags_cmd_out |= f_respo2;
-       cc_ReadStatus(); /* command: give 1-byte status */
-       i=ResponseStatus();
-       if (famT_drive&&(i<0))
-       {
-               cc_DriveReset();
-               i=ResponseStatus();
-#if 0
-                sbp_sleep(HZ);
-#endif 0
-               i=ResponseStatus();
-       }
-       if (i<0)
-       {
-               msg(DBG_INF,"sbpcd_open: ResponseStatus timed out (%d).\n",i);
-               MOD_DEC_USE_COUNT;
-               RETURN_UP(-EIO);                  /* drive doesn't respond */
-       }
-       if (famT_drive) msg(DBG_TEA,"sbpcd_open: ResponseStatus=%02X\n", i);
-       if (!(famT_drive))
-               if (!st_spinning)
-               {
-                       cc_SpinUp();
-                       flags_cmd_out |= f_respo2;
-                       cc_ReadStatus();
-                       i=ResponseStatus();
-               }
-       if (famT_drive) msg(DBG_TEA,"sbpcd_open: status %02X\n", D_S[d].status_bits);
-       if (!st_door_closed||!st_caddy_in)
-       {
-               msg(DBG_INF, "sbpcd_open: no disk in drive.\n");
-               D_S[d].open_count=0;
-               MOD_DEC_USE_COUNT;
-               RETURN_UP(-ENXIO);
-       }
+
        /*
         * try to keep an "open" counter here and lock the door if 0->1.
         */
@@ -5360,24 +5389,6 @@ static void sbpcd_release(struct cdrom_device_info * cdi)
 /*
  *
  */
-#if 0
-static struct file_operations sbpcd_fops =
-{
-       NULL,                   /* lseek - default */
-       block_read,             /* read - general block-dev read */
-       block_write,            /* write - general block-dev write */
-       NULL,                   /* readdir - bad */
-       NULL,                   /* poll */
-       sbpcd_ioctl,            /* ioctl */
-       NULL,                   /* mmap */
-       sbpcd_open,             /* open */
-       sbpcd_release,          /* release */
-       NULL,                   /* fsync */
-       NULL,                   /* fasync */
-       sbpcd_chk_disk_change,  /* media_change */
-       NULL                    /* revalidate */
-};
-#endif
 static int sbpcd_media_changed( struct cdrom_device_info *cdi, int disc_nr);
 static struct cdrom_device_ops sbpcd_dops = {
   sbpcd_open,                   /* open */
@@ -5394,7 +5405,7 @@ static struct cdrom_device_ops sbpcd_dops = {
   sbpcd_audio_ioctl,            /* audio ioctl */
   sbpcd_dev_ioctl,              /* device-specific ioctl */
   CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK | CDC_MULTI_SESSION |
-    CDC_MEDIA_CHANGED | CDC_MCN | CDC_PLAY_AUDIO, /* capability */
+    CDC_MEDIA_CHANGED | CDC_MCN | CDC_PLAY_AUDIO | CDC_IOCTLS, /* capability */
   1,                            /* number of minor devices */
 };
 
@@ -5556,7 +5567,7 @@ __initfunc(int SBPCD_INIT(void))
        int i=0, j=0;
        int addr[2]={1, CDROM_PORT};
        int port_index;
-       
+
        sti();
        
        msg(DBG_INF,"sbpcd.c %s\n", VERSION);
@@ -5630,14 +5641,6 @@ __initfunc(int SBPCD_INIT(void))
        check_datarate();
        msg(DBG_INI,"check_datarate done.\n");
        
-#if 0
-       if (!famL_drive)
-       {
-               OUT(CDo_reset,0);
-               sbp_sleep(HZ);
-       }
-#endif 0
-
        for (j=0;j<NR_SBPCD;j++)
        {
                if (D_S[j].drv_id==-1) continue;
@@ -5830,11 +5833,6 @@ static int sbpcd_chk_disk_change(kdev_t full_dev)
        
        msg(DBG_CHK,"media_check (%d) called\n", MINOR(full_dev));
        i=MINOR(full_dev);
-       if ( (i<0) || (i>=NR_SBPCD) || (D_S[i].drv_id==-1) )
-       {
-               msg(DBG_INF, "media_check: invalid device %04X.\n", full_dev);
-               return (-1);
-       }
        
        if (D_S[i].CD_changed==0xFF)
         {
index e9021316d1e42ccd18cfbd9b5b076f4444340483..805e98a82a6030258a26499317c5c6048952724e 100644 (file)
 #define JUKEBOX 0
 #else
 #define JUKEBOX 1
-#endif DISTRIBUTION
+#endif /* DISTRIBUTION */
 
 /* tray control: eject tray after last use */
 #if DISTRIBUTION
 #define EJECT 0
 #else
 #define EJECT 1
-#endif DISTRIBUTION
+#endif /* DISTRIBUTION */
 
 /* max. number of audio frames to read with one     */
 /* request (allocates n* 2352 bytes kernel memory!) */
@@ -570,7 +570,7 @@ pause:   8d pr 00 00 00 00 00.  (0)  pause (pr=00)
                                      resume (pr=80) audio playing
 
 Mode Select:
-         84 00 nn-nn ??-?? 00   (0)  nn-nn: 2048 or 2340
+         84 00 nn-nn ??.?? 00   (0)  nn-nn: 2048 or 2340
                                      possibly defines transfer size
 
 set_vol: 84 83 00 00 sw le 00.  (0)  sw(itch): lrxxxxxx (off=1)
@@ -604,12 +604,12 @@ seek:    01 00 ll-bb-aa 00 00.  (0)
 seek:    01 02 mm-ss-ff 00 00.  (0)  
 
 Read Data:
-read:    02 xx-xx-xx nn-nn fl. (??)  read nn-nn blocks of 2048 bytes,
+read:    02 xx-xx-xx nn-nn fl.  (?)  read nn-nn blocks of 2048 bytes,
                                      starting at block xx-xx-xx  
                                      fl=0: "lba"-, =2:"msf-bcd"-coded xx-xx-xx
 
 Read XA-Data:
-read:    03 xx-xx-xx nn-nn fl. (??)  read nn-nn blocks of 2340 bytes, 
+read:    03 xx-xx-xx nn-nn fl.  (?)  read nn-nn blocks of 2340 bytes, 
                                      starting at block xx-xx-xx
                                      fl=0: "lba"-, =2:"msf-bcd"-coded xx-xx-xx
 
@@ -838,7 +838,7 @@ Read XA Parameter:
 
 /*==========================================================================*/
 /*==========================================================================*/
-#endif _LINUX_SBPCD_H
+#endif /* _LINUX_SBPCD_H */
 /*==========================================================================*/
 /*
  * Overrides for Emacs so that we follow Linus's tabbing style.
index fde3fd10ba22b38cce239e1b804fcfae23f6eb03..50a7123ac7be538dd3856e7c05c0b9dbb1252a5d 100644 (file)
@@ -38,11 +38,6 @@ O_OBJS    = zftape-compress.o lzrw3.o
 
 M_OBJS    = $(O_TARGET)
 
-include $(TOPDIR)/Rules.make
-
-#
-# sorry, a special rule. 
-#
-lzrw3.o: lzrw3.c
-       $(CC) $(CFLAGS) -O6 -funroll-all-loops -c $<
+CFLAGS_lzrw3.o := -O6 -funroll-all-loops
 
+include $(TOPDIR)/Rules.make
index f662763b537d097bb2da408f5c80a927df7f5014..a7bac06554896a0a0a76ae893bdb6f44a6b9a6f0 100644 (file)
 # The 8390 drivers share the EI_DEBUG setting.
 
 # General options for Space.c
-OPTS           = # -DETH0_ADDR=0x300 -DETH0_IRQ=11
-
-WD_OPTS                = #-DWD_SHMEM=0xDD000
-EL2_OPTS       = #-DEL2_AUI
-NE_OPTS                =
-HP_OPTS                =
-PLIP_OPTS      =
-DEPCA_OPTS     = 
-EWRK3_OPTS     = 
-DE4X5_OPTS     = 
-DEFXX_OPTS     =
-ELP_OPTS       =
-TULIP_OPTS     =
-CS89x0_OPTS    =
+CONFIG_Space.o = # -DETH0_ADDR=0x300 -DETH0_IRQ=11
+CONFIG_3c503.o = # -DEL2_AUI
+CONFIG_wd.o    = # -DWD_SHMEM=0xDD000
index 3db67fcfa91d0f86547981fe59de8efa93fa3bde..b9048473a1da61b895f1625c3ee29c445752dc54 100644 (file)
@@ -735,80 +735,5 @@ include $(TOPDIR)/Rules.make
 clean:
        rm -f core *.o *.a *.s
 
-wd.o:  wd.c CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) $(WD_OPTS) -c $<
-
-3c503.o:       3c503.c CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) $(EL2_OPTS) -c $<
-
-3c505.o: 3c505.c CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) $(ELP_OPTS) -c $<
-
-de4x5.o: de4x5.c CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) $(DE4X5_OPTS) -c $<
-
-ewrk3.o: ewrk3.c CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) $(EWRK3_OPTS) -c $<
-
-depca.o: depca.c CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) $(DEPCA_OPTS) -c $<
-
-Space.o: Space.c ../../include/linux/autoconf.h CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) $(OPTS) -c $<
-
-net_init.o: ../../include/linux/autoconf.h
-
-ne.o:  ne.c CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) $(NE_OPTS) -c $<
-
-hp.o:  hp.c CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) $(HP_OPTS) -c $<
-
-plip.o:        plip.c CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) $(PLIP_OPTS) -c $<
-
-slip.o:        slip.c CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
-
-strip.o: strip.c CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
-
-dummy.o: dummy.c CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
-
-de600.o: de600.c CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) $(DE600_OPTS) -c $<
-
-de620.o: de620.c CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) $(DE620_OPTS) -c $<
-
-lance.o: lance.c CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) $(LANCE_OPTS) -c $<
-
-8390.o: 8390.c 8390.h CONFIG
-
-sdla.o: sdla.c CONFIG 
-
-dlci.o: dlci.c CONFIG
-
-sdladrv.o: sdladrv.c CONFIG
-
 wanpipe.o: $(WANPIPE_OBJS)
        ld -r -o $@ $(WANPIPE_OBJS)
-
-sdlamain.o: sdlamain.c CONFIG
-
-sdla_x25.o: sdla_x25.c CONFIG
-
-sdla_fr.o: sdla_fr.c CONFIG
-
-sdla_ppp.o: sdla_ppp.c CONFIG
-
-dgrs.o: dgrs.c dgrs.h CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
-
-ltpc.o: ltpc.c ltpc.h CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
-
-tulip.o: tulip.c CONFIG
-       $(CC) $(CPPFLAGS) $(CFLAGS) $(TULIP_OPTS) -c $<
index 8229001f128a1c90745e98661fc1c5c445a15ecf..36e04de28178ae61370882918cc06d193a177baf 100644 (file)
@@ -13,8 +13,9 @@ MIX_OBJS :=
 MOD_LIST_NAME := SCSI_MODULES
 SCSI_SRCS = $(wildcard $(L_OBJS:%.o=%.c))
 
-AHA152X        = -DDEBUG_AHA152X -DAUTOCONF
-GDTH = #-DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ -DGDTH_STATISTICS
+CFLAGS_aha152x.o =   -DDEBUG_AHA152X -DAUTOCONF
+CFLAGS_gdth.o    = # -DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ -DGDTH_STATISTICS
+CFLAGS_seagate.o =   -DARBITRATE -DSLOW_HANDSHAKE -DFAST32 -DPARITY
 
 .SUFFIXES:
 .SUFFIXES: .c .o .h .a
@@ -455,24 +456,14 @@ endif
 
 include $(TOPDIR)/Rules.make
 
-BusLogic.o: BusLogic.c FlashPoint.c
+# This gives correct output but uses old-style "excessive compilation".
+# This will be fixed soon (about December 1997 or January 1998).
+BusLogic.o: BusLogic.c FlashPoint.c ../../include/linux/autoconf.h
        $(CC) $(CFLAGS) -c BusLogic.c -o BusLogic.O
        $(CC) $(CFLAGS) -c FlashPoint.c -o FlashPoint.O
        $(LD) -r -o BusLogic.o BusLogic.O FlashPoint.O
        rm -f BusLogic.O FlashPoint.O
 
-aha152x.o: aha152x.c
-       $(CC) $(CFLAGS) $(AHA152X) -c aha152x.c 
-
-gdth.o: gdth.c gdth.h gdth_proc.c gdth_proc.h
-       $(CC) $(CFLAGS) $(GDTH) -c gdth.c 
-
-aic7xxx.o: aic7xxx.c aic7xxx_seq.h aic7xxx_reg.h
-       $(CC) $(CFLAGS) -c -o $@ aic7xxx.c
-
-seagate.o: seagate.c
-       $(CC) $(CFLAGS) -DARBITRATE -DSLOW_HANDSHAKE -DFAST32 -DPARITY -c seagate.c 
-
 53c8xx_d.h 53c8xx_u.h : 53c7,8xx.scr script_asm.pl
        ln -sf 53c7,8xx.scr fake.c
        $(CPP) -traditional -DCHIP=810 fake.c | grep -v '^#' | perl script_asm.pl 
index 018afc0259a8db5827cec8149fda3b7f270365f6..c299a3d47276039df12efe589a995b1d234740d6 100644 (file)
@@ -532,7 +532,7 @@ static int ad1848_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
        int val;
 
        if (cmd == SOUND_MIXER_PRIVATE1) {
-               if (__get_user(val, (int *)arg))
+               if (get_user(val, (int *)arg))
                        return -EFAULT;
 
                if (val != 0xffff) {
@@ -546,22 +546,22 @@ static int ad1848_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
                                ad_write(devc, 26, ad_read(devc, 26) | 0x40);           /* Mute mono out */
                }
                val = devc->mixer_output_port;
-               return __put_user(val, (int *)arg);
+               return put_user(val, (int *)arg);
        }
        if (((cmd >> 8) & 0xff) == 'M') {
                if (_SIOC_DIR(cmd) & _SIOC_WRITE)
                        switch (cmd & 0xff) {
                        case SOUND_MIXER_RECSRC:
-                               if (__get_user(val, (int *)arg))
+                               if (get_user(val, (int *)arg))
                                        return -EFAULT;
                                val = ad1848_set_recmask(devc, val);
-                               return __put_user(val, (int *)arg);
+                               return put_user(val, (int *)arg);
                                
                            default:
-                               if (__get_user(val, (int *)arg))
+                               if (get_user(val, (int *)arg))
                                        return -EFAULT;
                                val = ad1848_mixer_set(devc, cmd & 0xff, val);
-                               return __put_user(val, (int *)arg);
+                               return put_user(val, (int *)arg);
                        } 
                else
                        switch (cmd & 0xff) {
@@ -571,28 +571,28 @@ static int ad1848_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
                            
                        case SOUND_MIXER_RECSRC:
                                val = devc->recmask;
-                               return __put_user(val, (int *)arg);
+                               return put_user(val, (int *)arg);
                                
                        case SOUND_MIXER_DEVMASK:
                                val = devc->supported_devices;
-                               return __put_user(val, (int *)arg);
+                               return put_user(val, (int *)arg);
                                
                        case SOUND_MIXER_STEREODEVS:
                                val = devc->supported_devices;
                                if (devc->model != MD_C930)
                                        val &= ~(SOUND_MASK_SPEAKER | SOUND_MASK_IMIX);
-                               return __put_user(val, (int *)arg);
+                               return put_user(val, (int *)arg);
                                
                        case SOUND_MIXER_RECMASK:
                                val = devc->supported_rec_devices;
-                               return __put_user(val, (int *)arg);
+                               return put_user(val, (int *)arg);
 
                        case SOUND_MIXER_CAPS:
-                               return __put_user(SOUND_CAP_EXCL_INPUT, (int *)arg);
+                               return put_user(SOUND_CAP_EXCL_INPUT, (int *)arg);
 
                        default:
                                val = ad1848_mixer_get(devc, cmd & 0xff);
-                               return __put_user(val, (int *)arg);
+                               return put_user(val, (int *)arg);
                        }
        } else
                return -EINVAL;
index 0a090ca51eed675fe39b58ddc57273fa046bd904..7e93ac0a7f173ba81d8cf1073db48394559cd49f 100644 (file)
@@ -2834,115 +2834,128 @@ set_input_volumes(void)
 
 int gus_default_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
 {
-       int vol, voice, val;
-
-       if (((cmd >> 8) & 0xff) == 'M') {
-               if (_SIOC_DIR(cmd) & _SIOC_WRITE)
-                       switch (cmd & 0xff) {
-                       case SOUND_MIXER_RECSRC:
-                               if (__get_user(gus_recmask, (int *)arg))
-                                       return -EFAULT;
-                               gus_recmask &= MIX_DEVS;
-                               if (!(gus_recmask & (SOUND_MASK_MIC | SOUND_MASK_LINE)))
-                                       gus_recmask = SOUND_MASK_MIC;
-                               /* Note! Input volumes are updated during next open for recording */
-                               return __put_user(gus_recmask, (int *)arg);
-
-                       case SOUND_MIXER_MIC:
-                               if (__get_user(vol, (int *)arg))
-                                       return -EFAULT;
-                               vol &= 0xff;
-                               if (vol < 0)
-                                       vol = 0;
-                               if (vol > 100)
-                                       vol = 100;
-                               gus_mic_vol = vol;
-                               set_input_volumes();
-                               vol |= (vol << 8);
-                               return __put_user(vol, (int *)arg);
+       int vol, val;
+
+       if (((cmd >> 8) & 0xff) != 'M')
+               return -EINVAL;
+
+       if (!access_ok(VERIFY_WRITE, (int *)arg, sizeof(int)))
+               return -EFAULT;
+
+       if (_SIOC_DIR(cmd) & _SIOC_WRITE) {
+               if (__get_user(val, (int *) arg))
+                       return -EFAULT;
+
+               switch (cmd & 0xff) {
+               case SOUND_MIXER_RECSRC:
+                       gus_recmask = val & MIX_DEVS;
+                       if (!(gus_recmask & (SOUND_MASK_MIC | SOUND_MASK_LINE)))
+                               gus_recmask = SOUND_MASK_MIC;
+                       /* Note! Input volumes are updated during next open for recording */
+                       val = gus_recmask;
+                       break;
+
+               case SOUND_MIXER_MIC:
+                       vol = val & 0xff;
+                       if (vol < 0)
+                               vol = 0;
+                       if (vol > 100)
+                               vol = 100;
+                       gus_mic_vol = vol;
+                       set_input_volumes();
+                       vol |= (vol << 8);
+                       val = vol;
+                       break;
                                
-                       case SOUND_MIXER_LINE:
-                               if (__get_user(vol, (int *)arg))
-                                       return -EFAULT;
-                               vol &= 0xff;
-                               if (vol < 0)
-                                       vol = 0;
-                               if (vol > 100)
-                                       vol = 100;
-                               gus_line_vol = vol;
-                               set_input_volumes();
-                               vol |= (vol << 8);
-                               return __put_user(vol, (int *)arg);
-
-                       case SOUND_MIXER_PCM:
-                               if (__get_user(gus_pcm_volume, (int *)arg))
-                                       return -EFAULT;
-                               gus_pcm_volume &= 0xff;
-                               if (gus_pcm_volume < 0)
-                                       gus_pcm_volume = 0;
-                               if (gus_pcm_volume > 100)
-                                       gus_pcm_volume = 100;
-                               gus_audio_update_volume();
-                               gus_pcm_volume |= (gus_pcm_volume << 8);
-                               return __put_user(gus_pcm_volume, (int *)arg);
-
-                       case SOUND_MIXER_SYNTH:
-                               if (__get_user(gus_wave_volume, (int *)arg))
-                                       return -EFAULT;
-                               gus_wave_volume &= 0xff;
-                               if (gus_wave_volume < 0)
-                                       gus_wave_volume = 0;
-                               if (gus_wave_volume > 100)
-                                       gus_wave_volume = 100;
-                               if (active_device == GUS_DEV_WAVE)
-                                       for (voice = 0; voice < nr_voices; voice++)
-                                               dynamic_volume_change(voice);   /* Apply the new vol */
-                               gus_wave_volume |= (gus_wave_volume << 8);
-                               return __put_user(gus_wave_volume, (int *)arg);
-
-                       default:
-                               return -EINVAL;
-                       } else
-                               switch (cmd & 0xff) {
-                                       /*
-                                        * Return parameters
-                                        */
-                               case SOUND_MIXER_RECSRC:
-                                       return __put_user(gus_recmask, (int *)arg);
+               case SOUND_MIXER_LINE:
+                       vol = val & 0xff;
+                       if (vol < 0)
+                               vol = 0;
+                       if (vol > 100)
+                               vol = 100;
+                       gus_line_vol = vol;
+                       set_input_volumes();
+                       vol |= (vol << 8);
+                       val = vol;
+                       break;
+
+               case SOUND_MIXER_PCM:
+                       gus_pcm_volume = val & 0xff;
+                       if (gus_pcm_volume < 0)
+                               gus_pcm_volume = 0;
+                       if (gus_pcm_volume > 100)
+                               gus_pcm_volume = 100;
+                       gus_audio_update_volume();
+                       gus_pcm_volume |= (gus_pcm_volume << 8);
+                       val = gus_pcm_volume;
+                       break;
+
+               case SOUND_MIXER_SYNTH:
+                       gus_wave_volume = val & 0xff;
+                       if (gus_wave_volume < 0)
+                               gus_wave_volume = 0;
+                       if (gus_wave_volume > 100)
+                               gus_wave_volume = 100;
+                       if (active_device == GUS_DEV_WAVE) {
+                               int voice;
+                               for (voice = 0; voice < nr_voices; voice++)
+                                       dynamic_volume_change(voice);   /* Apply the new vol */
+                       }
+                       gus_wave_volume |= (gus_wave_volume << 8);
+                       val = gus_wave_volume;
+                       break;
+
+               default:
+                       return -EINVAL;
+               }
+
+       } else {
+               switch (cmd & 0xff) {
+               /*
+                * Return parameters
+                */
+               case SOUND_MIXER_RECSRC:
+                       val = gus_recmask;
+                       break;
                                        
-                               case SOUND_MIXER_DEVMASK:
-                                       return __put_user(MIX_DEVS, (int *)arg);
+               case SOUND_MIXER_DEVMASK:
+                       val = MIX_DEVS;
+                       break;
 
-                               case SOUND_MIXER_STEREODEVS:
-                                       return __put_user(0, (int *)arg);
+               case SOUND_MIXER_STEREODEVS:
+                       val = 0;
+                       break;
 
-                               case SOUND_MIXER_RECMASK:
-                                       val = SOUND_MASK_MIC | SOUND_MASK_LINE;
-                                       return __put_user(val, (int *)arg);
+               case SOUND_MIXER_RECMASK:
+                       val = SOUND_MASK_MIC | SOUND_MASK_LINE;
+                       break;
 
-                               case SOUND_MIXER_CAPS:
-                                       return __put_user(0, (int *)arg);
+               case SOUND_MIXER_CAPS:
+                       val = 0;
+                       break;
 
-                               case SOUND_MIXER_MIC:
-                                       val = gus_mic_vol | (gus_mic_vol << 8);
-                                       return __put_user(val, (int *)arg);
+               case SOUND_MIXER_MIC:
+                       val = gus_mic_vol | (gus_mic_vol << 8);
+                       break;
 
-                               case SOUND_MIXER_LINE:
-                                       val = gus_line_vol | (gus_line_vol << 8);
-                                       return __put_user(val, (int *)arg);
+               case SOUND_MIXER_LINE:
+                       val = gus_line_vol | (gus_line_vol << 8);
+                       break;
 
-                               case SOUND_MIXER_PCM:
-                                       val = gus_pcm_volume | (gus_pcm_volume << 8);
-                                       return __put_user(val, (int *)arg);
+               case SOUND_MIXER_PCM:
+                       val = gus_pcm_volume | (gus_pcm_volume << 8);
+                       break;
 
-                               case SOUND_MIXER_SYNTH:
-                                       return __put_user(gus_wave_volume | (gus_wave_volume << 8), (int *)arg);
+               case SOUND_MIXER_SYNTH:
+                       val = gus_wave_volume | (gus_wave_volume << 8);
+                       break;
 
-                               default:
-                                       return -EINVAL;
-                               }
-       } else
-               return -EINVAL;
+               default:
+                       return -EINVAL;
+               }
+       }
+
+       return __put_user(val, (int *)arg);
 }
 
 static struct mixer_operations gus_mixer_operations =
index 357e55524be3503c886797832e8708068bbc039d..197c6b210d200bb45cbc726d8cf3045657b6c950 100644 (file)
@@ -123,7 +123,7 @@ static int ics2101_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
        if (((cmd >> 8) & 0xff) == 'M') {
                if (_SIOC_DIR(cmd) & _SIOC_WRITE) {
                        
-                       if (__get_user(val, (int *)arg))
+                       if (get_user(val, (int *)arg))
                                return -EFAULT;
                        switch (cmd & 0xff) {
                        case SOUND_MIXER_RECSRC:
@@ -152,7 +152,7 @@ static int ics2101_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
                        default:
                                return -EINVAL;
                        }
-                       return __put_user(val, (int *)arg);
+                       return put_user(val, (int *)arg);
                } else {
                        switch (cmd & 0xff) {
                                /*
@@ -200,7 +200,7 @@ static int ics2101_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
                        default:
                                return -EINVAL;
                        }
-                       return __put_user(val, (int *)arg);
+                       return put_user(val, (int *)arg);
                }
        }
        return -EINVAL;
index 15ad09deb24c70869279179805c16b5e208794c6..0340b37b990f43149611e20a03c7d101c7a78ad6 100644 (file)
@@ -27,9 +27,6 @@ ifndef TOPDIR
 TOPDIR=/usr/src/linux
 endif
 
-.c.o:
-       $(CC) $(CFLAGS) -c $<
-
 lowlevel.o:    $(OBJS)
        $(LD) -r -o lowlevel.o $(OBJS)
 
index f801adc887327173c1efc2e60551b1c0f51d21c2..5c357d891486634ba145f0f815dfe78ed7d2740d 100644 (file)
@@ -50,7 +50,7 @@ extern int sound_open_dma(int chn, char *deviceID);
 extern void sound_free_dma(int chn);
 extern void sound_close_dma(int chn);
 
-extern void reporgram_timer(void);
+extern void reprogram_timer(void);
 
 #define RUNTIME_DMA_ALLOC
 #define USE_AUTOINIT_DMA
index 2e4829d44028baf86e29dce1ff1c73132e476382..7c0687b77df7d59e585ab4273cf5a717d402950a 100644 (file)
@@ -220,7 +220,7 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
 
        DEB(printk("pas2_mixer.c: int pas_mixer_ioctl(unsigned int cmd = %X, unsigned int arg = %X)\n", cmd, arg));
        if (cmd == SOUND_MIXER_PRIVATE1) { /* Set loudness bit */
-               if (__get_user(level, (int *)arg))
+               if (get_user(level, (int *)arg))
                        return -EFAULT;
                if (level == -1)  /* Return current settings */
                        level = (mode_control & 0x04);
@@ -231,10 +231,10 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
                        set_mode(mode_control);
                }
                level = !!level;
-               return __put_user(level, (int *)arg);
+               return put_user(level, (int *)arg);
        }
        if (cmd == SOUND_MIXER_PRIVATE2) { /* Set enhance bit */
-               if (__get_user(level, (int *)arg))
+               if (get_user(level, (int *)arg))
                        return -EFAULT;
                if (level == -1) { /* Return current settings */
                        if (!(mode_control & 0x03))
@@ -254,10 +254,10 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
                                i = (i + 1) * 20;
                        level = i;
                }
-               return __put_user(level, (int *)arg);
+               return put_user(level, (int *)arg);
        }
        if (cmd == SOUND_MIXER_PRIVATE3) { /* Set mute bit */
-               if (__get_user(level, (int *)arg))
+               if (get_user(level, (int *)arg))
                        return -EFAULT;
                if (level == -1)        /* Return current settings */
                        level = !(pas_read(0x0B8A) & 0x20);
@@ -269,10 +269,10 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
 
                        level = !(pas_read(0x0B8A) & 0x20);
                }
-               return __put_user(level, (int *)arg);
+               return put_user(level, (int *)arg);
        }
        if (((cmd >> 8) & 0xff) == 'M') {
-               if (__get_user(v, (int *)arg))
+               if (get_user(v, (int *)arg))
                        return -EFAULT;
                if (_SIOC_DIR(cmd) & _SIOC_WRITE) {
                        v = pas_mixer_set(cmd & 0xff, v);
@@ -303,7 +303,7 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
                                break;
                        }
                }
-               return __put_user(v, (int *)arg);
+               return put_user(v, (int *)arg);
        }
        return -EINVAL;
 }
index 9171360b33cf7b8a09006b7e5038d14241ad5ef7..2d494a0ddc4849c5b8a903ed993a6f3da7aa3aa3 100644 (file)
@@ -293,14 +293,14 @@ static int sb_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
         * Use ioctl(fd, SOUND_MIXER_PRIVATE1, &mode) to turn AGC off (0) or on (1).
         */
        if (cmd == SOUND_MIXER_PRIVATE1 && devc->model == MDL_SB16) {
-               if (__get_user(val, (int *)arg))
+               if (get_user(val, (int *)arg))
                        return -EFAULT;
                sb_setmixer(devc, 0x43, (~val) & 0x01);
                return 0;
        }
        if (((cmd >> 8) & 0xff) == 'M') {
                if (_SIOC_DIR(cmd) & _SIOC_WRITE) {
-                       if (__get_user(val, (int *)arg))
+                       if (get_user(val, (int *)arg))
                                return -EFAULT;
                        switch (cmd & 0xff) {
                        case SOUND_MIXER_RECSRC:
@@ -338,7 +338,7 @@ static int sb_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
                                  ret = sb_mixer_get(devc, cmd & 0xff);
                                  break;
                          }
-               return __put_user(ret, (int *)arg); 
+               return put_user(ret, (int *)arg); 
        } else
                return -EINVAL;
 }
index be43c491b1804dc6f0813c3c34c9312539c2789f..5c83ada1196e8eefb3a841eeeb4c47ea6393de5a 100644 (file)
@@ -12,10 +12,8 @@ O_OBJS   := dir.o file.o inode.o ioctl.o mmap.o ncplib_kernel.o sock.o
 M_OBJS   := $(O_TARGET)
 
 # If you want debugging output, please uncomment the following line
-
 # EXTRA_CFLAGS += -DDEBUG_NCP=1
 
-include $(TOPDIR)/Rules.make
+CFLAGS_ncplib_kernel.o := -finline-functions
 
-ncplib_kernel.o: ncplib_kernel.c ncplib_kernel.h
-       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -finline-functions -c -o $@ $<
+include $(TOPDIR)/Rules.make
index 0d403f23a47341476ae58563b37815d9626286d8..1272d817fd52709ff4e8393e9f581efc39aa5770 100644 (file)
@@ -132,6 +132,42 @@ out:
        return result;
 }
 
+/*
+ * This pretty-prints the pathname of a dentry,
+ * clarifying sockets etc.
+ */
+static int do_proc_readlink(struct dentry *dentry, char * buffer, int buflen)
+{
+       struct inode * inode;
+       char * tmp = (char*)__get_free_page(GFP_KERNEL), *path, *pattern;
+       int len;
+
+       /* Check for special dentries.. */
+       pattern = NULL;
+       inode = dentry->d_inode;
+       if (inode && dentry->d_parent == dentry) {
+               if (inode->i_sock)
+                       pattern = "socket:[%lu]";
+               if (inode->i_pipe)
+                       pattern = "pipe:[%lu]";
+       }
+       
+       if (pattern) {
+               len = sprintf(tmp, pattern, inode->i_ino);
+               path = tmp;
+       } else {
+               path = d_path(dentry, tmp, PAGE_SIZE);
+               len = tmp + PAGE_SIZE - path;
+       }
+
+       if (len < buflen)
+               buflen = len;
+       dput(dentry);
+       copy_to_user(buffer, path, buflen);
+       free_page((unsigned long)tmp);
+       return buflen;
+}
+
 static int proc_readlink(struct dentry * dentry, char * buffer, int buflen)
 {
        int error;
@@ -141,18 +177,7 @@ static int proc_readlink(struct dentry * dentry, char * buffer, int buflen)
        if (!IS_ERR(dentry)) {
                error = -ENOENT;
                if (dentry) {
-                       char * tmp = (char*)__get_free_page(GFP_KERNEL), *path;
-                       int len;
-
-                       path = d_path(dentry, tmp, PAGE_SIZE);
-                       len = tmp + PAGE_SIZE - path;
-
-                       if (len < buflen)
-                               buflen = len;
-                       dput(dentry);
-                       copy_to_user(buffer, path, buflen);
-                       free_page((unsigned long)tmp);
-                       error = buflen;
+                       error = do_proc_readlink(dentry, buffer, buflen);
                }
        }
        return error;
index 8947f97df57d596bcf5f5594fb4142a9e9a271f9..8448fc6ca12379c01ea39c583a4747da989e428a 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 1992         David Giller, rafetmad@oxy.edu
  *               1994, 1995   Eberhard Moenkeberg, emoenke@gwdg.de
  *               1996         David van Leeuwen, david@tm.tno.nl
- *               1997         Erik Andersen, andersee@debian.org
+ *               1997, 1998   Erik Andersen, andersee@debian.org
  */
  
 #ifndef        _LINUX_CDROM_H
@@ -417,4 +417,4 @@ extern int register_cdrom(struct cdrom_device_info *cdi);
 extern int unregister_cdrom(struct cdrom_device_info *cdi);
 #endif  /* End of kernel only stuff */ 
 
-#endif  _LINUX_CDROM_H
+#endif  /* _LINUX_CDROM_H */
index f817d0710dba2f5515679158d695a6f926cae154..9d1c14f7ad6dda45a6a185d95c54bffb2aed29e8 100644 (file)
@@ -3,28 +3,4 @@
 
 #include <linux/autoconf.h>
 
-/*
- * Defines for what uname() should return 
- */
-#ifndef UTS_SYSNAME
-#define UTS_SYSNAME "Linux"
-#endif
-
-#ifndef UTS_MACHINE
-#define UTS_MACHINE "unknown"
-#endif
-
-#ifndef UTS_NODENAME
-#define UTS_NODENAME "(none)"  /* set by sethostname() */
-#endif
-
-#ifndef UTS_DOMAINNAME
-#define UTS_DOMAINNAME "(none)"        /* set by setdomainname() */
-#endif
-
-/*
- * The definitions for UTS_RELEASE and UTS_VERSION are now defined
- * in linux/version.h, and should only be used by linux/version.c
- */
-
 #endif
index 1c2320e99efa6ab5e289c65dd5ff508662b40e41..97d0d77c20eda588c59f43d038c61d74ffbf8d91 100644 (file)
@@ -266,6 +266,7 @@ static inline int buffer_protected(struct buffer_head * bh)
 #include <linux/ufs_fs_i.h>
 #include <linux/romfs_fs_i.h>
 #include <linux/smb_fs_i.h>
+#include <linux/hfs_fs_i.h>
 
 /*
  * Attribute flags.  These should be or-ed together to figure out what
@@ -366,6 +367,7 @@ struct inode {
                struct ufs_inode_info           ufs_i;
                struct romfs_inode_info         romfs_i;
                struct smb_inode_info           smbfs_i;
+               struct hfs_inode_info           hfs_i;
                struct socket                   socket_i;
                void                            *generic_ip;
        } u;
@@ -503,6 +505,7 @@ extern int fasync_helper(struct file *, int, struct fasync_struct **);
 #include <linux/ufs_fs_sb.h>
 #include <linux/romfs_fs_sb.h>
 #include <linux/smb_fs_sb.h>
+#include <linux/hfs_fs_sb.h>
 
 struct super_block {
        kdev_t                  s_dev;
@@ -538,6 +541,7 @@ struct super_block {
                struct ufs_sb_info      ufs_sb;
                struct romfs_sb_info    romfs_sb;
                struct smb_sb_info      smbfs_sb;
+               struct hfs_sb_info      hfs_sb;
                void                    *generic_sbp;
        } u;
 };
index 9038cad511606b6153656ebd399455f1f279a855..f43c42c5da16f8bb6166b44dc7bb5f5133dd9026 100644 (file)
@@ -208,35 +208,12 @@ struct hfs_cap_info {
 
 #ifdef __KERNEL__
 
-#include <linux/version.h>
+#if defined(CONFIG_HFS_FS) || defined(CONFIG_HFS_FS_MODULE)
 
-#if (LINUX_VERSION_CODE < 0x020001)
-#error "Linux kernel version 2.0.1 or newer is required."
-#endif
-
-#if (LINUX_VERSION_CODE < 0x020100) && !defined(__alpha__)
-typedef int hfs_rwret_t;
-typedef int hfs_rwarg_t;
-#else
 typedef ssize_t hfs_rwret_t;
 typedef size_t hfs_rwarg_t;
-#endif
-
-#if (LINUX_VERSION_CODE < 0x020104)
-#      define  copy_to_user    memcpy_tofs
-#      define  copy_from_user  memcpy_fromfs
-#endif
-
-#if (LINUX_VERSION_CODE < 0x020106)
-#      include <asm/segment.h>
-#else
-#      include <asm/uaccess.h>
-#endif
 
-#if (LINUX_VERSION_CODE < 0x020105)
-extern inline void clear_user(char *addr, off_t count)
-{ while (count--) { put_user(0, addr++); } }
-#endif
+#include <asm/uaccess.h>
 
 /* Some forward declarations */
 struct hfs_fork;
@@ -328,18 +305,8 @@ extern int hfs_mac2eight(char *, const struct hfs_name *);
 extern int hfs_mac2alpha(char *, const struct hfs_name *);
 extern int hfs_mac2triv(char *, const struct hfs_name *);
 
-#ifdef MODULE /* The kernel may or may not know about HFS */
-extern __inline__ struct hfs_inode_info *HFS_I(struct inode *inode) {
-       return (struct hfs_inode_info *)(&inode->u);
-}
-
-extern __inline__ struct hfs_sb_info *HFS_SB(struct super_block *super) {
-       return (struct hfs_sb_info *)(&super->u);
-}
-#else
-# define       HFS_I(X)        (&((X)->u.hfs_i))
-# define       HFS_SB(X)       (&((X)->u.hfs_sb))
-#endif
+#define        HFS_I(X)        (&((X)->u.hfs_i))
+#define        HFS_SB(X)       (&((X)->u.hfs_sb))
 
 extern __inline__ void hfs_nameout(struct inode *dir, struct hfs_name *out,
                                   const char *in, int len) {
@@ -388,6 +355,8 @@ static __inline__ void hfs_drop_special(const struct hfs_name *name,
     }
   }
 }
+
+#endif
 #endif /* __KERNEL__ */
 
 #endif
diff --git a/include/linux/uts.h b/include/linux/uts.h
new file mode 100644 (file)
index 0000000..39e09ae
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef _LINUX_UTS_H
+#define _LINUX_UTS_H
+
+/*
+ * Defines for what uname() should return 
+ */
+#ifndef UTS_SYSNAME
+#define UTS_SYSNAME "Linux"
+#endif
+
+#ifndef UTS_MACHINE
+#define UTS_MACHINE "unknown"
+#endif
+
+#ifndef UTS_NODENAME
+#define UTS_NODENAME "(none)"  /* set by sethostname() */
+#endif
+
+#ifndef UTS_DOMAINNAME
+#define UTS_DOMAINNAME "(none)"        /* set by setdomainname() */
+#endif
+
+#endif
index 0196fdff70bfabb89797b941fb4ffbbdcedb868a..08d91a3b95c7af7053c63e944fc5040c5016dac8 100644 (file)
@@ -6,15 +6,11 @@
  *  May be freely distributed as part of Linux.
  */
 
-#include <linux/config.h>
+#include <linux/uts.h>
 #include <linux/utsname.h>
 #include <linux/version.h>
 #include <linux/compile.h>
 
-/* make the "checkconfig" script happy: we really need to include config.h */
-#ifdef CONFIG_BOGUS
-#endif
-
 #define version(a) Version_ ## a
 #define version_string(a) version(a)
 
index a728719ef1bb2572cc108879d186901b6532253f..ff908f68a879bb422ea651a026ec4db580caeb8d 100644 (file)
@@ -21,7 +21,6 @@ ifeq ($(CONFIG_MODULES),y)
 OX_OBJS  += ksyms.o
 endif
 
-include $(TOPDIR)/Rules.make
+CFLAGS_sched.o := $(PROFILING) -fno-omit-frame-pointer
 
-sched.o: sched.c
-       $(CC) $(CFLAGS) $(PROFILING) -fno-omit-frame-pointer -c $<
+include $(TOPDIR)/Rules.make
index 05cde7481de4c9e64e42c5d6c65c060307b08ed3..eaf0db043022d7623d54715fca1c8395705a0de3 100644 (file)
@@ -25,15 +25,15 @@ tkparse: tkparse.o tkcond.o tkgen.o
        ${HOSTCC} -o tkparse tkparse.o tkcond.o tkgen.o
 
 tkparse.o: tkparse.c tkparse.h
-       $(HOSTCC) $(HOSTCFLAGS) -c -o tkparse.o tkparse.c
 
 tkcond.o: tkcond.c tkparse.h
-       $(HOSTCC) $(HOSTCFLAGS) -c -o tkcond.o tkcond.c
 
 tkgen.o: tkgen.c tkparse.h
-       $(HOSTCC) $(HOSTCFLAGS) -c -o tkgen.o tkgen.c
+
+tkparse.o tkcond.o tkgen.o:
+       $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $(@:.o=.c)
 
 clean:
-       rm -f *~ kconfig.tk *.o tkparse
+       rm -f *~ kconfig.tk *.o tkparse mkdep split-include
 
 include $(TOPDIR)/Rules.make
index 586be364503b704c552b691f409ebfe1aa609aa4..657bb04892fbb4eb5e7725afccf14f685916d51c 100644 (file)
 # 081297 Pavel Machek (pavel@atrey.karlin.mff.cuni.cz) - better error 
 # handling
 #
+# 131197 Michael Chastain (mec@shout.net) - output all lines for a
+# choice list, not just the selected one.  This makes the output
+# the same as Configure output, which is important for smart config
+# dependencies.
+#
 # 101297 Michael Chastain (mec@shout.net) - remove sound driver cruft.
 #
 # 221297 Michael Chastain (mec@shout.net) - make define_bool actually
@@ -1051,11 +1056,19 @@ save_configuration () {
                : ${current:=$default}
 
                #
-               # Then extract the actual option from the list of choices.
+               # Output all choices (to be compatible with other configs).
                #
-               current=${choices#*$current} ; set $current
-
-               define_bool "$1" "y"
+               set -- $choices
+               while [ -n "$2" ]
+               do
+                       if eval [ "$1" = "$current" ]
+                       then
+                           define_bool "$2" "y"
+                       else
+                           define_bool "$2" "n"
+                       fi
+                       shift ; shift
+               done
        }
 
        function mainmenu_name () {
diff --git a/scripts/checkconfig.pl b/scripts/checkconfig.pl
new file mode 100644 (file)
index 0000000..2f5092b
--- /dev/null
@@ -0,0 +1,50 @@
+#! /usr/bin/perl
+#
+# checkconfig: find uses of CONFIG_* names without matching definitions.
+
+use integer;
+
+foreach $file (@ARGV)
+{
+    # Open this file.
+    open(FILE, $file) || die "Can't open $file: $!\n";
+
+    # Initialize variables.
+    my $fInComment   = 0;
+    my $fUseConfig   = 0;
+    my $iLinuxConfig = 0;
+    my %configList   = ();
+
+    LINE: while ( <FILE> )
+    {
+       # Strip comments.
+       $fInComment && (s+^.*?\*/+ +o ? ($fInComment = 0) : next);
+       m+/\*+o && (s+/\*.*?\*/+ +go, (s+/\*.*$+ +o && ($fInComment = 1)));
+
+       # Pick up definitions.
+       if ( m/^#/o )
+       {
+           $iLinuxConfig      = $. if m/^#\s*include\s+<linux\/config\.h>/o;
+           $configList{uc $1} = 1  if m/^#\s*include\s+<config\/(\S*)\.h>/o;
+           $configList{$1}    = 1  if m/^#\s*define\s+CONFIG_(\w*)/o;
+           $configList{$1}    = 1  if m/^#\s*undef\s+CONFIG_(\w*)/o;
+       }
+
+       # Look for usages.
+       next unless m/CONFIG_/o;
+       WORD: while ( m/\bCONFIG_(\w*)/og )
+       {
+           $fUseConfig = 1;
+           last LINE if $iLinuxConfig;
+           next WORD if exists $configList{$1};
+           print "$file: $.: need CONFIG_$1.\n";
+           $configList{$1} = 0;
+       }
+    }
+
+    # Report superfluous includes.
+    if ( $iLinuxConfig && ! $fUseConfig )
+       { print "$file: $iLinuxConfig: <linux/config.h> not needed.\n"; }
+
+    close(FILE);
+}
diff --git a/scripts/depend.awk b/scripts/depend.awk
deleted file mode 100644 (file)
index 93cb0eb..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-# This is an awk script which does dependencies. We do NOT want it to
-# recursively follow #include directives.
-#
-# The HPATH environment variable should be set to indicate where to look
-# for include files.  The -I in front of the path is optional.
-
-#
-# Surely there is a more elegant way to see if a file exists.  Anyone know
-# what it is?
-#
-function fileExists(f,    TMP, dummy, result) {
-       if(result=FILEHASH[f]) {
-               if(result=="Yes") {
-                       return "Yes"
-               } else {return ""}
-       }
-       ERRNO = getline dummy < f
-       if(ERRNO >= 0) {
-               close(f)
-               return FILEHASH[f]="Yes"
-       } else {
-               FILEHASH[f]="No"
-               return ""
-       }
-}
-
-function endfile(f) {
-       if (hasconfig && !needsconfig) {
-               printf "%s doesn't need config\n",f > "/dev/stderr"
-       }
-       if (hasdep) {
-               print cmd
-       }
-}
-
-BEGIN{
-       hasdep=0
-       hasconfig=0
-       needsconfig=0
-       incomment=0
-       if(!(TOPDIR=ENVIRON["TOPDIR"])) {
-               print "Environment variable TOPDIR is not set"
-               exit 1
-       }
-       split(ENVIRON["HPATH"],parray," ")
-       for(path in parray) {
-           sub("^-I","",parray[path])
-           sub("[/ ]*$","",parray[path])
-       }
-}
-
-# eliminate comments
-{
-    # remove all comments fully contained on a single line
-       gsub("\\/\\*.*\\*\\/", "")
-       if (incomment) {
-               if ($0 ~ /\*\//) {
-                       incomment = 0;
-                       gsub(".*\\*\\/", "")
-               } else {
-                       next
-               }
-       } else {
-               # start of multi-line comment
-               if ($0 ~ /\/\*/)
-               {
-                       incomment = 1;
-                       sub("\\/\\*.*", "")
-               } else if ($0 ~ /\*\//) {
-                       incomment = 0;
-                       sub(".*\\*\\/", "")
-               }
-       }
-}
-
-/^[    ]*#[    ]*if.*[^A-Za-z_]CONFIG_/ {
-       needsconfig=1
-       if (!hasconfig) {
-               printf "%s needs config but has not included config file\n",FILENAME > "/dev/stderr"
-               # only say it once per file..
-               hasconfig = 1
-       }
-}
-
-/^[    ]*#[    ]*include[      ]*[<"][^        ]*[>"]/{
-       found=0
-       if(LASTFILE!=FILENAME) {
-               endfile(LASTFILE)
-               hasdep=0
-               hasconfig=0
-               needsconfig=0
-               incomment=0
-               cmd=""
-               LASTFILE=FILENAME
-               depname=FILENAME
-               relpath=FILENAME
-               sub("\\.c$",".o: ",depname)
-               sub("\\.S$",".o: ",depname)
-               if (depname==FILENAME) {
-                       cmd="\n\t@touch "depname
-               }
-               sub("\\.h$",".h: ",depname)
-               if(relpath ~ "^\\." ) {
-                       sub("[^/]*$","",  relpath)
-                       relpath=relpath"/"
-                       sub("//","/",  relpath)
-               } else {
-                       relpath=""
-               }
-       }
-       fname=$0
-       sub("^#[        ]*include[      ]*[<\"]","",fname)
-       sub("[>\"].*","",fname)
-       if (fname=="linux/config.h") {
-               hasconfig=1
-       }
-       rfname=relpath""fname
-       if(fileExists(rfname)) {
-               found=1
-               if (!hasdep) {
-                       printf "%s", depname
-               }
-               hasdep=1
-               printf " \\\n   %s", rfname
-               if(fname ~ "^\\." ) {
-                       fnd=0;
-                       for(i in ARGV) {
-                               if(ARGV[i]==rfname) {
-                                       fnd=1
-                               }
-                       }
-                       if(fnd==0) {
-                               ARGV[ARGC]=rfname
-                               ++ARGC
-                       }
-               }
-       } else {
-               for(path in parray) {
-                       if(fileExists(parray[path]"/"fname)) {
-                               shortp=parray[path]
-                               found=1
-                               if (!hasdep) {
-                                       printf "%s", depname
-                               }
-                               hasdep=1
-                               printf " \\\n   %s", parray[path]"/"fname
-                       }
-               }
-       }
-}
-
-END{
-       endfile(FILENAME)
-}
index a7877b4f439a235f9b9b9fc9a42f46be919dd57d..4a8ab351d50583c27648381ac47d997fe4568817 100644 (file)
@@ -228,10 +228,10 @@ proc write_comment { file1 file2 text } {
 proc write_tristate { file1 file2 varname variable dep } {
        if { $variable == 0 } \
                then { puts $file1 "# $varname is not set"; \
-                      puts $file2 "#undef $varname"} \
+                      puts $file2 "#undef  $varname"} \
        elseif { $variable == 2 || ($dep == 2 && $variable == 1) } \
                then { puts $file1 "$varname=m"; \
-                      puts $file2 "#undef $varname"; \
+                      puts $file2 "#undef  $varname"; \
                       puts $file2 "#define ${varname}_MODULE 1" } \
        elseif { $variable == 1 && $dep != 2 } \
                then { puts $file1 "$varname=y"; \
@@ -244,7 +244,7 @@ proc write_tristate { file1 file2 varname variable dep } {
 proc write_int { file1 file2 varname variable dep } {
        if { $dep == 0 } \
                then { puts $file1 "# $varname is not set"; \
-                      puts $file2 "#undef $varname"} \
+                      puts $file2 "#undef  $varname"} \
        else {
                puts $file1 "$varname=$variable"; \
                puts $file2 "#define $varname $variable"; \
@@ -254,7 +254,7 @@ proc write_int { file1 file2 varname variable dep } {
 proc write_hex { file1 file2 varname variable dep } {
        if { $dep == 0 } \
                then { puts $file1 "# $varname is not set"; \
-                      puts $file2 "#undef $varname"} \
+                      puts $file2 "#undef  $varname"} \
        else {
                puts $file1 "$varname=$variable"; \
                puts $file2 "#define $varname 0x$variable"; \
@@ -264,7 +264,7 @@ proc write_hex { file1 file2 varname variable dep } {
 proc write_string { file1 file2 varname variable dep } {
        if { $dep == 0 } \
                then { puts $file1 "# $varname is not set"; \
-                      puts $file2 "#undef $varname"} \
+                      puts $file2 "#undef  $varname"} \
        else {
                puts $file1 "$varname=\"$variable\""; \
                puts $file2 "#define $varname \"$variable\""; \
diff --git a/scripts/hfiles.sh b/scripts/hfiles.sh
deleted file mode 100644 (file)
index 4643194..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-#
-# This script looks to see if a directory contains .h files
-#
-for dir in $@; do
-       for hfile in $dir/*.h; do
-               if [ -f $hfile ]; then echo $dir; fi
-               break
-       done
-done
-exit 0
index d8ecde8813aed0824bc374e444892f9c3c09ec7c..6ce6b6e411266672fc68933259eb46adbd26abd6 100644 (file)
@@ -1,18 +1,31 @@
+/*
+ * Originally by Linus Torvalds.
+ * Smart CONFIG_* processing by Werner Almesberger, Michael Chastain.
+ *
+ * Usage: mkdep file ...
+ * 
+ * Read source files and output makefile dependency lines for them.
+ * I make simple dependency lines for #include <*.h> and #include "*.h".
+ * I also find instances of CONFIG_FOO and generate dependencies
+ *    like include/config/foo.h.
+ */
+
+#include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
-
-#include <errno.h>
 #include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <unistd.h>
+
 #include <sys/fcntl.h>
 #include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
 
-char *filename, *command, __depname[256] = "\n\t@touch ";
-int needsconfig, hasconfig, hasmodules, hasdep;
 
+char __depname[512] = "\n\t@touch ";
 #define depname (__depname+9)
+int hasdep;
 
 struct path_struct {
        int len;
@@ -22,22 +35,113 @@ struct path_struct {
        {  0, "" }
 };
 
-static void handle_include(int type, char *name, int len)
+
+
+/*
+ * This records all the configuration options seen.
+ * In perl this would be a hash, but here it's a long string
+ * of values separated by newlines.  This is simple and
+ * extremely fast.
+ */
+char * str_config  = NULL;
+int    size_config = 0;
+int    len_config  = 0;
+
+
+
+/*
+ * Grow the configuration string to a desired length.
+ * Usually the first growth is plenty.
+ */
+void grow_config(int len)
+{
+       if (str_config == NULL) {
+               len_config  = 0;
+               size_config = 4096;
+               str_config  = malloc(4096);
+               if (str_config == NULL)
+                       { perror("malloc"); exit(1); }
+       }
+
+       while (len_config + len > size_config) {
+               str_config = realloc(str_config, size_config *= 2);
+               if (str_config == NULL)
+                       { perror("malloc"); exit(1); }
+       }
+}
+
+
+
+/*
+ * Lookup a value in the configuration string.
+ */
+int is_defined_config(const char * name, int len)
+{
+       const char * pconfig;
+       const char * plast = str_config + len_config - len;
+       for ( pconfig = str_config + 1; pconfig < plast; pconfig++ ) {
+               if (pconfig[ -1] == '\n'
+               &&  pconfig[len] == '\n'
+               &&  !memcmp(pconfig, name, len))
+                       return 1;
+       }
+       return 0;
+}
+
+
+
+/*
+ * Add a new value to the configuration string.
+ */
+void define_config(int convert, const char * name, int len)
+{
+       grow_config(len + 1);
+
+       memcpy(str_config+len_config, name, len);
+
+       if (convert) {
+               int i;
+               for (i = 0; i < len; i++) {
+                       char c = str_config[len_config+i];
+                       if (isupper(c)) c = tolower(c);
+                       if (c == '_')   c = '/';
+                       str_config[len_config+i] = c;
+               }
+       }
+
+       len_config += len;
+       str_config[len_config++] = '\n';
+}
+
+
+
+/*
+ * Clear the set of configuration strings.
+ */
+void clear_config( )
+{
+       len_config = 0;
+       define_config(0, "", 0);
+}
+
+
+
+/*
+ * Handle an #include line.
+ */
+void handle_include(int type, const char * name, int len)
 {
-       int plen;
        struct path_struct *path = path_array+type;
 
-       if (len == 14)
-               if (!memcmp(name, "linux/config.h", len))
-                       hasconfig = 1;
-               else if (!memcmp(name, "linux/module.h", len))
-                       hasmodules = 1;
-
-       plen = path->len;
-       memcpy(path->buffer+plen, name, len);
-       len += plen;
-       path->buffer[len] = '\0';
-       if (access(path->buffer, F_OK))
+       if (len == 14 && !memcmp(name, "linux/config.h", len))
+               return;
+
+       if (len >= 7 && !memcmp(name, "config/", 7))
+               define_config(0, name+7, len-7-2);
+
+       memcpy(path->buffer+path->len, name, len);
+       path->buffer[path->len+len] = '\0';
+       if (access(path->buffer, F_OK) != 0)
                return;
 
        if (!hasdep) {
@@ -47,15 +151,48 @@ static void handle_include(int type, char *name, int len)
        printf(" \\\n   %s", path->buffer);
 }
 
-static void handle_config(void)
+
+
+/*
+ * Record the use of a CONFIG_* word.
+ */
+void use_config(const char * name, int len)
 {
-       needsconfig = 1;
-       if (!hasconfig)
-               fprintf(stderr,
-                       "%s needs config but has not included config file\n",
-                       filename);
+       char *pc;
+       int i;
+
+       pc = path_array[0].buffer + path_array[0].len;
+       memcpy(pc, "config/", 7);
+       pc += 7;
+
+       for (i = 0; i < len; i++) {
+           char c = name[i];
+           if (isupper(c)) c = tolower(c);
+           if (c == '_')   c = '/';
+           pc[i] = c;
+       }
+       pc[len] = '\0';
+
+       if (is_defined_config(pc, len))
+           return;
+
+       define_config(0, pc, len);
+
+       if (!hasdep) {
+               hasdep = 1;
+               printf("%s: ", depname);
+       }
+       printf(" \\\n   $(wildcard %s.h)", path_array[0].buffer);
 }
 
+
+
+/*
+ * Macros for stunningly fast map-based character access.
+ * __buf is a register which holds the current word of the input.
+ * Thus, there is one memory access per sizeof(unsigned long) characters.
+ */
+
 #if defined(__alpha__) || defined(__i386__)
 #define LE_MACHINE
 #endif
@@ -69,243 +206,283 @@ static void handle_config(void)
 #endif
 
 #define GETNEXT { \
-next_byte(__buf); \
-if (!__nrbuf) { \
-       __buf = *(unsigned long *) next; \
-       __nrbuf = sizeof(unsigned long); \
-       if (!__buf) \
-               break; \
-} next++; __nrbuf--; }
+       next_byte(__buf); \
+       if ((unsigned long) next % sizeof(unsigned long) == 0) { \
+               __buf = * (unsigned long *) next; \
+               if (!__buf) \
+                       break; \
+       } \
+       next++; \
+}
+
+/*
+ * State machine macros.
+ */
 #define CASE(c,label) if (current == c) goto label
 #define NOTCASE(c,label) if (current != c) goto label
 
-static void state_machine(register char *next)
+/*
+ * Yet another state machine speedup.
+ */
+#define MAX2(a,b) ((a)>(b)?(a):(b))
+#define MIN2(a,b) ((a)<(b)?(a):(b))
+#define MAX5(a,b,c,d,e) (MAX2(a,MAX2(b,MAX2(c,MAX2(d,e)))))
+#define MIN5(a,b,c,d,e) (MIN2(a,MIN2(b,MIN2(c,MIN2(d,e)))))
+
+
+
+/*
+ * The state machine looks for (approximately) these Perl regular expressions:
+ *
+ *    m|\/\*.*?\*\/|
+ *    m|'.*?'|
+ *    m|".*?"|
+ *    m|#\s*include\s*"(.*?)"|
+ *    m|#\s*include\s*<(.*?>"|
+ *    m|#\s*(?define|undef)\s*CONFIG_(\w*)|
+ *    m|(?!\w)CONFIG_|
+ *
+ * About 98% of the CPU time is spent here, and most of that is in
+ * the 'start' paragraph.  Because the current characters are
+ * in a register, the start loop usually eats 4 or 8 characters
+ * per memory read.  The MAX5 and MIN5 tests dispose of most
+ * input characters with 1 or 2 comparisons.
+ */
+void state_machine(const char * map)
 {
-       for(;;) {
-       register unsigned long __buf = 0;
-       register unsigned long __nrbuf = 0;
+       const char * next = map;
+       const char * map_dot;
+       unsigned long __buf = 0;
 
-normal:
+       for (;;) {
+start:
        GETNEXT
-__normal:
-       CASE('/',slash);
-       CASE('"',string);
-       CASE('\'',char_const);
-       CASE('#',preproc);
-       goto normal;
-
+__start:
+       if (current > MAX5('/','\'','"','#','C')) goto start;
+       if (current < MIN5('/','\'','"','#','C')) goto start;
+       CASE('/',  slash);
+       CASE('\'', squote);
+       CASE('"',  dquote);
+       CASE('#',  pound);
+       CASE('C',  cee);
+       goto start;
+
+/* / */
 slash:
        GETNEXT
-       CASE('*',comment);
-       goto __normal;
-
-string:
+       NOTCASE('*', __start);
+slash_star_dot_star:
        GETNEXT
-       CASE('"',normal);
-       NOTCASE('\\',string);
+__slash_star_dot_star:
+       NOTCASE('*', slash_star_dot_star);
        GETNEXT
-       goto string;
+       NOTCASE('/', __slash_star_dot_star);
+       goto start;
 
-char_const:
+/* '.*?' */
+squote:
        GETNEXT
-       CASE('\'',normal);
-       NOTCASE('\\',char_const);
+       CASE('\'', start);
+       NOTCASE('\\', squote);
        GETNEXT
-       goto char_const;
+       goto squote;
 
-comment:
+/* ".*?" */
+dquote:
        GETNEXT
-__comment:
-       NOTCASE('*',comment);
+       CASE('"', start);
+       NOTCASE('\\', dquote);
        GETNEXT
-       CASE('/',normal);
-       goto __comment;
+       goto dquote;
 
-preproc:
+/* #\s* */
+pound:
        GETNEXT
-       CASE('\n',normal);
-       CASE(' ',preproc);
-       CASE('\t',preproc);
-       CASE('i',i_preproc);
-       CASE('e',e_preproc);
+       CASE(' ',  pound);
+       CASE('\t', pound);
+       CASE('i',  pound_i);
+       CASE('d',  pound_d);
+       CASE('u',  pound_u);
+       goto __start;
+
+/* #\s*i */
+pound_i:
+       GETNEXT NOTCASE('n', __start);
+       GETNEXT NOTCASE('c', __start);
+       GETNEXT NOTCASE('l', __start);
+       GETNEXT NOTCASE('u', __start);
+       GETNEXT NOTCASE('d', __start);
+       GETNEXT NOTCASE('e', __start);
+       goto pound_include;
+
+/* #\s*include\s* */
+pound_include:
        GETNEXT
-
-skippreproc:
-       CASE('\n',normal);
-       CASE('\\',skippreprocslash);
+       CASE(' ',  pound_include);
+       CASE('\t', pound_include);
+       map_dot = next;
+       CASE('"',  pound_include_dquote);
+       CASE('<',  pound_include_langle);
+       goto __start;
+
+/* #\s*include\s*"(.*)" */
+pound_include_dquote:
        GETNEXT
-       goto skippreproc;
-
-skippreprocslash:
-       GETNEXT;
-       GETNEXT;
-       goto skippreproc;
+       CASE('\n', start);
+       NOTCASE('"', pound_include_dquote);
+       handle_include(1, map_dot, next - map_dot - 1);
+       goto start;
 
-e_preproc:
+/* #\s*include\s*<(.*)> */
+pound_include_langle:
        GETNEXT
-       NOTCASE('l',skippreproc);
+       CASE('\n', start);
+       NOTCASE('>', pound_include_langle);
+       handle_include(0, map_dot, next - map_dot - 1);
+       goto start;
+
+/* #\s*d */
+pound_d:
+       GETNEXT NOTCASE('e', __start);
+       GETNEXT NOTCASE('f', __start);
+       GETNEXT NOTCASE('i', __start);
+       GETNEXT NOTCASE('n', __start);
+       GETNEXT NOTCASE('e', __start);
+       goto pound_define_undef;
+
+/* #\s*u */
+pound_u:
+       GETNEXT NOTCASE('n', __start);
+       GETNEXT NOTCASE('d', __start);
+       GETNEXT NOTCASE('e', __start);
+       GETNEXT NOTCASE('f', __start);
+       goto pound_define_undef;
+
+/* #\s*(define|undef)\s*CONFIG_(\w*) */
+pound_define_undef:
        GETNEXT
-       NOTCASE('i',skippreproc);
+       CASE(' ',  pound_define_undef);
+       CASE('\t', pound_define_undef);
+
+               NOTCASE('C', __start);
+       GETNEXT NOTCASE('O', __start);
+       GETNEXT NOTCASE('N', __start);
+       GETNEXT NOTCASE('F', __start);
+       GETNEXT NOTCASE('I', __start);
+       GETNEXT NOTCASE('G', __start);
+       GETNEXT NOTCASE('_', __start);
+
+       map_dot = next;
+pound_define_undef_CONFIG_word:
        GETNEXT
-       CASE('f',if_line);
-       goto skippreproc;
-
-i_preproc:
-       GETNEXT
-       CASE('f',if_line);
-       NOTCASE('n',skippreproc);
-       GETNEXT
-       NOTCASE('c',skippreproc);
-       GETNEXT
-       NOTCASE('l',skippreproc);
-       GETNEXT
-       NOTCASE('u',skippreproc);
-       GETNEXT
-       NOTCASE('d',skippreproc);
-       GETNEXT
-       NOTCASE('e',skippreproc);
-
-/* "# include" found */
-include_line:
-       GETNEXT
-       CASE('\n',normal);
-       CASE('<', std_include_file);
-       NOTCASE('"', include_line);
-
-/* "local" include file */
-{
-       char *incname = next;
-local_include_name:
-       GETNEXT
-       CASE('\n',normal);
-       NOTCASE('"', local_include_name);
-       handle_include(1, incname, next-incname-1);
-       goto skippreproc;
-}
-
-/* <std> include file */
-std_include_file:
-{
-       char *incname = next;
-std_include_name:
+       if (isalnum(current) || current == '_')
+               goto pound_define_undef_CONFIG_word;
+       define_config(1, map_dot, next - map_dot - 1);
+       goto __start;
+
+/* \<CONFIG_(\w*) */
+cee:
+       if (next >= map+2 && (isalnum(next[-2]) || next[-2] == '_'))
+               goto start;
+       GETNEXT NOTCASE('O', __start);
+       GETNEXT NOTCASE('N', __start);
+       GETNEXT NOTCASE('F', __start);
+       GETNEXT NOTCASE('I', __start);
+       GETNEXT NOTCASE('G', __start);
+       GETNEXT NOTCASE('_', __start);
+
+       map_dot = next;
+cee_CONFIG_word:
        GETNEXT
-       CASE('\n',normal);
-       NOTCASE('>', std_include_name);
-       handle_include(0, incname, next-incname-1);
-       goto skippreproc;
+       if (isalnum(current) || current == '_')
+               goto cee_CONFIG_word;
+       use_config(map_dot, next - map_dot - 1);
+       goto __start;
+    }
 }
 
-if_line:
-       if (needsconfig)
-               goto skippreproc;
-if_start:
-       GETNEXT
-       CASE('C', config);
-       CASE('\n', normal);
-       CASE('_', if_middle);
-       if (current >= 'a' && current <= 'z')
-               goto if_middle;
-       if (current < 'A' || current > 'Z')
-               goto if_start;
-config:
-       GETNEXT
-       NOTCASE('O', __if_middle);
-       GETNEXT
-       NOTCASE('N', __if_middle);
-       GETNEXT
-       NOTCASE('F', __if_middle);
-       GETNEXT
-       NOTCASE('I', __if_middle);
-       GETNEXT
-       NOTCASE('G', __if_middle);
-       GETNEXT
-       NOTCASE('_', __if_middle);
-       handle_config();
-       goto skippreproc;
 
-if_middle:
-       GETNEXT
-__if_middle:
-       CASE('\n', normal);
-       CASE('_', if_middle);
-       if (current >= 'a' && current <= 'z')
-               goto if_middle;
-       if (current < 'A' || current > 'Z')
-               goto if_start;
-       goto if_middle;
-       }
-}
 
-static void do_depend(void)
+/*
+ * Generate dependencies for one file.
+ */
+void do_depend(const char * filename, const char * command)
 {
-       char *map;
        int mapsize;
        int pagesizem1 = getpagesize()-1;
-       int fd = open(filename, O_RDONLY);
+       int fd;
        struct stat st;
+       char * map;
 
+       fd = open(filename, O_RDONLY);
        if (fd < 0) {
-               if (errno != ENOENT)
-                       perror(filename);
+               perror(filename);
                return;
        }
+
        fstat(fd, &st);
        if (st.st_size == 0) {
                fprintf(stderr,"%s is empty\n",filename);
+               close(fd);
                return;
        }
+
        mapsize = st.st_size + 2*sizeof(unsigned long);
        mapsize = (mapsize+pagesizem1) & ~pagesizem1;
        map = mmap(NULL, mapsize, PROT_READ, MAP_PRIVATE, fd, 0);
-       if (-1 == (long)map) {
+       if ((long) map == -1) {
                perror("mkdep: mmap");
                close(fd);
                return;
        }
-       close(fd);
+       if ((unsigned long) map % sizeof(unsigned long) != 0)
+       {
+               fprintf(stderr, "do_depend: map not aligned\n");
+               exit(1);
+       }
+
+       hasdep = 0;
+       clear_config();
        state_machine(map);
-       munmap(map, mapsize);
        if (hasdep)
                puts(command);
+
+       munmap(map, mapsize);
+       close(fd);
 }
 
+
+
+/*
+ * Generate dependencies for all files.
+ */
 int main(int argc, char **argv)
 {
        int len;
-       char * hpath;
+       char *hpath;
 
        hpath = getenv("HPATH");
        if (!hpath)
                hpath = "/usr/src/linux/include";
        len = strlen(hpath);
        memcpy(path_array[0].buffer, hpath, len);
-       if (len && hpath[len-1] != '/') {
-               path_array[0].buffer[len] = '/';
-               len++;
-       }
+       if (len && hpath[len-1] != '/')
+               path_array[0].buffer[len++] = '/';
        path_array[0].buffer[len] = '\0';
        path_array[0].len = len;
 
        while (--argc > 0) {
-               int len;
-               char *name = *++argv;
-
-               filename = name;
-               len = strlen(name);
-               memcpy(depname, name, len+1);
-               command = __depname;
-               if (len > 2 && name[len-2] == '.') {
-                       switch (name[len-1]) {
-                               case 'c':
-                               case 'S':
-                                       depname[len-1] = 'o';
-                                       command = "";
+               const char * filename = *++argv;
+               const char * command  = __depname;
+               len = strlen(filename);
+               memcpy(depname, filename, len+1);
+               if (len > 2 && filename[len-2] == '.') {
+                       if (filename[len-1] == 'c' || filename[len-1] == 'S') {
+                           depname[len-1] = 'o';
+                           command = "";
                        }
                }
-               needsconfig = hasconfig = hasmodules = hasdep = 0;
-               do_depend();
-               if (hasconfig && !hasmodules && !needsconfig)
-                       fprintf(stderr, "%s doesn't need config\n", filename);
+               do_depend(filename, command);
        }
        return 0;
 }
diff --git a/scripts/split-include.c b/scripts/split-include.c
new file mode 100644 (file)
index 0000000..4c02cc8
--- /dev/null
@@ -0,0 +1,226 @@
+/*
+ * split-include.c
+ *
+ * Copyright abandoned, Michael Chastain, <mailto:mec@shout.net>.
+ * This is a C version of syncdep.pl by Werner Almesberger.
+ *
+ * This program takes autoconf.h as input and outputs a directory full
+ * of one-line include files, merging onto the old values.
+ *
+ * Think of the configuration options as key-value pairs.  Then there
+ * are five cases:
+ *
+ *    key      old value   new value   action
+ *
+ *    KEY-1    VALUE-1     VALUE-1     leave file alone
+ *    KEY-2    VALUE-2A    VALUE-2B    write VALUE-2B into file
+ *    KEY-3    -           VALUE-3     write VALUE-3  into file
+ *    KEY-4    VALUE-4     -           write an empty file
+ *    KEY-5    (empty)     -           leave old empty file alone
+ */
+
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define ERROR_EXIT(strExit)                                            \
+    {                                                                  \
+       const int errnoSave = errno;                                    \
+       fprintf(stderr, "%s: ", str_my_name);                           \
+       errno = errnoSave;                                              \
+       perror((strExit));                                              \
+       exit(1);                                                        \
+    }
+
+
+
+int main(int argc, const char * argv [])
+{
+    const char * str_my_name;
+    const char * str_file_autoconf;
+    const char * str_dir_config;
+
+    FILE * fp_config;
+    FILE * fp_target;
+    FILE * fp_find;
+
+    int buffer_size;
+
+    char * line;
+    char * old_line;
+    char * list_target;
+    char * ptarget;
+
+    struct stat stat_buf;
+
+    /* Check arg count. */
+    if (argc != 3)
+    {
+       fprintf(stderr, "%s: wrong number of arguments.\n", argv[0]);
+       exit(1);
+    }
+
+    str_my_name       = argv[0];
+    str_file_autoconf = argv[1];
+    str_dir_config    = argv[2];
+
+    /* Find a buffer size. */
+    if (stat(str_file_autoconf, &stat_buf) != 0)
+       ERROR_EXIT(str_file_autoconf);
+    buffer_size = 2 * stat_buf.st_size + 4096;
+
+    /* Allocate buffers. */
+    if ( (line        = malloc(buffer_size)) == NULL
+    ||   (old_line    = malloc(buffer_size)) == NULL
+    ||   (list_target = malloc(buffer_size)) == NULL )
+       ERROR_EXIT(str_file_autoconf);
+
+    /* Open autoconfig file. */
+    if ((fp_config = fopen(str_file_autoconf, "r")) == NULL)
+       ERROR_EXIT(str_file_autoconf);
+
+    /* Make output directory if needed. */
+    if (stat(str_dir_config, &stat_buf) != 0)
+    {
+       if (mkdir(str_dir_config, 0755) != 0)
+           ERROR_EXIT(str_dir_config);
+    }
+
+    /* Change to output directory. */
+    if (chdir(str_dir_config) != 0)
+       ERROR_EXIT(str_dir_config);
+       
+    /* Put initial separator into target list. */
+    ptarget = list_target;
+    *ptarget++ = '\n';
+
+    /* Read config lines. */
+    while (fgets(line, buffer_size, fp_config))
+    {
+       const char * str_config;
+       int is_same;
+       int itarget;
+
+       if (line[0] != '#')
+           continue;
+       if ((str_config = strstr(line, "CONFIG_")) == NULL)
+           continue;
+
+       /* Make the output file name. */
+       str_config += sizeof("CONFIG_") - 1;
+       for (itarget = 0; !isspace(str_config[itarget]); itarget++)
+       {
+           char c = str_config[itarget];
+           if (isupper(c)) c = tolower(c);
+           if (c == '_')   c = '/';
+           ptarget[itarget] = c;
+       }
+       ptarget[itarget++] = '.';
+       ptarget[itarget++] = 'h';
+       ptarget[itarget++] = '\0';
+
+       /* Check for existing file. */
+       is_same = 0;
+       if ((fp_target = fopen(ptarget, "r")) != NULL)
+       {
+           fgets(old_line, buffer_size, fp_target);
+           if (fclose(fp_target) != 0)
+               ERROR_EXIT(ptarget);
+           if (!strcmp(line, old_line))
+               is_same = 1;
+       }
+
+       if (!is_same)
+       {
+           /* Auto-create directories. */
+           int islash;
+           for (islash = 0; islash < itarget; islash++)
+           {
+               if (ptarget[islash] == '/')
+               {
+                   ptarget[islash] = '\0';
+                   if (stat(ptarget, &stat_buf) != 0
+                   &&  mkdir(ptarget, 0755)     != 0)
+                       ERROR_EXIT( ptarget );
+                   ptarget[islash] = '/';
+               }
+           }
+
+           /* Write the file. */
+           if ((fp_target = fopen(ptarget, "w" )) == NULL)
+               ERROR_EXIT(ptarget);
+           fputs(line, fp_target);
+           if (ferror(fp_target) || fclose(fp_target) != 0)
+               ERROR_EXIT(ptarget);
+       }
+
+       /* Update target list */
+       ptarget += itarget;
+       *(ptarget-1) = '\n';
+    }
+
+    /*
+     * Close autoconfig file.
+     * Terminate the target list.
+     */
+    if (fclose(fp_config) != 0)
+       ERROR_EXIT(str_file_autoconf);
+    *ptarget = '\0';
+
+    /*
+     * Fix up existing files which have no new value.
+     * This is Case 4 and Case 5.
+     *
+     * I re-read the tree and filter it against list_target.
+     * This is crude.  But it avoids data copies.  Also, list_target
+     * is compact and contiguous, so it easily fits into cache.
+     *
+     * Notice that list_target contains strings separated by \n,
+     * with a \n before the first string and after the last.
+     * fgets gives the incoming names a terminating \n.
+     * So by having an initial \n, strstr will find exact matches.
+     */
+
+    fp_find = popen("find * -type f -print", "r");
+    if (fp_find == 0)
+       ERROR_EXIT( "find" );
+
+    line[0] = '\n';
+    while (fgets(line+1, buffer_size, fp_find))
+    {
+       if (strstr(list_target, line) == NULL)
+       {
+           /*
+            * This is an old file with no CONFIG_* flag in autoconf.h.
+            */
+
+           /* First strip the \n. */
+           line[strlen(line)-1] = '\0';
+
+           /* Grab size. */
+           if (stat(line+1, &stat_buf) != 0)
+               ERROR_EXIT(line);
+
+           /* If file is not empty, make it empty and give it a fresh date. */
+           if (stat_buf.st_size != 0)
+           {
+               if ((fp_target = fopen(line+1, "w")) == NULL)
+                   ERROR_EXIT(line);
+               if (fclose(fp_target) != 0)
+                   ERROR_EXIT(line);
+           }
+       }
+    }
+
+    if (pclose(fp_find) != 0)
+       ERROR_EXIT("find");
+
+    return 0;
+}
index 5f6ca3f881494e45b25507cb716da7217f02cdbe..ebd5269bf3892b1c2b5ab145e8b4e6fee3b30a51 100644 (file)
  * 1997 12 08
  * Michael Chastain - Remove sound driver special cases.
  *
+ * 1997 11 15
+ * Michael Chastain - For choice buttons, write values for all options,
+ *                    not just the single chosen one.  This is compatible
+ *                    with 'make config' and 'make oldconfig', and is
+ *                    needed so smart-config dependencies work if the
+ *                    user switches from one configuration method to
+ *                    another.
+ *
  * TO DO:
  *   - clean up - there are useless ifdef's everywhere.
  *   - better comments throughout - C code generating tcl is really cryptic.
@@ -1034,9 +1042,10 @@ void dump_tk_script(struct kconfig *scfg)
                      cfg1 != NULL && cfg1->tok == tok_choice;
                      cfg1 = cfg1->next)
                    {
-                     printf("\tif { $%s == \"%s\" } then { write_tristate $cfg $autocfg %s 1 $notmod }\n",
+                     printf("\tif { $%s == \"%s\" } then { write_tristate $cfg $autocfg %s 1 $notmod } else { write_tristate $cfg $autocfg %s 0 $notmod }\n",
                             cfg->optionname,
                             cfg1->label,
+                            cfg1->optionname,
                             cfg1->optionname);
                    }
                }