From 9a0a7855ec45628c701877d6b4b3a98c23ffd50b Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:28:41 -0500 Subject: [PATCH] Import 2.3.29pre2 --- Documentation/ioctl-number.txt | 2 + arch/arm/kernel/ecard.c | 2 +- arch/i386/boot/Makefile | 2 +- arch/i386/kernel/apm.c | 2 +- arch/i386/kernel/mca.c | 2 + arch/i386/kernel/mtrr.c | 21 +- arch/i386/mm/init.c | 6 +- arch/m68k/mac/iop.c | 10 +- arch/ppc/mm/init.c | 23 +- drivers/block/DAC960.c | 41 +-- drivers/block/DAC960.h | 4 - drivers/block/alim15x3.c | 6 +- drivers/block/ide-proc.c | 21 +- drivers/block/piix.c | 6 +- drivers/block/sis5513.c | 6 +- drivers/block/via82cxxx.c | 6 +- drivers/char/ftape/lowlevel/ftape-proc.h | 2 - drivers/char/h8.c | 7 +- drivers/char/ip2main.c | 6 +- drivers/char/radio-typhoon.c | 6 +- drivers/char/serial.c | 3 +- drivers/net/8390.c | 1 - drivers/net/Config.in | 2 +- drivers/net/bmac.c | 4 +- drivers/net/hamradio/bpqether.c | 2 +- drivers/net/hamradio/scc.c | 2 +- drivers/net/hamradio/yam.c | 2 +- drivers/net/pcmcia/ray_cs.c | 3 +- drivers/net/strip.c | 2 +- drivers/net/tlan.c | 12 +- drivers/nubus/proc.c | 4 +- drivers/pci/proc.c | 4 +- drivers/scsi/53c7,8xx.c | 4 +- drivers/scsi/AM53C974.c | 2 +- drivers/scsi/NCR53C9x.c | 2 +- drivers/scsi/advansys.c | 4 +- drivers/scsi/aic7xxx.c | 12 +- drivers/scsi/dtc.c | 8 +- drivers/scsi/eata_dma.c | 2 +- drivers/scsi/eata_pio.c | 2 +- drivers/scsi/g_NCR5380.c | 8 +- drivers/scsi/g_NCR5380.h | 4 +- drivers/scsi/hosts.h | 6 +- drivers/scsi/ini9100u.c | 2 +- drivers/scsi/inia100.c | 2 +- drivers/scsi/ncr53c8xx.c | 2 +- drivers/scsi/scsi.c | 154 +++++---- drivers/scsi/seagate.c | 8 +- drivers/scsi/sim710.c | 35 +- drivers/scsi/sym53c8xx.c | 2 +- drivers/scsi/t128.c | 59 ++-- drivers/scsi/t128.h | 14 +- drivers/sound/soundcard.c | 4 +- drivers/usb/cpia.c | 377 ++++++++++---------- drivers/usb/cpia.h | 9 +- drivers/usb/ezusb.c | 2 +- drivers/usb/hp_scanner.c | 4 +- drivers/usb/proc_usb.c | 17 +- drivers/video/matroxfb.c | 10 +- drivers/zorro/proc.c | 4 +- fs/Makefile | 17 +- fs/coda/sysctl.c | 8 +- fs/proc/generic.c | 406 +++++++++++++++++++--- fs/proc/inode-alloc.txt | 1 - fs/proc/inode.c | 74 ++-- fs/proc/openpromfs.c | 5 +- fs/proc/proc_tty.c | 3 +- fs/proc/procfs_syms.c | 5 +- fs/proc/root.c | 415 ++--------------------- fs/udf/balloc.c | 50 +++ fs/udf/dir.c | 4 +- fs/udf/directory.c | 1 - fs/udf/file.c | 19 +- fs/udf/inode.c | 35 +- fs/udf/lowlevel.c | 2 +- fs/udf/namei.c | 38 ++- fs/udf/super.c | 14 +- fs/udf/truncate.c | 3 +- fs/udf/udf_sb.h | 3 - fs/udf/udfdecl.h | 233 +++++-------- fs/udf/udfend.h | 5 + include/linux/netdevice.h | 1 - include/linux/proc_fs.h | 97 +----- include/linux/serial.h | 14 + include/linux/serialP.h | 9 +- include/linux/sysctl.h | 3 +- include/linux/udf_fs.h | 4 +- include/linux/videodev.h | 1 + include/linux/wanrouter.h | 2 +- include/net/ax25.h | 4 +- include/net/br.h | 1 - include/net/ip.h | 2 +- include/net/netrom.h | 4 +- include/net/rose.h | 6 +- include/net/x25.h | 2 +- kernel/sysctl.c | 5 +- net/802/tr.c | 4 +- net/appletalk/aarp.c | 2 +- net/appletalk/ddp.c | 6 +- net/ax25/af_ax25.c | 2 +- net/ax25/ax25_route.c | 2 +- net/ax25/ax25_uid.c | 2 +- net/bridge/br.c | 2 +- net/core/dev.c | 6 +- net/decnet/af_decnet.c | 4 +- net/decnet/dn_dev.c | 2 +- net/decnet/dn_fib.c | 2 +- net/decnet/dn_neigh.c | 2 +- net/decnet/dn_raw.c | 2 +- net/decnet/dn_route.c | 2 +- net/ipv4/af_inet.c | 12 +- net/ipv4/arp.c | 4 +- net/ipv4/fib_frontend.c | 2 +- net/ipv4/igmp.c | 2 +- net/ipv4/ip_output.c | 2 +- net/ipv4/ipmr.c | 4 +- net/ipv4/proc.c | 6 +- net/ipv4/raw.c | 2 +- net/ipv4/route.c | 4 +- net/ipv4/tcp_ipv4.c | 2 +- net/ipv4/udp.c | 2 +- net/ipv6/addrconf.c | 2 +- net/ipv6/af_inet6.c | 10 +- net/ipv6/ndisc.c | 2 +- net/ipv6/proc.c | 5 +- net/ipv6/raw.c | 2 +- net/ipv6/route.c | 6 +- net/ipv6/tcp_ipv6.c | 2 +- net/ipv6/udp.c | 2 +- net/ipx/af_ipx.c | 8 +- net/irda/discovery.c | 3 +- net/irda/ircomm/ircomm_core.c | 10 +- net/irda/iriap.c | 2 +- net/irda/irlan/irlan_common.c | 6 +- net/irda/irlap.c | 7 +- net/irda/irlmp.c | 7 +- net/irda/irproc.c | 15 +- net/irda/irttp.c | 4 +- net/netrom/af_netrom.c | 2 +- net/netrom/nr_route.c | 6 +- net/rose/af_rose.c | 2 +- net/rose/rose_route.c | 9 +- net/wanrouter/wanproc.c | 142 +++----- net/x25/af_x25.c | 2 +- net/x25/x25_route.c | 2 +- 145 files changed, 1364 insertions(+), 1453 deletions(-) diff --git a/Documentation/ioctl-number.txt b/Documentation/ioctl-number.txt index 311f713ddc97..c2a1b00253c6 100644 --- a/Documentation/ioctl-number.txt +++ b/Documentation/ioctl-number.txt @@ -122,6 +122,8 @@ Code Seq# Include File Comments asm-sparc64/kbio.h 'l' 00-3F linux/tcfs_fs.h transparent cryptographic file system +'l' 40-7F linux/udf_fs_i.h in development: + 'm' all linux/mtio.h conflict! 'm' all linux/soundcard.h conflict! 'm' all linux/synclink.h conflict! diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c index c777db9939d3..89c2ca2e8309 100644 --- a/arch/arm/kernel/ecard.c +++ b/arch/arm/kernel/ecard.c @@ -865,7 +865,7 @@ static int ecard_prints(char *buffer, ecard_t *ec) return buffer - start; } -int get_ecard_dev_info(char *buf, char **start, off_t pos, int count, int wr) +static int get_ecard_dev_info(char *buf, char **start, off_t pos, int count) { ecard_t *ec = cards; off_t at = 0; diff --git a/arch/i386/boot/Makefile b/arch/i386/boot/Makefile index e01672fe9c00..f50853d8f47f 100644 --- a/arch/i386/boot/Makefile +++ b/arch/i386/boot/Makefile @@ -54,7 +54,7 @@ bootsect.s: bootsect.S Makefile $(BOOT_INCL) bbootsect: bbootsect.o bbootsect_kludge.o $(LD) -Ttext 0x0 -R bbootsect_kludge.o -s -oformat binary $< -o $@ -bbootsect_kludge.o: bbootsect.o bsetup.o +bbootsect_kludge.o: bbootsect.o bsetup.o $(LD) -r $^ -o $@ bbootsect.o: bbootsect.s diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c index cdeaf9a35f82..a2453d9f3769 100644 --- a/arch/i386/kernel/apm.c +++ b/arch/i386/kernel/apm.c @@ -1193,7 +1193,7 @@ static int do_open(struct inode * inode, struct file * filp) return 0; } -int apm_get_info(char *buf, char **start, off_t fpos, int length, int dummy) +static int apm_get_info(char *buf, char **start, off_t fpos, int length) { char * p; unsigned short bx; diff --git a/arch/i386/kernel/mca.c b/arch/i386/kernel/mca.c index 86fc022e63d4..7061e55db3c0 100644 --- a/arch/i386/kernel/mca.c +++ b/arch/i386/kernel/mca.c @@ -744,11 +744,13 @@ static int mca_read_proc(char *page, char **start, off_t off, void __init mca_do_proc_init(void) { int i; + struct proc_dir_entry *proc_mca; struct proc_dir_entry* node = NULL; struct MCA_adapter *p; if(mca_info == NULL) return; /* Should never happen */ + proc_mca = proc_mkdir("mca", &proc_root); create_proc_read_entry("pos",0,proc_mca,get_mca_info,NULL); create_proc_read_entry("machine",0,proc_mca,get_mca_machine_info,NULL); diff --git a/arch/i386/kernel/mtrr.c b/arch/i386/kernel/mtrr.c index 9e612451cd86..e00f379028c0 100644 --- a/arch/i386/kernel/mtrr.c +++ b/arch/i386/kernel/mtrr.c @@ -1446,12 +1446,6 @@ static int mtrr_ioctl (struct inode *inode, struct file *file, return 0; } /* End Function mtrr_ioctl */ -static int mtrr_open (struct inode *ino, struct file *filep) -{ - MOD_INC_USE_COUNT; - return 0; -} /* End Function mtrr_open */ - static int mtrr_close (struct inode *ino, struct file *file) { int i, max; @@ -1482,7 +1476,7 @@ static struct file_operations mtrr_fops = NULL, /* Poll */ mtrr_ioctl, /* IOctl */ NULL, /* MMAP */ - mtrr_open, /* Open */ + NULL, /* Open */ NULL, /* Flush */ mtrr_close, /* Release */ NULL, /* Fsync */ @@ -1515,11 +1509,7 @@ static struct inode_operations proc_mtrr_inode_operations = { NULL /* revalidate */ }; -static struct proc_dir_entry proc_root_mtrr = { - 0, 4, "mtrr", - S_IFREG | S_IWUSR | S_IRUGO, 1, 0, 0, - 0, &proc_mtrr_inode_operations -}; +static struct proc_dir_entry *proc_root_mtrr; static void compute_ascii (void) { @@ -1555,7 +1545,7 @@ static void compute_ascii (void) ascii_buf_bytes += strlen (ascii_buffer + ascii_buf_bytes); } } - proc_root_mtrr.size = ascii_buf_bytes; + proc_root_mtrr->size = ascii_buf_bytes; } /* End Function compute_ascii */ #endif /* CONFIG_PROC_FS */ @@ -1826,9 +1816,8 @@ int __init mtrr_init(void) # endif /* !__SMP__ */ # ifdef CONFIG_PROC_FS - proc_register (&proc_root, &proc_root_mtrr); -# endif - + proc_root_mtrr = create_proc_entry("mtrr", S_IWUSR|S_IRUGO, &proc_root); + proc_root_mtrr->ops = &proc_mtrr_inode_operations; init_table (); return 0; } /* End Function mtrr_init */ diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c index e6d35cce188e..0cba81502d49 100644 --- a/arch/i386/mm/init.c +++ b/arch/i386/mm/init.c @@ -514,7 +514,7 @@ static inline int page_is_ram (unsigned long pagenr) int i; for (i = 0; i < e820.nr_map; i++) { - unsigned long addr, size; + unsigned long addr, end; if (e820.map[i].type != E820_RAM) /* not usable memory */ continue; @@ -524,8 +524,8 @@ static inline int page_is_ram (unsigned long pagenr) * check here. */ addr = (e820.map[i].addr+PAGE_SIZE-1) >> PAGE_SHIFT; - size = e820.map[i].size >> PAGE_SHIFT; - if ((pagenr >= addr) && (pagenr < addr+size)) + end = (e820.map[i].addr+e820.map[i].size) >> PAGE_SHIFT; + if ((pagenr >= addr) && (pagenr < end)) return 1; } return 0; diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c index 26a0518db0fc..21969ce6fd61 100644 --- a/arch/m68k/mac/iop.c +++ b/arch/m68k/mac/iop.c @@ -51,6 +51,9 @@ * IOP hasn't died. * o Some of the IOP manager routines need better error checking and * return codes. Nothing major, just prettying up. + * + * + share the stuff you were smoking when you wrote the iop_get_proc_info() + * for case when CONFIG_PROC_FS is undefined. */ /* @@ -125,9 +128,10 @@ int iop_scc_present,iop_ism_present; #ifdef CONFIG_PROC_FS -static int iop_get_proc_info(char *, char **, off_t, int, int); +static int iop_get_proc_info(char *, char **, off_t, int); #else -static int iop_get_proc_info(char *, char **, off_t, int, int) {} +/* What the bloody hell is THAT ??? */ +static int iop_get_proc_info(char *, char **, off_t, int) {} #endif /* CONFIG_PROC_FS */ /* structure for tracking channel listeners */ @@ -670,7 +674,7 @@ int iop_dump_one_iop(char *buf, int iop_num, char *iop_name) return len; } -int iop_get_proc_info(char *buf, char **start, off_t pos, int count, int wr) +static int iop_get_proc_info(char *buf, char **start, off_t pos, int count) { int len, cnt; diff --git a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c index b0a376c8e411..da4f6fb05e17 100644 --- a/arch/ppc/mm/init.c +++ b/arch/ppc/mm/init.c @@ -422,7 +422,7 @@ __ioremap(unsigned long addr, unsigned long size, unsigned long flags) if (mem_init_done) { struct vm_struct *area; - area = get_vm_area(size, VM_IOREMAP); + area = get_vm_area(size, VM_ALLOC); if (area == 0) return NULL; v = VMALLOC_VMADDR(area->addr); @@ -779,11 +779,9 @@ static void __init coalesce_mem_pieces(struct mem_pieces *mp) mp->n_regions = d; } -#if defined(CONFIG_PMAC) || defined(CONFIG_CHRP) || defined(CONFIG_ALL_PPC) /* * Read in a property describing some pieces of memory. */ - static void __init get_mem_prop(char *name, struct mem_pieces *mp) { struct reg_property *rp; @@ -802,7 +800,6 @@ static void __init get_mem_prop(char *name, struct mem_pieces *mp) sort_mem_pieces(mp); coalesce_mem_pieces(mp); } -#endif /* CONFIG_PMAC || CONFIG_CHRP || CONFIG_ALL_PPC */ /* * Set up one of the I/D BAT (block address translation) register pairs. @@ -1215,6 +1212,18 @@ void __init paging_init(void) */ empty_bad_page = alloc_bootmem_pages(PAGE_SIZE); empty_bad_page_table = alloc_bootmem_pages(PAGE_SIZE); + { + unsigned int zones_size[2]; + /* + * All pages are DMA-able so this is wrong - the zone code is assuming + * both regions have a value so this is necessary for now. + * -- Cort + */ + zones_size[0] = virt_to_phys(end_of_DRAM-(1<<20)) >> PAGE_SHIFT; + zones_size[1] = (1<<20) >> PAGE_SHIFT; + + free_area_init(zones_size); + } } void __init mem_init(void) @@ -1239,6 +1248,12 @@ void __init mem_init(void) clear_bit(PG_reserved, &mem_map[MAP_NR(addr)].flags); } #endif /* CONFIG_BLK_DEV_INITRD */ + + /* mark the RTAS pages as reserved */ + if ( rtas_data ) + for (addr = (rtas_data+PAGE_OFFSET); addr < PAGE_ALIGN(PAGE_OFFSET+rtas_data+rtas_size) ; + rtas_data += PAGE_SIZE) + SetPageReserved(mem_map + MAP_NR(addr)); for (addr = PAGE_OFFSET; addr < (unsigned long)end_of_DRAM; addr += PAGE_SIZE) { diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index b2f24a633a34..55b54b3ffd00 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c @@ -3483,36 +3483,20 @@ static void DAC960_CreateProcEntries(void) ControllerNumber++) { DAC960_Controller_T *Controller = DAC960_Controllers[ControllerNumber]; - PROC_DirectoryEntry_T *ControllerProcEntry, *InitialStatusProcEntry; - PROC_DirectoryEntry_T *CurrentStatusProcEntry, *UserCommandProcEntry; + PROC_DirectoryEntry_T *ControllerProcEntry; + PROC_DirectoryEntry_T *UserCommandProcEntry; if (Controller == NULL) continue; - ControllerProcEntry = &Controller->ControllerProcEntry; - ControllerProcEntry->name = Controller->ControllerName; - ControllerProcEntry->namelen = strlen(ControllerProcEntry->name); - ControllerProcEntry->mode = S_IFDIR | S_IRUGO | S_IXUGO; - proc_register(DAC960_ProcDirectoryEntry, ControllerProcEntry); - InitialStatusProcEntry = &Controller->InitialStatusProcEntry; - InitialStatusProcEntry->name = "initial_status"; - InitialStatusProcEntry->namelen = strlen(InitialStatusProcEntry->name); - InitialStatusProcEntry->mode = S_IFREG | S_IRUGO; - InitialStatusProcEntry->data = Controller; - InitialStatusProcEntry->read_proc = DAC960_ProcReadInitialStatus; - proc_register(ControllerProcEntry, InitialStatusProcEntry); - CurrentStatusProcEntry = &Controller->CurrentStatusProcEntry; - CurrentStatusProcEntry->name = "current_status"; - CurrentStatusProcEntry->namelen = strlen(CurrentStatusProcEntry->name); - CurrentStatusProcEntry->mode = S_IFREG | S_IRUGO; - CurrentStatusProcEntry->data = Controller; - CurrentStatusProcEntry->read_proc = DAC960_ProcReadCurrentStatus; - proc_register(ControllerProcEntry, CurrentStatusProcEntry); - UserCommandProcEntry = &Controller->UserCommandProcEntry; - UserCommandProcEntry->name = "user_command"; - UserCommandProcEntry->namelen = strlen(UserCommandProcEntry->name); - UserCommandProcEntry->mode = S_IFREG | S_IWUSR | S_IRUSR; - UserCommandProcEntry->data = Controller; - UserCommandProcEntry->read_proc = DAC960_ProcReadUserCommand; + ControllerProcEntry = proc_mkdir(Controller->ControllerName, + DAC960_ProcDirectoryEntry); + create_proc_read_entry("initial_status",0,ControllerProcEntry, + DAC960_ProcReadInitialStatus, Controller); + create_proc_read_entry("current_status",0,ControllerProcEntry, + DAC960_ProcReadCurrentStatus, Controller); + UserCommandProcEntry = + create_proc_read_entry("user_command", S_IWUSR|S_IRUSR, + ControllerProcEntry, + DAC960_ProcReadUserCommand, Controller); UserCommandProcEntry->write_proc = DAC960_ProcWriteUserCommand; - proc_register(ControllerProcEntry, UserCommandProcEntry); } } @@ -3524,6 +3508,7 @@ static void DAC960_CreateProcEntries(void) static void DAC960_DestroyProcEntries(void) { + /* FIXME */ remove_proc_entry("driver/rd", NULL); } diff --git a/drivers/block/DAC960.h b/drivers/block/DAC960.h index 2ff757786385..1696c507ba62 100644 --- a/drivers/block/DAC960.h +++ b/drivers/block/DAC960.h @@ -1258,10 +1258,6 @@ typedef struct DAC960_Controller DAC960_StatusMailbox_T *FirstStatusMailbox; DAC960_StatusMailbox_T *LastStatusMailbox; DAC960_StatusMailbox_T *NextStatusMailbox; - PROC_DirectoryEntry_T ControllerProcEntry; - PROC_DirectoryEntry_T InitialStatusProcEntry; - PROC_DirectoryEntry_T CurrentStatusProcEntry; - PROC_DirectoryEntry_T UserCommandProcEntry; WaitQueue_T CommandWaitQueue; DAC960_DCDB_T MonitoringDCDB; DAC960_Enquiry_T Enquiry[2]; diff --git a/drivers/block/alim15x3.c b/drivers/block/alim15x3.c index 8ed1928894e4..ee398e156d93 100644 --- a/drivers/block/alim15x3.c +++ b/drivers/block/alim15x3.c @@ -35,8 +35,8 @@ #include #include -static int ali_get_info(char *buffer, char **addr, off_t offset, int count, int dummy); -extern int (*ali_display_info)(char *, char **, off_t, int, int); /* ide-proc.c */ +static int ali_get_info(char *buffer, char **addr, off_t offset, int count); +extern int (*ali_display_info)(char *, char **, off_t, int); /* ide-proc.c */ struct pci_dev *bmide_dev; char *fifo[4] = { @@ -67,7 +67,7 @@ char *channel_status[8] = { "error DRQ busy" }; -static int ali_get_info(char *buffer, char **addr, off_t offset, int count, int dummy) +static int ali_get_info(char *buffer, char **addr, off_t offset, int count) { byte reg53h, reg5xh, reg5yh, reg5xh1, reg5yh1; unsigned int bibma; diff --git a/drivers/block/ide-proc.c b/drivers/block/ide-proc.c index 0b18b3ad8fa1..e11ad6da0423 100644 --- a/drivers/block/ide-proc.c +++ b/drivers/block/ide-proc.c @@ -75,22 +75,22 @@ #ifdef CONFIG_BLK_DEV_ALI15X3 extern byte ali_proc; -int (*ali_display_info)(char *, char **, off_t, int, int) = NULL; +int (*ali_display_info)(char *, char **, off_t, int) = NULL; #endif /* CONFIG_BLK_DEV_ALI15X3 */ #ifdef CONFIG_BLK_DEV_PIIX extern byte piix_proc; -int (*piix_display_info)(char *, char **, off_t, int, int) = NULL; +int (*piix_display_info)(char *, char **, off_t, int) = NULL; #endif /* CONFIG_BLK_DEV_PIIX */ #ifdef CONFIG_BLK_DEV_SIS5513 extern byte sis_proc; -int (*sis_display_info)(char *, char **, off_t, int, int) = NULL; +int (*sis_display_info)(char *, char **, off_t, int) = NULL; #endif /* CONFIG_BLK_DEV_SIS5513 */ #ifdef CONFIG_BLK_DEV_VIA82CXXX extern byte via_proc; -int (*via_display_info)(char *, char **, off_t, int, int) = NULL; +int (*via_display_info)(char *, char **, off_t, int) = NULL; #endif /* CONFIG_BLK_DEV_VIA82CXXX */ static int ide_getxdigit(char c) @@ -668,17 +668,12 @@ void ide_remove_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p) } } -static int proc_ide_readlink(struct proc_dir_entry *de, char *page) -{ - int n = (de->name[2] - 'a') / 2; - return sprintf(page, "ide%d/%s", n, de->name); -} - static void create_proc_ide_drives(ide_hwif_t *hwif) { int d; struct proc_dir_entry *ent; struct proc_dir_entry *parent = hwif->proc; + char name[64]; for (d = 0; d < MAX_DRIVES; d++) { ide_drive_t *drive = &hwif->drives[d]; @@ -697,11 +692,9 @@ static void create_proc_ide_drives(ide_hwif_t *hwif) ide_add_proc_entries(drive->proc, driver->proc, drive); } } - ent = create_proc_entry(drive->name, S_IFLNK | S_IRUGO | S_IWUGO | S_IXUGO, proc_ide_root); + sprintf(name,"ide%d/%s", (drive->name[2]-'a')/2, drive->name); + ent = proc_symlink(drive->name, proc_ide_root, name); if (!ent) return; - ent->data = drive; - ent->readlink_proc = proc_ide_readlink; - ent->nlink = 1; } } diff --git a/drivers/block/piix.c b/drivers/block/piix.c index ec978a791e0c..f3db8496372f 100644 --- a/drivers/block/piix.c +++ b/drivers/block/piix.c @@ -74,12 +74,12 @@ #include #include -static int piix_get_info(char *, char **, off_t, int, int); -extern int (*piix_display_info)(char *, char **, off_t, int, int); /* ide-proc.c */ +static int piix_get_info(char *, char **, off_t, int); +extern int (*piix_display_info)(char *, char **, off_t, int); /* ide-proc.c */ extern char *ide_media_verbose(ide_drive_t *); static struct pci_dev *bmide_dev; -static int piix_get_info (char *buffer, char **addr, off_t offset, int count, int dummy) +static int piix_get_info (char *buffer, char **addr, off_t offset, int count) { /* int rc; */ int piix_who = (bmide_dev->device == PCI_DEVICE_ID_INTEL_82371AB) ? 4 : 3; diff --git a/drivers/block/sis5513.c b/drivers/block/sis5513.c index c45404069da3..bdd30a20d66a 100644 --- a/drivers/block/sis5513.c +++ b/drivers/block/sis5513.c @@ -106,8 +106,8 @@ static __inline__ char * find_udma_mode (byte cycle_time) #include #include -static int sis_get_info(char *, char **, off_t, int, int); -extern int (*sis_display_info)(char *, char **, off_t, int, int); /* ide-proc.c */ +static int sis_get_info(char *, char **, off_t, int); +extern int (*sis_display_info)(char *, char **, off_t, int); /* ide-proc.c */ struct pci_dev *bmide_dev; static char *cable_type[] = { @@ -140,7 +140,7 @@ static char *active_time [] = { "6 PCICLK", "12 PCICLK" }; -static int sis_get_info (char *buffer, char **addr, off_t offset, int count, int dummy) +static int sis_get_info (char *buffer, char **addr, off_t offset, int count) { int rc; char *p = buffer; diff --git a/drivers/block/via82cxxx.c b/drivers/block/via82cxxx.c index e6f61c03fc9b..9d7836e98f6f 100644 --- a/drivers/block/via82cxxx.c +++ b/drivers/block/via82cxxx.c @@ -119,8 +119,8 @@ static char *control3_str[] = { "192" }; -static int via_get_info(char *, char **, off_t, int, int); -extern int (*via_display_info)(char *, char **, off_t, int, int); /* ide-proc.c */ +static int via_get_info(char *, char **, off_t, int); +extern int (*via_display_info)(char *, char **, off_t, int); /* ide-proc.c */ static struct pci_dev *bmide_dev; static char * print_apollo_drive_config (char *buf, struct pci_dev *dev) @@ -304,7 +304,7 @@ static char * print_apollo_chipset_control3 (char *buf, struct pci_dev *dev, return (char *)p; } -static int via_get_info (char *buffer, char **addr, off_t offset, int count, int dummy) +static int via_get_info (char *buffer, char **addr, off_t offset, int count) { /* * print what /proc/via displays, diff --git a/drivers/char/ftape/lowlevel/ftape-proc.h b/drivers/char/ftape/lowlevel/ftape-proc.h index 5673d5a41b7b..264dfcc1d22d 100644 --- a/drivers/char/ftape/lowlevel/ftape-proc.h +++ b/drivers/char/ftape/lowlevel/ftape-proc.h @@ -29,8 +29,6 @@ #include -extern struct proc_dir_entry proc_ftape; - extern int ftape_proc_init(void); extern void ftape_proc_destroy(void); diff --git a/drivers/char/h8.c b/drivers/char/h8.c index 0a6a63fff0eb..a0cc714c59ff 100644 --- a/drivers/char/h8.c +++ b/drivers/char/h8.c @@ -58,9 +58,10 @@ int h8_display_unblank(void); static void h8_intr(int irq, void *dev_id, struct pt_regs *regs); #ifdef CONFIG_PROC_FS -static int h8_get_info(char *, char **, off_t, int, int); +static int h8_get_info(char *, char **, off_t, int); #else -static int h8_get_info(char *, char **, off_t, int, int) {} +static int h8_get_info(char *, char **, off_t, int) {} +#error "Somebody needs to learn C. Badly." #endif /* @@ -402,7 +403,7 @@ void h8_hw_init(void) } #ifdef CONFIG_PROC_FS -int h8_get_info(char *buf, char **start, off_t fpos, int length, int dummy) +static int h8_get_info(char *buf, char **start, off_t fpos, int length) { char *p; diff --git a/drivers/char/ip2main.c b/drivers/char/ip2main.c index b31f10ac9fbe..4f25001fbf2e 100644 --- a/drivers/char/ip2main.c +++ b/drivers/char/ip2main.c @@ -71,7 +71,7 @@ #include -int ip2_read_procmem(char *, char **, off_t, int, int ); +static int ip2_read_procmem(char *, char **, off_t, int); int ip2_read_proc(char *, char **, off_t, int, int *, void * ); /********************/ @@ -3003,8 +3003,8 @@ ip2_ipl_open( struct inode *pInode, struct file *pFile ) #define LIMIT (PAGE_SIZE - 120) -int -ip2_read_procmem(char *buf, char **start, off_t offset, int len, int unused) +static int +ip2_read_procmem(char *buf, char **start, off_t offset, int len) { i2eBordStrPtr pB; i2ChanStrPtr pCh; diff --git a/drivers/char/radio-typhoon.c b/drivers/char/radio-typhoon.c index 7f546a12d545..434dff875179 100644 --- a/drivers/char/radio-typhoon.c +++ b/drivers/char/radio-typhoon.c @@ -72,8 +72,7 @@ static int typhoon_ioctl(struct video_device *dev, unsigned int cmd, void *arg); static int typhoon_open(struct video_device *dev, int flags); static void typhoon_close(struct video_device *dev); #ifdef CONFIG_RADIO_TYPHOON_PROC_FS -static int typhoon_get_info(char *buf, char **start, off_t offset, int len, - int unused); +static int typhoon_get_info(char *buf, char **start, off_t offset, int len); #endif static void typhoon_setvol_generic(struct typhoon_device *dev, int vol) @@ -299,8 +298,7 @@ static struct video_device typhoon_radio = #ifdef CONFIG_RADIO_TYPHOON_PROC_FS -static int typhoon_get_info(char *buf, char **start, off_t offset, int len, - int unused) +static int typhoon_get_info(char *buf, char **start, off_t offset, int len) { #ifdef MODULE #define MODULEPROCSTRING "Driver loaded as a module" diff --git a/drivers/char/serial.c b/drivers/char/serial.c index 25d89c555b7f..f6302c5ee2e1 100644 --- a/drivers/char/serial.c +++ b/drivers/char/serial.c @@ -154,13 +154,12 @@ static char *serial_revdate = "1999-11-17"; #ifdef MODVERSIONS #include #endif -#include #else /* !NEW_MODULES */ #ifdef MODVERSIONS #define MODULE #endif -#include #endif /* NEW_MODULES */ +#include #include #ifdef LOCAL_HEADERS diff --git a/drivers/net/8390.c b/drivers/net/8390.c index dde3b12a99aa..04c15f61c904 100644 --- a/drivers/net/8390.c +++ b/drivers/net/8390.c @@ -47,7 +47,6 @@ static const char *version = "8390.c:v1.10cvs 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n"; -#include #include #include #include diff --git a/drivers/net/Config.in b/drivers/net/Config.in index 3dc7e9ae3826..5314d96ee61e 100644 --- a/drivers/net/Config.in +++ b/drivers/net/Config.in @@ -153,9 +153,9 @@ if [ "$CONFIG_NET_ETHERNET" = "y" ]; then fi tristate ' PCI NE2000 support' CONFIG_NE2K_PCI # tristate ' Sundance Alta support' CONFIG_ALTA + tristate ' SiS 900/7016 PCI Fast Ethernet Adapter support' CONFIG_SIS900 tristate ' TI ThunderLAN support' CONFIG_TLAN tristate ' VIA Rhine support' CONFIG_VIA_RHINE - tristate ' SiS 900/7016 PCI Fast Ethernet Adapter support' CONFIG_SIS900 if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then tristate ' Racal-Interlan EISA ES3210 support (EXPERIMENTAL)' CONFIG_ES3210 tristate ' SMC EtherPower II (EXPERIMENTAL)' CONFIG_EPIC100 diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c index 928718b7eb14..cc1ce55a7bb1 100644 --- a/drivers/net/bmac.c +++ b/drivers/net/bmac.c @@ -166,7 +166,7 @@ static void bmac_txdma_intr(int irq, void *dev_id, struct pt_regs *regs); static void bmac_rxdma_intr(int irq, void *dev_id, struct pt_regs *regs); static void bmac_set_timeout(struct net_device *dev); static void bmac_tx_timeout(unsigned long data); -static int bmac_proc_info ( char *buffer, char **start, off_t offset, int length, int dummy); +static int bmac_proc_info ( char *buffer, char **start, off_t offset, int length); static int bmac_output(struct sk_buff *skb, struct net_device *dev); static void bmac_start(struct net_device *dev); @@ -1560,7 +1560,7 @@ static void dump_dbdma(volatile struct dbdma_cmd *cp,int count) #endif static int -bmac_proc_info(char *buffer, char **start, off_t offset, int length, int dummy) +bmac_proc_info(char *buffer, char **start, off_t offset, int length) { int len = 0; off_t pos = 0; diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c index 421803aae3d3..55ed5254e876 100644 --- a/drivers/net/hamradio/bpqether.c +++ b/drivers/net/hamradio/bpqether.c @@ -451,7 +451,7 @@ static char * bpq_print_ethaddr(unsigned char *e) return buf; } -int bpq_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int bpq_get_info(char *buffer, char **start, off_t offset, int length) { struct bpqdev *bpqdev; int len = 0; diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c index a46cff85f485..af3037916c00 100644 --- a/drivers/net/hamradio/scc.c +++ b/drivers/net/hamradio/scc.c @@ -2068,7 +2068,7 @@ static struct net_device_stats *scc_net_get_stats(struct net_device *dev) /* ******************************************************************** */ -static int scc_net_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int scc_net_get_info(char *buffer, char **start, off_t offset, int length) { struct scc_channel *scc; struct scc_kiss *kiss; diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c index d50539d6499e..e99d4c7a9c83 100644 --- a/drivers/net/hamradio/yam.c +++ b/drivers/net/hamradio/yam.c @@ -781,7 +781,7 @@ static void yam_interrupt(int irq, void *dev_id, struct pt_regs *regs) } } -static int yam_net_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int yam_net_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0; int i; diff --git a/drivers/net/pcmcia/ray_cs.c b/drivers/net/pcmcia/ray_cs.c index 39fac8b99885..ad7a7263a816 100644 --- a/drivers/net/pcmcia/ray_cs.c +++ b/drivers/net/pcmcia/ray_cs.c @@ -2527,8 +2527,7 @@ static char *nettype[] = {"Adhoc", "Infra "}; static char *framing[] = {"Encapsulation", "Translation"} ; /*===========================================================================*/ -static int ray_cs_proc_read(char *buf, char **start, off_t offset, - int len, int unused) +static int ray_cs_proc_read(char *buf, char **start, off_t offset, int len) { /* Print current values which are not available via other means * eg ifconfig diff --git a/drivers/net/strip.c b/drivers/net/strip.c index 1a5ae2a734ad..2f3eb9076782 100644 --- a/drivers/net/strip.c +++ b/drivers/net/strip.c @@ -1251,7 +1251,7 @@ sprintf_status_info(char *buffer, struct strip *strip_info) * the /proc file system. */ -static int get_status_info(char *buffer, char **start, off_t req_offset, int req_len, int dummy) +static int get_status_info(char *buffer, char **start, off_t req_offset, int req_len) { int total = 0, slop = 0; struct strip *strip_info = struct_strip_list; diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c index cbbee85327ed..13751db71031 100644 --- a/drivers/net/tlan.c +++ b/drivers/net/tlan.c @@ -1130,8 +1130,8 @@ u32 TLan_HandleTxEOF( struct net_device *dev, u16 host_int ) printk( "TLAN: Received interrupt for uncompleted TX frame.\n" ); } -#if LINUX_KERNEL_VERSION > 0x20100 - priv->stats->tx_bytes += head_list->frameSize; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,0) + priv->stats.tx_bytes += head_list->frameSize; #endif head_list->cStat = TLAN_CSTAT_UNUSED; @@ -1250,8 +1250,8 @@ u32 TLan_HandleRxEOF( struct net_device *dev, u16 host_int ) skb_reserve( skb, 2 ); t = (void *) skb_put( skb, head_list->frameSize ); -#if LINUX_KERNEL_VERSION > 0x20100 - priv->stats->rx_bytes += head_list->frameSize; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,0) + priv->stats.rx_bytes += head_list->frameSize; #endif memcpy( t, head_buffer, head_list->frameSize ); @@ -1274,8 +1274,8 @@ u32 TLan_HandleRxEOF( struct net_device *dev, u16 host_int ) skb = (struct sk_buff *) head_list->buffer[9].address; head_list->buffer[9].address = 0; skb_trim( skb, head_list->frameSize ); -#if LINUX_KERNEL_VERSION > 0x20100 - priv->stats->rx_bytes += head_list->frameSize; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,0) + priv->stats.rx_bytes += head_list->frameSize; #endif skb->protocol = eth_type_trans( skb, dev ); diff --git a/drivers/nubus/proc.c b/drivers/nubus/proc.c index 9295a0dde902..593162ef125d 100644 --- a/drivers/nubus/proc.c +++ b/drivers/nubus/proc.c @@ -26,8 +26,8 @@ #include #include -int -get_nubus_dev_info(char *buf, char **start, off_t pos, int count, int wr) +static int +get_nubus_dev_info(char *buf, char **start, off_t pos, int count) { struct nubus_dev *dev = nubus_devices; off_t at = 0; diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index 4688e82fb225..986ab0c3df60 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c @@ -234,8 +234,8 @@ static struct inode_operations proc_bus_pci_inode_operations = { #define LONG_FORMAT "\t%16lx" #endif -int -get_pci_dev_info(char *buf, char **start, off_t pos, int count, int wr) +static int +get_pci_dev_info(char *buf, char **start, off_t pos, int count) { struct pci_dev *dev = pci_devices; off_t at = 0; diff --git a/drivers/scsi/53c7,8xx.c b/drivers/scsi/53c7,8xx.c index 8991d84d414c..7954d557e762 100644 --- a/drivers/scsi/53c7,8xx.c +++ b/drivers/scsi/53c7,8xx.c @@ -1312,7 +1312,7 @@ normal_init (Scsi_Host_Template *tpnt, int board, int chip, */ if (base) { - instance->base = (unsigned char *) (unsigned long) base; + instance->base = (unsigned long) base; /* Check for forced I/O mapping */ if (!(options & OPTION_IO_MAPPED)) { options |= OPTION_MEMORY_MAPPED; @@ -1689,7 +1689,7 @@ NCR53c8x0_init_fixup (struct Scsi_Host *host) { memory_to_ncr = tmp|DMODE_800_DIOM; ncr_to_memory = tmp|DMODE_800_SIOM; } else { - base = virt_to_bus(host->base); + base = virt_to_bus((void *)host->base); memory_to_ncr = ncr_to_memory = tmp; } diff --git a/drivers/scsi/AM53C974.c b/drivers/scsi/AM53C974.c index 25fc2aea74d3..74b63bd37631 100644 --- a/drivers/scsi/AM53C974.c +++ b/drivers/scsi/AM53C974.c @@ -695,7 +695,7 @@ static int __init AM53C974_init(Scsi_Host_Template * tpnt, struct pci_dev *pdev instance = scsi_register(tpnt, sizeof(struct AM53C974_hostdata)); hostdata = (struct AM53C974_hostdata *) instance->hostdata; - instance->base = NULL; + instance->base = 0; instance->io_port = pdev->resource[0].start; instance->irq = pdev->irq; instance->dma_channel = -1; diff --git a/drivers/scsi/NCR53C9x.c b/drivers/scsi/NCR53C9x.c index d5158e5b973c..cdf480d706b2 100644 --- a/drivers/scsi/NCR53C9x.c +++ b/drivers/scsi/NCR53C9x.c @@ -668,7 +668,7 @@ void esp_initialize(struct NCR_ESP *esp) ccf, (int) esp->neg_defp); /* Fill in ehost data */ - esp->ehost->base = (unsigned char *) eregs; + esp->ehost->base = (unsigned long)eregs; esp->ehost->this_id = esp->scsi_id; esp->ehost->irq = esp->irq; diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index d032e6dd072d..877224d1c43e 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -5351,7 +5351,7 @@ advansys_detect(Scsi_Host_Template *tpnt) /* BIOS start address. */ if (ASC_NARROW_BOARD(boardp)) { - shp->base = (char *) ((ulong) AscGetChipBiosAddress( + shp->base = ((ulong) AscGetChipBiosAddress( asc_dvc_varp->iop_base, asc_dvc_varp->bus_type)); } else { @@ -5385,7 +5385,7 @@ advansys_detect(Scsi_Host_Template *tpnt) * Convert x86 realmode code segment to a linear * address by shifting left 4. */ - shp->base = (uchar *) (boardp->bios_codeseg << 4); + shp->base = (boardp->bios_codeseg << 4); } else { shp->base = 0; } diff --git a/drivers/scsi/aic7xxx.c b/drivers/scsi/aic7xxx.c index 9f48fce9840e..fc0c8ec1c551 100644 --- a/drivers/scsi/aic7xxx.c +++ b/drivers/scsi/aic7xxx.c @@ -280,10 +280,6 @@ # define FALSE 0 #endif -#ifndef KERNEL_VERSION -# define KERNEL_VERSION(x,y,z) (((x)<<16)+((y)<<8)+(z)) -#endif - /* * We need the bios32.h file if we are kernel version 2.1.92 or less. The * full set of pci_* changes wasn't in place until 2.1.93 @@ -7919,7 +7915,7 @@ aic7xxx_register(Scsi_Host_Template *template, struct aic7xxx_host *p, host->this_id = p->scsi_id; host->io_port = p->base; host->n_io_port = 0xFF; - host->base = (unsigned char *) p->mbase; + host->base = p->mbase; host->irq = p->irq; if (p->features & AHC_WIDE) { @@ -8043,7 +8039,7 @@ aic7xxx_register(Scsi_Host_Template *template, struct aic7xxx_host *p, { unsigned char devconfig; -#if LINUX_KERNEL_VERSION > KERNEL_VERSION(2,1,92) +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,92) pci_read_config_byte(p->pdev, DEVCONFIG, &devconfig); #else pcibios_read_config_byte(p->pci_bus, p->pci_device_fn, @@ -8061,7 +8057,7 @@ aic7xxx_register(Scsi_Host_Template *template, struct aic7xxx_host *p, if (aic7xxx_verbose & VERBOSE_PROBE2) printk("(scsi%d) Force clearing STPWLEV bit\n", p->host_no); } -#if LINUX_KERNEL_VERSION > KERNEL_VERSION(2,1,92) +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,92) pci_write_config_byte(p->pdev, DEVCONFIG, devconfig); #else pcibios_write_config_byte(p->pci_bus, p->pci_device_fn, @@ -9680,7 +9676,7 @@ aic7xxx_detect(Scsi_Host_Template *template) devconfig |= 0x80000040; pcibios_write_config_dword(pci_bus, pci_devfn, DEVCONFIG, devconfig); #endif /* AIC7XXX_STRICT_PCI_SETUP */ -#endif /* LINUIX_VERSION_CODE > KERNEL_VERSION(2,1,92) */ +#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2,1,92) */ temp_p->unpause = INTEN; temp_p->pause = temp_p->unpause | PAUSE; diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c index 3ca182501d60..8917f32f8daf 100644 --- a/drivers/scsi/dtc.c +++ b/drivers/scsi/dtc.c @@ -147,7 +147,7 @@ static struct override { #define NO_OVERRIDES (sizeof(overrides) / sizeof(struct override)) static struct base { - unsigned int address; + unsigned long address; int noauto; } bases[] __initdata = {{0xcc000, 0}, {0xc8000, 0}, {0xdc000, 0}, {0xd8000, 0}}; @@ -241,7 +241,7 @@ int __init dtc_detect(Scsi_Host_Template * tpnt){ break; instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata)); - instance->base = (void *)base; + instance->base = base; NCR5380_init(instance, 0); @@ -360,7 +360,7 @@ static inline int NCR5380_pread (struct Scsi_Host *instance, while (NCR5380_read(DTC_CONTROL_REG) & CSR_HOST_BUF_NOT_RDY) ++i; rtrc(3); - memcpy_fromio(d, base + DTC_DATA_BUF, 128); + isa_memcpy_fromio(d, base + DTC_DATA_BUF, 128); d += 128; len -= 128; rtrc(7); /*** with int's on, it sometimes hangs after here. @@ -410,7 +410,7 @@ static inline int NCR5380_pwrite (struct Scsi_Host *instance, while (NCR5380_read(DTC_CONTROL_REG) & CSR_HOST_BUF_NOT_RDY) ++i; rtrc(3); - memcpy_toio(base + DTC_DATA_BUF, src, 128); + isa_memcpy_toio(base + DTC_DATA_BUF, src, 128); src += 128; len -= 128; } diff --git a/drivers/scsi/eata_dma.c b/drivers/scsi/eata_dma.c index dd90d073d932..2ca322c0e688 100644 --- a/drivers/scsi/eata_dma.c +++ b/drivers/scsi/eata_dma.c @@ -1281,7 +1281,7 @@ short register_HBA(u32 base, struct get_conf *gc, Scsi_Host_Template * tpnt, hd->channel = gc->MAX_CHAN; sh->max_channel = gc->MAX_CHAN; sh->unique_id = base; - sh->base = (char *) base; + sh->base = base; sh->io_port = base; sh->n_io_port = 9; sh->irq = gc->IRQ; diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c index 4c08f5922f20..dca7ca7659a6 100644 --- a/drivers/scsi/eata_pio.c +++ b/drivers/scsi/eata_pio.c @@ -782,7 +782,7 @@ int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * tpnt) SD(sh)->devflags=1<scsi_id[3]; SD(sh)->moresupport=gc->MORE_support; sh->unique_id = base; - sh->base = (char *) base; + sh->base = base; sh->io_port = base; sh->n_io_port = 8; sh->irq = gc->IRQ; diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c index a2dcf462e56e..37e955b2a8b0 100644 --- a/drivers/scsi/g_NCR5380.c +++ b/drivers/scsi/g_NCR5380.c @@ -490,7 +490,7 @@ static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst, dst[start+i] = NCR5380_read(C400_HOST_BUFFER); #else /* implies CONFIG_SCSI_G_NCR5380_MEM */ - memcpy(dst+start,NCR53C400_host_buffer+NCR5380_map_name,128); + isa_memcpy_fromio(dst+start,NCR53C400_host_buffer+NCR5380_map_name,128); #endif start+=128; blocks--; @@ -511,7 +511,7 @@ static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst, dst[start+i] = NCR5380_read(C400_HOST_BUFFER); #else /* implies CONFIG_SCSI_G_NCR5380_MEM */ - memcpy(dst+start,NCR53C400_host_buffer+NCR5380_map_name,128); + isa_memcpy_fromio(dst+start,NCR53C400_host_buffer+NCR5380_map_name,128); #endif start+=128; blocks--; @@ -598,7 +598,7 @@ static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src NCR5380_write(C400_HOST_BUFFER, src[start+i]); #else /* implies CONFIG_SCSI_G_NCR5380_MEM */ - memcpy(NCR53C400_host_buffer+NCR5380_map_name,src+start,128); + isa_memcpy_toio(NCR53C400_host_buffer+NCR5380_map_name,src+start,128); #endif start+=128; blocks--; @@ -618,7 +618,7 @@ static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src NCR5380_write(C400_HOST_BUFFER, src[start+i]); #else /* implies CONFIG_SCSI_G_NCR5380_MEM */ - memcpy(NCR53C400_host_buffer+NCR5380_map_name,src+start,128); + isa_memcpy_toio(NCR53C400_host_buffer+NCR5380_map_name,src+start,128); #endif start+=128; blocks--; diff --git a/drivers/scsi/g_NCR5380.h b/drivers/scsi/g_NCR5380.h index 9844ed9bd833..32894de45bcb 100644 --- a/drivers/scsi/g_NCR5380.h +++ b/drivers/scsi/g_NCR5380.h @@ -140,8 +140,8 @@ int generic_NCR5380_proc_info(char* buffer, char** start, off_t offset, int leng #define NCR5380_region_size 0x3a00 -#define NCR5380_read(reg) (*(NCR5380_map_name + NCR53C400_mem_base + (reg))) -#define NCR5380_write(reg, value) (*(NCR5380_map_name + NCR53C400_mem_base + (reg)) = value) +#define NCR5380_read(reg) isa_readb(NCR5380_map_name + NCR53C400_mem_base + (reg)) +#define NCR5380_write(reg, value) isa_writeb(NCR5380_map_name + NCR53C400_mem_base + (reg), value) #endif diff --git a/drivers/scsi/hosts.h b/drivers/scsi/hosts.h index 9c4c37bb54d6..78375e844664 100644 --- a/drivers/scsi/hosts.h +++ b/drivers/scsi/hosts.h @@ -350,7 +350,7 @@ struct Scsi_Host unsigned wish_block:1; /* These parameters should be set by the detect routine */ - unsigned char *base; + unsigned long base; unsigned long io_port; unsigned char n_io_port; unsigned char dma_channel; @@ -486,11 +486,7 @@ extern void scsi_unregister_module(int, void *); * Even bigger hack for SparcSTORAGE arrays. Those are at least 6 disks, but * usually up to 30 disks, so everyone would need to change this. -jj */ -#ifdef CONFIG_SCSI_PLUTO_MODULE #define SD_EXTRA_DEVS 40 -#else -#define SD_EXTRA_DEVS 4 -#endif #define ST_EXTRA_DEVS 2 #define SR_EXTRA_DEVS 2 #define SG_EXTRA_DEVS (SD_EXTRA_DEVS + SR_EXTRA_DEVS + ST_EXTRA_DEVS) diff --git a/drivers/scsi/ini9100u.c b/drivers/scsi/ini9100u.c index db256c53c6b8..9cbab294901c 100644 --- a/drivers/scsi/ini9100u.c +++ b/drivers/scsi/ini9100u.c @@ -397,7 +397,7 @@ int i91u_detect(Scsi_Host_Template * tpnt) hreg->max_lun = 32; /* 10/21/97 */ hreg->irq = pHCB->HCS_Intr; hreg->this_id = pHCB->HCS_SCSI_ID; /* Assign HCS index */ - hreg->base = (UCHAR *) pHCB; + hreg->base = (unsigned long)pHCB; hreg->sg_tablesize = TOTAL_SG_ENTRY; /* Maximun support is 32 */ /* Initial tulip chip */ diff --git a/drivers/scsi/inia100.c b/drivers/scsi/inia100.c index ce541d225b46..decbb8af72dc 100644 --- a/drivers/scsi/inia100.c +++ b/drivers/scsi/inia100.c @@ -399,7 +399,7 @@ int inia100_detect(Scsi_Host_Template * tpnt) */ hreg->irq = pHCB->HCS_Intr; hreg->this_id = pHCB->HCS_SCSI_ID; /* Assign HCS index */ - hreg->base = (UCHAR *) pHCB; + hreg->base = (unsigned long)pHCB; #if 1 hreg->sg_tablesize = TOTAL_SG_ENTRY; /* Maximun support is 32 */ diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c index 837b4be833e7..9003dcb70e44 100644 --- a/drivers/scsi/ncr53c8xx.c +++ b/drivers/scsi/ncr53c8xx.c @@ -4498,7 +4498,7 @@ printk(KERN_INFO "ncr53c%s-%d: rev=0x%02x, base=0x%lx, io_port=0x%lx, irq=%d\n", instance->max_id = np->maxwide ? 16 : 8; instance->max_lun = SCSI_NCR_MAX_LUN; #ifndef NCR_IOMAPPED - instance->base = (char *) np->reg; + instance->base = (unsigned long)np->reg; #endif instance->irq = device->slot.irq; instance->unique_id = device->slot.io_port; diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 30fe2666675e..e89387421f14 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -59,6 +59,7 @@ #include #include #include +#include #include "scsi.h" #include "hosts.h" @@ -73,8 +74,7 @@ struct proc_dir_entry *proc_scsi = NULL; #ifdef CONFIG_PROC_FS -static int scsi_proc_info(char *buffer, char **start, off_t offset, - int length, int inout); +static int scsi_proc_info(char *buffer, char **start, off_t offset, int length); static void scsi_dump_status(int level); #endif @@ -1972,6 +1972,9 @@ void scsi_build_commandblocks(Scsi_Device * SDpnt) SDpnt->has_cmdblocks = 1; } +static ssize_t proc_scsi_gen_write(struct file * file, const char * buf, + unsigned long length, void *data); + #ifndef MODULE /* { */ /* * scsi_dev_init() is our initialization routine, which in turn calls host @@ -1983,6 +1986,7 @@ int __init scsi_dev_init(void) Scsi_Device *SDpnt; struct Scsi_Host *shpnt; struct Scsi_Device_Template *sdtpnt; + struct proc_dir_entry *generic; #ifdef FOO_ON_YOU return; #endif @@ -1999,7 +2003,13 @@ int __init scsi_dev_init(void) return -ENOMEM; } - create_proc_info_entry ("scsi/scsi", 0, 0, scsi_proc_info); + generic = create_proc_info_entry ("scsi/scsi", 0, 0, scsi_proc_info); + if (!generic) { + printk (KERN_ERR "cannot init /proc/scsi/scsi\n"); + remove_proc_entry("scsi", 0); + return -ENOMEM; + } + generic->write_proc = proc_scsi_gen_write; #endif /* Init a few things so we can "malloc" memory. */ @@ -2108,63 +2118,77 @@ static void print_inquiry(unsigned char *data) printk("\n"); } - #ifdef CONFIG_PROC_FS -static int scsi_proc_info(char *buffer, char **start, off_t offset, - int length, int inout) +static int scsi_proc_info(char *buffer, char **start, off_t offset, int length) { - Scsi_Cmnd *SCpnt; - struct Scsi_Device_Template *SDTpnt; Scsi_Device *scd; struct Scsi_Host *HBA_ptr; - char *p; - int host, channel, id, lun; int size, len = 0; off_t begin = 0; off_t pos = 0; - if (inout == 0) { - /* - * First, see if there are any attached devices or not. - */ - for (HBA_ptr = scsi_hostlist; HBA_ptr; HBA_ptr = HBA_ptr->next) { - if (HBA_ptr->host_queue != NULL) { - break; - } + /* + * First, see if there are any attached devices or not. + */ + for (HBA_ptr = scsi_hostlist; HBA_ptr; HBA_ptr = HBA_ptr->next) { + if (HBA_ptr->host_queue != NULL) { + break; } - size = sprintf(buffer + len, "Attached devices: %s\n", (HBA_ptr) ? "" : "none"); + } + size = sprintf(buffer + len, "Attached devices: %s\n", (HBA_ptr) ? "" : "none"); + len += size; + pos = begin + len; + for (HBA_ptr = scsi_hostlist; HBA_ptr; HBA_ptr = HBA_ptr->next) { +#if 0 + size += sprintf(buffer + len, "scsi%2d: %s\n", (int) HBA_ptr->host_no, + HBA_ptr->hostt->procname); len += size; pos = begin + len; - for (HBA_ptr = scsi_hostlist; HBA_ptr; HBA_ptr = HBA_ptr->next) { -#if 0 - size += sprintf(buffer + len, "scsi%2d: %s\n", (int) HBA_ptr->host_no, - HBA_ptr->hostt->procname); +#endif + for (scd = HBA_ptr->host_queue; scd; scd = scd->next) { + proc_print_scsidevice(scd, buffer, &size, len); len += size; pos = begin + len; -#endif - for (scd = HBA_ptr->host_queue; scd; scd = scd->next) { - proc_print_scsidevice(scd, buffer, &size, len); - len += size; - pos = begin + len; - - if (pos < offset) { - len = 0; - begin = pos; - } - if (pos > offset + length) - goto stop_output; + + if (pos < offset) { + len = 0; + begin = pos; } + if (pos > offset + length) + goto stop_output; } - - stop_output: - *start = buffer + (offset - begin); /* Start of wanted data */ - len -= (offset - begin); /* Start slop */ - if (len > length) - len = length; /* Ending slop */ - return (len); } - if (!buffer || length < 11 || strncmp("scsi", buffer, 4)) - return (-EINVAL); + +stop_output: + *start = buffer + (offset - begin); /* Start of wanted data */ + len -= (offset - begin); /* Start slop */ + if (len > length) + len = length; /* Ending slop */ + return (len); +} + +static ssize_t proc_scsi_gen_write(struct file * file, const char * buf, + unsigned long length, void *data) +{ + Scsi_Cmnd *SCpnt; + struct Scsi_Device_Template *SDTpnt; + Scsi_Device *scd; + struct Scsi_Host *HBA_ptr; + char *p; + int host, channel, id, lun; + char * buffer; + int err; + + if (!buf || length>PAGE_SIZE) + return -EINVAL; + + if (!(buffer = (char *) __get_free_page(GFP_KERNEL))) + return -ENOMEM; + copy_from_user(buffer, buf, length); + + err = -EINVAL; + if (length < 11 || strncmp("scsi", buffer, 4)) + goto out; /* * Usage: echo "scsi dump #N" > /proc/scsi/scsi @@ -2177,7 +2201,7 @@ static int scsi_proc_info(char *buffer, char **start, off_t offset, p = buffer + 10; if (*p == '\0') - return (-EINVAL); + goto out; level = simple_strtoul(p, NULL, 0); scsi_dump_status(level); @@ -2211,7 +2235,7 @@ static int scsi_proc_info(char *buffer, char **start, off_t offset, */ scsi_logging_level = 0; } else { - return (-EINVAL); + goto out; } } else { *p++ = '\0'; @@ -2242,7 +2266,7 @@ static int scsi_proc_info(char *buffer, char **start, off_t offset, } else if (strcmp(token, "ioctl") == 0) { SCSI_SET_IOCTL_LOGGING(level); } else { - return (-EINVAL); + goto out; } } @@ -2277,8 +2301,9 @@ static int scsi_proc_info(char *buffer, char **start, off_t offset, break; } } + err = -ENXIO; if (!HBA_ptr) - return (-ENXIO); + goto out; for (scd = HBA_ptr->host_queue; scd; scd = scd->next) { if ((scd->channel == channel @@ -2288,8 +2313,9 @@ static int scsi_proc_info(char *buffer, char **start, off_t offset, } } + err = -ENOSYS; if (scd) - return (-ENOSYS); /* We do not yet support unplugging */ + goto out; /* We do not yet support unplugging */ scan_scsis(HBA_ptr, 1, channel, id, lun); @@ -2299,8 +2325,8 @@ static int scsi_proc_info(char *buffer, char **start, off_t offset, if (HBA_ptr->select_queue_depths != NULL) (HBA_ptr->select_queue_depths) (HBA_ptr, HBA_ptr->host_queue); - return (length); - + err = length; + goto out; } /* * Usage: echo "scsi remove-single-device 0 1 2 3" >/proc/scsi/scsi @@ -2327,8 +2353,9 @@ static int scsi_proc_info(char *buffer, char **start, off_t offset, break; } } + err = -ENODEV; if (!HBA_ptr) - return (-ENODEV); + goto out; for (scd = HBA_ptr->host_queue; scd; scd = scd->next) { if ((scd->channel == channel @@ -2339,10 +2366,11 @@ static int scsi_proc_info(char *buffer, char **start, off_t offset, } if (scd == NULL) - return (-ENODEV); /* there is no such device attached */ + goto out; /* there is no such device attached */ + err = -EBUSY; if (scd->access_count) - return (-EBUSY); + goto out; SDTpnt = scsi_devicelist; while (SDTpnt != NULL) { @@ -2372,11 +2400,14 @@ static int scsi_proc_info(char *buffer, char **start, off_t offset, } scsi_init_free((char *) scd, sizeof(Scsi_Device)); } else { - return (-EBUSY); + goto out; } - return (0); + err = 0; } - return (-EINVAL); +out: + + free_page((unsigned long) buffer); + return err; } #endif @@ -3246,6 +3277,7 @@ int init_module(void) { unsigned long size; int has_space = 0; + struct proc_dir_entry *generic; /* * This makes /proc/scsi and /proc/scsi/scsi visible. @@ -3256,7 +3288,13 @@ int init_module(void) printk (KERN_ERR "cannot init /proc/scsi\n"); return -ENOMEM; } - create_proc_info_entry ("scsi/scsi", 0, 0, scsi_proc_info); + generic = create_proc_info_entry ("scsi/scsi", 0, 0, scsi_proc_info); + if (!generic) { + printk (KERN_ERR "cannot init /proc/scsi/scsi\n"); + remove_proc_entry("scsi", 0); + return -ENOMEM; + } + generic->write_proc = proc_scsi_gen_write; #endif scsi_loadable_module_flag = 1; diff --git a/drivers/scsi/seagate.c b/drivers/scsi/seagate.c index 05f49569e688..402b6e1c429c 100644 --- a/drivers/scsi/seagate.c +++ b/drivers/scsi/seagate.c @@ -245,10 +245,10 @@ static unsigned char controller_type = 0; /* set to SEAGATE for ST0x static int irq = IRQ; #define retcode(result) (((result) << 16) | (message << 8) | status) -#define STATUS ((u8) readb(st0x_cr_sr)) -#define DATA ((u8) readb(st0x_dr)) -#define WRITE_CONTROL(d) { writeb((d), st0x_cr_sr); } -#define WRITE_DATA(d) { writeb((d), st0x_dr); } +#define STATUS ((u8) isa_readb(st0x_cr_sr)) +#define DATA ((u8) isa_readb(st0x_dr)) +#define WRITE_CONTROL(d) { isa_writeb((d), st0x_cr_sr); } +#define WRITE_DATA(d) { isa_writeb((d), st0x_dr); } void st0x_setup (char *str, int *ints) { diff --git a/drivers/scsi/sim710.c b/drivers/scsi/sim710.c index 61e91c38fd5e..e7489348df88 100644 --- a/drivers/scsi/sim710.c +++ b/drivers/scsi/sim710.c @@ -58,11 +58,10 @@ * */ -#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s)) - #include #include +#include #include #include #include @@ -74,9 +73,9 @@ #include #include #include -#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,17) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,17) #include -#elif LINUX_VERSION_CODE >= LinuxVersionCode(2,1,93) +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,93) #include #endif #include @@ -291,8 +290,9 @@ static __inline__ void run_process_issue_queue(struct sim710_hostdata *); static void process_issue_queue (struct sim710_hostdata *, unsigned long flags); static int full_reset(struct Scsi_Host * host); + /* - * Function: void sim710_setup(char *str, int *ints) + * Function: int param_setup(char *str) */ #ifdef MODULE @@ -301,8 +301,8 @@ static int full_reset(struct Scsi_Host * host); #define ARG_SEP ',' #endif -void -sim710_setup(char *str, int *ints) +static int +param_setup(char *str) { char *cur = str; char *pc, *pv; @@ -340,7 +340,7 @@ sim710_setup(char *str, int *ints) opt_noneg = val; else if (!strncmp(cur, "disabled:", 5)) { no_of_boards = -1; - return; + return 1; } #ifdef DEBUG else if (!strncmp(cur, "debug:", 6)) { @@ -348,19 +348,28 @@ sim710_setup(char *str, int *ints) } #endif else - printk("sim710_setup: unexpected boot option '%.*s' ignored\n", (int)(pc-cur+1), cur); + printk("sim710: unexpected boot option '%.*s' ignored\n", (int)(pc-cur+1), cur); if ((cur = strchr(cur, ARG_SEP)) != NULL) ++cur; } + return 1; } -#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,13) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13) #ifndef MODULE -__setup("sim710=", sim710_setup); +__setup("sim710=", param_setup); #endif +#else +/* Old boot param syntax support */ +void +sim710_setup(char *str, int *ints) +{ + param_setup(str); +} #endif + /* * Function: static const char *sbcl_to_phase (int sbcl) */ @@ -1324,7 +1333,7 @@ sim710_detect(Scsi_Host_Template * tpnt) #ifdef MODULE if (sim710) - sim710_setup(sim710, (int *)0); + param_setup(sim710); #endif if (no_of_boards < 0) { @@ -1462,7 +1471,7 @@ sim710_detect(Scsi_Host_Template * tpnt) host->irq = irq_vector; host->this_id = scsi_id; host->unique_id = base_addr; - host->base = (char *)base_addr; + host->base = base_addr; ncr_halt(host); diff --git a/drivers/scsi/sym53c8xx.c b/drivers/scsi/sym53c8xx.c index d1443aeedd78..5cd4d6070b63 100644 --- a/drivers/scsi/sym53c8xx.c +++ b/drivers/scsi/sym53c8xx.c @@ -5474,7 +5474,7 @@ printk(KERN_INFO NAME53C "%s-%d: rev=0x%02x, base=0x%lx, io_port=0x%lx, irq=%d\n instance->max_id = np->maxwide ? 16 : 8; instance->max_lun = MAX_LUN; #ifndef NCR_IOMAPPED - instance->base = (char *) np->reg; + instance->base = np->reg; #endif instance->irq = np->irq; instance->unique_id = np->base_io; diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index c8bab6983969..0420c4dc1af3 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c @@ -122,14 +122,14 @@ #include static struct override { - unsigned char *address; + unsigned long address; int irq; } overrides #ifdef T128_OVERRIDE [] __initdata = T128_OVERRIDE; #else - [4] __initdata = {{NULL,IRQ_AUTO}, {NULL,IRQ_AUTO}, - {NULL,IRQ_AUTO}, {NULL,IRQ_AUTO}}; + [4] __initdata = {{0, IRQ_AUTO}, {0, IRQ_AUTO}, + {0 ,IRQ_AUTO}, {0, IRQ_AUTO}}; #endif #define NO_OVERRIDES (sizeof(overrides) / sizeof(struct override)) @@ -169,7 +169,7 @@ void __init t128_setup(char *str, int *ints){ printk("t128_setup : usage t128=address,irq\n"); else if (commandline_current < NO_OVERRIDES) { - overrides[commandline_current].address = (unsigned char *) ints[1]; + overrides[commandline_current].address = ints[1]; overrides[commandline_current].irq = ints[2]; for (i = 0; i < NO_BASES; ++i) if (bases[i].address == ints[1]) { @@ -196,14 +196,14 @@ void __init t128_setup(char *str, int *ints){ int __init t128_detect(Scsi_Host_Template * tpnt){ static int current_override = 0, current_base = 0; struct Scsi_Host *instance; - unsigned char *base; + unsigned long base; int sig, count; tpnt->proc_name = "t128"; tpnt->proc_info = &t128_proc_info; for (count = 0; current_override < NO_OVERRIDES; ++current_override) { - base = NULL; + base = 0; if (overrides[current_override].address) base = overrides[current_override].address; @@ -218,7 +218,7 @@ int __init t128_detect(Scsi_Host_Template * tpnt){ signatures[sig].offset, signatures[sig].string, strlen(signatures[sig].string))) { - base = (unsigned char *) bases[current_base].address; + base = bases[current_base].address; #if (TDEBUG & TDEBUG_INIT) printk("scsi-t128 : detected board.\n"); #endif @@ -234,7 +234,7 @@ int __init t128_detect(Scsi_Host_Template * tpnt){ break; instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata)); - instance->base = phys_to_virt((unsigned int)base); + instance->base = base; NCR5380_init(instance, 0); @@ -259,8 +259,7 @@ int __init t128_detect(Scsi_Host_Template * tpnt){ printk("scsi%d : irq = %d\n", instance->host_no, instance->irq); #endif - printk("scsi%d : at 0x%08x", instance->host_no, (int) - instance->base); + printk("scsi%d : at 0x%08lx", instance->host_no, instance->base); if (instance->irq == IRQ_NONE) printk (" interrupts disabled"); else @@ -320,28 +319,28 @@ int t128_biosparam(Disk * disk, kdev_t dev, int * ip) static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst, int len) { - register unsigned char *reg = (unsigned char *) (instance->base + - T_DATA_REG_OFFSET), *d = dst; + unsigned long reg = instance->base + T_DATA_REG_OFFSET; + unsigned char *d = dst; register int i = len; #if 0 for (; i; --i) { - while (!(instance->base[T_STATUS_REG_OFFSET]) & T_ST_RDY) barrier(); + while (!(isa_readb(instance->base+T_STATUS_REG_OFFSET) & T_ST_RDY)) barrier(); #else - while (!(instance->base[T_STATUS_REG_OFFSET]) & T_ST_RDY) barrier(); + while (!(isa_readb(instance->base+T_STATUS_REG_OFFSET) & T_ST_RDY)) barrier(); for (; i; --i) { #endif - *d++ = *reg; + *d++ = isa_readb(reg); } - if (*(instance->base + T_STATUS_REG_OFFSET) & T_ST_TIM) { + if (isa_readb(instance->base + T_STATUS_REG_OFFSET) & T_ST_TIM) { unsigned char tmp; - volatile unsigned char *foo; + unsigned long foo; foo = instance->base + T_CONTROL_REG_OFFSET; - tmp = *foo; - *foo = tmp | T_CR_CT; - *foo = tmp; + tmp = isa_readb(foo); + isa_writeb(tmp | T_CR_CT, foo); + isa_writeb(tmp, foo); printk("scsi%d : watchdog timer fired in NCR5380_pread()\n", instance->host_no); return -1; @@ -364,27 +363,27 @@ static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst, static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src, int len) { - register unsigned char *reg = (unsigned char *) (instance->base + - T_DATA_REG_OFFSET), *s = src; + unsigned long reg = instance->base + T_DATA_REG_OFFSET; + unsigned char *s = src; register int i = len; #if 0 for (; i; --i) { - while (!(instance->base[T_STATUS_REG_OFFSET]) & T_ST_RDY) barrier(); + while (!(isa_readb(instance->base+T_STATUS_REG_OFFSET) & T_ST_RDY)) barrier(); #else - while (!(instance->base[T_STATUS_REG_OFFSET]) & T_ST_RDY) barrier(); + while (!(isa_readb(instance->base+T_STATUS_REG_OFFSET) & T_ST_RDY)) barrier(); for (; i; --i) { #endif - *reg = *s++; + isa_writeb(*s++, reg); } - if (*(instance->base + T_STATUS_REG_OFFSET) & T_ST_TIM) { + if (isa_readb(instance->base + T_STATUS_REG_OFFSET) & T_ST_TIM) { unsigned char tmp; - volatile unsigned char *foo; + unsigned long foo; foo = instance->base + T_CONTROL_REG_OFFSET; - tmp = *foo; - *foo = tmp | T_CR_CT; - *foo = tmp; + tmp = isa_readb(foo); + isa_writeb(tmp | T_CR_CT, foo); + isa_writeb(tmp, foo); printk("scsi%d : watchdog timer fired in NCR5380_pwrite()\n", instance->host_no); return -1; diff --git a/drivers/scsi/t128.h b/drivers/scsi/t128.h index e3a8b6c90d38..9e4e98d04803 100644 --- a/drivers/scsi/t128.h +++ b/drivers/scsi/t128.h @@ -137,28 +137,28 @@ int t128_proc_info (char *buffer, char **start, off_t offset, #ifndef HOSTS_C #define NCR5380_implementation_fields \ - volatile unsigned char *base + unsigned long base #define NCR5380_local_declare() \ - volatile unsigned char *base + unsigned long base #define NCR5380_setup(instance) \ - base = (volatile unsigned char *) (instance)->base + base = (instance)->base #define T128_address(reg) (base + T_5380_OFFSET + ((reg) * 0x20)) #if !(TDEBUG & TDEBUG_TRANSFER) -#define NCR5380_read(reg) (*(T128_address(reg))) -#define NCR5380_write(reg, value) (*(T128_address(reg)) = (value)) +#define NCR5380_read(reg) isa_readb(T128_address(reg)) +#define NCR5380_write(reg, value) isa_writeb((value),(T128_address(reg))) #else #define NCR5380_read(reg) \ (((unsigned char) printk("scsi%d : read register %d at address %08x\n"\ - , instance->hostno, (reg), T128_address(reg))), *(T128_address(reg))) + , instance->hostno, (reg), T128_address(reg))), isa_readb(T128_address(reg))) #define NCR5380_write(reg, value) { \ printk("scsi%d : write %02x to register %d at address %08x\n", \ instance->hostno, (value), (reg), T128_address(reg)); \ - *(T128_address(reg)) = (value); \ + isa_writeb((value), (T128_address(reg))); \ } #endif diff --git a/drivers/sound/soundcard.c b/drivers/sound/soundcard.c index 97d05c93bf39..5d1425bfccc3 100644 --- a/drivers/sound/soundcard.c +++ b/drivers/sound/soundcard.c @@ -152,7 +152,7 @@ static int get_mixer_levels(caddr_t arg) return 0; } -static int sound_proc_get_info(char *buffer, char **start, off_t offset, int length, int inout) +static int sound_proc_get_info(char *buffer, char **start, off_t offset, int length) { int len, i, drv; off_t pos = 0; @@ -325,7 +325,7 @@ static ssize_t sndstat_file_read(struct file * file, char * buf, size_t nbytes, count = MIN(PROC_BLOCK_SIZE, nbytes); start = NULL; - n = sound_proc_get_info(page, &start, *ppos, count, 0); + n = sound_proc_get_info(page, &start, *ppos, count); if (n < count) eof = 1; diff --git a/drivers/usb/cpia.c b/drivers/usb/cpia.c index 0042b2ddb676..46b190e9b955 100644 --- a/drivers/usb/cpia.c +++ b/drivers/usb/cpia.c @@ -26,7 +26,8 @@ #include "usb.h" #include "cpia.h" -#define CPIA_DEBUG /* Gobs of debugging info */ +static int debug = 0; +MODULE_PARM(debug, "i"); /* Video Size 384 x 288 x 3 bytes for RGB */ /* 384 because xawtv tries to grab 384 even though we tell it 352 is our max */ @@ -295,7 +296,8 @@ static void cpia_parse_data(struct usb_cpia *cpia) { struct cpia_frame *frame, *pframe; unsigned char *data = cpia->scratch; - unsigned long l; + unsigned long left; + long copylen = 0; /* Grab the current frame and the previous frame */ frame = &cpia->frame[cpia->curframe]; @@ -310,7 +312,7 @@ static void cpia_parse_data(struct usb_cpia *cpia) { struct cpia_frame_header *header; - /* We need atleast 2 bytes for the magic value */ + /* We need at least 2 bytes for the magic value */ if (scratch_left(data) < 2) goto out; @@ -329,7 +331,8 @@ static void cpia_parse_data(struct usb_cpia *cpia) while (scratch_left(data) >= 4) { if (*((__u32 *)data) == 0xFFFFFFFF) { data += 4; - printk(KERN_INFO "cpia: EOF while scanning for magic\n"); + if (debug >= 1) + printk(KERN_INFO "cpia: EOF while scanning for magic\n"); goto error; } data++; @@ -337,7 +340,7 @@ static void cpia_parse_data(struct usb_cpia *cpia) break; } case STATE_HEADER: - /* We need atleast 64 bytes for the header */ + /* We need at least 64 bytes for the header */ if (scratch_left(data) < sizeof(struct cpia_frame_header)) goto out; @@ -352,16 +355,17 @@ static void cpia_parse_data(struct usb_cpia *cpia) frame->header.col_start) * 8; frame->hdrheight = (frame->header.row_end - frame->header.row_start) * 4; -#ifdef CPIA_DEBUG - printk("cpia: frame size %dx%d\n", - frame->hdrwidth, frame->hdrheight); - printk("cpia: frame %scompressed\n", - frame->header.comp_enable ? "" : "not "); -#endif + if (debug >= 2) { + printk(KERN_DEBUG "cpia: frame size %dx%d\n", + frame->hdrwidth, frame->hdrheight); + printk(KERN_DEBUG "cpia: frame %scompressed\n", + frame->header.comp_enable ? "" : "not "); + } frame->scanstate = STATE_LINES; frame->curline = 0; break; + case STATE_LINES: { unsigned char *f, *end; @@ -378,7 +382,8 @@ static void cpia_parse_data(struct usb_cpia *cpia) /* Check to make sure it's nothing outrageous */ if (len > (frame->hdrwidth * 2) + 1) { - printk(KERN_INFO "cpia: bad length, resynching (expected %d, got %d)\n", (frame->hdrwidth * 2) + 1, len); + if (debug >= 1) + printk(KERN_DEBUG "cpia: bad length, resynching (expected %d, got %d)\n", (frame->hdrwidth * 2) + 1, len); goto error; } @@ -391,7 +396,8 @@ static void cpia_parse_data(struct usb_cpia *cpia) /* Is the end of the line there */ if (data[len - 1] != 0xFD) { - printk(KERN_INFO "cpia: lost synch\n"); + if (debug >= 1) + printk(KERN_DEBUG "cpia: lost synch\n"); goto error; } @@ -412,6 +418,7 @@ static void cpia_parse_data(struct usb_cpia *cpia) /* Compress RLE data */ i = *data >> 1; memcpy(f, fp, i * 3); + copylen += (i * 3); f += (i * 3); fp += (i * 3); data++; @@ -432,6 +439,7 @@ y1 *= 76310; *f++ = LIMIT(b + y); *f++ = LIMIT(g + y); *f++ = LIMIT(r + y); *f++ = LIMIT(b + y1); *f++ = LIMIT(g + y1); *f++ = LIMIT(r + y1); fp += 6; + copylen += 6; } } } else { @@ -448,15 +456,10 @@ y *= 76310; y1 *= 76310; *f++ = LIMIT(b + y); *f++ = LIMIT(g + y); *f++ = LIMIT(r + y); *f++ = LIMIT(b + y1); *f++ = LIMIT(g + y1); *f++ = LIMIT(r + y1); +copylen += 6; } } -#ifdef CPIA_DEBUG - /* Make sure we found the end correctly */ - if (*data != 0xFD) - printk("cpia: missed end!\n"); -#endif - /* Skip the last byte */ data++; @@ -464,43 +467,48 @@ y1 *= 76310; goto nextframe; break; - } - } - } + } /* end case STATE_LINES */ + } /* end switch (scanstate) */ + } /* end while (1) */ nextframe: -#ifdef CPIA_DEBUG - printk("cpia: marking as success\n"); -#endif + if (debug >= 1) + printk(KERN_DEBUG "cpia: marking as success\n"); + if (scratch_left(data) >= 4 && *((__u32 *)data) == 0xFFFFFFFF) data += 4; frame->grabstate = FRAME_DONE; - cpia->curframe = -1; - /* This will cause the process to request another frame */ - if (waitqueue_active(&frame->wq)) - wake_up_interruptible(&frame->wq); - - goto out; + goto wakeup; error: -#ifdef CPIA_DEBUG - printk("cpia: marking as error\n"); -#endif + if (debug >= 1) + printk(KERN_DEBUG "cpia: marking as error\n"); + frame->grabstate = FRAME_ERROR; - cpia->curframe = -1; + + /* Get a fresh frame since this frame may have been important */ cpia->compress = 0; - /* This will cause the process to request another frame */ + copylen = 0; + +wakeup: + + cpia->curframe = -1; + + /* This will cause the process to request another frame. */ if (waitqueue_active(&frame->wq)) wake_up_interruptible(&frame->wq); out: /* Grab the remaining */ - l = scratch_left(data); - memmove(cpia->scratch, data, l); - cpia->scratchlen = l; + left = scratch_left(data); + memmove(cpia->scratch, data, left); + cpia->scratchlen = left; + + /* Update the frame's uncompressed length. */ + frame->scanlength += copylen; } /* @@ -515,24 +523,23 @@ static int cpia_compress_isochronous(struct usb_cpia *cpia, struct usb_isoc_desc data = cpia->scratch + cpia->scratchlen; for (i = 0; i < isodesc->frame_count; i++) { int n = isodesc->frames[i].frame_length; -#ifdef CPIA_DEBUG int st = isodesc->frames[i].frame_status; - if (st) + if (st && debug >= 1) printk(KERN_DEBUG "cpia data error: [%d] len=%d, status=%X\n", i, n, st); -#endif + if ((cpia->scratchlen + n) > SCRATCH_BUF_SIZE) { - printk(KERN_ERR "cpia: scratch buf overflow!\n"); - return 0; + printk(KERN_DEBUG "cpia: scratch buf overflow!\n"); + return totlen; } - if (n) + if (n) { memmove(data, cdata, n); - - data += n; - totlen += n; - cpia->scratchlen += n; + data += n; + totlen += n; + cpia->scratchlen += n; + } cdata += isodesc->frame_size; } @@ -547,7 +554,8 @@ static int cpia_isoc_irq(int status, void *__buffer, int len, void *isocdesc) int i; if (!cpia->streaming) { - printk("cpia: oops, not streaming, but interrupt\n"); + if (debug >= 1) + printk(KERN_DEBUG "cpia: oops, not streaming, but interrupt\n"); return 0; } @@ -558,10 +566,11 @@ static int cpia_isoc_irq(int status, void *__buffer, int len, void *isocdesc) len = cpia_compress_isochronous(cpia, sbuf->isodesc); /* If we don't have a frame we're current working on, complain */ - if (len) { - if (cpia->curframe < 0) - printk("cpia: received data, but no frame available\n"); - else + if (cpia->scratchlen) { + if (cpia->curframe < 0) { + if (debug >= 1) + printk(KERN_DEBUG "cpia: received data, but no frame available\n"); + } else cpia_parse_data(cpia); } @@ -583,6 +592,7 @@ static int cpia_init_isoc(struct usb_cpia *cpia) struct usb_isoc_desc *id; int fx, err; + cpia->compress = 0; cpia->curframe = -1; cpia->cursbuf = 0; cpia->scratchlen = 0; @@ -597,7 +607,7 @@ static int cpia_init_isoc(struct usb_cpia *cpia) err = usb_init_isoc(dev, usb_rcvisocpipe(dev, 1), FRAMES_PER_DESC, cpia, &cpia->sbuf[0].isodesc); if (err) { - printk(KERN_ERR "cpia_init_isoc: usb_init_isoc() ret %d\n", + printk(KERN_ERR "cpia_init_isoc: usb_init_isoc ret %d\n", err); return -ENOMEM; } @@ -605,17 +615,12 @@ static int cpia_init_isoc(struct usb_cpia *cpia) err = usb_init_isoc(dev, usb_rcvisocpipe(dev, 1), FRAMES_PER_DESC, cpia, &cpia->sbuf[1].isodesc); if (err) { - printk(KERN_ERR "cpia_init_isoc: usb_init_isoc() ret %d\n", + printk(KERN_ERR "cpia_init_isoc: usb_init_isoc ret %d\n", err); usb_free_isoc (cpia->sbuf[0].isodesc); return -ENOMEM; } -#ifdef CPIA_DEBUG - printk("isodesc[0] @ %p\n", cpia->sbuf[0].isodesc); - printk("isodesc[1] @ %p\n", cpia->sbuf[1].isodesc); -#endif - /* Set the Isoc. desc. parameters. */ /* First for desc. [0] */ id = cpia->sbuf[0].isodesc; @@ -639,10 +644,12 @@ static int cpia_init_isoc(struct usb_cpia *cpia) err = usb_run_isoc(cpia->sbuf[0].isodesc, NULL); if (err) - printk(KERN_ERR "CPiA USB driver error (%d) on usb_run_isoc\n", err); + printk(KERN_ERR "cpia_init_isoc: usb_run_isoc ret %d\n", + err); err = usb_run_isoc(cpia->sbuf[1].isodesc, cpia->sbuf[0].isodesc); if (err) - printk(KERN_ERR "CPiA USB driver error (%d) on usb_run_isoc\n", err); + printk(KERN_ERR "cpia_init_isoc: usb_run_isoc ret %d\n", + err); cpia->streaming = 1; @@ -656,13 +663,13 @@ static void cpia_stop_isoc(struct usb_cpia *cpia) /* Turn off continuous grab */ if (usb_cpia_set_grab_mode(cpia->dev, 0) < 0) { - printk(KERN_INFO "cpia_set_grab_mode error\n"); + printk(KERN_ERR "cpia_set_grab_mode error\n"); return /* -EBUSY */; } /* Set packet size to 0 */ if (usb_set_interface(cpia->dev, 1, 0) < 0) { - printk(KERN_INFO "usb_set_interface error\n"); + printk(KERN_ERR "usb_set_interface error\n"); return /* -EINVAL */; } @@ -696,6 +703,7 @@ static int cpia_new_frame(struct usb_cpia *cpia, int framenum) frame->grabstate = FRAME_GRABBING; frame->scanstate = STATE_SCANNING; + frame->scanlength = 0; /* accumulated in cpia_parse_data() */ cpia->curframe = framenum; @@ -714,7 +722,7 @@ static int cpia_new_frame(struct usb_cpia *cpia, int framenum) if (usb_cpia_set_compression(cpia->dev, cpia->compress ? COMP_AUTO : COMP_DISABLED, DONT_DECIMATE) < 0) { - printk(KERN_INFO "cpia_set_compression error\n"); + printk(KERN_ERR "cpia_set_compression error\n"); return -EBUSY; } @@ -723,7 +731,7 @@ static int cpia_new_frame(struct usb_cpia *cpia, int framenum) /* Grab the frame */ if (usb_cpia_upload_frame(cpia->dev, WAIT_FOR_NEXT_FRAME) < 0) { - printk(KERN_INFO "cpia_upload_frame error\n"); + printk(KERN_ERR "cpia_upload_frame error\n"); return -EBUSY; } @@ -733,16 +741,18 @@ static int cpia_new_frame(struct usb_cpia *cpia, int framenum) /* Video 4 Linux API */ static int cpia_open(struct video_device *dev, int flags) { - int err = -ENOMEM; + int err = -EBUSY; struct usb_cpia *cpia = (struct usb_cpia *)dev; -#ifdef CPIA_DEBUG - printk("cpia_open\n"); -#endif + down(&cpia->lock); + if (cpia->user) + goto out_unlock; cpia->frame[0].grabstate = FRAME_UNUSED; cpia->frame[1].grabstate = FRAME_UNUSED; + err = -ENOMEM; + /* Allocate memory for the frame buffers */ cpia->fbuf = rvmalloc(2 * MAX_FRAME_SIZE); if (!cpia->fbuf) @@ -750,10 +760,6 @@ static int cpia_open(struct video_device *dev, int flags) cpia->frame[0].data = cpia->fbuf; cpia->frame[1].data = cpia->fbuf + MAX_FRAME_SIZE; -#ifdef CPIA_DEBUG - printk("frame [0] @ %p\n", cpia->frame[0].data); - printk("frame [1] @ %p\n", cpia->frame[1].data); -#endif cpia->sbuf[0].data = kmalloc (FRAMES_PER_DESC * FRAME_SIZE_PER_DESC, GFP_KERNEL); if (!cpia->sbuf[0].data) @@ -763,15 +769,22 @@ static int cpia_open(struct video_device *dev, int flags) if (!cpia->sbuf[1].data) goto open_err_on1; -#ifdef CPIA_DEBUG - printk("sbuf[0] @ %p\n", cpia->sbuf[0].data); - printk("sbuf[1] @ %p\n", cpia->sbuf[1].data); -#endif + /* Set default sizes in case IOCTL (VIDIOCMCAPTURE) is not used + * (using read() instead). */ + cpia->frame[0].width = 352; + cpia->frame[0].height = 288; + cpia->frame[0].bytes_read = 0; + cpia->frame[1].width = 352; + cpia->frame[1].height = 288; + cpia->frame[1].bytes_read = 0; err = cpia_init_isoc(cpia); if (err) goto open_err_on2; + cpia->user++; + up(&cpia->lock); + MOD_INC_USE_COUNT; return 0; @@ -784,15 +797,18 @@ open_err_on0: rvfree(cpia->fbuf, 2 * MAX_FRAME_SIZE); open_err_ret: return err; + +out_unlock: + up(&cpia->lock); + return err; } static void cpia_close(struct video_device *dev) { struct usb_cpia *cpia = (struct usb_cpia *)dev; -#ifdef CPIA_DEBUG - printk("cpia_close\n"); -#endif + down(&cpia->lock); + cpia->user--; MOD_DEC_USE_COUNT; @@ -802,6 +818,8 @@ static void cpia_close(struct video_device *dev) kfree(cpia->sbuf[1].data); kfree(cpia->sbuf[0].data); + + up(&cpia->lock); } static int cpia_init_done(struct video_device *dev) @@ -823,10 +841,6 @@ static int cpia_ioctl(struct video_device *dev, unsigned int cmd, void *arg) { struct video_capability b; -#ifdef CPIA_DEBUG - printk("GCAP\n"); -#endif - strcpy(b.name, "CPiA USB Camera"); b.type = VID_TYPE_CAPTURE | VID_TYPE_SUBCAPTURE; b.channels = 1; @@ -845,10 +859,6 @@ static int cpia_ioctl(struct video_device *dev, unsigned int cmd, void *arg) { struct video_channel v; -#ifdef CPIA_DEBUG - printk("GCHAN\n"); -#endif - if (copy_from_user(&v, arg, sizeof(v))) return -EFAULT; if (v.channel != 0) @@ -861,16 +871,13 @@ static int cpia_ioctl(struct video_device *dev, unsigned int cmd, void *arg) if (copy_to_user(arg, &v, sizeof(v))) return -EFAULT; + return 0; } case VIDIOCSCHAN: { int v; -#ifdef CPIA_DEBUG - printk("SCHAN\n"); -#endif - if (copy_from_user(&v, arg, sizeof(v))) return -EFAULT; @@ -883,10 +890,6 @@ static int cpia_ioctl(struct video_device *dev, unsigned int cmd, void *arg) { struct video_picture p; -#ifdef CPIA_DEBUG - printk("GPICT\n"); -#endif - p.colour = 0x8000; /* Damn British people :) */ p.hue = 0x8000; p.brightness = 180 << 8; /* XXX */ @@ -904,39 +907,24 @@ static int cpia_ioctl(struct video_device *dev, unsigned int cmd, void *arg) { struct video_picture p; -#ifdef CPIA_DEBUG - printk("SPICT\n"); -#endif - if (copy_from_user(&p, arg, sizeof(p))) return -EFAULT; -#ifdef CPIA_DEBUG - printk("Attempting to set palette %d, depth %d\n", - p.palette, p.depth); - printk("SPICT: brightness=%d, hue=%d, colour=%d, contrast=%d, whiteness=%d\n", - p.brightness, p.hue, p.colour, p.contrast, p.whiteness); -#endif - return 0; } case VIDIOCSWIN: { struct video_window vw; -#ifdef CPIA_DEBUG - printk("SWIN\n"); -#endif - if (copy_from_user(&vw, arg, sizeof(vw))) return -EFAULT; if (vw.flags) return -EINVAL; if (vw.clipcount) return -EINVAL; - if (vw.height != 176) + if (vw.height != 288) return -EINVAL; - if (vw.width != 144) + if (vw.width != 352) return -EINVAL; cpia->compress = 0; @@ -947,16 +935,12 @@ static int cpia_ioctl(struct video_device *dev, unsigned int cmd, void *arg) { struct video_window vw; -#ifdef CPIA_DEBUG - printk("GWIN\n"); -#endif - vw.x = 0; vw.y = 0; - vw.width = 176; - vw.height = 144; + vw.width = 352; + vw.height = 288; vw.chromakey = 0; - vw.flags = 0; + vw.flags = 30; /* 30 fps */ if (copy_to_user(arg, &vw, sizeof(vw))) return -EFAULT; @@ -966,9 +950,6 @@ static int cpia_ioctl(struct video_device *dev, unsigned int cmd, void *arg) case VIDIOCGMBUF: { struct video_mbuf vm; -#ifdef CPIA_DEBUG - printk("MBUF\n"); -#endif memset(&vm, 0, sizeof(vm)); vm.size = MAX_FRAME_SIZE * 2; @@ -988,11 +969,9 @@ static int cpia_ioctl(struct video_device *dev, unsigned int cmd, void *arg) if (copy_from_user((void *)&vm, (void *)arg, sizeof(vm))) return -EFAULT; -#ifdef CPIA_DEBUG - printk("MCAPTURE\n"); - printk("frame: %d, size: %dx%d, format: %d\n", - vm.frame, vm.width, vm.height, vm.format); -#endif + if (debug >= 1) + printk(KERN_DEBUG "frame: %d, size: %dx%d, format: %d\n", + vm.frame, vm.width, vm.height, vm.format); if (vm.format != VIDEO_PALETTE_RGB24) return -EINVAL; @@ -1020,16 +999,11 @@ static int cpia_ioctl(struct video_device *dev, unsigned int cmd, void *arg) { int frame; -#ifdef CPIA_DEBUG - printk("SYNC\n"); -#endif - if (copy_from_user((void *)&frame, arg, sizeof(int))) return -EFAULT; -#ifdef CPIA_DEBUG - printk("cpia: syncing to frame %d\n", frame); -#endif + if (debug >= 1) + printk(KERN_DEBUG "cpia: syncing to frame %d\n", frame); switch (cpia->frame[frame].grabstate) { case FRAME_UNUSED: @@ -1039,15 +1013,15 @@ static int cpia_ioctl(struct video_device *dev, unsigned int cmd, void *arg) case FRAME_ERROR: redo: do { +#if 0 init_waitqueue_head(&cpia->frame[frame].wq); +#endif interruptible_sleep_on(&cpia->frame[frame].wq); if (signal_pending(current)) return -EINTR; - } while (cpia->frame[frame].grabstate == - FRAME_GRABBING); + } while (cpia->frame[frame].grabstate == FRAME_GRABBING); - if (cpia->frame[frame].grabstate == - FRAME_ERROR) { + if (cpia->frame[frame].grabstate == FRAME_ERROR) { int ret; if ((ret = cpia_new_frame(cpia, frame)) < 0) @@ -1059,9 +1033,6 @@ redo: break; } -#ifdef CPIA_DEBUG - printk("cpia: finished, synced to frame %d\n", frame); -#endif cpia->frame[frame].grabstate = FRAME_UNUSED; return 0; @@ -1070,10 +1041,6 @@ redo: { struct video_buffer vb; -#ifdef CPIA_DEBUG - printk("GFBUF\n"); -#endif - memset(&vb, 0, sizeof(vb)); vb.base = NULL; /* frame buffer not supported, not used */ @@ -1105,15 +1072,81 @@ redo: static long cpia_read(struct video_device *dev, char *buf, unsigned long count, int noblock) { -#if 0 struct usb_cpia *cpia = (struct usb_cpia *)dev; - int len; -#endif + int frmx = -1; + volatile struct cpia_frame *frame; + + if (debug >= 1) + printk(KERN_DEBUG "cpia_read: %ld bytes, noblock=%d\n", count, noblock); + + if (!dev || !buf) + return -EFAULT; + + /* See if a frame is completed, then use it. */ + if (cpia->frame[0].grabstate >= FRAME_DONE) /* _DONE or _ERROR */ + frmx = 0; + else if (cpia->frame[1].grabstate >= FRAME_DONE)/* _DONE or _ERROR */ + frmx = 1; + + if (noblock && (frmx == -1)) + return -EAGAIN; + + /* If no FRAME_DONE, look for a FRAME_GRABBING state. */ + /* See if a frame is in process (grabbing), then use it. */ + if (frmx == -1) { + if (cpia->frame[0].grabstate == FRAME_GRABBING) + frmx = 0; + else if (cpia->frame[1].grabstate == FRAME_GRABBING) + frmx = 1; + } -#ifdef CPIA_DEBUG - printk("cpia_read: %ld bytes\n", count); -#endif - return 0; + /* If no frame is active, start one. */ + if (frmx == -1) + cpia_new_frame(cpia, frmx = 0); + + frame = &cpia->frame[frmx]; + +restart: + while (frame->grabstate == FRAME_GRABBING) { + interruptible_sleep_on(&frame->wq); + if (signal_pending(current)) + return -EINTR; + } + + if (frame->grabstate == FRAME_ERROR) { + frame->bytes_read = 0; +printk("cpia_read: errored frame %d\n", cpia->curframe); + if (cpia_new_frame(cpia, frmx)) + printk(KERN_ERR "cpia_read: cpia_new_frame error\n"); + goto restart; + } + + if (debug >= 1) + printk(KERN_DEBUG "cpia_read: frmx=%d, bytes_read=%ld, scanlength=%ld\n", + frmx, frame->bytes_read, frame->scanlength); + + /* copy bytes to user space; we allow for partials reads */ + if ((count + frame->bytes_read) > frame->scanlength) + count = frame->scanlength - frame->bytes_read; + + if (copy_to_user(buf, frame->data + frame->bytes_read, count)) + return -EFAULT; + + frame->bytes_read += count; + if (debug >= 1) + printk(KERN_DEBUG "cpia_read: {copy} count used=%ld, new bytes_read=%ld\n", + count, frame->bytes_read); + + if (frame->bytes_read >= frame->scanlength) { /* All data has been read */ + frame->bytes_read = 0; + + /* Mark it as available to be used again. */ + cpia->frame[frmx].grabstate = FRAME_UNUSED; + if (cpia_new_frame(cpia, frmx ? 0 : 1)) + printk(KERN_ERR "cpia_read: cpia_new_frame returned error\n"); + } + + return count; } static int cpia_mmap(struct video_device *dev, const char *adr, unsigned long size) @@ -1122,9 +1155,6 @@ static int cpia_mmap(struct video_device *dev, const char *adr, unsigned long si unsigned long start = (unsigned long)adr; unsigned long page, pos; -#ifdef CPIA_DEBUG - printk("mmap: %ld (%lX) bytes\n", size, size); -#endif if (size > (((2 * MAX_FRAME_SIZE) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))) return -EINVAL; @@ -1173,17 +1203,18 @@ static int usb_cpia_configure(struct usb_cpia *cpia) /* Set altsetting 0 on interface 1 */ if (usb_set_interface(dev, 1, 0) < 0) { - printk(KERN_INFO "usb_set_interface error\n"); + printk(KERN_ERR "usb_set_interface error\n"); return -EBUSY; } if (usb_cpia_get_version(dev, version) < 0) { - printk(KERN_INFO "cpia_get_version error\n"); + printk(KERN_ERR "cpia_get_version error\n"); return -EBUSY; } - printk(KERN_DEBUG "cpia: Firmware v%d.%d, VC Hardware v%d.%d\n", - version[0], version[1], version[2], version[3]); + if (debug >= 1) + printk(KERN_DEBUG "cpia: Firmware v%d.%d, VC Hardware v%d.%d\n", + version[0], version[1], version[2], version[3]); memcpy(&cpia->vdev, &cpia_template, sizeof(cpia_template)); @@ -1191,45 +1222,47 @@ static int usb_cpia_configure(struct usb_cpia *cpia) init_waitqueue_head(&cpia->frame[1].wq); if (video_register_device(&cpia->vdev, VFL_TYPE_GRABBER) == -1) { - printk(KERN_INFO "video_register_device failed\n"); + printk(KERN_ERR "video_register_device failed\n"); return -EBUSY; } if (usb_cpia_goto_hi_power(dev) < 0) { - printk(KERN_INFO "cpia_goto_hi_power error\n"); + printk(KERN_ERR "cpia_goto_hi_power error\n"); goto error; } if (usb_cpia_get_vp_version(dev, version) < 0) { - printk(KERN_INFO "cpia_get_vp_version error\n"); + printk(KERN_ERR "cpia_get_vp_version error\n"); goto error; } - printk(KERN_DEBUG "cpia: VP v%d rev %d\n", version[0], version[1]); - printk(KERN_DEBUG "cpia: Camera Head ID %04X\n", (version[3] << 8) + version[2]); + if (debug >= 1) { + printk(KERN_DEBUG "cpia: VP v%d rev %d\n", version[0], version[1]); + printk(KERN_DEBUG "cpia: Camera Head ID %04X\n", (version[3] << 8) + version[2]); + } /* Turn on continuous grab */ if (usb_cpia_set_grab_mode(dev, 1) < 0) { - printk(KERN_INFO "cpia_set_grab_mode error\n"); + printk(KERN_ERR "cpia_set_grab_mode error\n"); goto error; } /* Set up the sensor to be 30fps */ if (usb_cpia_set_sensor_fps(dev, 1, 0) < 0) { - printk(KERN_INFO "cpia_set_sensor_fps error\n"); + printk(KERN_ERR "cpia_set_sensor_fps error\n"); goto error; } /* Set video into CIF mode, and order into YUYV mode */ if (usb_cpia_set_format(dev, FORMAT_CIF, FORMAT_422, FORMAT_YUYV) < 0) { - printk(KERN_INFO "cpia_set_format error\n"); + printk(KERN_ERR "cpia_set_format error\n"); goto error; } /* Turn off compression */ if (usb_cpia_set_compression(dev, COMP_DISABLED, DONT_DECIMATE) < 0) { - printk(KERN_INFO "cpia_set_compression error\n"); + printk(KERN_ERR "cpia_set_compression error\n"); goto error; } @@ -1283,6 +1316,8 @@ static void * cpia_probe(struct usb_device *dev, unsigned int ifnum) cpia->dev = dev; if (!usb_cpia_configure(cpia)) { + cpia->user=0; + init_MUTEX(&cpia->lock); /* to 1 == available */ return cpia; } else return NULL; } diff --git a/drivers/usb/cpia.h b/drivers/usb/cpia.h index 9261c55954dd..53ed688ead8d 100644 --- a/drivers/usb/cpia.h +++ b/drivers/usb/cpia.h @@ -159,11 +159,14 @@ struct cpia_frame { int hdrwidth; /* Width the frame actually is */ int hdrheight; /* Height */ - int grabstate; /* State of grabbing */ + volatile int grabstate; /* State of grabbing */ int scanstate; /* State of scanning */ int curline; /* Line of frame we're working on */ + long scanlength; /* uncompressed, raw data length of frame */ + long bytes_read; /* amount of scanlength that has been read from *data */ + wait_queue_head_t wq; /* Processes waiting */ }; @@ -176,6 +179,9 @@ struct usb_cpia { /* Device structure */ struct usb_device *dev; + struct semaphore lock; + int user; /* user count for exclusive use */ + int streaming; /* Are we streaming Isochronous? */ int grabbing; /* Are we grabbing? */ @@ -195,4 +201,3 @@ struct usb_cpia { }; #endif - diff --git a/drivers/usb/ezusb.c b/drivers/usb/ezusb.c index 9a0ec4b17b3d..00e8dadcc147 100644 --- a/drivers/usb/ezusb.c +++ b/drivers/usb/ezusb.c @@ -491,7 +491,7 @@ static int ezusb_bulk(struct usb_device *usbdev, unsigned int ep, unsigned int l } } } - ret = usbdev->bus->op->bulk_msg(usbdev, pipe, tbuf, length, &len2, timeout); + ret = usb_bulk_msg(usbdev, pipe, tbuf, length, &len2, timeout); if (ret < 0) { if (length > 0) free_page((unsigned long)tbuf); diff --git a/drivers/usb/hp_scanner.c b/drivers/usb/hp_scanner.c index c25f6af09279..f61311b51192 100644 --- a/drivers/usb/hp_scanner.c +++ b/drivers/usb/hp_scanner.c @@ -128,7 +128,7 @@ write_scanner(struct file * file, const char * buffer, return bytes_written ? bytes_written : -EINTR; } - result = hps->hpscan_dev->bus->op->bulk_msg(hps->hpscan_dev,usb_sndbulkpipe(hps->hpscan_dev, 2), obuf, thistime, &partial, HZ*10); + result = usb_bulk_msg(hps->hpscan_dev,usb_sndbulkpipe(hps->hpscan_dev, 2), obuf, thistime, &partial, HZ*10); //printk(KERN_DEBUG "write stats: result:%d thistime:%lu partial:%lu\n", result, thistime, partial); @@ -186,7 +186,7 @@ read_scanner(struct file * file, char * buffer, return -ENODEV; this_read = (count > IBUF_SIZE) ? IBUF_SIZE : count; - result = hps->hpscan_dev->bus->op->bulk_msg(hps->hpscan_dev, usb_rcvbulkpipe(hps->hpscan_dev, 1), ibuf, this_read, &partial, HZ*10); + result = usb_bulk_msg(hps->hpscan_dev, usb_rcvbulkpipe(hps->hpscan_dev, 1), ibuf, this_read, &partial, HZ*10); printk(KERN_DEBUG "read stats: result:%d this_read:%u partial:%lu\n", result, this_read, partial); diff --git a/drivers/usb/proc_usb.c b/drivers/usb/proc_usb.c index e11c528259a7..7408d82b3fb5 100644 --- a/drivers/usb/proc_usb.c +++ b/drivers/usb/proc_usb.c @@ -2,6 +2,7 @@ * drivers/usb/proc_usb.c * (C) Copyright 1999 Randy Dunlap. * (C) Copyright 1999 Thomas Sailer . (proc file per device) + * (C) Copyright 1999 Deti Fliegl (new USB architecture) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -591,7 +592,7 @@ static int usbdev_ioctl_ezusbcompat(struct inode *inode, struct file *file, unsi free_page((unsigned long)tbuf); return -EINVAL; } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, (ctrl.timeout * HZ + 500) / 1000); + i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, (ctrl.timeout * HZ + 500) / 1000); if (!i && len2) { copy_to_user_ret(bulk.data, tbuf, len2, -EFAULT); } @@ -599,7 +600,7 @@ static int usbdev_ioctl_ezusbcompat(struct inode *inode, struct file *file, unsi if (len1) { copy_from_user_ret(tbuf, bulk.data, len1, -EFAULT); } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, (ctrl.timeout * HZ + 500) / 1000); + i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, (ctrl.timeout * HZ + 500) / 1000); } free_page((unsigned long)tbuf); if (i) { @@ -670,7 +671,7 @@ static int usbdev_ioctl_ezusbcompat(struct inode *inode, struct file *file, unsi free_page((unsigned long)tbuf); return -EINVAL; } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); + i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); if (!i && len2) { copy_to_user_ret(obulk.data, tbuf, len2, -EFAULT); } @@ -678,7 +679,7 @@ static int usbdev_ioctl_ezusbcompat(struct inode *inode, struct file *file, unsi if (len1) { copy_from_user_ret(tbuf, obulk.data, len1, -EFAULT); } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); + i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); } free_page((unsigned long)tbuf); if (i) { @@ -804,7 +805,7 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd free_page((unsigned long)tbuf); return -EINVAL; } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, (bulk.timeout * HZ + 500) / 1000); + i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, (bulk.timeout * HZ + 500) / 1000); if (!i && len2) { copy_to_user_ret(bulk.data, tbuf, len2, -EFAULT); } @@ -812,7 +813,7 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd if (len1) { copy_from_user_ret(tbuf, bulk.data, len1, -EFAULT); } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, (bulk.timeout * HZ + 500) / 1000); + i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, (bulk.timeout * HZ + 500) / 1000); } free_page((unsigned long)tbuf); if (i) { @@ -877,7 +878,7 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd free_page((unsigned long)tbuf); return -EINVAL; } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); + i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); if (!i && len2) { copy_to_user_ret(obulk.data, tbuf, len2, -EFAULT); } @@ -885,7 +886,7 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd if (len1) { copy_from_user_ret(tbuf, obulk.data, len1, -EFAULT); } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); + i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); } free_page((unsigned long)tbuf); if (i) { diff --git a/drivers/video/matroxfb.c b/drivers/video/matroxfb.c index 4b0ffb0ade3a..bb2863b5d6ec 100644 --- a/drivers/video/matroxfb.c +++ b/drivers/video/matroxfb.c @@ -587,7 +587,6 @@ struct matrox_fb_info { int text_type_aux; int video64bits; unsigned int vgastep; - unsigned int vgastepdisp; unsigned int textmode; unsigned int textstep; unsigned int textvram; /* character cells */ @@ -5490,10 +5489,11 @@ static struct video_board vbG400 __initdata = {0x2000000, 0x1000000, FB_ACCEL #define DEVF_DMA 0x80 #define DEVF_SUPPORT32MB 0x100 #define DEVF_ANY_VXRES 0x200 +#define DEVF_TEXT16B 0x400 #define DEVF_G100 (DEVF_VIDEO64BIT | DEVF_SWAPS | DEVF_CROSS4MB | DEVF_DDC_8_2) /* no doc, no vxres... */ #define DEVF_G200 (DEVF_VIDEO64BIT | DEVF_SWAPS | DEVF_CROSS4MB | DEVF_DDC_8_2 | DEVF_ANY_VXRES) -#define DEVF_G400 (DEVF_VIDEO64BIT | DEVF_SWAPS | DEVF_CROSS4MB | DEVF_DDC_8_2 | DEVF_ANY_VXRES | DEVF_SUPPORT32MB) +#define DEVF_G400 (DEVF_VIDEO64BIT | DEVF_SWAPS | DEVF_CROSS4MB | DEVF_DDC_8_2 | DEVF_ANY_VXRES | DEVF_SUPPORT32MB | DEVF_TEXT16B) static struct board { unsigned short vendor, device, rev, svid, sid; @@ -5666,12 +5666,14 @@ static int __init initMatrox2(WPMINFO struct display* d, struct board* b){ if (b->flags & DEVF_TEXT4B) { ACCESS_FBINFO(devflags.vgastep) = 4; ACCESS_FBINFO(devflags.textmode) = 4; - ACCESS_FBINFO(devflags.vgastepdisp) = 16; + ACCESS_FBINFO(devflags.text_type_aux) = FB_AUX_TEXT_MGA_STEP16; + } else if (b->flags & DEVF_TEXT16B) { + ACCESS_FBINFO(devflags.vgastep) = 16; + ACCESS_FBINFO(devflags.textmode) = 1; ACCESS_FBINFO(devflags.text_type_aux) = FB_AUX_TEXT_MGA_STEP16; } else { ACCESS_FBINFO(devflags.vgastep) = 8; ACCESS_FBINFO(devflags.textmode) = 1; - ACCESS_FBINFO(devflags.vgastepdisp) = 64; ACCESS_FBINFO(devflags.text_type_aux) = FB_AUX_TEXT_MGA_STEP8; } #ifdef CONFIG_FB_MATROX_32MB diff --git a/drivers/zorro/proc.c b/drivers/zorro/proc.c index 325c85edcc4a..c5b3e481b658 100644 --- a/drivers/zorro/proc.c +++ b/drivers/zorro/proc.c @@ -99,8 +99,8 @@ static struct inode_operations proc_bus_zorro_inode_operations = { NULL /* revalidate */ }; -int -get_zorro_dev_info(char *buf, char **start, off_t pos, int count, int wr) +static int +get_zorro_dev_info(char *buf, char **start, off_t pos, int count) { u_int slot; off_t at = 0; diff --git a/fs/Makefile b/fs/Makefile index 88810457ddbe..6b22588cbdc7 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -265,14 +265,6 @@ else endif endif -ifeq ($(CONFIG_BINFMT_ELF),y) -BINFMTS += binfmt_elf.o -else - ifeq ($(CONFIG_BINFMT_ELF),m) - M_OBJS += binfmt_elf.o - endif -endif - ifeq ($(CONFIG_BINFMT_AOUT),y) BINFMTS += binfmt_aout.o else @@ -289,7 +281,6 @@ else endif endif - ifeq ($(CONFIG_BINFMT_MISC),y) BINFMTS += binfmt_misc.o else @@ -301,4 +292,12 @@ endif # binfmt_script is always there BINFMTS += binfmt_script.o +ifeq ($(CONFIG_BINFMT_ELF),y) +BINFMTS += binfmt_elf.o +else + ifeq ($(CONFIG_BINFMT_ELF),m) + M_OBJS += binfmt_elf.o + endif +endif + include $(TOPDIR)/Rules.make diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c index 42b0fafca582..d05f9567d06a 100644 --- a/fs/coda/sysctl.c +++ b/fs/coda/sysctl.c @@ -285,7 +285,7 @@ int do_reset_coda_cache_inv_stats( ctl_table * table, int write, } int coda_vfs_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ) + int length) { int len=0; off_t begin; @@ -352,7 +352,7 @@ int coda_vfs_stats_get_info( char * buffer, char ** start, off_t offset, } int coda_upcall_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ) + int length) { int len=0; int i; @@ -399,7 +399,7 @@ int coda_upcall_stats_get_info( char * buffer, char ** start, off_t offset, } int coda_permission_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ) + int length) { int len=0; off_t begin; @@ -428,7 +428,7 @@ int coda_permission_stats_get_info( char * buffer, char ** start, off_t offset, } int coda_cache_inv_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ) + int length) { int len=0; off_t begin; diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 5ef59004cdb9..39009ec4d946 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -16,8 +16,6 @@ #include #include -extern struct inode_operations proc_dyna_dir_inode_operations; - static ssize_t proc_file_read(struct file * file, char * buf, size_t nbytes, loff_t *ppos); static ssize_t proc_file_write(struct file * file, const char * buffer, @@ -37,37 +35,10 @@ static struct file_operations proc_file_operations = { proc_file_lseek, /* lseek */ proc_file_read, /* read */ proc_file_write, /* write */ - NULL, /* readdir */ - NULL, /* poll */ - NULL, /* ioctl */ - NULL, /* mmap */ - NULL, /* no special open code */ - NULL, /* flush */ - NULL, /* no special release code */ - NULL /* can't fsync */ }; -struct inode_operations proc_file_inode_operations = { +static struct inode_operations proc_file_inode_operations = { &proc_file_operations, /* default proc file-ops */ - NULL, /* create */ - NULL, /* lookup */ - NULL, /* link */ - NULL, /* unlink */ - NULL, /* symlink */ - NULL, /* mkdir */ - NULL, /* rmdir */ - NULL, /* mknod */ - NULL, /* rename */ - NULL, /* readlink */ - NULL, /* follow_link */ - NULL, /* get_block */ - NULL, /* readpage */ - NULL, /* writepage */ - NULL, /* flushpage */ - NULL, /* truncate */ - NULL, /* permission */ - NULL, /* smap */ - NULL /* revalidate */ }; #ifndef MIN @@ -101,12 +72,8 @@ proc_file_read(struct file * file, char * buf, size_t nbytes, loff_t *ppos) /* * Handle backwards compatibility with the old net * routines. - * - * XXX What gives with the file->f_flags & O_ACCMODE - * test? Seems stupid to me.... */ - n = dp->get_info(page, &start, *ppos, count, - (file->f_flags & O_ACCMODE) == O_RDWR); + n = dp->get_info(page, &start, *ppos, count); if (n < count) eof = 1; } else if (dp->read_proc) { @@ -114,7 +81,7 @@ proc_file_read(struct file * file, char * buf, size_t nbytes, loff_t *ppos) count, &eof, dp->data); } else break; - + if (!start) { /* * For proc files that are less than 4k @@ -221,6 +188,340 @@ static int xlate_proc_name(const char *name, return 0; } +static unsigned char proc_alloc_map[PROC_NDYNAMIC / 8] = {0}; + +static int make_inode_number(void) +{ + int i = find_first_zero_bit((void *) proc_alloc_map, PROC_NDYNAMIC); + if (i<0 || i>=PROC_NDYNAMIC) + return -1; + set_bit(i, (void *) proc_alloc_map); + return PROC_DYNAMIC_FIRST + i; +} + +static int proc_readlink(struct dentry * dentry, char * buffer, int buflen) +{ + struct inode *inode = dentry->d_inode; + struct proc_dir_entry * de; + int len; + de = (struct proc_dir_entry *) inode->u.generic_ip; + len = de->size+1; + if (len > buflen) + len = buflen; + copy_to_user(buffer, de->data, len); + return len; +} + +struct dentry * proc_follow_link(struct dentry * dentry, struct dentry *base, unsigned int follow) +{ + struct inode *inode = dentry->d_inode; + struct proc_dir_entry * de; + de = (struct proc_dir_entry *) inode->u.generic_ip; + return lookup_dentry(de->data, base, follow); +} + +static struct inode_operations proc_link_inode_operations = { + NULL, /* no file-ops */ + NULL, /* create */ + NULL, /* lookup */ + NULL, /* link */ + NULL, /* unlink */ + NULL, /* symlink */ + NULL, /* mkdir */ + NULL, /* rmdir */ + NULL, /* mknod */ + NULL, /* rename */ + proc_readlink, /* readlink */ + proc_follow_link, /* follow_link */ +}; + +/* + * As some entries in /proc are volatile, we want to + * get rid of unused dentries. This could be made + * smarter: we could keep a "volatile" flag in the + * inode to indicate which ones to keep. + */ +static void +proc_delete_dentry(struct dentry * dentry) +{ + d_drop(dentry); +} + +static struct dentry_operations proc_dentry_operations = +{ + NULL, /* revalidate */ + NULL, /* d_hash */ + NULL, /* d_compare */ + proc_delete_dentry /* d_delete(struct dentry *) */ +}; + +/* + * Don't create negative dentries here, return -ENOENT by hand + * instead. + */ +struct dentry *proc_lookup(struct inode * dir, struct dentry *dentry) +{ + struct inode *inode; + struct proc_dir_entry * de; + int error; + + error = -ENOENT; + inode = NULL; + de = (struct proc_dir_entry *) dir->u.generic_ip; + if (de) { + for (de = de->subdir; de ; de = de->next) { + if (!de || !de->low_ino) + continue; + if (de->namelen != dentry->d_name.len) + continue; + if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { + int ino = de->low_ino; + error = -EINVAL; + inode = proc_get_inode(dir->i_sb, ino, de); + break; + } + } + } + + if (inode) { + dentry->d_op = &proc_dentry_operations; + d_add(dentry, inode); + return NULL; + } + return ERR_PTR(error); +} + +/* + * This returns non-zero if at EOF, so that the /proc + * root directory can use this and check if it should + * continue with the entries.. + * + * Note that the VFS-layer doesn't care about the return + * value of the readdir() call, as long as it's non-negative + * for success.. + */ +int proc_readdir(struct file * filp, + void * dirent, filldir_t filldir) +{ + struct proc_dir_entry * de; + unsigned int ino; + int i; + struct inode *inode = filp->f_dentry->d_inode; + + ino = inode->i_ino; + de = (struct proc_dir_entry *) inode->u.generic_ip; + if (!de) + return -EINVAL; + i = filp->f_pos; + switch (i) { + case 0: + if (filldir(dirent, ".", 1, i, ino) < 0) + return 0; + i++; + filp->f_pos++; + /* fall through */ + case 1: + if (filldir(dirent, "..", 2, i, + filp->f_dentry->d_parent->d_inode->i_ino + ) < 0) + return 0; + i++; + filp->f_pos++; + /* fall through */ + default: + de = de->subdir; + i -= 2; + for (;;) { + if (!de) + return 1; + if (!i) + break; + de = de->next; + i--; + } + + do { + if (filldir(dirent, de->name, de->namelen, filp->f_pos, de->low_ino) < 0) + return 0; + filp->f_pos++; + de = de->next; + } while (de); + } + return 1; +} + +/* + * These are the generic /proc directory operations. They + * use the in-memory "struct proc_dir_entry" tree to parse + * the /proc directory. + */ +static struct file_operations proc_dir_operations = { + NULL, /* lseek - default */ + NULL, /* read - bad */ + NULL, /* write - bad */ + proc_readdir, /* readdir */ +}; + +/* + * proc directories can do almost nothing.. + */ +struct inode_operations proc_dir_inode_operations = { + &proc_dir_operations, /* default net directory file-ops */ + NULL, /* create */ + proc_lookup, /* lookup */ +}; + +int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp) +{ + int i; + + i = make_inode_number(); + if (i < 0) + return -EAGAIN; + dp->low_ino = i; + dp->next = dir->subdir; + dp->parent = dir; + dir->subdir = dp; + if (S_ISDIR(dp->mode)) { + if (dp->ops == NULL) + dp->ops = &proc_dir_inode_operations; + dir->nlink++; + } else if (S_ISLNK(dp->mode)) { + if (dp->ops == NULL) + dp->ops = &proc_link_inode_operations; + } else if (S_ISREG(dp->mode)) { + if (dp->ops == NULL) + dp->ops = &proc_file_inode_operations; + } + return 0; +} + +/* + * Kill an inode that got unregistered.. + */ +static void proc_kill_inodes(struct proc_dir_entry *de) +{ + struct list_head *p; + struct super_block *sb; + + /* + * Actually it's a partial revoke(). We have to go through all + * copies of procfs. proc_super_blocks is protected by the big + * lock for the time being. + */ + for (sb = proc_super_blocks; + sb; + sb = (struct super_block*)sb->u.generic_sbp) { + file_list_lock(); + for (p = sb->s_files.next; p != &sb->s_files; p = p->next) { + struct file * filp = list_entry(p, struct file, f_list); + struct dentry * dentry; + struct inode * inode; + + dentry = filp->f_dentry; + if (!dentry) + continue; + if (dentry->d_op != &proc_dentry_operations) + continue; + inode = dentry->d_inode; + if (!inode) + continue; + if (inode->u.generic_ip != de) + continue; + filp->f_op = NULL; + } + file_list_unlock(); + } +} + +struct proc_dir_entry *proc_symlink(const char *name, + struct proc_dir_entry *parent, char *dest) +{ + struct proc_dir_entry *ent = NULL; + const char *fn = name; + int len; + + if (!parent && xlate_proc_name(name, &parent, &fn) != 0) + goto out; + len = strlen(fn); + + ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL); + if (!ent) + goto out; + memset(ent, 0, sizeof(struct proc_dir_entry)); + memcpy(((char *) ent) + sizeof(*ent), fn, len + 1); + ent->name = ((char *) ent) + sizeof(*ent); + ent->namelen = len; + ent->nlink = 1; + ent->mode = S_IFLNK|S_IRUGO|S_IWUGO|S_IXUGO; + ent->data = kmalloc((ent->size=strlen(dest))+1, GFP_KERNEL); + if (!ent->data) { + kfree(ent); + goto out; + } + strcpy((char*)ent->data,dest); + + proc_register(parent, ent); + +out: + return ent; +} + +struct proc_dir_entry *proc_mknod(const char *name, mode_t mode, + struct proc_dir_entry *parent, kdev_t rdev) +{ + struct proc_dir_entry *ent = NULL; + const char *fn = name; + int len; + + if (!parent && xlate_proc_name(name, &parent, &fn) != 0) + goto out; + len = strlen(fn); + + ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL); + if (!ent) + goto out; + memset(ent, 0, sizeof(struct proc_dir_entry)); + memcpy(((char *) ent) + sizeof(*ent), fn, len + 1); + ent->name = ((char *) ent) + sizeof(*ent); + ent->namelen = len; + ent->nlink = 1; + ent->mode = mode; + ent->rdev = rdev; + + proc_register(parent, ent); + +out: + return ent; +} + +struct proc_dir_entry *proc_mkdir(const char *name, struct proc_dir_entry *parent) +{ + struct proc_dir_entry *ent = NULL; + const char *fn = name; + int len; + + if (!parent && xlate_proc_name(name, &parent, &fn) != 0) + goto out; + len = strlen(fn); + + ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL); + if (!ent) + goto out; + memset(ent, 0, sizeof(struct proc_dir_entry)); + memcpy(((char *) ent) + sizeof(*ent), fn, len + 1); + ent->name = ((char *) ent) + sizeof(*ent); + ent->namelen = len; + ent->ops = &proc_dir_inode_operations; + ent->nlink = 2; + ent->mode = S_IFDIR | S_IRUGO | S_IXUGO; + + proc_register(parent, ent); + +out: + return ent; +} + struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, struct proc_dir_entry *parent) { @@ -243,7 +544,7 @@ struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, if (S_ISDIR(mode)) { if ((mode & S_IALLUGO) == 0) mode |= S_IRUGO | S_IXUGO; - ent->ops = &proc_dyna_dir_inode_operations; + ent->ops = &proc_dir_inode_operations; ent->nlink = 2; } else { if ((mode & S_IFMT) == 0) @@ -260,14 +561,16 @@ out: return ent; } -extern void free_proc_entry(struct proc_dir_entry *); void free_proc_entry(struct proc_dir_entry *de) { int ino = de->low_ino; - if (ino >= PROC_DYNAMIC_FIRST && - ino < PROC_DYNAMIC_FIRST+PROC_NDYNAMIC) - kfree(de); + if (ino < PROC_DYNAMIC_FIRST && + ino >= PROC_DYNAMIC_FIRST+PROC_NDYNAMIC) + return; + if (S_ISLNK(de->mode) && de->data) + kfree(de->data); + kfree(de); } /* @@ -276,6 +579,7 @@ void free_proc_entry(struct proc_dir_entry *de) */ void remove_proc_entry(const char *name, struct proc_dir_entry *parent) { + struct proc_dir_entry **p; struct proc_dir_entry *de; const char *fn = name; int len; @@ -283,14 +587,17 @@ void remove_proc_entry(const char *name, struct proc_dir_entry *parent) if (!parent && xlate_proc_name(name, &parent, &fn) != 0) goto out; len = strlen(fn); - - for (de = parent->subdir; de ; de = de->next) { - if (proc_match(len, fn, de)) - break; - } - - if (de) { - proc_unregister(parent, de->low_ino); + for (p = &parent->subdir; *p; p=&(*p)->next ) { + if (!proc_match(len, fn, *p)) + continue; + de = *p; + *p = de->next; + de->next = NULL; + if (S_ISDIR(de->mode)) + parent->nlink--; + clear_bit(de->low_ino-PROC_DYNAMIC_FIRST, + (void *) proc_alloc_map); + proc_kill_inodes(de); de->nlink = 0; de->deleted = 1; if (!de->count) @@ -299,6 +606,7 @@ void remove_proc_entry(const char *name, struct proc_dir_entry *parent) printk("remove_proc_entry: %s/%s busy, count=%d\n", parent->name, de->name, de->count); } + break; } out: return; diff --git a/fs/proc/inode-alloc.txt b/fs/proc/inode-alloc.txt index 4af79966c465..fbcfa4e402e2 100644 --- a/fs/proc/inode-alloc.txt +++ b/fs/proc/inode-alloc.txt @@ -5,7 +5,6 @@ Current inode allocations in the proc-fs (hex-numbers): 001 root-ino 00001000-00001fff dynamic entries - 00002000-00002fff openprom entries 0001xxxx-7fffxxxx pid-dir entries for pid 1-7fff 80000000-ffffffff unused diff --git a/fs/proc/inode.c b/fs/proc/inode.c index b2828ec9da50..607a7d7e9920 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c @@ -13,7 +13,6 @@ #include #include #include -#include #define __NO_VERSION__ #include @@ -91,6 +90,30 @@ static void proc_put_super(struct super_block *sb) *p = (struct super_block *)(*p)->u.generic_sbp; } +static void proc_write_inode(struct inode * inode) +{ +} + +static void proc_read_inode(struct inode * inode) +{ + inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; +} + +static int proc_statfs(struct super_block *sb, struct statfs *buf, int bufsiz) +{ + struct statfs tmp; + + tmp.f_type = PROC_SUPER_MAGIC; + tmp.f_bsize = PAGE_SIZE/sizeof(long); + tmp.f_blocks = 0; + tmp.f_bfree = 0; + tmp.f_bavail = 0; + tmp.f_files = 0; + tmp.f_ffree = 0; + tmp.f_namelen = NAME_MAX; + return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0; +} + static struct super_operations proc_sops = { proc_read_inode, proc_write_inode, @@ -161,26 +184,16 @@ printk("proc_iget: using deleted entry %s, count=%d\n", de->name, de->count); } if (de->size) inode->i_size = de->size; - if (de->ops) - inode->i_op = de->ops; if (de->nlink) inode->i_nlink = de->nlink; if (de->owner) __MOD_INC_USE_COUNT(de->owner); + if (S_ISBLK(de->mode)||S_ISCHR(de->mode)||S_ISFIFO(de->mode)) + init_special_inode(inode,de->mode,kdev_t_to_nr(de->rdev)); + else if (de->ops) + inode->i_op = de->ops; } - /* - * Fixup the root inode's nlink value - */ - if (inode->i_ino == PROC_ROOT_INO) { - struct task_struct *p; - read_lock(&tasklist_lock); - for_each_task(p) { - if (p->pid) - inode->i_nlink++; - } - read_unlock(&tasklist_lock); - } out: return inode; @@ -193,6 +206,7 @@ struct super_block *proc_read_super(struct super_block *s,void *data, int silent) { struct inode * root_inode; + struct task_struct *p; lock_super(s); s->s_blocksize = 1024; @@ -202,6 +216,12 @@ struct super_block *proc_read_super(struct super_block *s,void *data, root_inode = proc_get_inode(s, PROC_ROOT_INO, &proc_root); if (!root_inode) goto out_no_root; + /* + * Fixup the root inode's nlink value + */ + read_lock(&tasklist_lock); + for_each_task(p) if (p->pid) root_inode->i_nlink++; + read_unlock(&tasklist_lock); s->s_root = d_alloc_root(root_inode); if (!s->s_root) goto out_no_root; @@ -218,27 +238,3 @@ out_no_root: unlock_super(s); return NULL; } - -int proc_statfs(struct super_block *sb, struct statfs *buf, int bufsiz) -{ - struct statfs tmp; - - tmp.f_type = PROC_SUPER_MAGIC; - tmp.f_bsize = PAGE_SIZE/sizeof(long); - tmp.f_blocks = 0; - tmp.f_bfree = 0; - tmp.f_bavail = 0; - tmp.f_files = 0; - tmp.f_ffree = 0; - tmp.f_namelen = NAME_MAX; - return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0; -} - -void proc_read_inode(struct inode * inode) -{ - inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; -} - -void proc_write_inode(struct inode * inode) -{ -} diff --git a/fs/proc/openpromfs.c b/fs/proc/openpromfs.c index 51ced2dcd8a6..5dc1e9dc47e7 100644 --- a/fs/proc/openpromfs.c +++ b/fs/proc/openpromfs.c @@ -944,9 +944,8 @@ static int openpromfs_create (struct inode *dir, struct dentry *dentry, int mode strncpy (p, dentry->d_name.name, dentry->d_name.len); p [dentry->d_name.len] = 0; alias_names [aliases_nodes++] = p; - inode = proc_get_inode (dir->i_sb, - NODEP2INO(NODE(dir->i_ino).first_prop) - + aliases_nodes, 0); + inode = iget (dir->i_sb, + NODEP2INO(NODE(dir->i_ino).first_prop) + aliases_nodes); if (!inode) return -EINVAL; inode->i_mode = S_IFREG | S_IRUGO | S_IWUSR; diff --git a/fs/proc/proc_tty.c b/fs/proc/proc_tty.c index 4b4ca41b8802..faff5bbb7dd7 100644 --- a/fs/proc/proc_tty.c +++ b/fs/proc/proc_tty.c @@ -161,10 +161,9 @@ void proc_tty_unregister_driver(struct tty_driver *driver) if (!ent) return; - proc_unregister(proc_tty_driver, ent->low_ino); + remove_proc_entry(driver->driver_name, proc_tty_driver); driver->proc_entry = 0; - kfree(ent); } /* diff --git a/fs/proc/procfs_syms.c b/fs/proc/procfs_syms.c index 6d5f4852381f..7c986d6151b3 100644 --- a/fs/proc/procfs_syms.c +++ b/fs/proc/procfs_syms.c @@ -8,8 +8,9 @@ extern struct proc_dir_entry *proc_sys_root; #ifdef CONFIG_SYSCTL EXPORT_SYMBOL(proc_sys_root); #endif -EXPORT_SYMBOL(proc_register); -EXPORT_SYMBOL(proc_unregister); +EXPORT_SYMBOL(proc_symlink); +EXPORT_SYMBOL(proc_mknod); +EXPORT_SYMBOL(proc_mkdir); EXPORT_SYMBOL(create_proc_entry); EXPORT_SYMBOL(remove_proc_entry); EXPORT_SYMBOL(proc_root); diff --git a/fs/proc/root.c b/fs/proc/root.c index 4b94b2d1d14f..15032d2cdd1f 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c @@ -16,250 +16,12 @@ #include #include -static int proc_root_readdir(struct file *, void *, filldir_t); -static struct dentry *proc_root_lookup(struct inode *,struct dentry *); -static int proc_unlink(struct inode *, struct dentry *); - -static unsigned char proc_alloc_map[PROC_NDYNAMIC / 8] = {0}; - -/* - * These are the generic /proc directory operations. They - * use the in-memory "struct proc_dir_entry" tree to parse - * the /proc directory. - */ -static struct file_operations proc_dir_operations = { - NULL, /* lseek - default */ - NULL, /* read - bad */ - NULL, /* write - bad */ - proc_readdir, /* readdir */ -}; - -/* - * proc directories can do almost nothing.. - */ -struct inode_operations proc_dir_inode_operations = { - &proc_dir_operations, /* default net directory file-ops */ - NULL, /* create */ - proc_lookup, /* lookup */ -}; - -/* - * /proc dynamic directories now support unlinking - */ -struct inode_operations proc_dyna_dir_inode_operations = { - &proc_dir_operations, /* default proc dir ops */ - NULL, /* create */ - proc_lookup, /* lookup */ - NULL, /* link */ - proc_unlink, /* unlink(struct inode *, struct dentry *) */ -}; - -/* - * The root /proc directory is special, as it has the - * directories. Thus we don't use the generic - * directory handling functions for that.. - */ -static struct file_operations proc_root_operations = { - NULL, /* lseek - default */ - NULL, /* read - bad */ - NULL, /* write - bad */ - proc_root_readdir, /* readdir */ -}; - -/* - * proc root can do almost nothing.. - */ -static struct inode_operations proc_root_inode_operations = { - &proc_root_operations, /* default base directory file-ops */ - NULL, /* create */ - proc_root_lookup, /* lookup */ -}; - -/* - * This is the root "inode" in the /proc tree.. - */ -struct proc_dir_entry proc_root = { - PROC_ROOT_INO, 5, "/proc", - S_IFDIR | S_IRUGO | S_IXUGO, 2, 0, 0, - 0, &proc_root_inode_operations, - NULL, NULL, - NULL, - &proc_root, NULL -}; - struct proc_dir_entry *proc_net, *proc_bus, *proc_root_fs, *proc_root_driver; -#ifdef CONFIG_MCA -struct proc_dir_entry *proc_mca; -#endif - #ifdef CONFIG_SYSCTL struct proc_dir_entry *proc_sys_root; #endif -static int make_inode_number(void) -{ - int i = find_first_zero_bit((void *) proc_alloc_map, PROC_NDYNAMIC); - if (i<0 || i>=PROC_NDYNAMIC) - return -1; - set_bit(i, (void *) proc_alloc_map); - return PROC_DYNAMIC_FIRST + i; -} - -int proc_readlink(struct dentry * dentry, char * buffer, int buflen) -{ - struct inode *inode = dentry->d_inode; - struct proc_dir_entry * de; - char *page; - int len = 0; - - de = (struct proc_dir_entry *) inode->u.generic_ip; - if (!de) - return -ENOENT; - if (!(page = (char*) __get_free_page(GFP_KERNEL))) - return -ENOMEM; - - if (de->readlink_proc) - len = de->readlink_proc(de, page); - - if (len > buflen) - len = buflen; - - copy_to_user(buffer, page, len); - free_page((unsigned long) page); - return len; -} - -struct dentry * proc_follow_link(struct dentry * dentry, struct dentry *base, unsigned int follow) -{ - struct inode *inode = dentry->d_inode; - struct proc_dir_entry * de; - char *page; - struct dentry *d; - int len = 0; - - de = (struct proc_dir_entry *) inode->u.generic_ip; - if (!(page = (char*) __get_free_page(GFP_KERNEL))) - return NULL; - - if (de->readlink_proc) - len = de->readlink_proc(de, page); - - d = lookup_dentry(page, base, follow); - free_page((unsigned long) page); - return d; -} - -static struct inode_operations proc_link_inode_operations = { - NULL, /* no file-ops */ - NULL, /* create */ - NULL, /* lookup */ - NULL, /* link */ - NULL, /* unlink */ - NULL, /* symlink */ - NULL, /* mkdir */ - NULL, /* rmdir */ - NULL, /* mknod */ - NULL, /* rename */ - proc_readlink, /* readlink */ - proc_follow_link, /* follow_link */ - NULL, /* get_block */ - NULL, /* readpage */ - NULL, /* writepage */ - NULL, /* flushpage */ - NULL, /* truncate */ - NULL, /* permission */ - NULL, /* smap */ - NULL /* revalidate */ -}; - -int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp) -{ - int i; - - if (dp->low_ino == 0) { - i = make_inode_number(); - if (i < 0) - return -EAGAIN; - dp->low_ino = i; - } - dp->next = dir->subdir; - dp->parent = dir; - dir->subdir = dp; - if (S_ISDIR(dp->mode)) { - if (dp->ops == NULL) - dp->ops = &proc_dir_inode_operations; - dir->nlink++; - } else if (S_ISLNK(dp->mode)) { - if (dp->ops == NULL) - dp->ops = &proc_link_inode_operations; - } else { - if (dp->ops == NULL) - dp->ops = &proc_file_inode_operations; - } - return 0; -} - -/* - * Kill an inode that got unregistered.. - */ -static void proc_kill_inodes(int ino) -{ - struct list_head *p; - struct super_block *sb; - - /* - * Actually it's a partial revoke(). We have to go through all - * copies of procfs. proc_super_blocks is protected by the big - * lock for the time being. - */ - for (sb = proc_super_blocks; - sb; - sb = (struct super_block*)sb->u.generic_sbp) { - file_list_lock(); - for (p = sb->s_files.next; p != &sb->s_files; p = p->next) { - struct file * filp = list_entry(p, struct file, f_list); - struct dentry * dentry; - struct inode * inode; - - dentry = filp->f_dentry; - if (!dentry) - continue; - if (dentry->d_op != &proc_dentry_operations) - continue; - inode = dentry->d_inode; - if (!inode) - continue; - if (inode->i_ino != ino) - continue; - filp->f_op = NULL; - } - file_list_unlock(); - } -} - -int proc_unregister(struct proc_dir_entry * dir, int ino) -{ - struct proc_dir_entry **p = &dir->subdir, *dp; - - while ((dp = *p) != NULL) { - if (dp->low_ino == ino) { - *p = dp->next; - dp->next = NULL; - if (S_ISDIR(dp->mode)) - dir->nlink--; - if (ino >= PROC_DYNAMIC_FIRST && - ino < PROC_DYNAMIC_FIRST+PROC_NDYNAMIC) - clear_bit(ino-PROC_DYNAMIC_FIRST, - (void *) proc_alloc_map); - proc_kill_inodes(ino); - return 0; - } - p = &dp->next; - } - return -EINVAL; -} - /* * /proc/self: */ @@ -298,14 +60,6 @@ static struct inode_operations proc_self_inode_operations = { NULL, /* rename */ proc_self_readlink, /* readlink */ proc_self_follow_link, /* follow_link */ - NULL, /* get_block */ - NULL, /* readpage */ - NULL, /* writepage */ - NULL, /* flushpage */ - NULL, /* truncate */ - NULL, /* permission */ - NULL, /* smap */ - NULL /* revalidate */ }; static struct proc_dir_entry proc_root_self = { @@ -325,24 +79,21 @@ void __init proc_root_init(void) { proc_misc_init(); proc_register(&proc_root, &proc_root_self); - proc_net = create_proc_entry("net", S_IFDIR, 0); + proc_net = proc_mkdir("net", 0); #ifdef CONFIG_SYSVIPC - create_proc_entry("sysvipc", S_IFDIR, 0); + proc_mkdir("sysvipc", 0); #endif #ifdef CONFIG_SYSCTL - proc_sys_root = create_proc_entry("sys", S_IFDIR, 0); -#endif -#ifdef CONFIG_MCA - proc_mca = create_proc_entry("mca", S_IFDIR, 0); + proc_sys_root = proc_mkdir("sys", 0); #endif - proc_root_fs = create_proc_entry("fs", S_IFDIR, 0); - proc_root_driver = create_proc_entry("driver", S_IFDIR, 0); + proc_root_fs = proc_mkdir("fs", 0); + proc_root_driver = proc_mkdir("driver", 0); #if defined(CONFIG_SUN_OPENPROMFS) || defined(CONFIG_SUN_OPENPROMFS_MODULE) #ifdef CONFIG_SUN_OPENPROMFS openpromfs_init (); #endif /* just give it a mountpoint */ - create_proc_entry("openprom", S_IFDIR, 0); + proc_mkdir("openprom", 0); #endif proc_tty_init(); #ifdef __powerpc__ @@ -351,63 +102,7 @@ void __init proc_root_init(void) #ifdef CONFIG_PROC_DEVICETREE proc_device_tree_init(); #endif - proc_bus = create_proc_entry("bus", S_IFDIR, 0); -} - -/* - * As some entries in /proc are volatile, we want to - * get rid of unused dentries. This could be made - * smarter: we could keep a "volatile" flag in the - * inode to indicate which ones to keep. - */ -static void -proc_delete_dentry(struct dentry * dentry) -{ - d_drop(dentry); -} - -struct dentry_operations proc_dentry_operations = -{ - NULL, /* revalidate */ - NULL, /* d_hash */ - NULL, /* d_compare */ - proc_delete_dentry /* d_delete(struct dentry *) */ -}; - -/* - * Don't create negative dentries here, return -ENOENT by hand - * instead. - */ -struct dentry *proc_lookup(struct inode * dir, struct dentry *dentry) -{ - struct inode *inode; - struct proc_dir_entry * de; - int error; - - error = -ENOENT; - inode = NULL; - de = (struct proc_dir_entry *) dir->u.generic_ip; - if (de) { - for (de = de->subdir; de ; de = de->next) { - if (!de || !de->low_ino) - continue; - if (de->namelen != dentry->d_name.len) - continue; - if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { - int ino = de->low_ino; - error = -EINVAL; - inode = proc_get_inode(dir->i_sb, ino, de); - break; - } - } - } - - if (inode) { - dentry->d_op = &proc_dentry_operations; - d_add(dentry, inode); - return NULL; - } - return ERR_PTR(error); + proc_bus = proc_mkdir("bus", 0); } static struct dentry *proc_root_lookup(struct inode * dir, struct dentry * dentry) @@ -446,63 +141,6 @@ static struct dentry *proc_root_lookup(struct inode * dir, struct dentry * dentr return proc_pid_lookup(dir, dentry); } -/* - * This returns non-zero if at EOF, so that the /proc - * root directory can use this and check if it should - * continue with the entries.. - * - * Note that the VFS-layer doesn't care about the return - * value of the readdir() call, as long as it's non-negative - * for success.. - */ -int proc_readdir(struct file * filp, - void * dirent, filldir_t filldir) -{ - struct proc_dir_entry * de; - unsigned int ino; - int i; - struct inode *inode = filp->f_dentry->d_inode; - - ino = inode->i_ino; - de = (struct proc_dir_entry *) inode->u.generic_ip; - if (!de) - return -EINVAL; - i = filp->f_pos; - switch (i) { - case 0: - if (filldir(dirent, ".", 1, i, ino) < 0) - return 0; - i++; - filp->f_pos++; - /* fall through */ - case 1: - if (filldir(dirent, "..", 2, i, de->parent->low_ino) < 0) - return 0; - i++; - filp->f_pos++; - /* fall through */ - default: - de = de->subdir; - i -= 2; - for (;;) { - if (!de) - return 1; - if (!i) - break; - de = de->next; - i--; - } - - do { - if (filldir(dirent, de->name, de->namelen, filp->f_pos, de->low_ino) < 0) - return 0; - filp->f_pos++; - de = de->next; - } while (de); - } - return 1; -} - static int proc_root_readdir(struct file * filp, void * dirent, filldir_t filldir) { @@ -518,14 +156,35 @@ static int proc_root_readdir(struct file * filp, return proc_pid_readdir(filp, dirent, filldir); } -static int proc_unlink(struct inode *dir, struct dentry *dentry) -{ - struct proc_dir_entry * dp = dir->u.generic_ip; +/* + * The root /proc directory is special, as it has the + * directories. Thus we don't use the generic + * directory handling functions for that.. + */ +static struct file_operations proc_root_operations = { + NULL, /* lseek - default */ + NULL, /* read - bad */ + NULL, /* write - bad */ + proc_root_readdir, /* readdir */ +}; -printk("proc_file_unlink: deleting %s/%s\n", dp->name, dentry->d_name.name); +/* + * proc root can do almost nothing.. + */ +static struct inode_operations proc_root_inode_operations = { + &proc_root_operations, /* default base directory file-ops */ + NULL, /* create */ + proc_root_lookup, /* lookup */ +}; - remove_proc_entry(dentry->d_name.name, dp); - dentry->d_inode->i_nlink = 0; - d_delete(dentry); - return 0; -} +/* + * This is the root "inode" in the /proc tree.. + */ +struct proc_dir_entry proc_root = { + PROC_ROOT_INO, 5, "/proc", + S_IFDIR | S_IRUGO | S_IXUGO, 2, 0, 0, + 0, &proc_root_inode_operations, + NULL, NULL, + NULL, + &proc_root, NULL +}; diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c index f5ab39437556..03e66fe236a4 100644 --- a/fs/udf/balloc.c +++ b/fs/udf/balloc.c @@ -34,6 +34,56 @@ #include "udf_i.h" #include "udf_sb.h" +#define udf_clear_bit(nr,addr) ext2_clear_bit(nr,addr) +#define udf_set_bit(nr,addr) ext2_set_bit(nr,addr) +#define udf_test_bit(nr, addr) ext2_test_bit(nr, addr) +#define udf_find_first_one_bit(addr, size) find_first_one_bit(addr, size) +#define udf_find_next_one_bit(addr, size, offset) find_next_one_bit(addr, size, offset) + +#define leBPL_to_cpup(x) leNUM_to_cpup(BITS_PER_LONG, x) +#define leNUM_to_cpup(x,y) xleNUM_to_cpup(x,y) +#define xleNUM_to_cpup(x,y) (le ## x ## _to_cpup(y)) + +extern inline int find_next_one_bit (void * addr, int size, int offset) +{ + unsigned long * p = ((unsigned long *) addr) + (offset / BITS_PER_LONG); + unsigned long result = offset & ~(BITS_PER_LONG-1); + unsigned long tmp; + + if (offset >= size) + return size; + size -= result; + offset &= (BITS_PER_LONG-1); + if (offset) + { + tmp = leBPL_to_cpup(p++); + tmp &= ~0UL << offset; + if (size < BITS_PER_LONG) + goto found_first; + if (tmp) + goto found_middle; + size -= BITS_PER_LONG; + result += BITS_PER_LONG; + } + while (size & ~(BITS_PER_LONG-1)) + { + if ((tmp = leBPL_to_cpup(p++))) + goto found_middle; + result += BITS_PER_LONG; + size -= BITS_PER_LONG; + } + if (!size) + return result; + tmp = leBPL_to_cpup(p); +found_first: + tmp &= ~0UL >> (BITS_PER_LONG-size); +found_middle: + return result + ffz(~tmp); +} + +#define find_first_one_bit(addr, size)\ + find_next_one_bit((addr), (size), 0) + static int read_block_bitmap(struct super_block * sb, unsigned int block, unsigned long bitmap_nr) { diff --git a/fs/udf/dir.c b/fs/udf/dir.c index cdcb0643a6bb..885a7ce6b6e3 100644 --- a/fs/udf/dir.c +++ b/fs/udf/dir.c @@ -159,13 +159,13 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d struct FileIdentDesc *fi=NULL; struct FileIdentDesc cfi; int block, iblock; - int nf_pos = filp->f_pos; + loff_t nf_pos = filp->f_pos; int flen; char fname[255]; char *nameptr; Uint16 liu; Uint8 lfi; - int size = (UDF_I_EXT0OFFS(dir) + dir->i_size) >> 2; + loff_t size = (UDF_I_EXT0OFFS(dir) + dir->i_size) >> 2; struct buffer_head * bh = NULL; lb_addr bloc, eloc; Uint32 extoffset, elen, offset; diff --git a/fs/udf/directory.c b/fs/udf/directory.c index 7ea1ac38ebf0..20dbf9bb7e30 100644 --- a/fs/udf/directory.c +++ b/fs/udf/directory.c @@ -17,7 +17,6 @@ */ #include "udfdecl.h" -#include "udf_sb.h" #if defined(__linux__) && defined(__KERNEL__) diff --git a/fs/udf/file.c b/fs/udf/file.c index 5d0efdabf7bf..83611fe67f72 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c @@ -43,11 +43,7 @@ #include "udf_i.h" #include "udf_sb.h" -#define NBUF 32 - -typedef void * poll_table; - -static long long udf_file_llseek(struct file *, long long, int); +static loff_t udf_file_llseek(struct file *, loff_t, int); static ssize_t udf_file_read_adinicb (struct file *, char *, size_t, loff_t *); static ssize_t udf_file_write (struct file *, const char *, size_t, loff_t *); #if BITS_PER_LONG < 64 @@ -152,7 +148,7 @@ struct inode_operations udf_file_inode_operations_adinicb = { /* * Make sure the offset never goes beyond the 32-bit mark.. */ -static long long udf_file_llseek(struct file * file, long long offset, int origin) +static loff_t udf_file_llseek(struct file * file, loff_t offset, int origin) { struct inode * inode = file->f_dentry->d_inode; @@ -169,12 +165,6 @@ static long long udf_file_llseek(struct file * file, long long offset, int origi break; } } -#if BITS_PER_LONG < 64 - if (((unsigned long long) offset >> 32) != 0) - { - return -EINVAL; - } -#endif if (offset != file->f_pos) { file->f_pos = offset; @@ -272,7 +262,8 @@ static ssize_t udf_file_read_adinicb(struct file * filp, char * buf, size_t bufsize, loff_t * loff) { struct inode *inode = filp->f_dentry->d_inode; - Uint32 size, left, pos, block; + loff_t size, left, pos; + Uint32 block; struct buffer_head *bh = NULL; size = inode->i_size; @@ -454,7 +445,7 @@ static int udf_release_file(struct inode * inode, struct file * filp) */ static int udf_open_file(struct inode * inode, struct file * filp) { - if (inode->i_size == (Uint32)-1 && (filp->f_mode & FMODE_WRITE)) + if ((inode->i_size & 0xFFFFFFFF00000000UL) && !(filp->f_flags & O_LARGEFILE)) return -EFBIG; return 0; } diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 71083a7bdd99..a16cb18a751f 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -383,7 +383,7 @@ static struct buffer_head * inode_getblk(struct inode * inode, long block, pextoffset = cextoffset; cextoffset = nextoffset; - + if ((etype = udf_next_aext(inode, &cbloc, &nextoffset, &eloc, &elen, &cbh, 1)) == -1) break; @@ -701,14 +701,31 @@ static void udf_merge_extents(struct inode *inode, (((laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits))) { - laarr[i].extLength = laarr[i+1].extLength + - (((laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) + - inode->i_sb->s_blocksize - 1) & ~(inode->i_sb->s_blocksize-1)); - if (*endnum > (i+2)) - memmove(&laarr[i+1], &laarr[i+2], - sizeof(long_ad) * (*endnum - (i+2))); - i --; - (*endnum) --; + if (((laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) + + (laarr[i+1].extLength & UDF_EXTENT_LENGTH_MASK) + + inode->i_sb->s_blocksize - 1) & ~UDF_EXTENT_LENGTH_MASK) + { + laarr[i+1].extLength = (laarr[i+1].extLength - + (laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) + + UDF_EXTENT_LENGTH_MASK) & ~(inode->i_sb->s_blocksize-1); + laarr[i].extLength = (UDF_EXTENT_LENGTH_MASK + 1) - + inode->i_sb->s_blocksize; + laarr[i+1].extLocation.logicalBlockNum = + laarr[i].extLocation.logicalBlockNum + + ((laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) >> + inode->i_sb->s_blocksize_bits); + } + else + { + laarr[i].extLength = laarr[i+1].extLength + + (((laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) + + inode->i_sb->s_blocksize - 1) & ~(inode->i_sb->s_blocksize-1)); + if (*endnum > (i+2)) + memmove(&laarr[i+1], &laarr[i+2], + sizeof(long_ad) * (*endnum - (i+2))); + i --; + (*endnum) --; + } } } } diff --git a/fs/udf/lowlevel.c b/fs/udf/lowlevel.c index 635ab1b79fbb..2b68985f3e7d 100644 --- a/fs/udf/lowlevel.c +++ b/fs/udf/lowlevel.c @@ -123,7 +123,7 @@ udf_get_last_block(kdev_t dev, int *flags) BLKGETSIZE, (unsigned long) &lblock); - if (!ret) /* Hard Disk */ + if (!ret && block != 0x7FFFFFFF) /* Hard Disk */ { if (mult) lblock *= mult; diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 712cf09fb69e..ebe839797c21 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c @@ -147,13 +147,13 @@ udf_find_entry(struct inode *dir, struct dentry *dentry, struct FileIdentDesc *cfi) { struct FileIdentDesc *fi=NULL; - int f_pos, block; - int flen; + loff_t f_pos; + int block, flen; char fname[255]; char *nameptr; Uint8 lfi; Uint16 liu; - int size = (UDF_I_EXT0OFFS(dir) + dir->i_size) >> 2; + loff_t size = (UDF_I_EXT0OFFS(dir) + dir->i_size) >> 2; lb_addr bloc, eloc; Uint32 extoffset, elen, offset; struct buffer_head *bh = NULL; @@ -492,7 +492,6 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, extoffset -= sizeof(long_ad); } - dir->i_size += nfidlen; if (sb->s_blocksize - fibh->eoffset >= nfidlen) { fibh->soffset = fibh->eoffset; @@ -550,8 +549,8 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, else { elen = ((elen + sb->s_blocksize - 1) & ~(sb->s_blocksize - 1)); - block = eloc.logicalBlockNum + ((elen - 1) >> - dir->i_sb->s_blocksize_bits); + block = eloc.logicalBlockNum + + ((elen - 1) >> dir->i_sb->s_blocksize_bits); elen = (EXTENT_RECORDED_ALLOCATED << 30) | elen; udf_write_aext(dir, bloc, &lextoffset, eloc, elen, &bh, 0); } @@ -568,11 +567,30 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, if (udf_next_aext(dir, &bloc, &lextoffset, &eloc, &elen, &bh, 1) == EXTENT_RECORDED_ALLOCATED) { - block = eloc.logicalBlockNum + ((elen - 1) >> - dir->i_sb->s_blocksize_bits); + if (block == (eloc.logicalBlockNum + + ((elen - 1) >> dir->i_sb->s_blocksize_bits))) + { + if (udf_next_aext(dir, &bloc, &lextoffset, &eloc, &elen, &bh, 1) != + EXTENT_RECORDED_ALLOCATED) + { + udf_release_data(bh); + udf_release_data(fibh->sbh); + udf_release_data(fibh->ebh); + udf_debug("next extent not recorded and allocated\n"); + return NULL; + } + } } else - block ++; + { + udf_release_data(bh); + udf_release_data(fibh->sbh); + udf_release_data(fibh->ebh); + udf_debug("next extent not recorded and allocated\n"); + return NULL; + } + block = eloc.logicalBlockNum + ((elen - 1) >> + dir->i_sb->s_blocksize_bits); } fi = (struct FileIdentDesc *)(fibh->sbh->b_data + sb->s_blocksize + fibh->soffset); @@ -586,6 +604,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, if (!udf_write_fi(cfi, fi, fibh, NULL, name)) { udf_release_data(bh); + dir->i_size += nfidlen; if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_IN_ICB) UDF_I_LENALLOC(dir) += nfidlen; dir->i_version = ++event; @@ -595,7 +614,6 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, else { udf_release_data(bh); - dir->i_size -= nfidlen; if (fibh->sbh != fibh->ebh) udf_release_data(fibh->ebh); udf_release_data(fibh->sbh); diff --git a/fs/udf/super.c b/fs/udf/super.c index 497887825e13..31fecbde2602 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -42,13 +42,10 @@ * 12/20/98 find the free space bitmap (if it exists) */ -#ifndef LINUX_VERSION_CODE -#include -#endif - #include "udfdecl.h" #include +#include #include #include #include @@ -66,6 +63,15 @@ #include #include +#define VDS_POS_PRIMARY_VOL_DESC 0 +#define VDS_POS_UNALLOC_SPACE_DESC 1 +#define VDS_POS_LOGICAL_VOL_DESC 2 +#define VDS_POS_PARTITION_DESC 3 +#define VDS_POS_IMP_USE_VOL_DESC 4 +#define VDS_POS_VOL_DESC_PTR 5 +#define VDS_POS_TERMINATING_DESC 6 +#define VDS_POS_LENGTH 7 + static char error_buf[1024]; /* These are the "meat" - everything else is stuffing */ diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c index 676f8b3e6145..1bf6e4cee7dc 100644 --- a/fs/udf/truncate.c +++ b/fs/udf/truncate.c @@ -38,8 +38,7 @@ static void extent_trunc(struct inode * inode, lb_addr bloc, int *extoffset, lb_addr neloc = { 0, 0 }; int nelen = 0; int blocks = inode->i_sb->s_blocksize / 512; - int last_block = (elen + inode->i_sb->s_blocksize - 1) / inode->i_sb->s_blocksize; - + int last_block = (elen + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits; if (offset) { diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h index 407d6006d723..310ba4aef4dc 100644 --- a/fs/udf/udf_sb.h +++ b/fs/udf/udf_sb.h @@ -1,9 +1,6 @@ #ifndef __LINUX_UDF_SB_H #define __LINUX_UDF_SB_H -#include -#include - /* Since UDF 1.50 is ISO 13346 based... */ #define UDF_SUPER_MAGIC 0x15013346 diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h index 543d15ea9407..787c83d86528 100644 --- a/fs/udf/udfdecl.h +++ b/fs/udf/udfdecl.h @@ -1,9 +1,11 @@ #ifndef __UDF_DECL_H #define __UDF_DECL_H -#define UDF_VERSION_NOTICE "v0.8.9.3" +#define UDF_VERSION_NOTICE "v0.8.9.4" +#include #include +#include "udfend.h" #ifdef __KERNEL__ @@ -20,15 +22,33 @@ #endif #include -/* if we're not defined, we must be compiling outside of the kernel tree */ + #if !defined(CONFIG_UDF_FS) && !defined(CONFIG_UDF_FS_MODULE) -/* ... so override config */ #define CONFIG_UDF_FS_MODULE -/* explicitly include udf_fs_sb.h and udf_fs_i.h */ #include #include #endif +#define udf_fixed_to_variable(x) ( ( ( (x) >> 5 ) * 39 ) + ( (x) & 0x0000001F ) ) +#define udf_variable_to_fixed(x) ( ( ( (x) / 39 ) << 5 ) + ( (x) % 39 ) ) + +#define CURRENT_UTIME (xtime.tv_usec) + +#define udf_file_entry_alloc_offset(inode)\ + ((UDF_I_EXTENDED_FE(inode) ?\ + sizeof(struct ExtendedFileEntry) :\ + sizeof(struct FileEntry)) + UDF_I_LENEATTR(inode)) + +#else + +#include + +#endif /* __KERNEL__ */ + + + +#ifdef __KERNEL__ + struct dentry; struct inode; struct task_struct; @@ -48,8 +68,49 @@ struct udf_fileident_bh int eoffset; }; +#endif /* __KERNEL__ */ + +struct udf_directory_record +{ + Uint32 d_parent; + Uint32 d_inode; + Uint32 d_name[255]; +}; + + +struct udf_vds_record +{ + Uint32 block; + Uint32 volDescSeqNum; +}; + +struct ktm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_isdst; +}; + +struct ustr +{ + Uint8 u_cmpID; + Uint8 u_name[UDF_NAME_LEN-1]; + Uint8 u_len; + Uint8 padding; + unsigned long u_hash; +}; + +#ifdef __KERNEL__ + +/* super.c */ extern void udf_error(struct super_block *, const char *, const char *, ...); extern void udf_warning(struct super_block *, const char *, const char *, ...); + +/* namei.c */ extern int udf_write_fi(struct FileIdentDesc *, struct FileIdentDesc *, struct udf_fileident_bh *, Uint8 *, Uint8 *); extern struct dentry * udf_lookup(struct inode *, struct dentry *); extern int udf_create(struct inode *, struct dentry *, int); @@ -60,7 +121,11 @@ extern int udf_unlink(struct inode *, struct dentry *); extern int udf_symlink(struct inode *, struct dentry *, const char *); extern int udf_link(struct dentry *, struct inode *, struct dentry *); extern int udf_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); + +/* file.c */ extern int udf_ioctl(struct inode *, struct file *, unsigned int, unsigned long); + +/* inode.c */ extern struct inode *udf_iget(struct super_block *, lb_addr); extern int udf_sync_inode(struct inode *); extern struct buffer_head * udf_expand_adinicb(struct inode *, int *, int, int *); @@ -80,9 +145,10 @@ extern int udf_insert_aext(struct inode *, lb_addr, int, lb_addr, Uint32, struct extern int udf_delete_aext(struct inode *, lb_addr, int, lb_addr, Uint32, struct buffer_head *); extern int udf_next_aext(struct inode *, lb_addr *, int *, lb_addr *, Uint32 *, struct buffer_head **, int); extern int udf_current_aext(struct inode *, lb_addr *, int *, lb_addr *, Uint32 *, struct buffer_head **, int); +extern void udf_discard_prealloc(struct inode *); +/* misc.c */ extern int udf_read_tagged_data(char *, int size, int fd, int block, int partref); - extern struct buffer_head *udf_tread(struct super_block *, int, int); extern struct GenericAttrFormat *udf_add_extendedattr(struct inode *, Uint32, Uint32, Uint8, struct buffer_head **); extern struct GenericAttrFormat *udf_get_extendedattr(struct inode *, Uint32, Uint8, struct buffer_head **); @@ -91,186 +157,73 @@ extern struct buffer_head *udf_read_ptagged(struct super_block *, lb_addr, Uint3 extern struct buffer_head *udf_read_untagged(struct super_block *, Uint32, Uint32); extern void udf_release_data(struct buffer_head *); +/* lowlevel.c */ extern unsigned int udf_get_last_session(kdev_t); extern unsigned int udf_get_last_block(kdev_t, int *); +/* partition.c */ extern Uint32 udf_get_pblock(struct super_block *, Uint32, Uint16, Uint32); extern Uint32 udf_get_lb_pblock(struct super_block *, lb_addr, Uint32); +/* unicode.c */ extern int udf_get_filename(Uint8 *, Uint8 *, int); +/* ialloc.c */ extern void udf_free_inode(struct inode *); extern struct inode * udf_new_inode (const struct inode *, int, int *); -extern void udf_discard_prealloc(struct inode *); + +/* truncate.c */ extern void udf_truncate(struct inode *); extern void udf_truncate_adinicb(struct inode *); + +/* balloc.c */ extern void udf_free_blocks(const struct inode *, lb_addr, Uint32, Uint32); extern int udf_alloc_blocks(const struct inode *, Uint16, Uint32, Uint32); extern int udf_new_block(const struct inode *, Uint16, Uint32, int *); extern int udf_sync_file(struct file *, struct dentry *); -#else - -#include +/* directory.c */ +extern Uint8 * udf_filead_read(struct inode *, Uint8 *, Uint8, lb_addr, int *, int *, struct buffer_head **, int *); +extern struct FileIdentDesc * udf_fileident_read(struct inode *, int *, struct udf_fileident_bh *, struct FileIdentDesc *, lb_addr *, Uint32 *, Uint32 *, struct buffer_head **); #endif /* __KERNEL__ */ -#include "udfend.h" - -/* structures */ -struct udf_directory_record -{ - Uint32 d_parent; - Uint32 d_inode; - Uint32 d_name[255]; -}; - -#define VDS_POS_PRIMARY_VOL_DESC 0 -#define VDS_POS_UNALLOC_SPACE_DESC 1 -#define VDS_POS_LOGICAL_VOL_DESC 2 -#define VDS_POS_PARTITION_DESC 3 -#define VDS_POS_IMP_USE_VOL_DESC 4 -#define VDS_POS_VOL_DESC_PTR 5 -#define VDS_POS_TERMINATING_DESC 6 -#define VDS_POS_LENGTH 7 - -struct udf_vds_record -{ - Uint32 block; - Uint32 volDescSeqNum; -}; - -struct ktm -{ - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_mon; - int tm_year; - int tm_isdst; -}; - -struct ustr -{ - Uint8 u_cmpID; - Uint8 u_name[UDF_NAME_LEN-1]; - Uint8 u_len; - Uint8 padding; - unsigned long u_hash; -}; - - -#define udf_fixed_to_variable(x) ( ( ( (x) >> 5 ) * 39 ) + ( (x) & 0x0000001F ) ) -#define udf_variable_to_fixed(x) ( ( ( (x) / 39 ) << 5 ) + ( (x) % 39 ) ) - -#ifdef __KERNEL__ - -#define CURRENT_UTIME (xtime.tv_usec) - -#define udf_file_entry_alloc_offset(inode)\ - ((UDF_I_EXTENDED_FE(inode) ?\ - sizeof(struct ExtendedFileEntry) :\ - sizeof(struct FileEntry)) + UDF_I_LENEATTR(inode)) - -#define udf_clear_bit(nr,addr) ext2_clear_bit(nr,addr) -#define udf_set_bit(nr,addr) ext2_set_bit(nr,addr) -#define udf_test_bit(nr, addr) ext2_test_bit(nr, addr) -#define udf_find_first_one_bit(addr, size) find_first_one_bit(addr, size) -#define udf_find_next_one_bit(addr, size, offset) find_next_one_bit(addr, size, offset) - -#define leBPL_to_cpup(x) leNUM_to_cpup(BITS_PER_LONG, x) -#define leNUM_to_cpup(x,y) xleNUM_to_cpup(x,y) -#define xleNUM_to_cpup(x,y) (le ## x ## _to_cpup(y)) - -extern inline int find_next_one_bit (void * addr, int size, int offset) -{ - unsigned long * p = ((unsigned long *) addr) + (offset / BITS_PER_LONG); - unsigned long result = offset & ~(BITS_PER_LONG-1); - unsigned long tmp; - - if (offset >= size) - return size; - size -= result; - offset &= (BITS_PER_LONG-1); - if (offset) - { - tmp = leBPL_to_cpup(p++); - tmp &= ~0UL << offset; - if (size < BITS_PER_LONG) - goto found_first; - if (tmp) - goto found_middle; - size -= BITS_PER_LONG; - result += BITS_PER_LONG; - } - while (size & ~(BITS_PER_LONG-1)) - { - if ((tmp = leBPL_to_cpup(p++))) - goto found_middle; - result += BITS_PER_LONG; - size -= BITS_PER_LONG; - } - if (!size) - return result; - tmp = leBPL_to_cpup(p); -found_first: - tmp &= ~0UL >> (BITS_PER_LONG-size); -found_middle: - return result + ffz(~tmp); -} - -#define find_first_one_bit(addr, size)\ - find_next_one_bit((addr), (size), 0) - -#endif - /* Miscellaneous UDF Prototypes */ +/* unicode.c */ extern int udf_ustr_to_dchars(Uint8 *, const struct ustr *, int); extern int udf_ustr_to_char(Uint8 *, const struct ustr *, int); extern int udf_ustr_to_dstring(dstring *, const struct ustr *, int); extern int udf_dchars_to_ustr(struct ustr *, const Uint8 *, int); extern int udf_char_to_ustr(struct ustr *, const Uint8 *, int); extern int udf_dstring_to_ustr(struct ustr *, const dstring *, int); - -extern Uint16 udf_crc(Uint8 *, Uint32, Uint16); extern int udf_translate_to_linux(Uint8 *, Uint8 *, int, Uint8 *, int); extern int udf_build_ustr(struct ustr *, dstring *, int); extern int udf_build_ustr_exact(struct ustr *, dstring *, int); extern int udf_CS0toUTF8(struct ustr *, struct ustr *); extern int udf_UTF8toCS0(dstring *, struct ustr *, int); +/* crc.c */ +extern Uint16 udf_crc(Uint8 *, Uint32, Uint16); + +/* misc.c */ extern uid_t udf_convert_uid(int); extern gid_t udf_convert_gid(int); extern Uint32 udf64_low32(Uint64); extern Uint32 udf64_high32(Uint64); +extern void udf_update_tag(char *, int); +extern void udf_new_tag(char *, Uint16, Uint16, Uint16, Uint32, int); - +/* udftime.c */ extern time_t *udf_stamp_to_time(time_t *, long *, timestamp); extern timestamp *udf_time_to_stamp(timestamp *, time_t, long); extern time_t udf_converttime (struct ktm *); -#ifdef __KERNEL__ -extern Uint8 * -udf_filead_read(struct inode *, Uint8 *, Uint8, lb_addr, int *, int *, - struct buffer_head **, int *); - -extern struct FileIdentDesc * -udf_fileident_read(struct inode *, int *, - struct udf_fileident_bh *, - struct FileIdentDesc *, - lb_addr *, Uint32 *, - Uint32 *, struct buffer_head **); -#endif -extern struct FileIdentDesc * -udf_get_fileident(void * buffer, int bufsize, int * offset); +/* directory.c */ +extern struct FileIdentDesc * udf_get_fileident(void * buffer, int bufsize, int * offset); extern extent_ad * udf_get_fileextent(void * buffer, int bufsize, int * offset); extern long_ad * udf_get_filelongad(void * buffer, int bufsize, int * offset, int); extern short_ad * udf_get_fileshortad(void * buffer, int bufsize, int * offset, int); extern Uint8 * udf_get_filead(struct FileEntry *, Uint8 *, int, int, int, int *); -extern void udf_update_tag(char *, int); -extern void udf_new_tag(char *, Uint16, Uint16, Uint16, Uint32, int); - -#endif +#endif /* __UDF_DECL_H */ diff --git a/fs/udf/udfend.h b/fs/udf/udfend.h index 031f5b507dd2..67161d7aea71 100644 --- a/fs/udf/udfend.h +++ b/fs/udf/udfend.h @@ -3,6 +3,8 @@ #ifndef __KERNEL__ +#include + #if __BYTE_ORDER == 0 #error "__BYTE_ORDER must be defined" @@ -44,8 +46,11 @@ #endif /* __BYTE_ORDER == 0 */ +#include + #else /* __KERNEL__ */ +#include #include #endif /* ! __KERNEL__ */ diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index b092b10d684f..59e67a8598e6 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -391,7 +391,6 @@ extern __inline__ int unregister_gifconf(unsigned int family) #define HAVE_NETIF_RX 1 extern void netif_rx(struct sk_buff *skb); extern void net_bh(void); -extern int dev_get_info(char *buffer, char **start, off_t offset, int length, int dummy); extern int dev_ioctl(unsigned int cmd, void *); extern int dev_change_flags(struct net_device *, unsigned); extern void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev); diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index d0e57016f98b..a061d647d899 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -53,7 +53,7 @@ typedef int (read_proc_t)(char *page, char **start, off_t off, int count, int *eof, void *data); typedef int (write_proc_t)(struct file *file, const char *buffer, unsigned long count, void *data); -typedef int (get_info_t)(char *, char **, off_t, int, int); +typedef int (get_info_t)(char *, char **, off_t, int); struct proc_dir_entry { unsigned short low_ino; @@ -71,24 +71,18 @@ struct proc_dir_entry { void *data; read_proc_t *read_proc; write_proc_t *write_proc; - int (*readlink_proc)(struct proc_dir_entry *de, char *page); unsigned int count; /* use count */ int deleted; /* delete flag */ + kdev_t rdev; }; #define PROC_INODE_PROPER(inode) ((inode)->i_ino & ~0xffff) -#define PROC_INODE_OPENPROM(inode) \ - ((inode->i_ino >= PROC_OPENPROM_FIRST) \ - && (inode->i_ino < PROC_OPENPROM_FIRST + PROC_NOPENPROM)) #ifdef CONFIG_PROC_FS extern struct proc_dir_entry proc_root; extern struct proc_dir_entry *proc_root_fs; extern struct proc_dir_entry *proc_net; -extern struct proc_dir_entry proc_sys; -extern struct proc_dir_entry proc_openprom; -extern struct proc_dir_entry *proc_mca; extern struct proc_dir_entry *proc_bus; extern struct proc_dir_entry *proc_root_driver; extern struct proc_dir_entry proc_root_kcore; @@ -101,62 +95,15 @@ void proc_pid_delete_inode(struct inode *inode); int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir); extern int proc_register(struct proc_dir_entry *, struct proc_dir_entry *); -extern int proc_unregister(struct proc_dir_entry *, int); extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, struct proc_dir_entry *parent); extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); - -/* - * retrieve the proc_dir_entry associated with /proc/driver/$module_name - */ -extern inline -struct proc_dir_entry *proc_driver_find (const char *module_name) -{ - struct proc_dir_entry *p; - - p = proc_root_driver->subdir; - while (p != NULL) { - if (strcmp (p->name, module_name) == 0) - return p; - - p = p->next; - } - return NULL; -} - - -/* - * remove /proc/driver/$module_name, and all its contents - */ -extern inline int proc_driver_unregister(const char *module_name) -{ - remove_proc_entry (module_name, proc_root_driver); - return 0; -} - - -/* - * create driver-specific playground directory, /proc/driver/$module_name - */ -extern inline int proc_driver_register(const char *module_name) -{ - struct proc_dir_entry *p; - - p = create_proc_entry (module_name, S_IFDIR, proc_root_driver); - - return (p == NULL) ? -1 : 0; -} - extern struct super_block *proc_super_blocks; -extern struct dentry_operations proc_dentry_operations; extern struct super_block *proc_read_super(struct super_block *,void *,int); extern int init_proc_fs(void); extern struct inode * proc_get_inode(struct super_block *, int, struct proc_dir_entry *); -extern int proc_statfs(struct super_block *, struct statfs *, int); -extern void proc_read_inode(struct inode *); -extern void proc_write_inode(struct inode *); extern int proc_match(int, const char *,struct proc_dir_entry *); @@ -178,22 +125,11 @@ struct openpromfs_dev { mode_t mode; char name[32]; }; -extern struct inode_operations * -proc_openprom_register(int (*readdir)(struct file *, void *, filldir_t), - struct dentry * (*lookup)(struct inode *, struct dentry *), - void (*use)(struct inode *, int), - struct openpromfs_dev ***); -extern void proc_openprom_deregister(void); -extern void (*proc_openprom_use)(struct inode *,int); extern int proc_openprom_regdev(struct openpromfs_dev *); extern int proc_openprom_unregdev(struct openpromfs_dev *); -extern struct inode_operations proc_dir_inode_operations; -extern struct inode_operations proc_file_inode_operations; -extern struct inode_operations proc_openprom_inode_operations; extern struct inode_operations proc_sys_inode_operations; extern struct inode_operations proc_kcore_inode_operations; -extern struct inode_operations proc_profile_inode_operations; extern struct inode_operations proc_kmsg_inode_operations; #if CONFIG_AP1000 extern struct inode_operations proc_ringbuf_inode_operations; @@ -213,6 +149,12 @@ extern void proc_tty_unregister_driver(struct tty_driver *driver); */ extern void proc_device_tree_init(void); +extern struct proc_dir_entry *proc_symlink(const char *, + struct proc_dir_entry *,char *); +extern struct proc_dir_entry *proc_mknod(const char *,mode_t, + struct proc_dir_entry *,kdev_t); +extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *); + extern inline struct proc_dir_entry *create_proc_read_entry(const char *name, mode_t mode, struct proc_dir_entry *base, read_proc_t *read_proc, void * data) @@ -247,7 +189,6 @@ extern inline void proc_net_remove(const char *name) #else extern inline int proc_register(struct proc_dir_entry *a, struct proc_dir_entry *b) { return 0; } -extern inline int proc_unregister(struct proc_dir_entry *a, int b) { return 0; } extern inline struct proc_dir_entry *proc_net_create(const char *name, mode_t mode, get_info_t *get_info) {return NULL;} extern inline void proc_net_remove(const char *name) {} @@ -256,6 +197,12 @@ extern inline struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, struct proc_dir_entry *parent) { return NULL; } extern inline void remove_proc_entry(const char *name, struct proc_dir_entry *parent) {}; +extern inline proc_dir_entry *proc_symlink(const char *name, + struct proc_dir_entry *parent,char *dest) {return NULL;} +extern inline proc_dir_entry *proc_mknod(const char *name,mode_t mode, + struct proc_dir_entry *parent,kdev_t rdev) {return NULL;} +extern struct proc_dir_entry *proc_mkdir(const char *name, + struct proc_dir_entry *parent) {return NULL;} extern inline struct proc_dir_entry *create_proc_read_entry(const char *name, mode_t mode, struct proc_dir_entry *base, @@ -268,22 +215,6 @@ extern inline struct proc_dir_entry *create_proc_info_entry(const char *name, extern inline void proc_tty_register_driver(struct tty_driver *driver) {}; extern inline void proc_tty_unregister_driver(struct tty_driver *driver) {}; -extern inline -struct proc_dir_entry *proc_driver_find (const char *module_name) -{ - return NULL; -} - -extern inline int proc_driver_unregister(const char *module_name) -{ - return 0; -} - -extern inline int proc_driver_register(const char *module_name) -{ - return 0; -} - extern struct proc_dir_entry proc_root; #endif /* CONFIG_PROC_FS */ diff --git a/include/linux/serial.h b/include/linux/serial.h index d16ef2583be3..6ca7fd9afd43 100644 --- a/include/linux/serial.h +++ b/include/linux/serial.h @@ -37,6 +37,20 @@ struct serial_struct { #define ASYNC_CLOSING_WAIT_INF 0 #define ASYNC_CLOSING_WAIT_NONE 65535 +/* + * The size of the serial xmit buffer is 1 page, or 4096 bytes + */ +#define SERIAL_XMIT_SIZE 4096 + +/* + * Counters of the input lines (CTS, DSR, RI, CD) interrupts + */ +struct async_icount { + __u32 cts, dsr, rng, dcd, tx, rx; + __u32 frame, parity, overrun, brk; + __u32 buf_overrun; +}; + /* * These are the supported serial types. */ diff --git a/include/linux/serialP.h b/include/linux/serialP.h index 25fb7d353d27..2ba8d94807f9 100644 --- a/include/linux/serialP.h +++ b/include/linux/serialP.h @@ -19,18 +19,11 @@ * For definitions of the flags field, see tty.h */ +#include #include #include #include -/* - * Counters of the input lines (CTS, DSR, RI, CD) interrupts - */ -struct async_icount { - __u32 cts, dsr, rng, dcd, tx, rx; - __u32 frame, parity, overrun, brk; - __u32 buf_overrun; -}; struct serial_state { int magic; diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index ce76c926d4b2..bba4a10f63bd 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -106,7 +106,8 @@ enum KERN_RANDOM=40, /* Random driver */ KERN_SHMALL=41, /* int: Maximum size of shared memory */ KERN_MSGMNI=42, /* int: msg queue identifiers */ - KERN_SEM=43 /* int: sysv semaphore limits */ + KERN_SEM=43, /* int: sysv semaphore limits */ + KERN_SPARC_STOP_A=44 /* int: Sparc Stop-A enable */ }; diff --git a/include/linux/udf_fs.h b/include/linux/udf_fs.h index 9c0b764a24d2..e3dbdd5fda22 100644 --- a/include/linux/udf_fs.h +++ b/include/linux/udf_fs.h @@ -30,8 +30,8 @@ #define UDF_DEFAULT_PREALLOC_BLOCKS 8 #define UDF_DEFAULT_PREALLOC_DIR_BLOCKS 0 -#define UDFFS_DATE "99/10/29" -#define UDFFS_VERSION "0.8.9.3" +#define UDFFS_DATE "99/11/18" +#define UDFFS_VERSION "0.8.9.4" #define UDFFS_DEBUG #ifdef UDFFS_DEBUG diff --git a/include/linux/videodev.h b/include/linux/videodev.h index f58bf97ddc1b..7091d50870a4 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h @@ -175,6 +175,7 @@ struct video_window struct video_clip *clips; /* Set only */ int clipcount; #define VIDEO_WINDOW_INTERLACE 1 +#define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */ #define VIDEO_CLIP_BITMAP -1 /* bitmap is 1024x625, a '1' bit represents a clipped pixel */ #define VIDEO_CLIPMAP_SIZE (128 * 625) diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h index 993579d8ce37..accecf8d29bc 100644 --- a/include/linux/wanrouter.h +++ b/include/linux/wanrouter.h @@ -363,7 +363,7 @@ typedef struct wan_device struct wan_device* next; /* -> next device */ struct net_device* dev; /* list of network interfaces */ unsigned ndev; /* number of interfaces */ - struct proc_dir_entry dent; /* proc filesystem entry */ + struct proc_dir_entry *dent; /* proc filesystem entry */ } wan_device_t; /* Public functions available for device drivers */ diff --git a/include/net/ax25.h b/include/net/ax25.h index 96780fc1fe83..f0c547d0b5d6 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h @@ -286,7 +286,7 @@ extern int ax25_check_iframes_acked(ax25_cb *, unsigned short); /* ax25_route.c */ extern void ax25_rt_device_down(struct net_device *); extern int ax25_rt_ioctl(unsigned int, void *); -extern int ax25_rt_get_info(char *, char **, off_t, int, int); +extern int ax25_rt_get_info(char *, char **, off_t, int); extern int ax25_rt_autobind(ax25_cb *, ax25_address *); extern ax25_route *ax25_rt_find_route(ax25_address *, struct net_device *); extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *); @@ -339,7 +339,7 @@ extern unsigned long ax25_display_timer(struct timer_list *); extern int ax25_uid_policy; extern ax25_address *ax25_findbyuid(uid_t); extern int ax25_uid_ioctl(int, struct sockaddr_ax25 *); -extern int ax25_uid_get_info(char *, char **, off_t, int, int); +extern int ax25_uid_get_info(char *, char **, off_t, int); extern void ax25_uid_free(void); /* sysctl_net_ax25.c */ diff --git a/include/net/br.h b/include/net/br.h index 82b79ca5d614..14203c06192c 100644 --- a/include/net/br.h +++ b/include/net/br.h @@ -296,7 +296,6 @@ void requeue_fdb(struct fdb *node, int new_port); struct fdb *br_avl_find_addr(unsigned char addr[6]); struct fdb *br_avl_insert (struct fdb * new_node); void sprintf_avl (char **pbuffer, struct fdb * tree, off_t *pos,int* len, off_t offset, int length); -int br_tree_get_info(char *buffer, char **start, off_t offset, int length, int dummy); void br_avl_delete_by_port(int port); /* externs */ diff --git a/include/net/ip.h b/include/net/ip.h index e14ad1445509..419078aba827 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -78,7 +78,7 @@ extern rwlock_t ip_ra_lock; extern void ip_mc_dropsocket(struct sock *); extern void ip_mc_dropdevice(struct net_device *dev); -extern int ip_mc_procinfo(char *, char **, off_t, int, int); +extern int ip_mc_procinfo(char *, char **, off_t, int); /* * Functions provided by ip.c diff --git a/include/net/netrom.h b/include/net/netrom.h index e69d76a0151f..11aefe5fa93f 100644 --- a/include/net/netrom.h +++ b/include/net/netrom.h @@ -147,8 +147,8 @@ extern struct net_device *nr_dev_get(ax25_address *); extern int nr_rt_ioctl(unsigned int, void *); extern void nr_link_failed(ax25_cb *, int); extern int nr_route_frame(struct sk_buff *, ax25_cb *); -extern int nr_nodes_get_info(char *, char **, off_t, int, int); -extern int nr_neigh_get_info(char *, char **, off_t, int, int); +extern int nr_nodes_get_info(char *, char **, off_t, int); +extern int nr_neigh_get_info(char *, char **, off_t, int); extern void nr_rt_free(void); /* nr_subr.c */ diff --git a/include/net/rose.h b/include/net/rose.h index a74f132c294e..da19fb64f1bb 100644 --- a/include/net/rose.h +++ b/include/net/rose.h @@ -207,9 +207,9 @@ extern struct rose_neigh *rose_get_neigh(rose_address *, unsigned char *, unsign extern int rose_rt_ioctl(unsigned int, void *); extern void rose_link_failed(ax25_cb *, int); extern int rose_route_frame(struct sk_buff *, ax25_cb *); -extern int rose_nodes_get_info(char *, char **, off_t, int, int); -extern int rose_neigh_get_info(char *, char **, off_t, int, int); -extern int rose_routes_get_info(char *, char **, off_t, int, int); +extern int rose_nodes_get_info(char *, char **, off_t, int); +extern int rose_neigh_get_info(char *, char **, off_t, int); +extern int rose_routes_get_info(char *, char **, off_t, int); extern void rose_rt_free(void); /* rose_subr.c */ diff --git a/include/net/x25.h b/include/net/x25.h index b2ea4f8b6a11..3b28c58ce1ae 100644 --- a/include/net/x25.h +++ b/include/net/x25.h @@ -192,7 +192,7 @@ extern struct net_device *x25_get_route(x25_address *); extern struct net_device *x25_dev_get(char *); extern void x25_route_device_down(struct net_device *); extern int x25_route_ioctl(unsigned int, void *); -extern int x25_routes_get_info(char *, char **, off_t, int, int); +extern int x25_routes_get_info(char *, char **, off_t, int); extern void x25_route_free(void); /* x25_subr.c */ diff --git a/kernel/sysctl.c b/kernel/sysctl.c index f18ad13c15f3..b62240ebedfd 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -584,13 +584,12 @@ static void unregister_proc_table(ctl_table * table, struct proc_dir_entry *root continue; } - /* Don't unregoster proc entries that are still being used.. */ + /* Don't unregister proc entries that are still being used.. */ if (de->count) continue; - proc_unregister(root, de->low_ino); table->de = NULL; - kfree(de); + remove_proc_entry(table->procname, root); } } diff --git a/net/802/tr.c b/net/802/tr.c index fe96fc696ef3..2d836d9c58a8 100644 --- a/net/802/tr.c +++ b/net/802/tr.c @@ -455,9 +455,9 @@ static void rif_check_expire(unsigned long dummy) */ #ifndef CONFIG_PROC_FS -int rif_get_info(char *buffer,char **start, off_t offset, int length, int dummy) {} +static int rif_get_info(char *buffer,char **start, off_t offset, int length) {} #else -int rif_get_info(char *buffer,char **start, off_t offset, int length, int dummy) +static int rif_get_info(char *buffer,char **start, off_t offset, int length) { int len=0; off_t begin=0; diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c index 392e01c2c904..6590ff316957 100644 --- a/net/appletalk/aarp.c +++ b/net/appletalk/aarp.c @@ -1055,7 +1055,7 @@ void aarp_device_down(struct net_device *dev) /* * Called from proc fs */ -int aarp_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int aarp_get_info(char *buffer, char **start, off_t offset, int length) { /* we should dump all our AARP entries */ struct aarp_entry *entry; diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index b31a462263f6..2c576f462972 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c @@ -214,7 +214,7 @@ extern inline void atalk_destroy_socket(struct sock *sk) /* * Called from proc fs */ -int atalk_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int atalk_get_info(char *buffer, char **start, off_t offset, int length) { struct sock *s; int len=0; @@ -1038,7 +1038,7 @@ static int atrtr_ioctl(unsigned int cmd, void *arg) /* Called from proc fs - just make it print the ifaces neatly */ -int atalk_if_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int atalk_if_get_info(char *buffer, char **start, off_t offset, int length) { struct atalk_iface *iface; int len=0; @@ -1071,7 +1071,7 @@ int atalk_if_get_info(char *buffer, char **start, off_t offset, int length, int /* Called from proc fs - just make it print the routes neatly */ -int atalk_rt_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int atalk_rt_get_info(char *buffer, char **start, off_t offset, int length) { struct atalk_route *rt; int len=0; diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 6aa960f9fdb8..ba93e1ba123b 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -1628,7 +1628,7 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) return 0; } -static int ax25_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int ax25_get_info(char *buffer, char **start, off_t offset, int length) { ax25_cb *ax25; int k; diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c index 3e301e3e6063..e92a1b39e4b4 100644 --- a/net/ax25/ax25_route.c +++ b/net/ax25/ax25_route.c @@ -236,7 +236,7 @@ int ax25_rt_ioctl(unsigned int cmd, void *arg) return 0; } -int ax25_rt_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int ax25_rt_get_info(char *buffer, char **start, off_t offset, int length) { ax25_route *ax25_rt; int len = 0; diff --git a/net/ax25/ax25_uid.c b/net/ax25/ax25_uid.c index f07362c33cb3..1cce0dd6d352 100644 --- a/net/ax25/ax25_uid.c +++ b/net/ax25/ax25_uid.c @@ -129,7 +129,7 @@ int ax25_uid_ioctl(int cmd, struct sockaddr_ax25 *sax) return -EINVAL; /*NOTREACHED */ } -int ax25_uid_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int ax25_uid_get_info(char *buffer, char **start, off_t offset, int length) { ax25_uid_assoc *pt; int len = 0; diff --git a/net/bridge/br.c b/net/bridge/br.c index d31664601204..4947a9b89de7 100644 --- a/net/bridge/br.c +++ b/net/bridge/br.c @@ -806,7 +806,7 @@ static void hold_timer_expiry(int port_no) /* (4.7.8) */ /* Vova Oksman: Write the buffer (contents of the Bridge table) */ /* to a PROCfs file */ -int br_tree_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int br_tree_get_info(char *buffer, char **start, off_t offset, int length) { int size; int len=0; diff --git a/net/core/dev.c b/net/core/dev.c index 612a14d5c2ec..0d9443ff42ba 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1228,7 +1228,7 @@ static int sprintf_stats(char *buffer, struct net_device *dev) * to create /proc/net/dev */ -int dev_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int dev_get_info(char *buffer, char **start, off_t offset, int length) { int len=0; off_t begin=0; @@ -1346,8 +1346,8 @@ static int sprintf_wireless_stats(char *buffer, struct net_device *dev) * Print info for /proc/net/wireless (print all entries) * This is a clone of /proc/net/dev (just above) */ -int dev_get_wireless_info(char * buffer, char **start, off_t offset, - int length, int dummy) +static int dev_get_wireless_info(char * buffer, char **start, off_t offset, + int length) { int len = 0; off_t begin = 0; diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index 077f3051c1d5..c4a9c44dd7cc 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c @@ -1980,7 +1980,7 @@ static struct packet_type dn_dix_packet_type = NULL, }; -static int dn_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int dn_get_info(char *buffer, char **start, off_t offset, int length) { struct sock *sk; struct dn_scp *scp; @@ -2036,7 +2036,7 @@ static int dn_get_info(char *buffer, char **start, off_t offset, int length, int #ifdef CONFIG_DECNET_RAW -extern int dn_raw_get_info(char *, char **, off_t, int, int); +extern int dn_raw_get_info(char *, char **, off_t, int); #endif /* CONFIG_DECNET_RAW */ static struct net_proto_family dn_family_ops = { diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 435f7859d257..87e28378c78b 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c @@ -1164,7 +1164,7 @@ static char *dn_type2asc(char type) return "?"; } -static int decnet_dev_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int decnet_dev_get_info(char *buffer, char **start, off_t offset, int length) { struct dn_dev *dn_db; struct net_device *dev; diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c index d07eefa970ed..358e9a184700 100644 --- a/net/decnet/dn_fib.c +++ b/net/decnet/dn_fib.c @@ -759,7 +759,7 @@ static int dn_proc_action_list(struct dn_fib_walker_t *fwt, struct dn_fib_node * return 0; } -static int decnet_rt_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int decnet_rt_get_info(char *buffer, char **start, off_t offset, int length) { struct dn_fib_procfs pinfo; int i; diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c index 775e1a26df1a..bddf4b049064 100644 --- a/net/decnet/dn_neigh.c +++ b/net/decnet/dn_neigh.c @@ -589,7 +589,7 @@ int dn_neigh_elist(struct net_device *dev, unsigned char *ptr, int n) #ifdef CONFIG_PROC_FS -int dn_neigh_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int dn_neigh_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0; off_t pos = 0; diff --git a/net/decnet/dn_raw.c b/net/decnet/dn_raw.c index ca7ec06317b1..90e9b2bad72f 100644 --- a/net/decnet/dn_raw.c +++ b/net/decnet/dn_raw.c @@ -264,7 +264,7 @@ struct proto_ops dn_raw_proto_ops = { }; #ifdef CONFIG_PROC_FS -int dn_raw_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int dn_raw_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0; off_t pos = 0; diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 7abab2b8d51b..679c3dfb024d 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c @@ -915,7 +915,7 @@ done: #ifdef CONFIG_PROC_FS -static int decnet_cache_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int decnet_cache_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0; off_t pos = 0; diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 396cf38d893e..5c370cc7ceb2 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -119,12 +119,12 @@ struct linux_mib net_statistics; atomic_t inet_sock_nr; -extern int raw_get_info(char *, char **, off_t, int, int); -extern int snmp_get_info(char *, char **, off_t, int, int); -extern int netstat_get_info(char *, char **, off_t, int, int); -extern int afinet_get_info(char *, char **, off_t, int, int); -extern int tcp_get_info(char *, char **, off_t, int, int); -extern int udp_get_info(char *, char **, off_t, int, int); +extern int raw_get_info(char *, char **, off_t, int); +extern int snmp_get_info(char *, char **, off_t, int); +extern int netstat_get_info(char *, char **, off_t, int); +extern int afinet_get_info(char *, char **, off_t, int); +extern int tcp_get_info(char *, char **, off_t, int); +extern int udp_get_info(char *, char **, off_t, int); extern void ip_mc_drop_socket(struct sock *sk); #ifdef CONFIG_DLCI diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index b60cd3650daa..f4272338b617 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -1003,11 +1003,11 @@ out: * Write the contents of the ARP cache to a PROCfs file. */ #ifndef CONFIG_PROC_FS -static int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy) { return 0; } +static int arp_get_info(char *buffer, char **start, off_t offset, int length) { return 0; } #else #define HBUFFERLEN 30 -static int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int arp_get_info(char *buffer, char **start, off_t offset, int length) { int len=0; off_t pos=0; diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 47cc41a92d5c..d48704cc6e3a 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -107,7 +107,7 @@ void fib_flush(void) */ static int -fib_get_procinfo(char *buffer, char **start, off_t offset, int length, int dummy) +fib_get_procinfo(char *buffer, char **start, off_t offset, int length) { int first = offset/128; char *ptr = buffer; diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 0ff9ffedae1c..5f4ab1078346 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c @@ -757,7 +757,7 @@ int ip_check_mc(struct in_device *in_dev, u32 mc_addr) #ifdef CONFIG_IP_MULTICAST -int ip_mc_procinfo(char *buffer, char **start, off_t offset, int length, int dummy) +int ip_mc_procinfo(char *buffer, char **start, off_t offset, int length) { off_t pos=0, begin=0; struct ip_mc_list *im; diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index fa464f24c37a..159cacb1bd9d 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -1017,7 +1017,7 @@ void __init ip_init(void) ip_rt_init(); #ifdef CONFIG_IP_MULTICAST - proc_net_create("igmp", S_IFREG | S_IRUGO, ip_mc_procinfo); + proc_net_create("igmp", 0, ip_mc_procinfo); #endif } diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index b65d6f405992..86393bfda037 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c @@ -1576,7 +1576,7 @@ int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait) * The /proc interfaces to multicast routing /proc/ip_mr_cache /proc/ip_mr_vif */ -int ipmr_vif_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int ipmr_vif_info(char *buffer, char **start, off_t offset, int length) { struct vif_device *vif; int len=0; @@ -1622,7 +1622,7 @@ int ipmr_vif_info(char *buffer, char **start, off_t offset, int length, int dumm return len; } -int ipmr_mfc_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int ipmr_mfc_info(char *buffer, char **start, off_t offset, int length) { struct mfc_cache *mfc; int len=0; diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index 7057c343aef1..e2068a3abe48 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c @@ -53,7 +53,7 @@ /* * Report socket allocation statistics [mea@utu.fi] */ -int afinet_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int afinet_get_info(char *buffer, char **start, off_t offset, int length) { /* From net/socket.c */ extern int socket_get_info(char *, char **, off_t, int); @@ -85,7 +85,7 @@ int afinet_get_info(char *buffer, char **start, off_t offset, int length, int du * Called from the PROCfs module. This outputs /proc/net/snmp. */ -int snmp_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int snmp_get_info(char *buffer, char **start, off_t offset, int length) { extern struct tcp_mib tcp_statistics; extern struct udp_mib udp_statistics; @@ -164,7 +164,7 @@ int snmp_get_info(char *buffer, char **start, off_t offset, int length, int dumm * Output /proc/net/netstat */ -int netstat_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int netstat_get_info(char *buffer, char **start, off_t offset, int length) { extern struct linux_mib net_statistics; int len; diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 83044d2cda0b..d445521764ed 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c @@ -603,7 +603,7 @@ static void get_raw_sock(struct sock *sp, char *tmpbuf, int i) atomic_read(&sp->refcnt), sp); } -int raw_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int raw_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0, num = 0, i; off_t pos = 0; diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 2fe7e0fdb78c..33b27036fe48 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -202,9 +202,9 @@ static __inline__ unsigned rt_hash_code(u32 daddr, u32 saddr, u8 tos) } #ifndef CONFIG_PROC_FS -static int rt_cache_get_info(char *buffer, char **start, off_t offset, int length, int dummy) { return 0; } +static int rt_cache_get_info(char *buffer, char **start, off_t offset, int length) { return 0; } #else -static int rt_cache_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int rt_cache_get_info(char *buffer, char **start, off_t offset, int length) { int len=0; off_t pos=0; diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 87ec2d773759..8e2c56654ffc 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -2076,7 +2076,7 @@ static void get_timewait_sock(struct tcp_tw_bucket *tw, char *tmpbuf, int i) atomic_read(&tw->refcnt), tw); } -int tcp_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int tcp_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0, num = 0, i; off_t begin, pos = 0; diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index bffd5b7271aa..518572142a97 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -1051,7 +1051,7 @@ static void get_udp_sock(struct sock *sp, char *tmpbuf, int i) atomic_read(&sp->refcnt), sp); } -int udp_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int udp_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0, num = 0, i; off_t pos = 0; diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 157fe6c4e301..d7192096bcc6 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -1540,7 +1540,7 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp) #ifdef CONFIG_PROC_FS static int iface_proc_info(char *buffer, char **start, off_t offset, - int length, int dummy) + int length) { struct inet6_ifaddr *ifp; int i; diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 1e056d2ea423..638c1e79d155 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c @@ -73,11 +73,11 @@ extern struct proto_ops inet6_dgram_ops; /* IPv6 procfs goodies... */ #ifdef CONFIG_PROC_FS -extern int raw6_get_info(char *, char **, off_t, int, int); -extern int tcp6_get_info(char *, char **, off_t, int, int); -extern int udp6_get_info(char *, char **, off_t, int, int); -extern int afinet6_get_info(char *, char **, off_t, int, int); -extern int afinet6_get_snmp(char *, char **, off_t, int, int); +extern int raw6_get_info(char *, char **, off_t, int); +extern int tcp6_get_info(char *, char **, off_t, int); +extern int udp6_get_info(char *, char **, off_t, int); +extern int afinet6_get_info(char *, char **, off_t, int); +extern int afinet6_get_snmp(char *, char **, off_t, int); #endif #ifdef CONFIG_SYSCTL diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index dab819da8c34..9c3cce05d49a 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -1110,7 +1110,7 @@ int ndisc_rcv(struct sk_buff *skb, unsigned long len) #ifdef CONFIG_PROC_FS #ifndef CONFIG_RTNETLINK -int ndisc_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int ndisc_get_info(char *buffer, char **start, off_t offset, int length) { int len=0; off_t pos=0; diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index 09845703b4ed..2e2603668e53 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c @@ -26,7 +26,7 @@ #include #include -int afinet6_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int afinet6_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0; len += sprintf(buffer+len, "TCP6: inuse %d highest %d\n", @@ -122,8 +122,7 @@ struct snmp6_item }; -int afinet6_get_snmp(char *buffer, char **start, off_t offset, int length, - int dummy) +int afinet6_get_snmp(char *buffer, char **start, off_t offset, int length) { int len = 0; int i; diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index b13ccd164120..d52c6a129b47 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c @@ -715,7 +715,7 @@ static void get_raw6_sock(struct sock *sp, char *tmpbuf, int i) atomic_read(&sp->refcnt), sp); } -int raw6_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int raw6_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0, num = 0, i; off_t pos = 0; diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 431ef0c85808..dddc12bc9f92 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -1809,8 +1809,7 @@ static int rt6_info_route(struct rt6_info *rt, void *p_arg) return 0; } -static int rt6_proc_info(char *buffer, char **start, off_t offset, int length, - int dummy) +static int rt6_proc_info(char *buffer, char **start, off_t offset, int length) { struct rt6_proc_arg arg; arg.buffer = buffer; @@ -1839,8 +1838,7 @@ static int rt6_proc_info(char *buffer, char **start, off_t offset, int length, extern struct rt6_statistics rt6_stats; -static int rt6_proc_stats(char *buffer, char **start, off_t offset, int length, - int dummy) +static int rt6_proc_stats(char *buffer, char **start, off_t offset, int length) { int len; diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index a80b1153b081..8f7fbb7ba8c6 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -1988,7 +1988,7 @@ static void get_timewait6_sock(struct tcp_tw_bucket *tw, char *tmpbuf, int i) #define LINE_LEN 190 #define LINE_FMT "%-190s\n" -int tcp6_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int tcp6_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0, num = 0, i; off_t begin, pos = 0; diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index e167c7e78c0c..6c2777b32f03 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -936,7 +936,7 @@ static void get_udp6_sock(struct sock *sp, char *tmpbuf, int i) atomic_read(&sp->refcnt), sp); } -int udp6_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int udp6_get_info(char *buffer, char **start, off_t offset, int length) { int len = 0, num = 0, i; off_t pos = 0; diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index d94e52a69186..60427ef6e845 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c @@ -1505,7 +1505,7 @@ static const char *ipx_device_name(ipx_interface *intrfc) /* Called from proc fs */ static int ipx_interface_get_info(char *buffer, char **start, off_t offset, - int length, int dummy) + int length) { ipx_interface *i; off_t begin = 0, pos = 0; @@ -1548,8 +1548,7 @@ static int ipx_interface_get_info(char *buffer, char **start, off_t offset, return (len); } -static int ipx_get_info(char *buffer, char **start, off_t offset, - int length, int dummy) +static int ipx_get_info(char *buffer, char **start, off_t offset, int length) { struct sock *s; ipx_interface *i; @@ -1630,8 +1629,7 @@ static int ipx_get_info(char *buffer, char **start, off_t offset, return (len); } -static int ipx_rt_get_info(char *buffer, char **start, off_t offset, - int length, int dummy) +static int ipx_rt_get_info(char *buffer, char **start, off_t offset, int length) { ipx_route *rt; off_t begin = 0, pos = 0; diff --git a/net/irda/discovery.c b/net/irda/discovery.c index 957426154e18..84d0239e3379 100644 --- a/net/irda/discovery.c +++ b/net/irda/discovery.c @@ -209,8 +209,7 @@ __u32 irlmp_find_device(hashbin_t *cachelog, char *name, __u32 *saddr) * Print discovery information in /proc file system * */ -int discovery_proc_read(char *buf, char **start, off_t offset, int len, - int unused) +int discovery_proc_read(char *buf, char **start, off_t offset, int len) { discovery_t *discovery; unsigned long flags; diff --git a/net/irda/ircomm/ircomm_core.c b/net/irda/ircomm/ircomm_core.c index 379e342adb58..ed45a509f3c0 100644 --- a/net/irda/ircomm/ircomm_core.c +++ b/net/irda/ircomm/ircomm_core.c @@ -52,8 +52,7 @@ static void ircomm_control_indication(struct ircomm_cb *self, struct sk_buff *skb, int clen); #ifdef CONFIG_PROC_FS -static int ircomm_proc_read(char *buf, char **start, off_t offset, int len, - int unused); +static int ircomm_proc_read(char *buf, char **start, off_t offset, int len); extern struct proc_dir_entry *proc_irda; #endif /* CONFIG_PROC_FS */ @@ -69,7 +68,7 @@ int __init ircomm_init(void) } #ifdef CONFIG_PROC_FS - create_proc_entry("ircomm", 0, proc_irda)->get_info = ircomm_proc_read; + create_proc_info_entry("ircomm", 0, proc_irda, ircomm_proc_read); #endif /* CONFIG_PROC_FS */ MESSAGE("IrCOMM protocol (Dag Brattli)\n"); @@ -463,13 +462,12 @@ void ircomm_flow_request(struct ircomm_cb *self, LOCAL_FLOW flow) #ifdef CONFIG_PROC_FS /* - * Function ircomm_proc_read (buf, start, offset, len, unused) + * Function ircomm_proc_read (buf, start, offset, len) * * * */ -int ircomm_proc_read(char *buf, char **start, off_t offset, int len, - int unused) +int ircomm_proc_read(char *buf, char **start, off_t offset, int len) { struct ircomm_cb *self; unsigned long flags; diff --git a/net/irda/iriap.c b/net/irda/iriap.c index bcd43e8c06ef..c5bf0ce220dd 100644 --- a/net/irda/iriap.c +++ b/net/irda/iriap.c @@ -883,7 +883,7 @@ static char *ias_value_types[] = { "IAS_STRING" }; -int irias_proc_read(char *buf, char **start, off_t offset, int len, int unused) +int irias_proc_read(char *buf, char **start, off_t offset, int len) { struct ias_object *obj; struct ias_attrib *attrib; diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c index caa3550c137e..64593e3197ad 100644 --- a/net/irda/irlan/irlan_common.c +++ b/net/irda/irlan/irlan_common.c @@ -96,8 +96,7 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, void irlan_close_tsaps(struct irlan_cb *self); #ifdef CONFIG_PROC_FS -static int irlan_proc_read(char *buf, char **start, off_t offset, int len, - int unused); +static int irlan_proc_read(char *buf, char **start, off_t offset, int len); extern struct proc_dir_entry *proc_irda; #endif /* CONFIG_PROC_FS */ @@ -1155,8 +1154,7 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) * * Give some info to the /proc file system */ -static int irlan_proc_read(char *buf, char **start, off_t offset, int len, - int unused) +static int irlan_proc_read(char *buf, char **start, off_t offset, int len) { struct irlan_cb *self; unsigned long flags; diff --git a/net/irda/irlap.c b/net/irda/irlap.c index ffa3665e39a9..8b259fd9c2b2 100644 --- a/net/irda/irlap.c +++ b/net/irda/irlap.c @@ -65,7 +65,7 @@ static char *lap_reasons[] = { }; #ifdef CONFIG_PROC_FS -int irlap_proc_read(char *, char **, off_t, int, int); +int irlap_proc_read(char *, char **, off_t, int); #endif /* CONFIG_PROC_FS */ @@ -1085,13 +1085,12 @@ void irlap_set_local_busy(struct irlap_cb *self, int status) #ifdef CONFIG_PROC_FS /* - * Function irlap_proc_read (buf, start, offset, len, unused) + * Function irlap_proc_read (buf, start, offset, len) * * Give some info to the /proc file system * */ -int irlap_proc_read(char *buf, char **start, off_t offset, int len, - int unused) +int irlap_proc_read(char *buf, char **start, off_t offset, int len) { struct irlap_cb *self; unsigned long flags; diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c index bd2f906f9b97..c83d62f4454c 100644 --- a/net/irda/irlmp.c +++ b/net/irda/irlmp.c @@ -63,7 +63,7 @@ char *lmp_reasons[] = { __u8 *irlmp_hint_to_service(__u8 *hint); #ifdef CONFIG_PROC_FS -int irlmp_proc_read(char *buf, char **start, off_t offst, int len, int unused); +int irlmp_proc_read(char *buf, char **start, off_t offst, int len); #endif /* @@ -1431,13 +1431,12 @@ __u32 irlmp_get_daddr(struct lsap_cb *self) #ifdef CONFIG_PROC_FS /* - * Function irlmp_proc_read (buf, start, offset, len, unused) + * Function irlmp_proc_read (buf, start, offset, len) * * Give some info to the /proc file system * */ -int irlmp_proc_read(char *buf, char **start, off_t offset, int len, - int unused) +int irlmp_proc_read(char *buf, char **start, off_t offset, int len) { struct lsap_cb *self; struct lap_cb *lap; diff --git a/net/irda/irproc.c b/net/irda/irproc.c index 8c2be853a081..5aca4d996900 100644 --- a/net/irda/irproc.c +++ b/net/irda/irproc.c @@ -33,16 +33,11 @@ #include #include -extern int irlap_proc_read(char *buf, char **start, off_t offset, int len, - int unused); -extern int irlmp_proc_read(char *buf, char **start, off_t offset, int len, - int unused); -extern int irttp_proc_read(char *buf, char **start, off_t offset, int len, - int unused); -extern int irias_proc_read(char *buf, char **start, off_t offset, int len, - int unused); -extern int discovery_proc_read(char *buf, char **start, off_t offset, int len, - int unused); +extern int irlap_proc_read(char *buf, char **start, off_t offset, int len); +extern int irlmp_proc_read(char *buf, char **start, off_t offset, int len); +extern int irttp_proc_read(char *buf, char **start, off_t offset, int len); +extern int irias_proc_read(char *buf, char **start, off_t offset, int len); +extern int discovery_proc_read(char *buf, char **start, off_t offset, int len); struct irda_entry { char *name; diff --git a/net/irda/irttp.c b/net/irda/irttp.c index 304f39e10756..862360b4ab1f 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c @@ -1477,11 +1477,11 @@ static void irttp_start_todo_timer(struct tsap_cb *self, int timeout) #ifdef CONFIG_PROC_FS /* - * Function irttp_proc_read (buf, start, offset, len, unused) + * Function irttp_proc_read (buf, start, offset, len) * * Give some info to the /proc file system */ -int irttp_proc_read(char *buf, char **start, off_t offset, int len, int unused) +int irttp_proc_read(char *buf, char **start, off_t offset, int len) { struct tsap_cb *self; unsigned long flags; diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 3c219cdf079a..e23edd41ba62 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c @@ -1163,7 +1163,7 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) return 0; } -static int nr_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int nr_get_info(char *buffer, char **start, off_t offset, int length) { struct sock *s; struct net_device *dev; diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c index 0a3f3a1f3677..fd36a887ee24 100644 --- a/net/netrom/nr_route.c +++ b/net/netrom/nr_route.c @@ -751,8 +751,7 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25) return (nr_neigh->ax25 != NULL); } -int nr_nodes_get_info(char *buffer, char **start, off_t offset, - int length, int dummy) +int nr_nodes_get_info(char *buffer, char **start, off_t offset, int length) { struct nr_node *nr_node; int len = 0; @@ -801,8 +800,7 @@ int nr_nodes_get_info(char *buffer, char **start, off_t offset, return len; } -int nr_neigh_get_info(char *buffer, char **start, off_t offset, - int length, int dummy) +int nr_neigh_get_info(char *buffer, char **start, off_t offset, int length) { struct nr_neigh *nr_neigh; int len = 0; diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 114e03944497..ba8dd204114a 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c @@ -1354,7 +1354,7 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) return 0; } -static int rose_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int rose_get_info(char *buffer, char **start, off_t offset, int length) { struct sock *s; struct net_device *dev; diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c index ba9759bd3643..d5d4de9ec1b0 100644 --- a/net/rose/rose_route.c +++ b/net/rose/rose_route.c @@ -968,8 +968,7 @@ int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25) return 1; } -int rose_nodes_get_info(char *buffer, char **start, off_t offset, - int length, int dummy) +int rose_nodes_get_info(char *buffer, char **start, off_t offset, int length) { struct rose_node *rose_node; int len = 0; @@ -1020,8 +1019,7 @@ int rose_nodes_get_info(char *buffer, char **start, off_t offset, return len; } -int rose_neigh_get_info(char *buffer, char **start, off_t offset, - int length, int dummy) +int rose_neigh_get_info(char *buffer, char **start, off_t offset, int length) { struct rose_neigh *rose_neigh; int len = 0; @@ -1075,8 +1073,7 @@ int rose_neigh_get_info(char *buffer, char **start, off_t offset, return len; } -int rose_routes_get_info(char *buffer, char **start, off_t offset, - int length, int dummy) +int rose_routes_get_info(char *buffer, char **start, off_t offset, int length) { struct rose_route *rose_route; int len = 0; diff --git a/net/wanrouter/wanproc.c b/net/wanrouter/wanproc.c index f62552b0bc69..61930fedefd6 100644 --- a/net/wanrouter/wanproc.c +++ b/net/wanrouter/wanproc.c @@ -65,24 +65,12 @@ static ssize_t router_proc_read(struct file* file, char* buf, size_t count, /* Methods for preparing data for reading proc entries */ -static int config_get_info(char* buf, char** start, off_t offs, int len, int dummy); -static int status_get_info(char* buf, char** start, off_t offs, int len, int dummy); -static int wandev_get_info(char* buf, char** start, off_t offs, int len, int dummy); +static int config_get_info(char* buf, char** start, off_t offs, int len); +static int status_get_info(char* buf, char** start, off_t offs, int len); +static int wandev_get_info(char* buf, char** start, off_t offs, int len); /* Miscellaneous */ -/* - * Global Data - */ - -/* - * Names of the proc directory entries - */ - -static char name_root[] = ROUTER_NAME; -static char name_conf[] = "config"; -static char name_stat[] = "status"; - /* * Structures for interfacing with the /proc filesystem. * Router creates its own directory /proc/net/router with the folowing @@ -178,68 +166,11 @@ static struct inode_operations wandev_inode = NULL /* revalidate */ }; -/* - * Proc filesystem directory entries. - */ - /* * /proc/net/router */ -static struct proc_dir_entry proc_router = -{ - 0, /* .low_ino */ - sizeof(name_root) - 1, /* .namelen */ - name_root, /* .name */ - 0555 | S_IFDIR, /* .mode */ - 2, /* .nlink */ -}; - -/* - * /proc/net/router/config - */ - -static struct proc_dir_entry proc_router_conf = -{ - 0, /* .low_ino */ - sizeof(name_conf) - 1, /* .namelen */ - name_conf, /* .name */ - 0444 | S_IFREG, /* .mode */ - 1, /* .nlink */ - 0, /* .uid */ - 0, /* .gid */ - 0, /* .size */ - &router_inode, /* .ops */ - &config_get_info, /* .get_info */ - NULL, /* .fill_node */ - NULL, /* .next */ - NULL, /* .parent */ - NULL, /* .subdir */ - NULL, /* .data */ -}; - -/* - * /proc/net/router/status - */ - -static struct proc_dir_entry proc_router_stat = -{ - 0, /* .low_ino */ - sizeof(name_stat) - 1, /* .namelen */ - name_stat, /* .name */ - 0444 | S_IFREG, /* .mode */ - 1, /* .nlink */ - 0, /* .uid */ - 0, /* .gid */ - 0, /* .size */ - &router_inode, /* .ops */ - status_get_info, /* .get_info */ - NULL, /* .fill_node */ - NULL, /* .next */ - NULL, /* .parent */ - NULL, /* .subdir */ - NULL, /* .data */ -}; +static struct proc_dir_entry *proc_router; /* Strings */ static char conf_hdr[] = @@ -261,14 +192,28 @@ static char stat_hdr[] = int __init wanrouter_proc_init (void) { - int err = proc_register(proc_net, &proc_router); - - if (!err) - { - proc_register(&proc_router, &proc_router_conf); - proc_register(&proc_router, &proc_router_stat); - } - return err; + struct proc_dir_entry *p; + proc_router = proc_mkdir(ROUTER_NAME, proc_net); + if (!proc_router) + goto fail; + + p = proc_create_proc_entry("config",0,proc_router); + if (!p) + goto fail_config; + p->ops = &router_inode; + p->info = config_get_info; + p = proc_create_proc_entry("status",0,proc_router); + if (!p) + goto fail_stat; + p->ops = &router_inode; + p->info = status_get_info; + return 0; +fail_stat: + remove_proc_entry("config", proc_router); +fail_config: + remove_proc_entry(proc_net, ROUTER_NAME); +fail: + return -ENOMEM; } /* @@ -277,9 +222,9 @@ int __init wanrouter_proc_init (void) void wanrouter_proc_cleanup (void) { - proc_unregister(&proc_router, proc_router_conf.low_ino); - proc_unregister(&proc_router, proc_router_stat.low_ino); - proc_unregister(proc_net, proc_router.low_ino); + remove_proc_entry("config", proc_router); + remove_proc_entry("status", proc_router); + remove_proc_entry(ROUTER_NAME,proc_net); } /* @@ -291,15 +236,13 @@ int wanrouter_proc_add (wan_device_t* wandev) if (wandev->magic != ROUTER_MAGIC) return -EINVAL; - memset(&wandev->dent, 0, sizeof(wandev->dent)); - wandev->dent.namelen = strlen(wandev->name); - wandev->dent.name = wandev->name; - wandev->dent.mode = 0444 | S_IFREG; - wandev->dent.nlink = 1; - wandev->dent.ops = &wandev_inode; - wandev->dent.get_info = &wandev_get_info; - wandev->dent.data = wandev; - return proc_register(&proc_router, &wandev->dent); + wandev->dent = create_proc_entry(wandev->name, 0, proc_router); + if (!wandev->dent) + return -ENOMEM; + wandev->dent->ops = &wandev_inode; + wandev->dent->get_info = wandev_get_info; + wandev->dent->data = wandev; + return 0; } /* @@ -310,7 +253,7 @@ int wanrouter_proc_delete(wan_device_t* wandev) { if (wandev->magic != ROUTER_MAGIC) return -EINVAL; - proc_unregister(&proc_router, wandev->dent.low_ino); + remove_proc_entry(wandev->name, proc_router); return 0; } @@ -359,7 +302,7 @@ static ssize_t router_proc_read(struct file* file, char* buf, size_t count, if (page == NULL) return -ENOBUFS; - pos = dent->get_info(page, dent->data, 0, 0, 0); + pos = dent->get_info(page, dent->data, 0, 0); offs = file->f_pos; if (offs < pos) { @@ -379,8 +322,7 @@ static ssize_t router_proc_read(struct file* file, char* buf, size_t count, * Return length of data. */ -static int config_get_info(char* buf, char** start, off_t offs, int len, - int dummy) +static int config_get_info(char* buf, char** start, off_t offs, int len) { int cnt = sizeof(conf_hdr) - 1; wan_device_t* wandev; @@ -411,8 +353,7 @@ static int config_get_info(char* buf, char** start, off_t offs, int len, * Return length of data. */ -static int status_get_info(char* buf, char** start, off_t offs, int len, - int dummy) +static int status_get_info(char* buf, char** start, off_t offs, int len) { int cnt = sizeof(stat_hdr) - 1; wan_device_t* wandev; @@ -466,8 +407,7 @@ static int status_get_info(char* buf, char** start, off_t offs, int len, * data space. */ -static int wandev_get_info(char* buf, char** start, off_t offs, int len, - int dummy) +static int wandev_get_info(char* buf, char** start, off_t offs, int len) { wan_device_t* wandev = (void*)start; int cnt = 0; diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index c77cb79a70b4..82b39c1b5ac7 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -1171,7 +1171,7 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) return 0; } -static int x25_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int x25_get_info(char *buffer, char **start, off_t offset, int length) { struct sock *s; struct net_device *dev; diff --git a/net/x25/x25_route.c b/net/x25/x25_route.c index 383855135b11..4cb51300bc19 100644 --- a/net/x25/x25_route.c +++ b/net/x25/x25_route.c @@ -217,7 +217,7 @@ int x25_route_ioctl(unsigned int cmd, void *arg) return 0; } -int x25_routes_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +int x25_routes_get_info(char *buffer, char **start, off_t offset, int length) { struct x25_route *x25_route; int len = 0; -- 2.39.5