Commit cfdec9c9 authored by Linus Torvalds's avatar Linus Torvalds

Import 2.1.78pre3

parent c95035fb
...@@ -209,19 +209,23 @@ symlinks: ...@@ -209,19 +209,23 @@ symlinks:
mkdir include/linux/modules; \ mkdir include/linux/modules; \
fi fi
oldconfig: symlinks oldconfig: symlinks scripts/split-include
$(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in $(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 $(MAKE) -C scripts kconfig.tk
wish -f 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 $(MAKE) -C scripts/lxdialog all
$(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in $(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 $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
scripts/split-include include/linux/autoconf.h include/config
linuxsubdirs: dummy linuxsubdirs: dummy
set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done
...@@ -339,8 +343,9 @@ endif ...@@ -339,8 +343,9 @@ endif
clean: archclean clean: archclean
rm -f kernel/ksyms.lst include/linux/compile.h rm -f kernel/ksyms.lst include/linux/compile.h
rm -f core `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print` rm -f `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print`
rm -f core `find . -type f -name 'core' -print` rm -f `find . -type f -name 'core' -print`
rm -f `find . -name '.*.flags' -print`
rm -f vmlinux System.map rm -f vmlinux System.map
rm -f .tmp* rm -f .tmp*
rm -f drivers/char/consolemap_deftbl.c drivers/char/conmakehash rm -f drivers/char/consolemap_deftbl.c drivers/char/conmakehash
...@@ -361,8 +366,9 @@ mrproper: clean ...@@ -361,8 +366,9 @@ mrproper: clean
rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog
rm -f .menuconfig.log rm -f .menuconfig.log
rm -f include/asm rm -f include/asm
rm -rf include/config
rm -f .depend `find . -name .depend -print` 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 -f $(TOPDIR)/include/linux/modversions.h
rm -rf $(TOPDIR)/include/linux/modules rm -rf $(TOPDIR)/include/linux/modules
rm -rf modules rm -rf modules
...@@ -380,10 +386,9 @@ sums: ...@@ -380,10 +386,9 @@ sums:
find . -type f -print | sort | xargs sum > .SUMS find . -type f -print | sort | xargs sum > .SUMS
dep-files: scripts/mkdep archdep include/linux/version.h 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 scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep; done set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep; done
mv .tmpdepend .depend
MODVERFILE := MODVERFILE :=
...@@ -393,6 +398,9 @@ endif ...@@ -393,6 +398,9 @@ endif
depend dep: dep-files $(MODVERFILE) depend dep: dep-files $(MODVERFILE)
checkconfig:
perl -w scripts/checkconfig.pl `find $(FINDHPATH) $(SUBDIRS) -name '*.[hcS]' -print | sort`
ifdef CONFIGURATION ifdef CONFIGURATION
..$(CONFIGURATION): ..$(CONFIGURATION):
@echo @echo
...@@ -421,3 +429,6 @@ include Rules.make ...@@ -421,3 +429,6 @@ include Rules.make
scripts/mkdep: scripts/mkdep.c scripts/mkdep: scripts/mkdep.c
$(HOSTCC) $(HOSTCFLAGS) -o 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
...@@ -45,13 +45,18 @@ first_rule: sub_dirs ...@@ -45,13 +45,18 @@ first_rule: sub_dirs
# #
%.s: %.c %.s: %.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -S $< -o $@ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -S $< -o $@
%.i: %.c %.i: %.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -E $< > $@ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -E $< > $@
%.o: %.c %.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 %.o: %.s
$(AS) $(ASFLAGS) $(EXTRA_CFLAGS) -o $@ $< $(AS) $(ASFLAGS) $(EXTRA_CFLAGS) -o $@ $<
...@@ -66,29 +71,39 @@ all_targets: $(O_TARGET) $(L_TARGET) ...@@ -66,29 +71,39 @@ all_targets: $(O_TARGET) $(L_TARGET)
# #
ifdef O_TARGET ifdef O_TARGET
ALL_O = $(OX_OBJS) $(O_OBJS) ALL_O = $(OX_OBJS) $(O_OBJS)
$(O_TARGET): $(ALL_O) $(TOPDIR)/include/linux/config.h $(O_TARGET): $(ALL_O)
rm -f $@ rm -f $@
ifneq "$(strip $(ALL_O))" "" ifneq "$(strip $(ALL_O))" ""
$(LD) $(EXTRA_LDFLAGS) -r -o $@ $(ALL_O) $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(ALL_O)
else else
$(AR) rcs $@ $(AR) rcs $@
endif 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 endif # O_TARGET
# #
# Rule to compile a set of .o files into one .a file # Rule to compile a set of .o files into one .a file
# #
ifdef L_TARGET ifdef L_TARGET
$(L_TARGET): $(LX_OBJS) $(L_OBJS) $(TOPDIR)/include/linux/config.h $(L_TARGET): $(LX_OBJS) $(L_OBJS)
rm -f $@ rm -f $@
$(AR) $(EXTRA_ARFLAGS) rcs $@ $(LX_OBJS) $(L_OBJS) $(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 endif
# #
# This make dependencies quickly # This make dependencies quickly
# #
fastdep: dummy fastdep: dummy
$(TOPDIR)/scripts/mkdep *.[chS] > .depend $(TOPDIR)/scripts/mkdep $(wildcard *.[chS] local.h.master) > .depend
ifdef ALL_SUB_DIRS ifdef ALL_SUB_DIRS
set -e; for i in $(ALL_SUB_DIRS); do $(MAKE) -C $$i fastdep; done set -e; for i in $(ALL_SUB_DIRS); do $(MAKE) -C $$i fastdep; done
endif endif
...@@ -131,7 +146,7 @@ endif ...@@ -131,7 +146,7 @@ endif
ifneq "$(strip $(ALL_MOBJS))" "" ifneq "$(strip $(ALL_MOBJS))" ""
echo $(PDWN) echo $(PDWN)
cd $$TOPDIR/modules; for i in $(ALL_MOBJS); do \ cd $$TOPDIR/modules; for i in $(ALL_MOBJS); do \
ln -sf ../$(PDWN)/$$i .; done ln -sf ../$(PDWN)/$$i $$i; done
endif endif
# #
...@@ -198,19 +213,54 @@ endif # CONFIG_MODVERSIONS ...@@ -198,19 +213,54 @@ endif # CONFIG_MODVERSIONS
ifneq "$(strip $(SYMTAB_OBJS))" "" ifneq "$(strip $(SYMTAB_OBJS))" ""
$(SYMTAB_OBJS): $(TOPDIR)/include/linux/modversions.h $(SYMTAB_OBJS:.o=.c) $(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
endif # CONFIG_MODULES endif # CONFIG_MODULES
# #
# include dependency files they exist # include dependency files if they exist
# #
ifeq (.depend,$(wildcard .depend)) ifneq ($(wildcard .depend),)
include .depend include .depend
endif endif
ifeq ($(TOPDIR)/.hdepend,$(wildcard $(TOPDIR)/.hdepend)) ifneq ($(wildcard $(TOPDIR)/.hdepend),)
include $(TOPDIR)/.hdepend include $(TOPDIR)/.hdepend
endif 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
...@@ -109,10 +109,10 @@ fi ...@@ -109,10 +109,10 @@ fi
endmenu endmenu
# Conditionally compile in the Uniform CD-ROM driver # 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 define_bool CONFIG_CDROM y
else 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 define_bool CONFIG_CDROM m
else else
define_bool CONFIG_CDROM n define_bool CONFIG_CDROM n
......
...@@ -237,6 +237,7 @@ CONFIG_LOCKD=y ...@@ -237,6 +237,7 @@ CONFIG_LOCKD=y
# CONFIG_NTFS_FS is not set # CONFIG_NTFS_FS is not set
# CONFIG_SYSV_FS is not set # CONFIG_SYSV_FS is not set
# CONFIG_AFFS_FS is not set # CONFIG_AFFS_FS is not set
# CONFIG_HFS_FS is not set
# CONFIG_ROMFS_FS is not set # CONFIG_ROMFS_FS is not set
CONFIG_AUTOFS_FS=y CONFIG_AUTOFS_FS=y
# CONFIG_UFS_FS is not set # CONFIG_UFS_FS is not set
......
...@@ -27,10 +27,8 @@ ...@@ -27,10 +27,8 @@
* unless you have a patch to fix it. I am working on it...) * unless you have a patch to fix it. I am working on it...)
* -Implement ide_cdrom_select_speed using the generic cdrom interface * -Implement ide_cdrom_select_speed using the generic cdrom interface
* -Fix ide_cdrom_reset so that it works (it does nothing right now) * -Fix ide_cdrom_reset so that it works (it does nothing right now)
* * -Query the drive to find what features are available before trying to
* MOSTLY DONE LIST: * use them (like trying to close the tray in drives that can't).
* Query the drive to find what features are available
* before trying to use them.
* *
* *
* ---------------------------------- * ----------------------------------
...@@ -182,10 +180,12 @@ ...@@ -182,10 +180,12 @@
* 4.07 Dec 17, 1997 -- fallback to set pc->stat on "tray open" * 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 * 4.08 Dec 18, 1997 -- spew less noise when tray is empty
* -- fix speed display for ACER 24X, 18X * -- 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/config.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -1663,7 +1663,7 @@ cdrom_read_toc (ide_drive_t *drive, ...@@ -1663,7 +1663,7 @@ cdrom_read_toc (ide_drive_t *drive,
if (stat) toc->capacity = 0x1fffff; if (stat) toc->capacity = 0x1fffff;
HWIF(drive)->gd->sizes[drive->select.b.unit << PARTN_BITS] 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; drive->part[0].nr_sects = toc->capacity * SECTORS_PER_FRAME;
/* Remember that we've read this stuff. */ /* Remember that we've read this stuff. */
......
/* linux/drivers/cdrom/cdrom.c. /* linux/drivers/cdrom/cdrom.c.
Copyright (c) 1996, 1997 David A. van Leeuwen. 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 May be copied or modified under the terms of the GNU General Public
License. See linux/COPYING for more information. License. See linux/COPYING for more information.
...@@ -68,14 +68,10 @@ ...@@ -68,14 +68,10 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#define VERSION "$Id: cdrom.c,v 2.1 1997/12/28 15:11:47 david Exp $" #define VERSION "$Id: cdrom.c,v 2.11 1998/01/04 01:11:18 erik Exp $"
#define REVISION "$Revision: 2.1 $" #define REVISION "Revision: 2.11"
#define FM_WRITE 0x2 /* file mode write bit */ #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 /* 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: */ error messages dumped to the system logs. The available masks include: */
#define CD_WARNING 0x1 #define CD_WARNING 0x1
...@@ -83,9 +79,14 @@ ...@@ -83,9 +79,14 @@
#define CD_DO_IOCTL 0x4 #define CD_DO_IOCTL 0x4
#define CD_OPEN 0x8 #define CD_OPEN 0x8
#define CD_CLOSE 0x10 #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)
/* #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) */ /* #define ERRLOGMASK (CD_WARNING|CD_REG_UNREG|CD_DO_IOCTL|CD_OPEN|CD_CLOSE) */
#ifdef VERBOSE_STATUS_INFO #ifdef VERBOSE_STATUS_INFO
...@@ -480,7 +481,7 @@ void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype* tracks) ...@@ -480,7 +481,7 @@ void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype* tracks)
tracks->cdi=0; tracks->cdi=0;
tracks->xa=0; tracks->xa=0;
tracks->error=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)) { if (!(cdi->ops->capability & CDC_PLAY_AUDIO)) {
tracks->error=CDS_NO_INFO; tracks->error=CDS_NO_INFO;
return; return;
...@@ -508,10 +509,10 @@ void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype* tracks) ...@@ -508,10 +509,10 @@ void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype* tracks)
tracks->data++; tracks->data++;
} else } else
tracks->audio++; 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); 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, header.cdth_trk1, tracks->audio, tracks->data,
tracks->cdi, tracks->xa); tracks->cdi, tracks->xa);
} }
......
...@@ -416,7 +416,8 @@ static int scd_drive_status(struct cdrom_device_info *cdi, int slot_nr) ...@@ -416,7 +416,8 @@ static int scd_drive_status(struct cdrom_device_info *cdi, int slot_nr)
return -EINVAL; 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 static inline void
...@@ -1085,7 +1086,7 @@ handle_sony_cd_attention(void) ...@@ -1085,7 +1086,7 @@ handle_sony_cd_attention(void)
volatile int val; volatile int val;
#if DEBUG #if 0*DEBUG
printk("Entering handle_sony_cd_attention\n"); printk("Entering handle_sony_cd_attention\n");
#endif #endif
if (is_attention()) if (is_attention())
...@@ -1166,7 +1167,7 @@ handle_sony_cd_attention(void) ...@@ -1166,7 +1167,7 @@ handle_sony_cd_attention(void)
} }
num_consecutive_attentions = 0; num_consecutive_attentions = 0;
#if DEBUG #if 0*DEBUG
printk("Leaving handle_sony_cd_attention at %d\n", __LINE__); printk("Leaving handle_sony_cd_attention at %d\n", __LINE__);
#endif #endif
return(0); return(0);
...@@ -2835,8 +2836,11 @@ static int scd_tray_move(struct cdrom_device_info *cdi, int position) ...@@ -2835,8 +2836,11 @@ static int scd_tray_move(struct cdrom_device_info *cdi, int position)
sony_audio_status = CDROM_AUDIO_INVALID; sony_audio_status = CDROM_AUDIO_INVALID;
return do_sony_cd_cmd_chk("EJECT",SONY_EJECT_CMD, NULL, 0, res_reg, &res_size); return do_sony_cd_cmd_chk("EJECT",SONY_EJECT_CMD, NULL, 0, res_reg, &res_size);
} else } else {
return 0; if (0 == scd_spinup())
sony_spun_up = 1;
return 0;
}
} }
/* /*
...@@ -3230,7 +3234,6 @@ scd_open(struct cdrom_device_info *cdi, int openmode) ...@@ -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]); printk("CDU31A: Unable to set XA params: 0x%2.2x\n", res_reg[1]);
} }
sony_xa_mode = 1; sony_xa_mode = 1;
printk("sony_xa_mode is set\n");
} }
/* A non-XA disk. Set the parms back if necessary. */ /* A non-XA disk. Set the parms back if necessary. */
else if (sony_xa_mode) else if (sony_xa_mode)
...@@ -3247,7 +3250,6 @@ printk("sony_xa_mode is set\n"); ...@@ -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]); printk("CDU31A: Unable to reset XA params: 0x%2.2x\n", res_reg[1]);
} }
sony_xa_mode = 0; sony_xa_mode = 0;
printk("sony_xa_mode is reset\n");
} }
sony_spun_up = 1; sony_spun_up = 1;
...@@ -3293,7 +3295,7 @@ static struct cdrom_device_ops scd_dops = { ...@@ -3293,7 +3295,7 @@ static struct cdrom_device_ops scd_dops = {
scd_reset, /* hard reset */ scd_reset, /* hard reset */
scd_audio_ioctl, /* audio ioctl */ scd_audio_ioctl, /* audio ioctl */
scd_dev_ioctl, /* device-specific 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_MULTI_SESSION | CDC_MCN | CDC_MEDIA_CHANGED | CDC_PLAY_AUDIO |
CDC_RESET | CDC_IOCTLS | CDC_DRIVE_STATUS, /* capability */ CDC_RESET | CDC_IOCTLS | CDC_DRIVE_STATUS, /* capability */
1, /* number of minor devices */ 1, /* number of minor devices */
...@@ -3571,6 +3573,7 @@ cdu31a_init(void)) ...@@ -3571,6 +3573,7 @@ cdu31a_init(void))
cdu31a_abort_timer.function = handle_abort_timeout; cdu31a_abort_timer.function = handle_abort_timeout;
scd_info.mask = deficiency; scd_info.mask = deficiency;
strncpy(scd_info.name, "cdu31a", sizeof(scd_info.name));
if (register_cdrom(&scd_info)) if (register_cdrom(&scd_info))
{ {
......
...@@ -75,9 +75,6 @@ static const char *mcdx_c_version ...@@ -75,9 +75,6 @@ static const char *mcdx_c_version
#define mcdx_drive_map mcdx #define mcdx_drive_map mcdx
#include "mcdx.h" #include "mcdx.h"
#define MCDX_QUIET 0
#ifndef HZ #ifndef HZ
#error HZ not defined #error HZ not defined
#endif #endif
...@@ -288,7 +285,7 @@ static struct cdrom_device_ops mcdx_dops = { ...@@ -288,7 +285,7 @@ static struct cdrom_device_ops mcdx_dops = {
NULL, /* hard reset */ NULL, /* hard reset */
mcdx_audio_ioctl, /* audio ioctl */ mcdx_audio_ioctl, /* audio ioctl */
NULL, /* device-specific 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 */ | CDC_DRIVE_STATUS, /* capability */
0, /* number of minor devices */ 0, /* number of minor devices */
}; };
......
...@@ -550,7 +550,6 @@ static struct cdrom_tocentry tocentry; ...@@ -550,7 +550,6 @@ static struct cdrom_tocentry tocentry;
static struct cdrom_subchnl SC; static struct cdrom_subchnl SC;
static struct cdrom_volctrl volctrl; static struct cdrom_volctrl volctrl;
static struct cdrom_read_audio read_audio; static struct cdrom_read_audio read_audio;
static struct cdrom_multisession ms_info;
static unsigned char msgnum=0; static unsigned char msgnum=0;
static char msgbuf[80]; static char msgbuf[80];
...@@ -2297,12 +2296,52 @@ static int cc_CloseTray(void) ...@@ -2297,12 +2296,52 @@ static int cc_CloseTray(void)
} }
i=cmd_out(); i=cmd_out();
msg(DBG_LCS,"p_door_closed bit %d after\n", st_door_closed); 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); return (i);
} }
static int sbpcd_tray_move(struct cdrom_device_info *cdi, int position) 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) ...@@ -2768,11 +2807,13 @@ static int cc_ReadTocDescr(void)
if (famLV_drive) D_S[d].CDsize_frm=D_S[d].size_blk+1; if (famLV_drive) D_S[d].CDsize_frm=D_S[d].size_blk+1;
} }
D_S[d].diskstate_flags |= toc_bit; 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].xa_byte,
D_S[d].n_first_track, D_S[d].n_first_track,
D_S[d].n_last_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); return (0);
} }
/*==========================================================================*/ /*==========================================================================*/
...@@ -3886,6 +3927,7 @@ static int DiskInfo(void) ...@@ -3886,6 +3927,7 @@ static int DiskInfo(void)
msg(DBG_000,"DiskInfo entered.\n"); msg(DBG_000,"DiskInfo entered.\n");
for (j=1;j<LOOP_COUNT;j++) for (j=1;j<LOOP_COUNT;j++)
{ {
#if 0
i=SetSpeed(); i=SetSpeed();
if (i<0) if (i<0)
{ {
...@@ -3898,10 +3940,14 @@ static int DiskInfo(void) ...@@ -3898,10 +3940,14 @@ static int DiskInfo(void)
msg(DBG_INF,"DiskInfo: cc_ModeSense returns %d\n", i); msg(DBG_INF,"DiskInfo: cc_ModeSense returns %d\n", i);
continue; continue;
} }
#endif
i=cc_ReadCapacity(); i=cc_ReadCapacity();
if (i>=0) break; if (i>=0) break;
msg(DBG_INF,"DiskInfo: ReadCapacity #%d returns %d\n", j, i); msg(DBG_INF,"DiskInfo: ReadCapacity #%d returns %d\n", j, i);
#if 0
i=cc_DriveReset(); i=cc_DriveReset();
#endif
if (!fam0_drive && j == 2) break;
} }
if (j==LOOP_COUNT) return (-33); /* give up */ if (j==LOOP_COUNT) return (-33); /* give up */
...@@ -3946,12 +3992,36 @@ static int DiskInfo(void) ...@@ -3946,12 +3992,36 @@ static int DiskInfo(void)
static int sbpcd_drive_status(struct cdrom_device_info *cdi, int slot_nr) static int sbpcd_drive_status(struct cdrom_device_info *cdi, int slot_nr)
{ {
if (CDSL_CURRENT != slot_nr) { int st;
/* we have no changer support */
return -EINVAL; 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) ...@@ -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) 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_format = CDROM_LBA;
ms_infp->addr.lba = D_S[d].lba_multi; ms_infp->addr.lba = D_S[MINOR(cdi->dev)].lba_multi;
if (D_S[d].f_multisession) if (D_S[MINOR(cdi->dev)].f_multisession)
ms_infp->xa_flag=1; /* valid redirection address */ ms_infp->xa_flag=1; /* valid redirection address */
else else
ms_infp->xa_flag=0; /* invalid redirection address */ 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, ...@@ -4304,8 +4374,30 @@ static int sbpcd_dev_ioctl(struct cdrom_device_info *cdi, u_int cmd,
error_flag=0; error_flag=0;
p = D_S[d].aud_buf; p = D_S[d].aud_buf;
if (sbpro_type==1) OUT(CDo_sel_i_d,1); if (sbpro_type==1) OUT(CDo_sel_i_d,1);
if (do_16bit) insw(CDi_data, p, read_audio.nframes*(CD_FRAMESIZE_RAW>>1)); if (do_16bit)
else insb(CDi_data, p, read_audio.nframes*CD_FRAMESIZE_RAW); {
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); if (sbpro_type==1) OUT(CDo_sel_i_d,0);
data_retrying = 0; data_retrying = 0;
} }
...@@ -4388,28 +4480,6 @@ static int sbpcd_dev_ioctl(struct cdrom_device_info *cdi, u_int cmd, ...@@ -4388,28 +4480,6 @@ static int sbpcd_dev_ioctl(struct cdrom_device_info *cdi, u_int cmd,
if(arg > 0xff) RETURN_UP(-EINVAL); if(arg > 0xff) RETURN_UP(-EINVAL);
read_ahead[MAJOR(cdi->dev)] = arg; read_ahead[MAJOR(cdi->dev)] = arg;
RETURN_UP(0); 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: default:
msg(DBG_IOC,"ioctl: unknown function request %04X\n", cmd); msg(DBG_IOC,"ioctl: unknown function request %04X\n", cmd);
RETURN_UP(-EINVAL); RETURN_UP(-EINVAL);
...@@ -5242,54 +5312,13 @@ static int sbp_data(struct request *req) ...@@ -5242,54 +5312,13 @@ static int sbp_data(struct request *req)
static int sbpcd_open(struct cdrom_device_info *cdi, int purpose) static int sbpcd_open(struct cdrom_device_info *cdi, int purpose)
{ {
int i; int i;
i = MINOR(cdi->dev); 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; MOD_INC_USE_COUNT;
down(&ioctl_read_sem); down(&ioctl_read_sem);
switch_drive(i); 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. * 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) ...@@ -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 int sbpcd_media_changed( struct cdrom_device_info *cdi, int disc_nr);
static struct cdrom_device_ops sbpcd_dops = { static struct cdrom_device_ops sbpcd_dops = {
sbpcd_open, /* open */ sbpcd_open, /* open */
...@@ -5394,7 +5405,7 @@ static struct cdrom_device_ops sbpcd_dops = { ...@@ -5394,7 +5405,7 @@ static struct cdrom_device_ops sbpcd_dops = {
sbpcd_audio_ioctl, /* audio ioctl */ sbpcd_audio_ioctl, /* audio ioctl */
sbpcd_dev_ioctl, /* device-specific ioctl */ sbpcd_dev_ioctl, /* device-specific ioctl */
CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK | CDC_MULTI_SESSION | 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 */ 1, /* number of minor devices */
}; };
...@@ -5556,7 +5567,7 @@ __initfunc(int SBPCD_INIT(void)) ...@@ -5556,7 +5567,7 @@ __initfunc(int SBPCD_INIT(void))
int i=0, j=0; int i=0, j=0;
int addr[2]={1, CDROM_PORT}; int addr[2]={1, CDROM_PORT};
int port_index; int port_index;
sti(); sti();
msg(DBG_INF,"sbpcd.c %s\n", VERSION); msg(DBG_INF,"sbpcd.c %s\n", VERSION);
...@@ -5630,14 +5641,6 @@ __initfunc(int SBPCD_INIT(void)) ...@@ -5630,14 +5641,6 @@ __initfunc(int SBPCD_INIT(void))
check_datarate(); check_datarate();
msg(DBG_INI,"check_datarate done.\n"); 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++) for (j=0;j<NR_SBPCD;j++)
{ {
if (D_S[j].drv_id==-1) continue; if (D_S[j].drv_id==-1) continue;
...@@ -5830,11 +5833,6 @@ static int sbpcd_chk_disk_change(kdev_t full_dev) ...@@ -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)); msg(DBG_CHK,"media_check (%d) called\n", MINOR(full_dev));
i=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) if (D_S[i].CD_changed==0xFF)
{ {
......
...@@ -119,14 +119,14 @@ ...@@ -119,14 +119,14 @@
#define JUKEBOX 0 #define JUKEBOX 0
#else #else
#define JUKEBOX 1 #define JUKEBOX 1
#endif DISTRIBUTION #endif /* DISTRIBUTION */
/* tray control: eject tray after last use */ /* tray control: eject tray after last use */
#if DISTRIBUTION #if DISTRIBUTION
#define EJECT 0 #define EJECT 0
#else #else
#define EJECT 1 #define EJECT 1
#endif DISTRIBUTION #endif /* DISTRIBUTION */
/* max. number of audio frames to read with one */ /* max. number of audio frames to read with one */
/* request (allocates n* 2352 bytes kernel memory!) */ /* request (allocates n* 2352 bytes kernel memory!) */
...@@ -570,7 +570,7 @@ pause: 8d pr 00 00 00 00 00. (0) pause (pr=00) ...@@ -570,7 +570,7 @@ pause: 8d pr 00 00 00 00 00. (0) pause (pr=00)
resume (pr=80) audio playing resume (pr=80) audio playing
Mode Select: 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 possibly defines transfer size
set_vol: 84 83 00 00 sw le 00. (0) sw(itch): lrxxxxxx (off=1) 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) ...@@ -604,12 +604,12 @@ seek: 01 00 ll-bb-aa 00 00. (0)
seek: 01 02 mm-ss-ff 00 00. (0) seek: 01 02 mm-ss-ff 00 00. (0)
Read Data: 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 starting at block xx-xx-xx
fl=0: "lba"-, =2:"msf-bcd"-coded xx-xx-xx fl=0: "lba"-, =2:"msf-bcd"-coded xx-xx-xx
Read XA-Data: 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 starting at block xx-xx-xx
fl=0: "lba"-, =2:"msf-bcd"-coded xx-xx-xx fl=0: "lba"-, =2:"msf-bcd"-coded xx-xx-xx
...@@ -838,7 +838,7 @@ Read XA Parameter: ...@@ -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. * Overrides for Emacs so that we follow Linus's tabbing style.
......
...@@ -38,11 +38,6 @@ O_OBJS = zftape-compress.o lzrw3.o ...@@ -38,11 +38,6 @@ O_OBJS = zftape-compress.o lzrw3.o
M_OBJS = $(O_TARGET) M_OBJS = $(O_TARGET)
include $(TOPDIR)/Rules.make CFLAGS_lzrw3.o := -O6 -funroll-all-loops
#
# sorry, a special rule.
#
lzrw3.o: lzrw3.c
$(CC) $(CFLAGS) -O6 -funroll-all-loops -c $<
include $(TOPDIR)/Rules.make
...@@ -74,17 +74,6 @@ ...@@ -74,17 +74,6 @@
# The 8390 drivers share the EI_DEBUG setting. # The 8390 drivers share the EI_DEBUG setting.
# General options for Space.c # General options for Space.c
OPTS = # -DETH0_ADDR=0x300 -DETH0_IRQ=11 CONFIG_Space.o = # -DETH0_ADDR=0x300 -DETH0_IRQ=11
CONFIG_3c503.o = # -DEL2_AUI
WD_OPTS = #-DWD_SHMEM=0xDD000 CONFIG_wd.o = # -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 =
...@@ -735,80 +735,5 @@ include $(TOPDIR)/Rules.make ...@@ -735,80 +735,5 @@ include $(TOPDIR)/Rules.make
clean: clean:
rm -f core *.o *.a *.s 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) wanpipe.o: $(WANPIPE_OBJS)
ld -r -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 $<
...@@ -13,8 +13,9 @@ MIX_OBJS := ...@@ -13,8 +13,9 @@ MIX_OBJS :=
MOD_LIST_NAME := SCSI_MODULES MOD_LIST_NAME := SCSI_MODULES
SCSI_SRCS = $(wildcard $(L_OBJS:%.o=%.c)) SCSI_SRCS = $(wildcard $(L_OBJS:%.o=%.c))
AHA152X = -DDEBUG_AHA152X -DAUTOCONF CFLAGS_aha152x.o = -DDEBUG_AHA152X -DAUTOCONF
GDTH = #-DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ -DGDTH_STATISTICS CFLAGS_gdth.o = # -DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ -DGDTH_STATISTICS
CFLAGS_seagate.o = -DARBITRATE -DSLOW_HANDSHAKE -DFAST32 -DPARITY
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .o .h .a .SUFFIXES: .c .o .h .a
...@@ -455,24 +456,14 @@ endif ...@@ -455,24 +456,14 @@ endif
include $(TOPDIR)/Rules.make 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 BusLogic.c -o BusLogic.O
$(CC) $(CFLAGS) -c FlashPoint.c -o FlashPoint.O $(CC) $(CFLAGS) -c FlashPoint.c -o FlashPoint.O
$(LD) -r -o BusLogic.o BusLogic.O FlashPoint.O $(LD) -r -o BusLogic.o BusLogic.O FlashPoint.O
rm -f 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 53c8xx_d.h 53c8xx_u.h : 53c7,8xx.scr script_asm.pl
ln -sf 53c7,8xx.scr fake.c ln -sf 53c7,8xx.scr fake.c
$(CPP) -traditional -DCHIP=810 fake.c | grep -v '^#' | perl script_asm.pl $(CPP) -traditional -DCHIP=810 fake.c | grep -v '^#' | perl script_asm.pl
......
...@@ -532,7 +532,7 @@ static int ad1848_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) ...@@ -532,7 +532,7 @@ static int ad1848_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
int val; int val;
if (cmd == SOUND_MIXER_PRIVATE1) { if (cmd == SOUND_MIXER_PRIVATE1) {
if (__get_user(val, (int *)arg)) if (get_user(val, (int *)arg))
return -EFAULT; return -EFAULT;
if (val != 0xffff) { if (val != 0xffff) {
...@@ -546,22 +546,22 @@ static int ad1848_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) ...@@ -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 */ ad_write(devc, 26, ad_read(devc, 26) | 0x40); /* Mute mono out */
} }
val = devc->mixer_output_port; val = devc->mixer_output_port;
return __put_user(val, (int *)arg); return put_user(val, (int *)arg);
} }
if (((cmd >> 8) & 0xff) == 'M') { if (((cmd >> 8) & 0xff) == 'M') {
if (_SIOC_DIR(cmd) & _SIOC_WRITE) if (_SIOC_DIR(cmd) & _SIOC_WRITE)
switch (cmd & 0xff) { switch (cmd & 0xff) {
case SOUND_MIXER_RECSRC: case SOUND_MIXER_RECSRC:
if (__get_user(val, (int *)arg)) if (get_user(val, (int *)arg))
return -EFAULT; return -EFAULT;
val = ad1848_set_recmask(devc, val); val = ad1848_set_recmask(devc, val);
return __put_user(val, (int *)arg); return put_user(val, (int *)arg);
default: default:
if (__get_user(val, (int *)arg)) if (get_user(val, (int *)arg))
return -EFAULT; return -EFAULT;
val = ad1848_mixer_set(devc, cmd & 0xff, val); val = ad1848_mixer_set(devc, cmd & 0xff, val);
return __put_user(val, (int *)arg); return put_user(val, (int *)arg);
} }
else else
switch (cmd & 0xff) { switch (cmd & 0xff) {
...@@ -571,28 +571,28 @@ static int ad1848_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) ...@@ -571,28 +571,28 @@ static int ad1848_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
case SOUND_MIXER_RECSRC: case SOUND_MIXER_RECSRC:
val = devc->recmask; val = devc->recmask;
return __put_user(val, (int *)arg); return put_user(val, (int *)arg);
case SOUND_MIXER_DEVMASK: case SOUND_MIXER_DEVMASK:
val = devc->supported_devices; val = devc->supported_devices;
return __put_user(val, (int *)arg); return put_user(val, (int *)arg);
case SOUND_MIXER_STEREODEVS: case SOUND_MIXER_STEREODEVS:
val = devc->supported_devices; val = devc->supported_devices;
if (devc->model != MD_C930) if (devc->model != MD_C930)
val &= ~(SOUND_MASK_SPEAKER | SOUND_MASK_IMIX); val &= ~(SOUND_MASK_SPEAKER | SOUND_MASK_IMIX);
return __put_user(val, (int *)arg); return put_user(val, (int *)arg);
case SOUND_MIXER_RECMASK: case SOUND_MIXER_RECMASK:
val = devc->supported_rec_devices; val = devc->supported_rec_devices;
return __put_user(val, (int *)arg); return put_user(val, (int *)arg);
case SOUND_MIXER_CAPS: case SOUND_MIXER_CAPS:
return __put_user(SOUND_CAP_EXCL_INPUT, (int *)arg); return put_user(SOUND_CAP_EXCL_INPUT, (int *)arg);
default: default:
val = ad1848_mixer_get(devc, cmd & 0xff); val = ad1848_mixer_get(devc, cmd & 0xff);
return __put_user(val, (int *)arg); return put_user(val, (int *)arg);
} }
} else } else
return -EINVAL; return -EINVAL;
......
...@@ -2834,115 +2834,128 @@ set_input_volumes(void) ...@@ -2834,115 +2834,128 @@ set_input_volumes(void)
int gus_default_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) int gus_default_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
{ {
int vol, voice, val; int vol, val;
if (((cmd >> 8) & 0xff) == 'M') { if (((cmd >> 8) & 0xff) != 'M')
if (_SIOC_DIR(cmd) & _SIOC_WRITE) return -EINVAL;
switch (cmd & 0xff) {
case SOUND_MIXER_RECSRC: if (!access_ok(VERIFY_WRITE, (int *)arg, sizeof(int)))
if (__get_user(gus_recmask, (int *)arg)) return -EFAULT;
return -EFAULT;
gus_recmask &= MIX_DEVS; if (_SIOC_DIR(cmd) & _SIOC_WRITE) {
if (!(gus_recmask & (SOUND_MASK_MIC | SOUND_MASK_LINE))) if (__get_user(val, (int *) arg))
gus_recmask = SOUND_MASK_MIC; return -EFAULT;
/* Note! Input volumes are updated during next open for recording */
return __put_user(gus_recmask, (int *)arg); switch (cmd & 0xff) {
case SOUND_MIXER_RECSRC:
case SOUND_MIXER_MIC: gus_recmask = val & MIX_DEVS;
if (__get_user(vol, (int *)arg)) if (!(gus_recmask & (SOUND_MASK_MIC | SOUND_MASK_LINE)))
return -EFAULT; gus_recmask = SOUND_MASK_MIC;
vol &= 0xff; /* Note! Input volumes are updated during next open for recording */
if (vol < 0) val = gus_recmask;
vol = 0; break;
if (vol > 100)
vol = 100; case SOUND_MIXER_MIC:
gus_mic_vol = vol; vol = val & 0xff;
set_input_volumes(); if (vol < 0)
vol |= (vol << 8); vol = 0;
return __put_user(vol, (int *)arg); if (vol > 100)
vol = 100;
gus_mic_vol = vol;
set_input_volumes();
vol |= (vol << 8);
val = vol;
break;
case SOUND_MIXER_LINE: case SOUND_MIXER_LINE:
if (__get_user(vol, (int *)arg)) vol = val & 0xff;
return -EFAULT; if (vol < 0)
vol &= 0xff; vol = 0;
if (vol < 0) if (vol > 100)
vol = 0; vol = 100;
if (vol > 100) gus_line_vol = vol;
vol = 100; set_input_volumes();
gus_line_vol = vol; vol |= (vol << 8);
set_input_volumes(); val = vol;
vol |= (vol << 8); break;
return __put_user(vol, (int *)arg);
case SOUND_MIXER_PCM:
case SOUND_MIXER_PCM: gus_pcm_volume = val & 0xff;
if (__get_user(gus_pcm_volume, (int *)arg)) if (gus_pcm_volume < 0)
return -EFAULT; gus_pcm_volume = 0;
gus_pcm_volume &= 0xff; if (gus_pcm_volume > 100)
if (gus_pcm_volume < 0) gus_pcm_volume = 100;
gus_pcm_volume = 0; gus_audio_update_volume();
if (gus_pcm_volume > 100) gus_pcm_volume |= (gus_pcm_volume << 8);
gus_pcm_volume = 100; val = gus_pcm_volume;
gus_audio_update_volume(); break;
gus_pcm_volume |= (gus_pcm_volume << 8);
return __put_user(gus_pcm_volume, (int *)arg); case SOUND_MIXER_SYNTH:
gus_wave_volume = val & 0xff;
case SOUND_MIXER_SYNTH: if (gus_wave_volume < 0)
if (__get_user(gus_wave_volume, (int *)arg)) gus_wave_volume = 0;
return -EFAULT; if (gus_wave_volume > 100)
gus_wave_volume &= 0xff; gus_wave_volume = 100;
if (gus_wave_volume < 0) if (active_device == GUS_DEV_WAVE) {
gus_wave_volume = 0; int voice;
if (gus_wave_volume > 100) for (voice = 0; voice < nr_voices; voice++)
gus_wave_volume = 100; dynamic_volume_change(voice); /* Apply the new vol */
if (active_device == GUS_DEV_WAVE) }
for (voice = 0; voice < nr_voices; voice++) gus_wave_volume |= (gus_wave_volume << 8);
dynamic_volume_change(voice); /* Apply the new vol */ val = gus_wave_volume;
gus_wave_volume |= (gus_wave_volume << 8); break;
return __put_user(gus_wave_volume, (int *)arg);
default:
default: return -EINVAL;
return -EINVAL; }
} else
switch (cmd & 0xff) { } else {
/* switch (cmd & 0xff) {
* Return parameters /*
*/ * Return parameters
case SOUND_MIXER_RECSRC: */
return __put_user(gus_recmask, (int *)arg); case SOUND_MIXER_RECSRC:
val = gus_recmask;
break;
case SOUND_MIXER_DEVMASK: case SOUND_MIXER_DEVMASK:
return __put_user(MIX_DEVS, (int *)arg); val = MIX_DEVS;
break;
case SOUND_MIXER_STEREODEVS: case SOUND_MIXER_STEREODEVS:
return __put_user(0, (int *)arg); val = 0;
break;
case SOUND_MIXER_RECMASK: case SOUND_MIXER_RECMASK:
val = SOUND_MASK_MIC | SOUND_MASK_LINE; val = SOUND_MASK_MIC | SOUND_MASK_LINE;
return __put_user(val, (int *)arg); break;
case SOUND_MIXER_CAPS: case SOUND_MIXER_CAPS:
return __put_user(0, (int *)arg); val = 0;
break;
case SOUND_MIXER_MIC: case SOUND_MIXER_MIC:
val = gus_mic_vol | (gus_mic_vol << 8); val = gus_mic_vol | (gus_mic_vol << 8);
return __put_user(val, (int *)arg); break;
case SOUND_MIXER_LINE: case SOUND_MIXER_LINE:
val = gus_line_vol | (gus_line_vol << 8); val = gus_line_vol | (gus_line_vol << 8);
return __put_user(val, (int *)arg); break;
case SOUND_MIXER_PCM: case SOUND_MIXER_PCM:
val = gus_pcm_volume | (gus_pcm_volume << 8); val = gus_pcm_volume | (gus_pcm_volume << 8);
return __put_user(val, (int *)arg); break;
case SOUND_MIXER_SYNTH: case SOUND_MIXER_SYNTH:
return __put_user(gus_wave_volume | (gus_wave_volume << 8), (int *)arg); val = gus_wave_volume | (gus_wave_volume << 8);
break;
default: default:
return -EINVAL; return -EINVAL;
} }
} else }
return -EINVAL;
return __put_user(val, (int *)arg);
} }
static struct mixer_operations gus_mixer_operations = static struct mixer_operations gus_mixer_operations =
......
...@@ -123,7 +123,7 @@ static int ics2101_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) ...@@ -123,7 +123,7 @@ static int ics2101_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
if (((cmd >> 8) & 0xff) == 'M') { if (((cmd >> 8) & 0xff) == 'M') {
if (_SIOC_DIR(cmd) & _SIOC_WRITE) { if (_SIOC_DIR(cmd) & _SIOC_WRITE) {
if (__get_user(val, (int *)arg)) if (get_user(val, (int *)arg))
return -EFAULT; return -EFAULT;
switch (cmd & 0xff) { switch (cmd & 0xff) {
case SOUND_MIXER_RECSRC: case SOUND_MIXER_RECSRC:
...@@ -152,7 +152,7 @@ static int ics2101_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) ...@@ -152,7 +152,7 @@ static int ics2101_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
default: default:
return -EINVAL; return -EINVAL;
} }
return __put_user(val, (int *)arg); return put_user(val, (int *)arg);
} else { } else {
switch (cmd & 0xff) { switch (cmd & 0xff) {
/* /*
...@@ -200,7 +200,7 @@ static int ics2101_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) ...@@ -200,7 +200,7 @@ static int ics2101_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
default: default:
return -EINVAL; return -EINVAL;
} }
return __put_user(val, (int *)arg); return put_user(val, (int *)arg);
} }
} }
return -EINVAL; return -EINVAL;
......
...@@ -27,9 +27,6 @@ ifndef TOPDIR ...@@ -27,9 +27,6 @@ ifndef TOPDIR
TOPDIR=/usr/src/linux TOPDIR=/usr/src/linux
endif endif
.c.o:
$(CC) $(CFLAGS) -c $<
lowlevel.o: $(OBJS) lowlevel.o: $(OBJS)
$(LD) -r -o lowlevel.o $(OBJS) $(LD) -r -o lowlevel.o $(OBJS)
......
...@@ -50,7 +50,7 @@ extern int sound_open_dma(int chn, char *deviceID); ...@@ -50,7 +50,7 @@ extern int sound_open_dma(int chn, char *deviceID);
extern void sound_free_dma(int chn); extern void sound_free_dma(int chn);
extern void sound_close_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 RUNTIME_DMA_ALLOC
#define USE_AUTOINIT_DMA #define USE_AUTOINIT_DMA
......
...@@ -220,7 +220,7 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) ...@@ -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)); 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 (cmd == SOUND_MIXER_PRIVATE1) { /* Set loudness bit */
if (__get_user(level, (int *)arg)) if (get_user(level, (int *)arg))
return -EFAULT; return -EFAULT;
if (level == -1) /* Return current settings */ if (level == -1) /* Return current settings */
level = (mode_control & 0x04); level = (mode_control & 0x04);
...@@ -231,10 +231,10 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) ...@@ -231,10 +231,10 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
set_mode(mode_control); set_mode(mode_control);
} }
level = !!level; level = !!level;
return __put_user(level, (int *)arg); return put_user(level, (int *)arg);
} }
if (cmd == SOUND_MIXER_PRIVATE2) { /* Set enhance bit */ if (cmd == SOUND_MIXER_PRIVATE2) { /* Set enhance bit */
if (__get_user(level, (int *)arg)) if (get_user(level, (int *)arg))
return -EFAULT; return -EFAULT;
if (level == -1) { /* Return current settings */ if (level == -1) { /* Return current settings */
if (!(mode_control & 0x03)) if (!(mode_control & 0x03))
...@@ -254,10 +254,10 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) ...@@ -254,10 +254,10 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
i = (i + 1) * 20; i = (i + 1) * 20;
level = i; level = i;
} }
return __put_user(level, (int *)arg); return put_user(level, (int *)arg);
} }
if (cmd == SOUND_MIXER_PRIVATE3) { /* Set mute bit */ if (cmd == SOUND_MIXER_PRIVATE3) { /* Set mute bit */
if (__get_user(level, (int *)arg)) if (get_user(level, (int *)arg))
return -EFAULT; return -EFAULT;
if (level == -1) /* Return current settings */ if (level == -1) /* Return current settings */
level = !(pas_read(0x0B8A) & 0x20); level = !(pas_read(0x0B8A) & 0x20);
...@@ -269,10 +269,10 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) ...@@ -269,10 +269,10 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
level = !(pas_read(0x0B8A) & 0x20); level = !(pas_read(0x0B8A) & 0x20);
} }
return __put_user(level, (int *)arg); return put_user(level, (int *)arg);
} }
if (((cmd >> 8) & 0xff) == 'M') { if (((cmd >> 8) & 0xff) == 'M') {
if (__get_user(v, (int *)arg)) if (get_user(v, (int *)arg))
return -EFAULT; return -EFAULT;
if (_SIOC_DIR(cmd) & _SIOC_WRITE) { if (_SIOC_DIR(cmd) & _SIOC_WRITE) {
v = pas_mixer_set(cmd & 0xff, v); v = pas_mixer_set(cmd & 0xff, v);
...@@ -303,7 +303,7 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) ...@@ -303,7 +303,7 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
break; break;
} }
} }
return __put_user(v, (int *)arg); return put_user(v, (int *)arg);
} }
return -EINVAL; return -EINVAL;
} }
......
...@@ -293,14 +293,14 @@ static int sb_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) ...@@ -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). * 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 (cmd == SOUND_MIXER_PRIVATE1 && devc->model == MDL_SB16) {
if (__get_user(val, (int *)arg)) if (get_user(val, (int *)arg))
return -EFAULT; return -EFAULT;
sb_setmixer(devc, 0x43, (~val) & 0x01); sb_setmixer(devc, 0x43, (~val) & 0x01);
return 0; return 0;
} }
if (((cmd >> 8) & 0xff) == 'M') { if (((cmd >> 8) & 0xff) == 'M') {
if (_SIOC_DIR(cmd) & _SIOC_WRITE) { if (_SIOC_DIR(cmd) & _SIOC_WRITE) {
if (__get_user(val, (int *)arg)) if (get_user(val, (int *)arg))
return -EFAULT; return -EFAULT;
switch (cmd & 0xff) { switch (cmd & 0xff) {
case SOUND_MIXER_RECSRC: case SOUND_MIXER_RECSRC:
...@@ -338,7 +338,7 @@ static int sb_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg) ...@@ -338,7 +338,7 @@ static int sb_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
ret = sb_mixer_get(devc, cmd & 0xff); ret = sb_mixer_get(devc, cmd & 0xff);
break; break;
} }
return __put_user(ret, (int *)arg); return put_user(ret, (int *)arg);
} else } else
return -EINVAL; return -EINVAL;
} }
......
...@@ -12,10 +12,8 @@ O_OBJS := dir.o file.o inode.o ioctl.o mmap.o ncplib_kernel.o sock.o ...@@ -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) M_OBJS := $(O_TARGET)
# If you want debugging output, please uncomment the following line # If you want debugging output, please uncomment the following line
# EXTRA_CFLAGS += -DDEBUG_NCP=1 # EXTRA_CFLAGS += -DDEBUG_NCP=1
include $(TOPDIR)/Rules.make CFLAGS_ncplib_kernel.o := -finline-functions
ncplib_kernel.o: ncplib_kernel.c ncplib_kernel.h include $(TOPDIR)/Rules.make
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -finline-functions -c -o $@ $<
...@@ -132,6 +132,42 @@ static struct dentry * proc_follow_link(struct dentry *dentry, ...@@ -132,6 +132,42 @@ static struct dentry * proc_follow_link(struct dentry *dentry,
return result; 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) static int proc_readlink(struct dentry * dentry, char * buffer, int buflen)
{ {
int error; int error;
...@@ -141,18 +177,7 @@ static int proc_readlink(struct dentry * dentry, char * buffer, int buflen) ...@@ -141,18 +177,7 @@ static int proc_readlink(struct dentry * dentry, char * buffer, int buflen)
if (!IS_ERR(dentry)) { if (!IS_ERR(dentry)) {
error = -ENOENT; error = -ENOENT;
if (dentry) { if (dentry) {
char * tmp = (char*)__get_free_page(GFP_KERNEL), *path; error = do_proc_readlink(dentry, buffer, buflen);
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;
} }
} }
return error; return error;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Copyright (C) 1992 David Giller, rafetmad@oxy.edu * Copyright (C) 1992 David Giller, rafetmad@oxy.edu
* 1994, 1995 Eberhard Moenkeberg, emoenke@gwdg.de * 1994, 1995 Eberhard Moenkeberg, emoenke@gwdg.de
* 1996 David van Leeuwen, david@tm.tno.nl * 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 #ifndef _LINUX_CDROM_H
...@@ -417,4 +417,4 @@ extern int register_cdrom(struct cdrom_device_info *cdi); ...@@ -417,4 +417,4 @@ extern int register_cdrom(struct cdrom_device_info *cdi);
extern int unregister_cdrom(struct cdrom_device_info *cdi); extern int unregister_cdrom(struct cdrom_device_info *cdi);
#endif /* End of kernel only stuff */ #endif /* End of kernel only stuff */
#endif _LINUX_CDROM_H #endif /* _LINUX_CDROM_H */
...@@ -3,28 +3,4 @@ ...@@ -3,28 +3,4 @@
#include <linux/autoconf.h> #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 #endif
...@@ -266,6 +266,7 @@ static inline int buffer_protected(struct buffer_head * bh) ...@@ -266,6 +266,7 @@ static inline int buffer_protected(struct buffer_head * bh)
#include <linux/ufs_fs_i.h> #include <linux/ufs_fs_i.h>
#include <linux/romfs_fs_i.h> #include <linux/romfs_fs_i.h>
#include <linux/smb_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 * Attribute flags. These should be or-ed together to figure out what
...@@ -366,6 +367,7 @@ struct inode { ...@@ -366,6 +367,7 @@ struct inode {
struct ufs_inode_info ufs_i; struct ufs_inode_info ufs_i;
struct romfs_inode_info romfs_i; struct romfs_inode_info romfs_i;
struct smb_inode_info smbfs_i; struct smb_inode_info smbfs_i;
struct hfs_inode_info hfs_i;
struct socket socket_i; struct socket socket_i;
void *generic_ip; void *generic_ip;
} u; } u;
...@@ -503,6 +505,7 @@ extern int fasync_helper(struct file *, int, struct fasync_struct **); ...@@ -503,6 +505,7 @@ extern int fasync_helper(struct file *, int, struct fasync_struct **);
#include <linux/ufs_fs_sb.h> #include <linux/ufs_fs_sb.h>
#include <linux/romfs_fs_sb.h> #include <linux/romfs_fs_sb.h>
#include <linux/smb_fs_sb.h> #include <linux/smb_fs_sb.h>
#include <linux/hfs_fs_sb.h>
struct super_block { struct super_block {
kdev_t s_dev; kdev_t s_dev;
...@@ -538,6 +541,7 @@ struct super_block { ...@@ -538,6 +541,7 @@ struct super_block {
struct ufs_sb_info ufs_sb; struct ufs_sb_info ufs_sb;
struct romfs_sb_info romfs_sb; struct romfs_sb_info romfs_sb;
struct smb_sb_info smbfs_sb; struct smb_sb_info smbfs_sb;
struct hfs_sb_info hfs_sb;
void *generic_sbp; void *generic_sbp;
} u; } u;
}; };
......
...@@ -208,35 +208,12 @@ struct hfs_cap_info { ...@@ -208,35 +208,12 @@ struct hfs_cap_info {
#ifdef __KERNEL__ #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 ssize_t hfs_rwret_t;
typedef size_t hfs_rwarg_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) #include <asm/uaccess.h>
extern inline void clear_user(char *addr, off_t count)
{ while (count--) { put_user(0, addr++); } }
#endif
/* Some forward declarations */ /* Some forward declarations */
struct hfs_fork; struct hfs_fork;
...@@ -328,18 +305,8 @@ extern int hfs_mac2eight(char *, const struct hfs_name *); ...@@ -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_mac2alpha(char *, const struct hfs_name *);
extern int hfs_mac2triv(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 */ #define HFS_I(X) (&((X)->u.hfs_i))
extern __inline__ struct hfs_inode_info *HFS_I(struct inode *inode) { #define HFS_SB(X) (&((X)->u.hfs_sb))
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
extern __inline__ void hfs_nameout(struct inode *dir, struct hfs_name *out, extern __inline__ void hfs_nameout(struct inode *dir, struct hfs_name *out,
const char *in, int len) { const char *in, int len) {
...@@ -388,6 +355,8 @@ static __inline__ void hfs_drop_special(const struct hfs_name *name, ...@@ -388,6 +355,8 @@ static __inline__ void hfs_drop_special(const struct hfs_name *name,
} }
} }
} }
#endif
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif #endif
#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
...@@ -6,15 +6,11 @@ ...@@ -6,15 +6,11 @@
* May be freely distributed as part of Linux. * May be freely distributed as part of Linux.
*/ */
#include <linux/config.h> #include <linux/uts.h>
#include <linux/utsname.h> #include <linux/utsname.h>
#include <linux/version.h> #include <linux/version.h>
#include <linux/compile.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(a) Version_ ## a
#define version_string(a) version(a) #define version_string(a) version(a)
......
...@@ -21,7 +21,6 @@ ifeq ($(CONFIG_MODULES),y) ...@@ -21,7 +21,6 @@ ifeq ($(CONFIG_MODULES),y)
OX_OBJS += ksyms.o OX_OBJS += ksyms.o
endif endif
include $(TOPDIR)/Rules.make CFLAGS_sched.o := $(PROFILING) -fno-omit-frame-pointer
sched.o: sched.c include $(TOPDIR)/Rules.make
$(CC) $(CFLAGS) $(PROFILING) -fno-omit-frame-pointer -c $<
...@@ -25,15 +25,15 @@ tkparse: tkparse.o tkcond.o tkgen.o ...@@ -25,15 +25,15 @@ tkparse: tkparse.o tkcond.o tkgen.o
${HOSTCC} -o tkparse tkparse.o tkcond.o tkgen.o ${HOSTCC} -o tkparse tkparse.o tkcond.o tkgen.o
tkparse.o: tkparse.c tkparse.h tkparse.o: tkparse.c tkparse.h
$(HOSTCC) $(HOSTCFLAGS) -c -o tkparse.o tkparse.c
tkcond.o: tkcond.c tkparse.h tkcond.o: tkcond.c tkparse.h
$(HOSTCC) $(HOSTCFLAGS) -c -o tkcond.o tkcond.c
tkgen.o: tkgen.c tkparse.h 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: clean:
rm -f *~ kconfig.tk *.o tkparse rm -f *~ kconfig.tk *.o tkparse mkdep split-include
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
...@@ -31,6 +31,11 @@ ...@@ -31,6 +31,11 @@
# 081297 Pavel Machek (pavel@atrey.karlin.mff.cuni.cz) - better error # 081297 Pavel Machek (pavel@atrey.karlin.mff.cuni.cz) - better error
# handling # 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. # 101297 Michael Chastain (mec@shout.net) - remove sound driver cruft.
# #
# 221297 Michael Chastain (mec@shout.net) - make define_bool actually # 221297 Michael Chastain (mec@shout.net) - make define_bool actually
...@@ -1051,11 +1056,19 @@ save_configuration () { ...@@ -1051,11 +1056,19 @@ save_configuration () {
: ${current:=$default} : ${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 set -- $choices
while [ -n "$2" ]
define_bool "$1" "y" do
if eval [ "$1" = "$current" ]
then
define_bool "$2" "y"
else
define_bool "$2" "n"
fi
shift ; shift
done
} }
function mainmenu_name () { function mainmenu_name () {
......
#! /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);
}
# 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)
}
...@@ -228,10 +228,10 @@ proc write_comment { file1 file2 text } { ...@@ -228,10 +228,10 @@ proc write_comment { file1 file2 text } {
proc write_tristate { file1 file2 varname variable dep } { proc write_tristate { file1 file2 varname variable dep } {
if { $variable == 0 } \ if { $variable == 0 } \
then { puts $file1 "# $varname is not set"; \ then { puts $file1 "# $varname is not set"; \
puts $file2 "#undef $varname"} \ puts $file2 "#undef $varname"} \
elseif { $variable == 2 || ($dep == 2 && $variable == 1) } \ elseif { $variable == 2 || ($dep == 2 && $variable == 1) } \
then { puts $file1 "$varname=m"; \ then { puts $file1 "$varname=m"; \
puts $file2 "#undef $varname"; \ puts $file2 "#undef $varname"; \
puts $file2 "#define ${varname}_MODULE 1" } \ puts $file2 "#define ${varname}_MODULE 1" } \
elseif { $variable == 1 && $dep != 2 } \ elseif { $variable == 1 && $dep != 2 } \
then { puts $file1 "$varname=y"; \ then { puts $file1 "$varname=y"; \
...@@ -244,7 +244,7 @@ proc write_tristate { file1 file2 varname variable dep } { ...@@ -244,7 +244,7 @@ proc write_tristate { file1 file2 varname variable dep } {
proc write_int { file1 file2 varname variable dep } { proc write_int { file1 file2 varname variable dep } {
if { $dep == 0 } \ if { $dep == 0 } \
then { puts $file1 "# $varname is not set"; \ then { puts $file1 "# $varname is not set"; \
puts $file2 "#undef $varname"} \ puts $file2 "#undef $varname"} \
else { else {
puts $file1 "$varname=$variable"; \ puts $file1 "$varname=$variable"; \
puts $file2 "#define $varname $variable"; \ puts $file2 "#define $varname $variable"; \
...@@ -254,7 +254,7 @@ proc write_int { file1 file2 varname variable dep } { ...@@ -254,7 +254,7 @@ proc write_int { file1 file2 varname variable dep } {
proc write_hex { file1 file2 varname variable dep } { proc write_hex { file1 file2 varname variable dep } {
if { $dep == 0 } \ if { $dep == 0 } \
then { puts $file1 "# $varname is not set"; \ then { puts $file1 "# $varname is not set"; \
puts $file2 "#undef $varname"} \ puts $file2 "#undef $varname"} \
else { else {
puts $file1 "$varname=$variable"; \ puts $file1 "$varname=$variable"; \
puts $file2 "#define $varname 0x$variable"; \ puts $file2 "#define $varname 0x$variable"; \
...@@ -264,7 +264,7 @@ proc write_hex { file1 file2 varname variable dep } { ...@@ -264,7 +264,7 @@ proc write_hex { file1 file2 varname variable dep } {
proc write_string { file1 file2 varname variable dep } { proc write_string { file1 file2 varname variable dep } {
if { $dep == 0 } \ if { $dep == 0 } \
then { puts $file1 "# $varname is not set"; \ then { puts $file1 "# $varname is not set"; \
puts $file2 "#undef $varname"} \ puts $file2 "#undef $varname"} \
else { else {
puts $file1 "$varname=\"$variable\""; \ puts $file1 "$varname=\"$variable\""; \
puts $file2 "#define $varname \"$variable\""; \ puts $file2 "#define $varname \"$variable\""; \
......
#!/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
/*
* 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 <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h>
#include <string.h> #include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <sys/fcntl.h> #include <sys/fcntl.h>
#include <sys/mman.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) #define depname (__depname+9)
int hasdep;
struct path_struct { struct path_struct {
int len; int len;
...@@ -22,22 +35,113 @@ struct path_struct { ...@@ -22,22 +35,113 @@ struct path_struct {
{ 0, "" } { 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; struct path_struct *path = path_array+type;
if (len == 14) if (len == 14 && !memcmp(name, "linux/config.h", len))
if (!memcmp(name, "linux/config.h", len)) return;
hasconfig = 1;
else if (!memcmp(name, "linux/module.h", len)) if (len >= 7 && !memcmp(name, "config/", 7))
hasmodules = 1; define_config(0, name+7, len-7-2);
plen = path->len; memcpy(path->buffer+path->len, name, len);
memcpy(path->buffer+plen, name, len); path->buffer[path->len+len] = '\0';
len += plen; if (access(path->buffer, F_OK) != 0)
path->buffer[len] = '\0';
if (access(path->buffer, F_OK))
return; return;
if (!hasdep) { if (!hasdep) {
...@@ -47,15 +151,48 @@ static void handle_include(int type, char *name, int len) ...@@ -47,15 +151,48 @@ static void handle_include(int type, char *name, int len)
printf(" \\\n %s", path->buffer); 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; char *pc;
if (!hasconfig) int i;
fprintf(stderr,
"%s needs config but has not included config file\n", pc = path_array[0].buffer + path_array[0].len;
filename); 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__) #if defined(__alpha__) || defined(__i386__)
#define LE_MACHINE #define LE_MACHINE
#endif #endif
...@@ -69,243 +206,283 @@ static void handle_config(void) ...@@ -69,243 +206,283 @@ static void handle_config(void)
#endif #endif
#define GETNEXT { \ #define GETNEXT { \
next_byte(__buf); \ next_byte(__buf); \
if (!__nrbuf) { \ if ((unsigned long) next % sizeof(unsigned long) == 0) { \
__buf = *(unsigned long *) next; \ __buf = * (unsigned long *) next; \
__nrbuf = sizeof(unsigned long); \ if (!__buf) \
if (!__buf) \ break; \
break; \ } \
} next++; __nrbuf--; } next++; \
}
/*
* State machine macros.
*/
#define CASE(c,label) if (current == c) goto label #define CASE(c,label) if (current == c) goto label
#define NOTCASE(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(;;) { const char * next = map;
register unsigned long __buf = 0; const char * map_dot;
register unsigned long __nrbuf = 0; unsigned long __buf = 0;
normal: for (;;) {
start:
GETNEXT GETNEXT
__normal: __start:
CASE('/',slash); if (current > MAX5('/','\'','"','#','C')) goto start;
CASE('"',string); if (current < MIN5('/','\'','"','#','C')) goto start;
CASE('\'',char_const); CASE('/', slash);
CASE('#',preproc); CASE('\'', squote);
goto normal; CASE('"', dquote);
CASE('#', pound);
CASE('C', cee);
goto start;
/* / */
slash: slash:
GETNEXT GETNEXT
CASE('*',comment); NOTCASE('*', __start);
goto __normal; slash_star_dot_star:
string:
GETNEXT GETNEXT
CASE('"',normal); __slash_star_dot_star:
NOTCASE('\\',string); NOTCASE('*', slash_star_dot_star);
GETNEXT GETNEXT
goto string; NOTCASE('/', __slash_star_dot_star);
goto start;
char_const: /* '.*?' */
squote:
GETNEXT GETNEXT
CASE('\'',normal); CASE('\'', start);
NOTCASE('\\',char_const); NOTCASE('\\', squote);
GETNEXT GETNEXT
goto char_const; goto squote;
comment: /* ".*?" */
dquote:
GETNEXT GETNEXT
__comment: CASE('"', start);
NOTCASE('*',comment); NOTCASE('\\', dquote);
GETNEXT GETNEXT
CASE('/',normal); goto dquote;
goto __comment;
preproc: /* #\s* */
pound:
GETNEXT GETNEXT
CASE('\n',normal); CASE(' ', pound);
CASE(' ',preproc); CASE('\t', pound);
CASE('\t',preproc); CASE('i', pound_i);
CASE('i',i_preproc); CASE('d', pound_d);
CASE('e',e_preproc); 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 GETNEXT
CASE(' ', pound_include);
skippreproc: CASE('\t', pound_include);
CASE('\n',normal); map_dot = next;
CASE('\\',skippreprocslash); CASE('"', pound_include_dquote);
CASE('<', pound_include_langle);
goto __start;
/* #\s*include\s*"(.*)" */
pound_include_dquote:
GETNEXT GETNEXT
goto skippreproc; CASE('\n', start);
NOTCASE('"', pound_include_dquote);
skippreprocslash: handle_include(1, map_dot, next - map_dot - 1);
GETNEXT; goto start;
GETNEXT;
goto skippreproc;
e_preproc: /* #\s*include\s*<(.*)> */
pound_include_langle:
GETNEXT 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 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 GETNEXT
CASE('f',if_line); if (isalnum(current) || current == '_')
goto skippreproc; goto pound_define_undef_CONFIG_word;
define_config(1, map_dot, next - map_dot - 1);
i_preproc: goto __start;
GETNEXT
CASE('f',if_line); /* \<CONFIG_(\w*) */
NOTCASE('n',skippreproc); cee:
GETNEXT if (next >= map+2 && (isalnum(next[-2]) || next[-2] == '_'))
NOTCASE('c',skippreproc); goto start;
GETNEXT GETNEXT NOTCASE('O', __start);
NOTCASE('l',skippreproc); GETNEXT NOTCASE('N', __start);
GETNEXT GETNEXT NOTCASE('F', __start);
NOTCASE('u',skippreproc); GETNEXT NOTCASE('I', __start);
GETNEXT GETNEXT NOTCASE('G', __start);
NOTCASE('d',skippreproc); GETNEXT NOTCASE('_', __start);
GETNEXT
NOTCASE('e',skippreproc); map_dot = next;
cee_CONFIG_word:
/* "# 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:
GETNEXT GETNEXT
CASE('\n',normal); if (isalnum(current) || current == '_')
NOTCASE('>', std_include_name); goto cee_CONFIG_word;
handle_include(0, incname, next-incname-1); use_config(map_dot, next - map_dot - 1);
goto skippreproc; 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 mapsize;
int pagesizem1 = getpagesize()-1; int pagesizem1 = getpagesize()-1;
int fd = open(filename, O_RDONLY); int fd;
struct stat st; struct stat st;
char * map;
fd = open(filename, O_RDONLY);
if (fd < 0) { if (fd < 0) {
if (errno != ENOENT) perror(filename);
perror(filename);
return; return;
} }
fstat(fd, &st); fstat(fd, &st);
if (st.st_size == 0) { if (st.st_size == 0) {
fprintf(stderr,"%s is empty\n",filename); fprintf(stderr,"%s is empty\n",filename);
close(fd);
return; return;
} }
mapsize = st.st_size + 2*sizeof(unsigned long); mapsize = st.st_size + 2*sizeof(unsigned long);
mapsize = (mapsize+pagesizem1) & ~pagesizem1; mapsize = (mapsize+pagesizem1) & ~pagesizem1;
map = mmap(NULL, mapsize, PROT_READ, MAP_PRIVATE, fd, 0); map = mmap(NULL, mapsize, PROT_READ, MAP_PRIVATE, fd, 0);
if (-1 == (long)map) { if ((long) map == -1) {
perror("mkdep: mmap"); perror("mkdep: mmap");
close(fd); close(fd);
return; 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); state_machine(map);
munmap(map, mapsize);
if (hasdep) if (hasdep)
puts(command); puts(command);
munmap(map, mapsize);
close(fd);
} }
/*
* Generate dependencies for all files.
*/
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int len; int len;
char * hpath; char *hpath;
hpath = getenv("HPATH"); hpath = getenv("HPATH");
if (!hpath) if (!hpath)
hpath = "/usr/src/linux/include"; hpath = "/usr/src/linux/include";
len = strlen(hpath); len = strlen(hpath);
memcpy(path_array[0].buffer, hpath, len); memcpy(path_array[0].buffer, hpath, len);
if (len && hpath[len-1] != '/') { if (len && hpath[len-1] != '/')
path_array[0].buffer[len] = '/'; path_array[0].buffer[len++] = '/';
len++;
}
path_array[0].buffer[len] = '\0'; path_array[0].buffer[len] = '\0';
path_array[0].len = len; path_array[0].len = len;
while (--argc > 0) { while (--argc > 0) {
int len; const char * filename = *++argv;
char *name = *++argv; const char * command = __depname;
len = strlen(filename);
filename = name; memcpy(depname, filename, len+1);
len = strlen(name); if (len > 2 && filename[len-2] == '.') {
memcpy(depname, name, len+1); if (filename[len-1] == 'c' || filename[len-1] == 'S') {
command = __depname; depname[len-1] = 'o';
if (len > 2 && name[len-2] == '.') { command = "";
switch (name[len-1]) {
case 'c':
case 'S':
depname[len-1] = 'o';
command = "";
} }
} }
needsconfig = hasconfig = hasmodules = hasdep = 0; do_depend(filename, command);
do_depend();
if (hasconfig && !hasmodules && !needsconfig)
fprintf(stderr, "%s doesn't need config\n", filename);
} }
return 0; return 0;
} }
/*
* 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;
}
...@@ -53,6 +53,14 @@ ...@@ -53,6 +53,14 @@
* 1997 12 08 * 1997 12 08
* Michael Chastain - Remove sound driver special cases. * 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: * TO DO:
* - clean up - there are useless ifdef's everywhere. * - clean up - there are useless ifdef's everywhere.
* - better comments throughout - C code generating tcl is really cryptic. * - better comments throughout - C code generating tcl is really cryptic.
...@@ -1034,9 +1042,10 @@ void dump_tk_script(struct kconfig *scfg) ...@@ -1034,9 +1042,10 @@ void dump_tk_script(struct kconfig *scfg)
cfg1 != NULL && cfg1->tok == tok_choice; cfg1 != NULL && cfg1->tok == tok_choice;
cfg1 = cfg1->next) 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, cfg->optionname,
cfg1->label, cfg1->label,
cfg1->optionname,
cfg1->optionname); cfg1->optionname);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment