From 83879d61267ce26c99a523d8bc7894b07b5175a4 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:09:39 -0500 Subject: [PATCH] Import 1.1.49 --- CREDITS | 8 +++ Makefile | 2 +- drivers/block/README.sbpcd | 22 ++++-- drivers/block/blk.h | 44 +----------- drivers/block/floppy.c | 17 ++--- drivers/block/hd.c | 11 +-- drivers/block/sbpcd.c | 16 +++-- drivers/net/ni52.c | 6 +- drivers/net/ni52.h | 18 ++--- drivers/net/ni65.c | 2 +- drivers/net/ni65.h | 4 +- drivers/scsi/sd.c | 3 +- drivers/scsi/sr.c | 2 +- fs/buffer.c | 12 ++-- fs/inode.c | 1 + fs/msdos/dir.c | 14 ++-- include/linux/blkdev.h | 47 +++++++++++++ include/linux/types.h | 3 + kernel/ksyms.c | 9 +++ kernel/sched.c | 14 ++-- mm/kmalloc.c | 4 +- mm/swap.c | 4 +- net/inet/skbuff.c | 134 ++++++++++++++++++------------------- net/inet/tcp.c | 3 +- 24 files changed, 216 insertions(+), 184 deletions(-) create mode 100644 include/linux/blkdev.h diff --git a/CREDITS b/CREDITS index 43e64414d3cc..103181f245a6 100644 --- a/CREDITS +++ b/CREDITS @@ -405,6 +405,14 @@ S: S78 W16203 Woods Road S: Muskego, Wisconsin 53150 S: USA +N: Harald Milz +E: hm@ix.de +D: Linux Projects Map, Linux Commercial-HOWTO +D: general Linux publicity in Germany, vacation port +D: UUCP and CNEWS binary packages for LST +S: Editorial Board iX Mag +S: Helstorfer Str. 7, D-30625 Hannover + N: Corey Minyard E: minyard@wf-rch.cirr.com D: Sony CDU31A CDROM Driver diff --git a/Makefile b/Makefile index ed120c5f7ec4..33c7b0761a4b 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ VERSION = 1 PATCHLEVEL = 1 -SUBLEVEL = 48 +SUBLEVEL = 49 ARCH = i386 diff --git a/drivers/block/README.sbpcd b/drivers/block/README.sbpcd index fa51a2eec389..371072a46834 100644 --- a/drivers/block/README.sbpcd +++ b/drivers/block/README.sbpcd @@ -1,5 +1,5 @@ -This README belongs to release 2.5 of the SoundBlaster Pro (Matsushita, -Kotobuki, Panasonic, CreativeLabs) CD-ROM driver for Linux. +This README belongs to release 2.6 or newer of the SoundBlaster Pro +(Matsushita, Kotobuki, Panasonic, CreativeLabs) CD-ROM driver for Linux. The driver is able to drive the whole family of "traditional" IDE-style (that has nothing to do with the new "Enhanced IDE" drive standard) Matsushita, @@ -14,7 +14,8 @@ It will work with the soundcard interfaces (SB Pro, SB 16, Galaxy, SoundFX, ...) and/or with the "no-sound" cards (Panasonic CI-101P, LaserMate, WDH-7001C, older Aztech cards, ...). It should work too now with the "configurable" interface "Sequoia S-1000", -which is found on the Spea Media FX sound card. +which is found on the Spea Media FX sound card. I still need feedback about +this. The interface type has to get configured in /usr/include/linux/sbpcd.h, because the behavior is different. @@ -113,8 +114,10 @@ To install: sbpcd=0x330,SPEA (these strings are case sensitive!). This is especially useful if you install a fresh distribution. -2. Do a "make config" and select "yes" for Matsushita CD-ROM support and for - ISO9660 FileSystem support. +2. "cd /usr/src/linux" and do a "make config" and select "y" for Matsushita + CD-ROM support and for ISO9660 FileSystem support. If you do not have a + second, third, or fourth controller and/or did not prepare sbpcd2 etc., + do not say "y" to the secondary Matsushita CD-ROM questions. SCSI and/or SCSI CD-ROM support is not needed. 3. Then do a "make dep", then make the kernel image ("make zlilo" or else). @@ -142,8 +145,13 @@ To install: 5. Reboot with the new kernel. -You should now be able to do "mount -t iso9660 -o block=2048 /dev/sbpcd /mnt" -and see the contents of your CD in the /mnt directory, and/or hear music with +You should now be able to do + mkdir /CD +and + mount -t iso9660 -o ro /dev/sbpcd /CD +or + mount -t iso9660 -o ro,block=2048 /dev/sbpcd /CD +and see the contents of your CD in the /CD directory, and/or hear music with "workman -c /dev/sbpcd &". diff --git a/drivers/block/blk.h b/drivers/block/blk.h index 35bff8c4e8e4..c9f09bd2bcf3 100644 --- a/drivers/block/blk.h +++ b/drivers/block/blk.h @@ -1,10 +1,8 @@ #ifndef _BLK_H #define _BLK_H -#include -#include +#include #include -#include /* * NR_REQUEST is the number of entries in the request-queue. @@ -18,26 +16,6 @@ */ #define NR_REQUEST 64 -/* - * Ok, this is an expanded form so that we can use the same - * request for paging requests when that is implemented. In - * paging, 'bh' is NULL, and the semaphore is used to wait - * for read/write completion. - */ -struct request { - int dev; /* -1 if no request */ - int cmd; /* READ or WRITE */ - int errors; - unsigned long sector; - unsigned long nr_sectors; - unsigned long current_nr_sectors; - char * buffer; - struct semaphore * sem; - struct buffer_head * bh; - struct buffer_head * bhtail; - struct request * next; -}; - /* * This is used in the elevator algorithm: Note that * reads always go before writes. This is natural: reads @@ -48,17 +26,6 @@ struct request { ((s1)->dev < (s2)->dev || (((s1)->dev == (s2)->dev && \ (s1)->sector < (s2)->sector))))) -struct blk_dev_struct { - void (*request_fn)(void); - struct request * current_request; -}; - - -struct sec_size { - unsigned block_size; - unsigned block_size_bits; -}; - /* * These will have to be changed to be aware of different buffer * sizes etc.. It actually needs a major cleanup. @@ -70,15 +37,6 @@ struct sec_size { #define SUBSECTOR(block) (CURRENT->current_nr_sectors > 0) -extern struct sec_size * blk_sec[MAX_BLKDEV]; -extern struct blk_dev_struct blk_dev[MAX_BLKDEV]; -extern struct wait_queue * wait_for_request; -extern void resetup_one_dev(struct gendisk *dev, int drive); - -extern int * blk_size[MAX_BLKDEV]; - -extern int * blksize_size[MAX_BLKDEV]; - extern unsigned long hd_init(unsigned long mem_start, unsigned long mem_end); extern unsigned long cdu31a_init(unsigned long mem_start, unsigned long mem_end); extern unsigned long mcd_init(unsigned long mem_start, unsigned long mem_end); diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 30fe257c2306..a4a30615f545 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -127,7 +127,7 @@ static int initialising=1; #define N_DRIVE 8 #else #define N_FDC 1 -#define N_DRIVE 4 +#define N_DRIVE 2 #endif #define TYPE(x) ( ((x)>>2) & 0x1f ) @@ -298,11 +298,12 @@ static struct floppy_struct floppy_type[32] = { #define SECTSIZE ( _FD_SECTSIZE(*floppy)) /* Auto-detection: Disk type used until the next media change occurs. */ -struct floppy_struct *current_type[N_DRIVE] = { NULL, NULL, NULL, NULL +struct floppy_struct *current_type[N_DRIVE] = { + NULL, NULL #ifdef HAVE_2_CONTROLLERS - ,NULL, NULL, NULL, NULL + ,NULL, NULL, NULL, NULL, NULL, NULL #endif - }; +}; /* * User-provided type information. current_type points to @@ -483,7 +484,7 @@ static void reset_fdc_info(int mode) UDRS->track = NEED_2_RECAL; } -/* selects the fdc and drive, and enables the fdc's its input/dma. */ +/* selects the fdc and drive, and enables the fdc's input/dma. */ static void set_fdc(int drive) { if ( drive >= 0 ){ @@ -544,10 +545,10 @@ static void motor_off_callback(unsigned long nr) static struct timer_list motor_off_timer[N_DRIVE] = { { NULL, NULL, 0, 0, motor_off_callback }, - { NULL, NULL, 0, 1, motor_off_callback }, - { NULL, NULL, 0, 2, motor_off_callback }, - { NULL, NULL, 0, 3, motor_off_callback } + { NULL, NULL, 0, 1, motor_off_callback } #ifdef HAVE_2_CONTROLLERS + ,{ NULL, NULL, 0, 2, motor_off_callback }, + { NULL, NULL, 0, 3, motor_off_callback } ,{ NULL, NULL, 0, 4, motor_off_callback }, { NULL, NULL, 0, 5, motor_off_callback }, { NULL, NULL, 0, 6, motor_off_callback }, diff --git a/drivers/block/hd.c b/drivers/block/hd.c index 781e2a71324b..b0f39069ee2b 100644 --- a/drivers/block/hd.c +++ b/drivers/block/hd.c @@ -307,9 +307,11 @@ static void identify_intr(void) if (NULL != (hd_ident_info[dev] = (struct hd_driveid *)kmalloc(sizeof(id),GFP_ATOMIC))) *hd_ident_info[dev] = id; - /* Quantum drives go weird at this point, so reset them! In */ - /* fact, do a reset in any case in case we changed the geometry */ - special_op[dev] += reset = 1; + /* Quantum drives go weird at this point, so reset them! */ + /* In fact, we should probably do a reset in any case in */ + /* case we changed the geometry */ + if (!strncmp(id.model, "QUANTUM", 7)) + special_op[dev] += reset = 1; /* flush remaining 384 (reserved/undefined) ID bytes: */ insw(HD_DATA,(char *)&id,sizeof(id)/2); @@ -367,7 +369,8 @@ static void reset_controller(void) outb_p(4,HD_CMD); for(i = 0; i < 1000; i++) nop(); - outb(hd_info[0].ctl & 0x0f ,HD_CMD); + outb_p(hd_info[0].ctl & 0x0f,HD_CMD); + for(i = 0; i < 1000; i++) nop(); if (drive_busy()) printk("HD-controller still busy\n"); if ((hd_error = inb(HD_ERROR)) != 1) diff --git a/drivers/block/sbpcd.c b/drivers/block/sbpcd.c index 1741d4cbd242..b3ee220a68ee 100644 --- a/drivers/block/sbpcd.c +++ b/drivers/block/sbpcd.c @@ -5,7 +5,7 @@ * and for "no-sound" interfaces like Lasermate and the * Panasonic CI-101P. * - * NOTE: This is release 2.5. + * NOTE: This is release 2.6. * It works with my SbPro & drive CR-521 V2.11 from 2/92 * and with the new CR-562-B V0.75 on a "naked" Panasonic * CI-101P interface. And vice versa. @@ -119,13 +119,15 @@ * * 2.4 Use different names for device registering. * - * 2.5 Added "#ifdef EJECT" code (default: enabled) to automatically eject + * 2.5 Added "#if EJECT" code (default: enabled) to automatically eject * the tray during last call to "sbpcd_release". - * Added "#ifdef JUKEBOX" code (default: disabled) to automatically eject + * Added "#if JUKEBOX" code (default: disabled) to automatically eject * the tray during call to "sbpcd_open" if no disk is in. * Turn on the CD volume of "compatible" sound cards, too; just define * SOUND_BASE (in sbpcd.h) accordingly (default: disabled). * + * 2.6 Nothing new. + * * TODO * * disk change detection @@ -201,7 +203,7 @@ #include "blk.h" -#define VERSION "2.5 Eberhard Moenkeberg " +#define VERSION "2.6 Eberhard Moenkeberg " #define SBPCD_DEBUG @@ -217,7 +219,7 @@ /* * still testing around... */ -#define JUKEBOX 0 /* tray control: eject if no disk is in */ +#define JUKEBOX 0 /* tray control: eject tray if no disk is in */ #define EJECT 1 /* tray control: eject tray after last use */ #define LONG_TIMING 0 /* test against timeouts with "gold" CDs on CR-521 */ #define MANY_SESSION 0 /* this will conflict with "true" multi-session! */ @@ -2561,7 +2563,7 @@ static int sbpcd_ioctl(struct inode *inode, struct file *file, u_int cmd, case CDROMSTART: /* Spin up the drive */ DPRINTF((DBG_IOC,"SBPCD: ioctl: CDROMSTART entered.\n")); - i=xx_SpinUp(); + xx_SpinUp(); DriveStruct[d].audio_state=0; return (0); @@ -3321,7 +3323,7 @@ static void sbpcd_release(struct inode * ip, struct file * file) do i=yy_LockDoor(0); while (i!=0); -#ifdef EJECT +#if EJECT if (new_drive) yy_SpinDown(); #endif } diff --git a/drivers/net/ni52.c b/drivers/net/ni52.c index f062ab9f3931..aa7673dfde14 100644 --- a/drivers/net/ni52.c +++ b/drivers/net/ni52.c @@ -903,7 +903,7 @@ static void ni52_rcv_int(struct device *dev) } /********************************************************** - * I never got this error , (which should occure if someone + * I never got this error , (which should occur if someone * wants to blast your machine) so I couldn't debug it for now. * but we _try_ to fix the receiver not ready int. */ @@ -1095,7 +1095,7 @@ static struct enet_statistics *ni52_get_stats(struct device *dev) { struct priv *p = (struct priv *) dev->priv; #ifdef DEBUG3 - printk("ni52: errs, crc %d, align %d, ressource %d, ovrn %d.\n",(int) p->scb->crc_errs,(int) p->scb->aln_errs,(int) p->scb->rsc_errs,(int) p->scb->ovrn_errs); + printk("ni52: errs, crc %d, align %d, resource %d, ovrn %d.\n",(int) p->scb->crc_errs,(int) p->scb->aln_errs,(int) p->scb->rsc_errs,(int) p->scb->ovrn_errs); #endif return &p->stats; } @@ -1108,7 +1108,7 @@ static void set_multicast_list(struct device *dev, int num_addrs, void *addrs) */ if(!num_addrs) - printk("%s: Currently, the Ni52 driver doesn't support promiscous or multicast mode.\n",dev->name); + printk("%s: Currently, the Ni52 driver doesn't support promiscuous or multicast mode.\n",dev->name); #if 0 p->scb->cmd = CUC_SUSPEND; diff --git a/drivers/net/ni52.h b/drivers/net/ni52.h index b0a614becbfa..652da6eaca3d 100644 --- a/drivers/net/ni52.h +++ b/drivers/net/ni52.h @@ -50,7 +50,7 @@ struct scp_struct */ struct iscp_struct { - unsigned char busy; /* 586 clears after succesful init */ + unsigned char busy; /* 586 clears after successful init */ unsigned char zero_dummy; /* hast to be zero */ unsigned short scb_offset; /* pointeroffset to the scb_base */ char *scb_base; /* base-address of all 16-bit offsets */ @@ -72,7 +72,7 @@ struct scb_struct }; /* - * possbile command values for the command word + * possible command values for the command word */ #define RUC_MASK 0x0070 /* mask for RU commands */ #define RUC_NOP 0x0000 /* NOP-command */ @@ -95,11 +95,11 @@ struct scb_struct #define ACK_RNR 0x1000 /* ack. STAT_RNR */ /* - * possbile status values for the status word + * possible status values for the status word */ #define STAT_MASK 0xf000 /* mask for cause of interrupt */ #define STAT_CX 0x8000 /* CU finished cmd with its I bit set */ -#define STAT_FR 0x4000 /* RU finished receiveing a frame */ +#define STAT_FR 0x4000 /* RU finished receiving a frame */ #define STAT_CNA 0x2000 /* CU left active state */ #define STAT_RNR 0x1000 /* RU left ready state */ @@ -130,7 +130,7 @@ struct rfd_struct #define RFD_LAST 0x8000 /* last: last rfd in the list */ #define RFD_SUSP 0x4000 /* last: suspend RU after */ #define RFD_ERRMASK 0x0fe1 /* status: errormask */ -#define RFD_MATCHADD 0x0002 /* status: Destinationaddress !matchs IA */ +#define RFD_MATCHADD 0x0002 /* status: Destinationaddress !matches IA */ #define RFD_RNR 0x0200 /* status: receiver out of resources */ /* @@ -140,7 +140,7 @@ struct rbd_struct { unsigned short status; /* status word,number of used bytes in buff */ unsigned short next; /* pointeroffset to next RBD */ - char *buffer; /* recevie buffer address pointer */ + char *buffer; /* receive buffer address pointer */ unsigned short size; /* size of this buffer */ unsigned short zero_dummy; /* dummy */ }; @@ -180,7 +180,7 @@ struct rbd_struct */ struct nop_cmd_struct { - unsigned short cmd_status; /* statius of this command */ + unsigned short cmd_status; /* status of this command */ unsigned short cmd_cmd; /* the command itself (+bits) */ unsigned short cmd_link; /* offsetpointer to next command */ }; @@ -247,7 +247,7 @@ struct transmit_cmd_struct #define TCMD_MAXCOLLMASK 0x000f #define TCMD_MAXCOLL 0x0020 #define TCMD_HEARTBEAT 0x0040 -#define TCMD_DEFFERED 0x0080 +#define TCMD_DEFERRED 0x0080 #define TCMD_UNDERRUN 0x0100 #define TCMD_LOSTCTS 0x0200 #define TCMD_NOCARRIER 0x0400 @@ -262,7 +262,7 @@ struct tdr_cmd_struct }; #define TDR_LNK_OK 0x8000 /* No link problem identified */ -#define TDR_XCVR_PRB 0x4000 /* indiactes a transceiver problem */ +#define TDR_XCVR_PRB 0x4000 /* indicates a transceiver problem */ #define TDR_ET_OPN 0x2000 /* open, no correct termination */ #define TDR_ET_SRT 0x1000 /* TDR detected a short circuit */ #define TDR_TIMEMASK 0x07ff /* mask for the time field */ diff --git a/drivers/net/ni65.c b/drivers/net/ni65.c index e2431d4b4892..126b41a06952 100644 --- a/drivers/net/ni65.c +++ b/drivers/net/ni65.c @@ -298,7 +298,7 @@ static int ni65_probe1(struct device *dev,int ioaddr) } } - return 0; /* we've found everyting */ + return 0; /* we've found everything */ } /* diff --git a/drivers/net/ni65.h b/drivers/net/ni65.h index b7ecdbc16789..144523fa26ef 100644 --- a/drivers/net/ni65.h +++ b/drivers/net/ni65.h @@ -21,7 +21,7 @@ #define CSR0_CERR 0x2000 /* Collision Error (RC) */ #define CSR0_MISS 0x1000 /* Missed packet (RC) */ #define CSR0_MERR 0x0800 /* Memory Error (RC) */ -#define CSR0_RINT 0x0400 /* Reciever Interrupt (RC) */ +#define CSR0_RINT 0x0400 /* Receiver Interrupt (RC) */ #define CSR0_TINT 0x0200 /* Transmit Interrupt (RC) */ #define CSR0_IDON 0x0100 /* Initialization Done (RC) */ #define CSR0_INTR 0x0080 /* Interrupt Flag (R) */ @@ -45,7 +45,7 @@ #define M_DTCR 0x0008 /* Disable Transmit CRC) */ #define M_LOOP 0x0004 /* Loopback */ #define M_DTX 0x0002 /* Disable the Transmitter */ -#define M_DRX 0x0001 /* Disable the Reciever */ +#define M_DRX 0x0001 /* Disable the Receiver */ /* diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index baa8afcaa381..569b9c613c5e 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -798,7 +798,6 @@ static void sd_init_done (Scsi_Cmnd * SCpnt) static int sd_init_onedisk(int i) { - int j = 0; unsigned char cmd[10]; unsigned char *buffer; char spintime; @@ -969,7 +968,7 @@ static int sd_init_onedisk(int i) rscsi_disks[i].capacity = 0; } else { printk ("scsi : deleting disk entry.\n"); - rscsi_disks[j].device = NULL; + rscsi_disks[i].device = NULL; sd_template.nr_dev--; return i; }; diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index ef7dc6bddb88..c6851fd58585 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -629,7 +629,7 @@ are any multiple of 512 bytes long. */ #endif /* Some dumb host adapters can speed transfers by knowing the - * minimum tranfersize in advance. + * minimum transfersize in advance. * * We shouldn't disconnect in the middle of a sector, but the cdrom * sector size can be larger than the size of a buffer and the diff --git a/fs/buffer.c b/fs/buffer.c index bcabae8f7b1b..aade8cafccbc 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -1061,7 +1061,7 @@ static unsigned long try_to_load_aligned(unsigned long address, buffermem += PAGE_SIZE; bh->b_this_page = tmp; mem_map[MAP_NR(address)]++; - buffer_pages[address >> PAGE_SHIFT] = bh; + buffer_pages[MAP_NR(address)] = bh; read_buffers(arr,block); while (block-- > 0) brelse(arr[block]); @@ -1190,7 +1190,7 @@ static int grow_buffers(int pri, int size) break; } free_list[isize] = bh; - buffer_pages[page >> PAGE_SHIFT] = bh; + buffer_pages[MAP_NR(page)] = bh; tmp->b_this_page = bh; wake_up(&buffer_wait); buffermem += PAGE_SIZE; @@ -1234,7 +1234,7 @@ static int try_to_free(struct buffer_head * bh, struct buffer_head ** bhp) put_unused_buffer_head(p); } while (tmp != bh); buffermem -= PAGE_SIZE; - buffer_pages[page >> PAGE_SHIFT] = NULL; + buffer_pages[MAP_NR(page)] = NULL; free_page(page); return !mem_map[MAP_NR(page)]; } @@ -1538,7 +1538,7 @@ static unsigned long try_to_generate_cluster(dev_t dev, int block, int size) break; } buffermem += PAGE_SIZE; - buffer_pages[page >> PAGE_SHIFT] = bh; + buffer_pages[MAP_NR(page)] = bh; bh->b_this_page = tmp; while (nblock-- > 0) brelse(arr[nblock]); @@ -1605,9 +1605,9 @@ void buffer_init(void) sizeof(struct buffer_head *)); - buffer_pages = (struct buffer_head **) vmalloc((high_memory >>PAGE_SHIFT) * + buffer_pages = (struct buffer_head **) vmalloc(MAP_NR(high_memory) * sizeof(struct buffer_head *)); - for (i = 0 ; i < high_memory >> PAGE_SHIFT ; i++) + for (i = 0 ; i < MAP_NR(high_memory) ; i++) buffer_pages[i] = NULL; for (i = 0 ; i < nr_hash ; i++) diff --git a/fs/inode.c b/fs/inode.c index 535318f498dd..e089ec92f9f3 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -417,6 +417,7 @@ struct inode * get_pipe_inode(void) inode->i_uid = current->fsuid; inode->i_gid = current->fsgid; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; + inode->i_blksize = PAGE_SIZE; return inode; } diff --git a/fs/msdos/dir.c b/fs/msdos/dir.c index 98f177d826e2..5051a07d7a4a 100644 --- a/fs/msdos/dir.c +++ b/fs/msdos/dir.c @@ -85,22 +85,20 @@ int msdos_readdir( for (i = last = 0; i < 8; i++) { if (!(c = de->name[i])) break; if (c >= 'A' && c <= 'Z') c += 32; - if (c != ' '){ + if (c != ' ') last = i+1; - *ptname++ = c; - } + ptname[i] = c; } i = last; - *ptname++ = '.'; + ptname[i] = '.'; i++; for (i2 = 0; i2 < 3; i2++) { if (!(c = de->ext[i2])) break; if (c >= 'A' && c <= 'Z') c += 32; - if (c != ' '){ + if (c != ' ') last = i+1; - *ptname++ = c; - } - i++; + ptname[i] = c; + i++; } if ((i = last) != 0) { if (!strcmp(de->name,MSDOS_DOT)) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h new file mode 100644 index 000000000000..84b48d93c82d --- /dev/null +++ b/include/linux/blkdev.h @@ -0,0 +1,47 @@ +#ifndef _LINUX_BLKDEV_H +#define _LINUX_BLKDEV_H + +#include +#include +#include + +/* + * Ok, this is an expanded form so that we can use the same + * request for paging requests when that is implemented. In + * paging, 'bh' is NULL, and the semaphore is used to wait + * for read/write completion. + */ +struct request { + int dev; /* -1 if no request */ + int cmd; /* READ or WRITE */ + int errors; + unsigned long sector; + unsigned long nr_sectors; + unsigned long current_nr_sectors; + char * buffer; + struct semaphore * sem; + struct buffer_head * bh; + struct buffer_head * bhtail; + struct request * next; +}; + +struct blk_dev_struct { + void (*request_fn)(void); + struct request * current_request; +}; + +struct sec_size { + unsigned block_size; + unsigned block_size_bits; +}; + +extern struct sec_size * blk_sec[MAX_BLKDEV]; +extern struct blk_dev_struct blk_dev[MAX_BLKDEV]; +extern struct wait_queue * wait_for_request; +extern void resetup_one_dev(struct gendisk *dev, int drive); + +extern int * blk_size[MAX_BLKDEV]; + +extern int * blksize_size[MAX_BLKDEV]; + +#endif diff --git a/include/linux/types.h b/include/linux/types.h index e3072ae5ec34..5acd519616d9 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -44,8 +44,11 @@ typedef unsigned short umode_t; typedef unsigned short nlink_t; typedef int daddr_t; typedef long off_t; + +#ifndef __STRICT_ANSI__ #define _LOFF_T typedef long long loff_t; +#endif /* bsd */ typedef unsigned char u_char; diff --git a/kernel/ksyms.c b/kernel/ksyms.c index cd6957d2f70b..c223f14674c5 100644 --- a/kernel/ksyms.c +++ b/kernel/ksyms.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -91,6 +92,14 @@ struct symbol_table symbol_table = { 0, 0, 0, /* for stacked module support */ X(register_blkdev), X(unregister_blkdev), + /* block device driver support */ + X(block_read), + X(block_write), + X(block_fsync), + X(wait_for_request), + X(blksize_size), + X(blk_dev), + /* Module creation of serial units */ X(register_serial), X(unregister_serial), diff --git a/kernel/sched.c b/kernel/sched.c index 666962dc996d..c6ad52fb45ae 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -286,7 +286,8 @@ void wake_up(struct wait_queue **q) } } if (!tmp->next) { - printk("wait_queue is bad (eip = %08lx)\n",((unsigned long *) q)[-1]); + printk("wait_queue is bad (eip = %p)\n", + __builtin_return_address(0)); printk(" q = %p\n",q); printk(" *q = %p\n",*q); printk(" tmp = %p\n",tmp); @@ -312,7 +313,8 @@ void wake_up_interruptible(struct wait_queue **q) } } if (!tmp->next) { - printk("wait_queue is bad (eip = %08lx)\n",((unsigned long *) q)[-1]); + printk("wait_queue is bad (eip = %p)\n", + __builtin_return_address(0)); printk(" q = %p\n",q); printk(" *q = %p\n",*q); printk(" tmp = %p\n",tmp); @@ -377,8 +379,8 @@ void add_timer(struct timer_list * timer) #if SLOW_BUT_DEBUGGING_TIMERS if (timer->next || timer->prev) { - printk("add_timer() called with non-zero list from %08lx\n", - ((unsigned long *) &timer)[-1]); + printk("add_timer() called with non-zero list from %p\n", + __builtin_return_address(0)); return; } #endif @@ -416,8 +418,8 @@ int del_timer(struct timer_list * timer) } } if (timer->next || timer->prev) - printk("del_timer() called from %08lx with timer not initialized\n", - ((unsigned long *) &timer)[-1]); + printk("del_timer() called from %p with timer not initialized\n", + __builtin_return_address(0)); restore_flags(flags); return 0; #else diff --git a/mm/kmalloc.c b/mm/kmalloc.c index 54c6e1671d0a..018f8db8fdbc 100644 --- a/mm/kmalloc.c +++ b/mm/kmalloc.c @@ -171,8 +171,8 @@ void * kmalloc (size_t size, int priority) if (intr_count && priority != GFP_ATOMIC) { static int count = 0; if (++count < 5) { - printk("kmalloc called nonatomically from interrupt %08lx\n", - ((unsigned long *)&size)[-1]); + printk("kmalloc called nonatomically from interrupt %p\n", + __builtin_return_address(0)); priority = GFP_ATOMIC; } } diff --git a/mm/swap.c b/mm/swap.c index 0d7291fc3b12..83649ca65da3 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -618,8 +618,8 @@ unsigned long __get_free_pages(int priority, unsigned long order) if (intr_count && priority != GFP_ATOMIC) { static int count = 0; if (++count < 5) { - printk("gfp called nonatomically from interrupt %08lx\n", - ((unsigned long *)&priority)[-1]); + printk("gfp called nonatomically from interrupt %p\n", + __builtin_return_address(0)); priority = GFP_ATOMIC; } } diff --git a/net/inet/skbuff.c b/net/inet/skbuff.c index 8702993c0495..b22cffcdabd8 100644 --- a/net/inet/skbuff.c +++ b/net/inet/skbuff.c @@ -9,13 +9,13 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ - + /* * Note: There are a load of cli()/sti() pairs protecting the net_memory type * variables. Without them for some reason the ++/-- operators do not come out * atomic. Also with gcc 2.4.5 these counts can come out wrong anyway - use 2.5.8!! */ - + #include #include #include @@ -40,7 +40,7 @@ /* * Resource tracking variables */ - + volatile unsigned long net_memory = 0; volatile unsigned long net_skbcount = 0; volatile unsigned long net_locked = 0; @@ -62,7 +62,7 @@ void show_net_buffers(void) /* * Debugging paranoia. Can go later when this crud stack works - */ + */ int skb_check(struct sk_buff *skb, int head, int line, char *file) { @@ -159,7 +159,6 @@ void skb_queue_head_init(struct sk_buff_head *list) /* * Insert an sk_buff at the start of a list. */ - void skb_queue_head(struct sk_buff_head *list_,struct sk_buff *newsk) { unsigned long flags; @@ -180,14 +179,13 @@ void skb_queue_head(struct sk_buff_head *list_,struct sk_buff *newsk) newsk->next->prev = newsk; newsk->prev->next = newsk; - + restore_flags(flags); } /* * Insert an sk_buff at the end of a list. */ - void skb_queue_tail(struct sk_buff_head *list_, struct sk_buff *newsk) { unsigned long flags; @@ -227,13 +225,13 @@ struct sk_buff *skb_dequeue(struct sk_buff_head *list_) cli(); IS_SKB_HEAD(list); - + result = list->next; if (result == list) { restore_flags(flags); return NULL; } - + result->next->prev = list; list->next = result->next; @@ -242,14 +240,13 @@ struct sk_buff *skb_dequeue(struct sk_buff_head *list_) restore_flags(flags); - IS_SKB(result); + IS_SKB(result); return result; } /* * Insert a packet before another one in a list. */ - void skb_insert(struct sk_buff *old, struct sk_buff *newsk) { unsigned long flags; @@ -270,14 +267,13 @@ void skb_insert(struct sk_buff *old, struct sk_buff *newsk) newsk->prev = old->prev; old->prev = newsk; newsk->prev->next = newsk; - + restore_flags(flags); } /* * Place a packet after a given packet in a list. */ - void skb_append(struct sk_buff *old, struct sk_buff *newsk) { unsigned long flags; @@ -309,7 +305,6 @@ void skb_append(struct sk_buff *old, struct sk_buff *newsk) * MUST EXIST when you unlink. Thus a list must have its contents unlinked * _FIRST_. */ - void skb_unlink(struct sk_buff *skb) { unsigned long flags; @@ -329,7 +324,7 @@ void skb_unlink(struct sk_buff *skb) #ifdef PARANOID_BUGHUNT_MODE /* This is legal but we sometimes want to watch it */ else printk("skb_unlink: not a linked element\n"); -#endif +#endif restore_flags(flags); } @@ -340,26 +335,26 @@ void skb_unlink(struct sk_buff *skb) void kfree_skb(struct sk_buff *skb, int rw) { - if (skb == NULL) + if (skb == NULL) { - printk("kfree_skb: skb = NULL (from %08lx)\n", - ((unsigned long *) &skb)[-1]); + printk("kfree_skb: skb = NULL (from %p)\n", + __builtin_return_address(0)); return; } IS_SKB(skb); - if (skb->lock) + if (skb->lock) { skb->free = 3; /* Free when unlocked */ net_free_locked++; return; } if (skb->free == 2) - printk("Warning: kfree_skb passed an skb that nobody set the free flag on! (from %08lx)\n", - ((unsigned long *) &skb)[-1]); + printk("Warning: kfree_skb passed an skb that nobody set the free flag on! (from %p)\n", + __builtin_return_address(0)); if (skb->next) - printk("Warning: kfree_skb passed an skb still on a list (from %08lx).\n", - ((unsigned long *) &skb)[-1]); - if (skb->sk) + printk("Warning: kfree_skb passed an skb still on a list (from %p).\n", + __builtin_return_address(0)); + if (skb->sk) { if(skb->sk->prot!=NULL) { @@ -378,16 +373,16 @@ void kfree_skb(struct sk_buff *skb, int rw) skb->sk->wmem_alloc-=skb->mem_len; if(!skb->sk->dead) skb->sk->write_space(skb->sk); -#ifdef CONFIG_SLAVE_BALANCING +#ifdef CONFIG_SLAVE_BALANCING if(skb->in_dev_queue && skb->dev!=NULL) skb->dev->pkt_queue--; #endif kfree_skbmem(skb,skb->mem_len); } - } - else + } + else { -#ifdef CONFIG_SLAVE_BALANCING +#ifdef CONFIG_SLAVE_BALANCING if(skb->in_dev_queue && skb->dev!=NULL) skb->dev->pkt_queue--; #endif @@ -399,45 +394,44 @@ void kfree_skb(struct sk_buff *skb, int rw) * Allocate a new skbuff. We do this ourselves so we can fill in a few 'private' * fields and also do memory statistics to find all the [BEEP] leaks. */ - - struct sk_buff *alloc_skb(unsigned int size,int priority) - { - struct sk_buff *skb; - unsigned long flags; - - if (intr_count && priority!=GFP_ATOMIC) { +struct sk_buff *alloc_skb(unsigned int size,int priority) +{ + struct sk_buff *skb; + unsigned long flags; + + if (intr_count && priority!=GFP_ATOMIC) { static int count = 0; if (++count < 5) { - printk("alloc_skb called nonatomically from interrupt %08lx\n", - ((unsigned long *)&size)[-1]); + printk("alloc_skb called nonatomically from interrupt %p\n", + __builtin_return_address(0)); priority = GFP_ATOMIC; } - } - - size+=sizeof(struct sk_buff); - skb=(struct sk_buff *)kmalloc(size,priority); - if (skb == NULL) - { - net_fails++; - return NULL; - } + } + + size+=sizeof(struct sk_buff); + skb=(struct sk_buff *)kmalloc(size,priority); + if (skb == NULL) + { + net_fails++; + return NULL; + } #ifdef PARANOID_BUGHUNT_MODE if(skb->magic_debug_cookie == SK_GOOD_SKB) printk("Kernel kmalloc handed us an existing skb (%p)\n",skb); -#endif +#endif net_allocs++; - - skb->free = 2; /* Invalid so we pick up forgetful users */ + + skb->free = 2; /* Invalid so we pick up forgetful users */ skb->lock = 0; skb->pkt_type = PACKET_HOST; /* Default type */ - skb->truesize = size; - skb->mem_len = size; - skb->mem_addr = skb; -#ifdef CONFIG_SLAVE_BALANCING - skb->in_dev_queue = 0; -#endif - skb->fraglist = NULL; + skb->truesize = size; + skb->mem_len = size; + skb->mem_addr = skb; +#ifdef CONFIG_SLAVE_BALANCING + skb->in_dev_queue = 0; +#endif + skb->fraglist = NULL; skb->prev = skb->next = NULL; skb->link3 = NULL; skb->sk = NULL; @@ -446,19 +440,19 @@ void kfree_skb(struct sk_buff *skb, int rw) skb->localroute = 0; save_flags(flags); cli(); - net_memory += size; - net_skbcount++; - restore_flags(flags); + net_memory += size; + net_skbcount++; + restore_flags(flags); #if CONFIG_SKB_CHECK skb->magic_debug_cookie = SK_GOOD_SKB; #endif - skb->users = 0; - return skb; + skb->users = 0; + return skb; } /* * Free an skbuff by memory - */ + */ void kfree_skbmem(struct sk_buff *skb,unsigned size) { @@ -469,11 +463,11 @@ void kfree_skbmem(struct sk_buff *skb,unsigned size) if(skb->in_dev_queue && skb->dev!=NULL) skb->dev->pkt_queue--; restore_flags(flags); -#endif +#endif IS_SKB(skb); if(size!=skb->truesize) printk("kfree_skbmem: size mismatch.\n"); - + if(skb->magic_debug_cookie == SK_GOOD_SKB) { save_flags(flags); @@ -498,13 +492,13 @@ struct sk_buff *skb_clone(struct sk_buff *skb, int priority) { struct sk_buff *n; unsigned long offset; - + n=alloc_skb(skb->mem_len-sizeof(struct sk_buff),priority); if(n==NULL) return NULL; - + offset=((char *)n)-((char *)skb); - + memcpy(n->data,skb->data,skb->mem_len-sizeof(struct sk_buff)); n->len=skb->len; n->link3=NULL; @@ -528,8 +522,8 @@ struct sk_buff *skb_clone(struct sk_buff *skb, int priority) n->pkt_type=skb->pkt_type; return n; } - - + + /* * Skbuff device locking */ @@ -560,7 +554,7 @@ void dev_kfree_skb(struct sk_buff *skb, int mode) cli(); if(skb->lock==1) net_locked--; - + if (!--skb->lock && (skb->free == 1 || skb->free == 3)) { restore_flags(flags); diff --git a/net/inet/tcp.c b/net/inet/tcp.c index 693912335001..9345fd079393 100644 --- a/net/inet/tcp.c +++ b/net/inet/tcp.c @@ -365,7 +365,7 @@ static int tcp_readable(struct sock *sk) sum = skb->len -(counted - skb->h.th->seq); /* Length - header but start from where we are up to (avoid overlaps) */ if (skb->h.th->syn) sum++; - if (sum >= 0) + if (sum > 0) { /* Add it up, move on */ amount += sum; if (skb->h.th->syn) @@ -3389,7 +3389,6 @@ static inline int tcp_urg(struct sock *sk, struct tcphdr *th, * If we are in FINWAIT-2, a received FIN moves us to TIME-WAIT. * */ - static int tcp_fin(struct sk_buff *skb, struct sock *sk, struct tcphdr *th, unsigned long saddr, struct device *dev) { -- 2.39.5