Commit 00e99d41 authored by Linus Torvalds's avatar Linus Torvalds

Import 2.1.24

parent 32d4fbac
...@@ -261,7 +261,7 @@ S: Maintained ...@@ -261,7 +261,7 @@ S: Maintained
PPP PROTOCOL DRIVERS AND COMPRESSORS PPP PROTOCOL DRIVERS AND COMPRESSORS
P: Al Longyear P: Al Longyear
M: longyear@netcom.com, Cc: longyear@sii.com M: longyear@pobox.com
L: linux-ppp@vger.rutgers.edu L: linux-ppp@vger.rutgers.edu
S: Maintained S: Maintained
......
VERSION = 2 VERSION = 2
PATCHLEVEL = 1 PATCHLEVEL = 1
SUBLEVEL = 23 SUBLEVEL = 24
ARCH = i386 ARCH = i386
......
...@@ -356,7 +356,11 @@ struct moveparams { ...@@ -356,7 +356,11 @@ struct moveparams {
void setup_output_buffer_if_we_run_high(struct moveparams *mv) void setup_output_buffer_if_we_run_high(struct moveparams *mv)
{ {
high_buffer_start = (uch *)(((ulg)&end) + HEAP_SIZE); high_buffer_start = (uch *)(((ulg)&end) + HEAP_SIZE);
#ifdef STANDARD_MEMORY_BIOS_CALL
if (EXT_MEM_K < (3*1024)) error("Less than 4MB of memory.\n"); if (EXT_MEM_K < (3*1024)) error("Less than 4MB of memory.\n");
#else
if (EXT_MEM_K*64 < (3*1024)) error("Less than 4MB of memory.\n");
#endif
mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START; mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START;
high_loaded = 1; high_loaded = 1;
free_mem_end_ptr = (long)high_buffer_start; free_mem_end_ptr = (long)high_buffer_start;
......
...@@ -638,11 +638,11 @@ void smp_callin(void) ...@@ -638,11 +638,11 @@ void smp_callin(void)
load_ldt(0); load_ldt(0);
local_flush_tlb(); local_flush_tlb();
while(!task[cpuid] || current_set[cpuid] != task[cpuid]) while (cpu_number_map[cpuid] == -1)
barrier(); barrier();
if (cpu_number_map[cpuid] == -1) while(!task[cpuid] || current_set[cpuid] != task[cpu_number_map[cpuid]])
while(1); barrier();
local_flush_tlb(); local_flush_tlb();
load_TR(cpu_number_map[cpuid]); load_TR(cpu_number_map[cpuid]);
......
...@@ -4128,7 +4128,6 @@ static void floppy_release_irq_and_dma(void) ...@@ -4128,7 +4128,6 @@ static void floppy_release_irq_and_dma(void)
extern char *get_options(char *str, int *ints); extern char *get_options(char *str, int *ints);
char *floppy=NULL; char *floppy=NULL;
MODULE_PARM(floppy, "s");
static void parse_floppy_cfg_string(char *cfg) static void parse_floppy_cfg_string(char *cfg)
{ {
......
/* /*
* linux/drivers/block/triton.c Version 1.13 Aug 12, 1996 * linux/drivers/block/triton.c Version 1.20 Jan 27, 1997
* *
* Copyright (c) 1995-1996 Mark Lord * Copyright (c) 1995-1997 Mark Lord
* May be copied or modified under the terms of the GNU General Public License * May be copied or modified under the terms of the GNU General Public License
*/ */
...@@ -95,6 +95,9 @@ ...@@ -95,6 +95,9 @@
* available from ftp://ftp.intel.com/pub/bios/10004bs0.exe * available from ftp://ftp.intel.com/pub/bios/10004bs0.exe
* (thanks to Glen Morrell <glen@spin.Stanford.edu> for researching this). * (thanks to Glen Morrell <glen@spin.Stanford.edu> for researching this).
* *
* Thanks to "Christopher J. Reimer" <reimer@doe.carleton.ca> for fixing the
* problem with some (all?) ACER motherboards/BIOSs.
*
* And, yes, Intel Zappa boards really *do* use the Triton IDE ports. * And, yes, Intel Zappa boards really *do* use the Triton IDE ports.
*/ */
#include <linux/types.h> #include <linux/types.h>
...@@ -143,7 +146,11 @@ const char *good_dma_drives[] = {"Micropolis 2112A", ...@@ -143,7 +146,11 @@ const char *good_dma_drives[] = {"Micropolis 2112A",
*/ */
#define PRD_BYTES 8 #define PRD_BYTES 8
#define PRD_ENTRIES (PAGE_SIZE / (2 * PRD_BYTES)) #define PRD_ENTRIES (PAGE_SIZE / (2 * PRD_BYTES))
#define DEFAULT_BMIBA 0xe800 /* in case BIOS did not init it */
/*
* Interface to access piix registers
*/
static unsigned int piix_key;
/* /*
* dma_intr() is the handler for disk read/write DMA interrupts * dma_intr() is the handler for disk read/write DMA interrupts
...@@ -366,6 +373,53 @@ static void init_triton_dma (ide_hwif_t *hwif, unsigned short base) ...@@ -366,6 +373,53 @@ static void init_triton_dma (ide_hwif_t *hwif, unsigned short base)
printk("\n"); printk("\n");
} }
/* The next two functions were stolen from cmd640.c, with
a few modifications */
static void put_piix_reg (unsigned short reg, long val)
{
unsigned long flags;
save_flags(flags);
cli();
outl_p((reg & 0xfc) | piix_key, 0xcf8);
outl_p(val, (reg & 3) | 0xcfc);
restore_flags(flags);
}
static long get_piix_reg (unsigned short reg)
{
long b;
unsigned long flags;
save_flags(flags);
cli();
outl_p((reg & 0xfc) | piix_key, 0xcf8);
b = inl_p((reg & 3) | 0xcfc);
restore_flags(flags);
return b;
}
/*
* Search for an (apparently) unused block of I/O space
* of "size" bytes in length.
*/
static short find_free_region (unsigned short size)
{
unsigned short i, base = 0xe800;
for (base = 0xe800; base > 0; base -= 0x800) {
if (!check_region(base,size)) {
for (i = 0; i < size; i++) {
if (inb(base+i) != 0xff)
goto next;
}
return base; /* success */
}
next:
}
return 0; /* failure */
}
/* /*
* ide_init_triton() prepares the IDE driver for DMA operation. * ide_init_triton() prepares the IDE driver for DMA operation.
* This routine is called once, from ide.c during driver initialization, * This routine is called once, from ide.c during driver initialization,
...@@ -379,8 +433,9 @@ void ide_init_triton (byte bus, byte fn) ...@@ -379,8 +433,9 @@ void ide_init_triton (byte bus, byte fn)
unsigned int bmiba, timings; unsigned int bmiba, timings;
printk("ide: i82371 PIIX (Triton) on PCI bus %d function %d\n", bus, fn); printk("ide: i82371 PIIX (Triton) on PCI bus %d function %d\n", bus, fn);
/* /*
* See if IDE and BM-DMA features are enabled: * See if IDE ports are enabled
*/ */
if ((rc = pcibios_read_config_word(bus, fn, 0x04, &pcicmd))) if ((rc = pcibios_read_config_word(bus, fn, 0x04, &pcicmd)))
goto quit; goto quit;
...@@ -388,42 +443,44 @@ void ide_init_triton (byte bus, byte fn) ...@@ -388,42 +443,44 @@ void ide_init_triton (byte bus, byte fn)
printk("ide: ports are not enabled (BIOS)\n"); printk("ide: ports are not enabled (BIOS)\n");
goto quit; goto quit;
} }
if ((rc = pcibios_read_config_dword(bus, fn, 0x40, &timings)))
goto quit;
if (!(timings & 0x80008000)) {
printk("ide: neither port is enabled\n");
goto quit;
}
/*
* See if Bus-Mastered DMA is enabled
*/
if ((pcicmd & 4) == 0) { if ((pcicmd & 4) == 0) {
printk("ide: BM-DMA feature is not enabled (BIOS)\n"); printk("ide: BM-DMA feature is not enabled (BIOS)\n");
} else { } else {
/* /*
* Get the bmiba base address * Get the bmiba base address
*/ */
int try_again = 1; if ((rc = pcibios_read_config_dword(bus, fn, 0x20, &bmiba)))
do { goto quit;
if ((rc = pcibios_read_config_dword(bus, fn, 0x20, &bmiba))) bmiba &= 0xfff0; /* extract port base address */
goto quit; if (bmiba) {
bmiba &= 0xfff0; /* extract port base address */ dma_enabled = 1;
if (bmiba) { } else {
dma_enabled = 1; unsigned short base;
break; printk("ide: BM-DMA base register is invalid (0x%04x, PnP BIOS problem)\n", bmiba);
} else { base = find_free_region(16);
printk("ide: BM-DMA base register is invalid (0x%04x, PnP BIOS problem)\n", bmiba); if (base) {
if (inb(DEFAULT_BMIBA) != 0xff || !try_again) printk("ide: bypassing BIOS; setting BMIBA to 0x%04x\n", base);
break; piix_key = 0x80000000 + (fn * 0x100);
printk("ide: setting BM-DMA base register to 0x%04x\n", DEFAULT_BMIBA); put_piix_reg(0x04,get_piix_reg(0x04)&~5);
if ((rc = pcibios_write_config_word(bus, fn, 0x04, pcicmd&~1))) put_piix_reg(0x20,(get_piix_reg(0x20)&0xFFFF000F)|base|1);
goto quit; put_piix_reg(0x04,get_piix_reg(0x04)|5);
rc = pcibios_write_config_dword(bus, fn, 0x20, DEFAULT_BMIBA|1); bmiba = get_piix_reg(0x20)&0x0000FFF0;
if (pcibios_write_config_word(bus, fn, 0x04, pcicmd|5) || rc) if (bmiba == base && (get_piix_reg(0x04) & 5) == 5)
goto quit; dma_enabled = 1;
else
printk("ide: no such luck; DMA disabled\n");
} }
} while (try_again--); }
}
/*
* See if ide port(s) are enabled
*/
if ((rc = pcibios_read_config_dword(bus, fn, 0x40, &timings)))
goto quit;
if (!(timings & 0x80008000)) {
printk("ide: neither port is enabled\n");
goto quit;
} }
/* /*
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/poll.h>
/* /*
* We sponge a minor off of the misc major. No need slurping * We sponge a minor off of the misc major. No need slurping
......
...@@ -46,6 +46,7 @@ static int soft_margin = TIMER_MARGIN; /* in seconds */ ...@@ -46,6 +46,7 @@ static int soft_margin = TIMER_MARGIN; /* in seconds */
struct timer_list watchdog_ticktock; struct timer_list watchdog_ticktock;
static int timer_alive = 0; static int timer_alive = 0;
static int in_use = 0;
/* /*
...@@ -70,8 +71,9 @@ static void watchdog_fire(unsigned long data) ...@@ -70,8 +71,9 @@ static void watchdog_fire(unsigned long data)
static int softdog_open(struct inode *inode, struct file *file) static int softdog_open(struct inode *inode, struct file *file)
{ {
if(timer_alive) if(in_use)
return -EBUSY; return -EBUSY;
in_use = 1;
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
/* /*
* Activate timer * Activate timer
...@@ -94,6 +96,7 @@ static void softdog_release(struct inode *inode, struct file *file) ...@@ -94,6 +96,7 @@ static void softdog_release(struct inode *inode, struct file *file)
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
timer_alive=0; timer_alive=0;
#endif #endif
in_use = 0;
} }
static void softdog_ping(void) static void softdog_ping(void)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Dynamic PPP devices by Jim Freeman <jfree@caldera.com>. * Dynamic PPP devices by Jim Freeman <jfree@caldera.com>.
* ppp_tty_receive ``noisy-raise-bug'' fixed by Ove Ewerlid <ewerlid@syscon.uu.se> * ppp_tty_receive ``noisy-raise-bug'' fixed by Ove Ewerlid <ewerlid@syscon.uu.se>
* *
* ==FILEVERSION 960528== * ==FILEVERSION 970126==
* *
* NOTE TO MAINTAINERS: * NOTE TO MAINTAINERS:
* If you modify this file at all, please set the number above to the * If you modify this file at all, please set the number above to the
...@@ -138,7 +138,6 @@ extern inline int lock_buffer (register struct ppp_buffer *buf); ...@@ -138,7 +138,6 @@ extern inline int lock_buffer (register struct ppp_buffer *buf);
static int rcv_proto_ip (struct ppp *, __u16, __u8 *, int); static int rcv_proto_ip (struct ppp *, __u16, __u8 *, int);
static int rcv_proto_ipx (struct ppp *, __u16, __u8 *, int); static int rcv_proto_ipx (struct ppp *, __u16, __u8 *, int);
static int rcv_proto_ipv6 (struct ppp *, __u16, __u8 *, int);
static int rcv_proto_vjc_comp (struct ppp *, __u16, __u8 *, int); static int rcv_proto_vjc_comp (struct ppp *, __u16, __u8 *, int);
static int rcv_proto_vjc_uncomp (struct ppp *, __u16, __u8 *, int); static int rcv_proto_vjc_uncomp (struct ppp *, __u16, __u8 *, int);
static int rcv_proto_unknown (struct ppp *, __u16, __u8 *, int); static int rcv_proto_unknown (struct ppp *, __u16, __u8 *, int);
...@@ -266,7 +265,6 @@ static ...@@ -266,7 +265,6 @@ static
ppp_proto_type proto_list[] = { ppp_proto_type proto_list[] = {
{ PPP_IP, rcv_proto_ip }, { PPP_IP, rcv_proto_ip },
{ PPP_IPX, rcv_proto_ipx }, { PPP_IPX, rcv_proto_ipx },
{ PPP_IPV6, rcv_proto_ipv6 },
{ PPP_VJC_COMP, rcv_proto_vjc_comp }, { PPP_VJC_COMP, rcv_proto_vjc_comp },
{ PPP_VJC_UNCOMP, rcv_proto_vjc_uncomp }, { PPP_VJC_UNCOMP, rcv_proto_vjc_uncomp },
{ PPP_LQR, rcv_proto_lqr }, { PPP_LQR, rcv_proto_lqr },
...@@ -1229,18 +1227,6 @@ rcv_proto_ipx (struct ppp *ppp, __u16 proto, __u8 * data, int count) ...@@ -1229,18 +1227,6 @@ rcv_proto_ipx (struct ppp *ppp, __u16 proto, __u8 * data, int count)
return 0; return 0;
} }
/*
* Process the receipt of an IPV6 frame
*/
static int
rcv_proto_ipv6 (struct ppp *ppp, __u16 proto, __u8 * data, int count)
{
if (((ppp2dev (ppp)->flags & IFF_UP) != 0) && (count > 0))
return ppp_rcv_rx (ppp, htons (ETH_P_IPV6), data, count);
return 0;
}
/* /*
* Process the receipt of an VJ Compressed frame * Process the receipt of an VJ Compressed frame
*/ */
...@@ -3076,10 +3062,6 @@ ppp_dev_xmit (sk_buff *skb, struct device *dev) ...@@ -3076,10 +3062,6 @@ ppp_dev_xmit (sk_buff *skb, struct device *dev)
answer = ppp_dev_xmit_ip (dev, ppp, data); answer = ppp_dev_xmit_ip (dev, ppp, data);
break; break;
case ETH_P_IPV6:
answer = ppp_dev_xmit_ipx (dev, ppp, data, len, PPP_IPV6);
break;
default: /* All others have no support at this time. */ default: /* All others have no support at this time. */
dev_kfree_skb (skb, FREE_WRITE); dev_kfree_skb (skb, FREE_WRITE);
return 0; return 0;
......
...@@ -65,7 +65,7 @@ u_short altgr_map[NR_KEYS] = { ...@@ -65,7 +65,7 @@ u_short altgr_map[NR_KEYS] = {
u_short ctrl_map[NR_KEYS] = { u_short ctrl_map[NR_KEYS] = {
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf100, 0xf101, 0xf109, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf100, 0xf101, 0xf109,
0xf102, 0xf10a, 0xf103, 0xf10b, 0xf104, 0xf701, 0xf105, 0xf200, 0xf102, 0xf10a, 0xf103, 0xf10b, 0xf104, 0xf701, 0xf105, 0xf200,
0xf107, 0xf200, 0xf108, 0xf703, 0xf603, 0xf11d, 0xf200, 0xf204, 0xf106, 0xf107, 0xf108, 0xf703, 0xf603, 0xf11d, 0xf200, 0xf204,
0xf601, 0xf200, 0xf200, 0xf600, 0xf602, 0xf200, 0xf200, 0xf000, 0xf601, 0xf200, 0xf200, 0xf600, 0xf602, 0xf200, 0xf200, 0xf000,
0xf01b, 0xf01c, 0xf01d, 0xf01e, 0xf01f, 0xf07f, 0xf200, 0xf200, 0xf01b, 0xf01c, 0xf01d, 0xf01e, 0xf01f, 0xf07f, 0xf200, 0xf200,
0xf01f, 0xf200, 0xf000, 0xf008, 0xf115, 0xf200, 0xf30d, 0xf30c, 0xf01f, 0xf200, 0xf000, 0xf008, 0xf115, 0xf200, 0xf30d, 0xf30c,
...@@ -103,7 +103,7 @@ u_short shift_ctrl_map[NR_KEYS] = { ...@@ -103,7 +103,7 @@ u_short shift_ctrl_map[NR_KEYS] = {
u_short alt_map[NR_KEYS] = { u_short alt_map[NR_KEYS] = {
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf500, 0xf501, 0xf509, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf500, 0xf501, 0xf509,
0xf502, 0xf50a, 0xf503, 0xf50b, 0xf504, 0xf701, 0xf505, 0xf200, 0xf502, 0xf50a, 0xf503, 0xf50b, 0xf504, 0xf701, 0xf505, 0xf200,
0xf507, 0xf200, 0xf508, 0xf703, 0xf603, 0xf11d, 0xf200, 0xf209, 0xf506, 0xf507, 0xf508, 0xf703, 0xf603, 0xf11d, 0xf200, 0xf209,
0xf210, 0xf200, 0xf200, 0xf600, 0xf211, 0xf81b, 0xf831, 0xf832, 0xf210, 0xf200, 0xf200, 0xf600, 0xf211, 0xf81b, 0xf831, 0xf832,
0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830,
0xf82d, 0xf83d, 0xf860, 0xf87f, 0xf115, 0xf200, 0xf30d, 0xf30c, 0xf82d, 0xf83d, 0xf860, 0xf87f, 0xf115, 0xf200, 0xf30d, 0xf30c,
...@@ -122,7 +122,7 @@ u_short alt_map[NR_KEYS] = { ...@@ -122,7 +122,7 @@ u_short alt_map[NR_KEYS] = {
u_short ctrl_alt_map[NR_KEYS] = { u_short ctrl_alt_map[NR_KEYS] = {
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf500, 0xf501, 0xf509, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf500, 0xf501, 0xf509,
0xf502, 0xf50a, 0xf503, 0xf50b, 0xf504, 0xf701, 0xf505, 0xf200, 0xf502, 0xf50a, 0xf503, 0xf50b, 0xf504, 0xf701, 0xf505, 0xf200,
0xf507, 0xf200, 0xf508, 0xf703, 0xf603, 0xf11d, 0xf200, 0xf200, 0xf506, 0xf507, 0xf508, 0xf703, 0xf603, 0xf11d, 0xf200, 0xf200,
0xf601, 0xf200, 0xf200, 0xf600, 0xf602, 0xf200, 0xf200, 0xf200, 0xf601, 0xf200, 0xf200, 0xf600, 0xf602, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf115, 0xf200, 0xf30d, 0xf30c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf115, 0xf200, 0xf30d, 0xf30c,
......
...@@ -51,13 +51,13 @@ keycode 0x0e = F6 F16 Console_18 ...@@ -51,13 +51,13 @@ keycode 0x0e = F6 F16 Console_18
# BLANK KEY on type 5 keyboards # BLANK KEY on type 5 keyboards
keycode 0x0f = keycode 0x0f =
keycode 0x10 = F7 F17 Console_19 keycode 0x10 = F7 F17 Console_19
control Keycode 0x10 = F7 control keycode 0x10 = F7
alt keycode 0x10 = Console_7 alt keycode 0x10 = Console_7
control alt keycode 0x10 = Console_7 control alt keycode 0x10 = Console_7
keycode 0x11 = F8 F18 Console_20 keycode 0x11 = F8 F18 Console_20
control keycode 0x10 = F8 control keycode 0x11 = F8
alt keycode 0x10 = Console_8 alt keycode 0x11 = Console_8
control alt keycode 0x10 = Console_8 control alt keycode 0x11 = Console_8
keycode 0x12 = F9 F19 Console_21 keycode 0x12 = F9 F19 Console_21
control keycode 0x12 = F9 control keycode 0x12 = F9
alt keycode 0x12 = Console_9 alt keycode 0x12 = Console_9
......
...@@ -194,12 +194,12 @@ ...@@ -194,12 +194,12 @@
#define CNTLREG2 0x2C /* rw control register two */ #define CNTLREG2 0x2C /* rw control register two */
#define CNTLREG2_ENF 0x40 /* enable features */ #define CNTLREG2_ENF 0x40 /* enable features */
#define CNTLREG3 0x30 /* rw control register three */ #define CNTLREG3 0x30 /* rw control register three */
#define CNTLREG3_ADIDCHK 0x80 /* additional ID check */ #define CNTLREG3_ADIDCHK 0x80 /* additional ID check */
#define CNTLREG3_FASTSCSI 0x10 /* fast SCSI */ #define CNTLREG3_FASTSCSI 0x10 /* fast SCSI */
#define CNTLREG3_FASTCLK 0x08 /* fast SCSI clocking */ #define CNTLREG3_FASTCLK 0x08 /* fast SCSI clocking */
#define CNTLREG4 0x34 /* rw control register four */ #define CNTLREG4 0x34 /* rw control register four */
#define CNTLREG4_GLITCH 0xC0 /* glitch eater */ #define CNTLREG4_GLITCH 0xC0 /* glitch eater */
#define CNTLREG4_PWD 0x20 /* reduced power feature */ #define CNTLREG4_PWD 0x20 /* reduced power feature */
#define CNTLREG4_RAE 0x08 /* write only, active negot. ctrl. */ #define CNTLREG4_RAE 0x08 /* write only, active negot. ctrl. */
...@@ -268,7 +268,7 @@ extern struct proc_dir_entry proc_scsi_am53c974; ...@@ -268,7 +268,7 @@ extern struct proc_dir_entry proc_scsi_am53c974;
#define AM53C974 { \ #define AM53C974 { \
NULL, /* pointer to next in list */ \ NULL, /* pointer to next in list */ \
NULL, /* long * usage_count */ \ NULL, /* struct module *module */ \
&proc_scsi_am53c974, /* struct proc_dir_entry *proc_dir */ \ &proc_scsi_am53c974, /* struct proc_dir_entry *proc_dir */ \
NULL, /* int (*proc_info)(char *, char **, off_t, int, int, int); */ \ NULL, /* int (*proc_info)(char *, char **, off_t, int, int, int); */ \
"AM53C974", /* name */ \ "AM53C974", /* name */ \
......
Sat Jan 18 15:51:45 1997 Richard Henderson <richard@twiddle.rth.home> Sat Jan 18 15:51:45 1997 Richard Henderson <rth@tamu.edu>
* Don't play with usage_count directly, instead hand around * Don't play with usage_count directly, instead hand around
the module header and use the module macros. the module header and use the module macros.
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* for more info. * for more info.
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/poll.h>
#include "sound_config.h" #include "sound_config.h"
...@@ -542,44 +542,31 @@ audio_init_devices (void) ...@@ -542,44 +542,31 @@ audio_init_devices (void)
*/ */
} }
int unsigned int
audio_select (int dev, struct fileinfo *file, int sel_type, select_table * wait) audio_poll (kdev_t dev, struct fileinfo *file, poll_table * wait)
{ {
char *dma_buf; char *dma_buf;
unsigned int mask = 0;
int buf_no, buf_ptr, buf_size; int buf_no, buf_ptr, buf_size;
dev = dev >> 4; dev = dev >> 4;
switch (sel_type) mask = DMAbuf_poll (dev, file, wait);
{
case SEL_IN:
if (audio_mode[dev] & AM_WRITE && !(audio_devs[dev]->flags & DMA_DUPLEX))
{
return 0; /* Not recording */
}
return DMAbuf_select (dev, file, sel_type, wait);
break;
case SEL_OUT: /* sel_in */
if (audio_mode[dev] & AM_READ && !(audio_devs[dev]->flags & DMA_DUPLEX)) if (audio_mode[dev] & AM_WRITE && !(audio_devs[dev]->flags & DMA_DUPLEX))
{ mask &= ~(POLLIN | POLLRDNORM); /* Wrong direction */
return 0; /* Wrong direction */
}
if (DMAbuf_get_curr_buffer (dev, &buf_no, &dma_buf, &buf_ptr, &buf_size) >= 0) /* sel_out */
{ if (audio_mode[dev] & AM_READ && !(audio_devs[dev]->flags & DMA_DUPLEX)) {
return 1; /* There is space in the current buffer */ mask &= ~(POLLOUT | POLLWRNORM); /* Wrong direction */
} goto sel_ex;
}
return DMAbuf_select (dev, file, sel_type, wait); if (DMAbuf_get_curr_buffer (dev, &buf_no, &dma_buf, &buf_ptr, &buf_size) >= 0)
break; mask |= POLLOUT | POLLWRNORM;
case SEL_EX:
return 0;
}
return 0; sel_ex:
return mask;
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* for more info. * for more info.
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/poll.h>
#include "sound_config.h" #include "sound_config.h"
...@@ -1834,109 +1834,70 @@ DMAbuf_reset_dma (int dev) ...@@ -1834,109 +1834,70 @@ DMAbuf_reset_dma (int dev)
{ {
} }
int unsigned int
DMAbuf_select (int dev, struct fileinfo *file, int sel_type, select_table * wait) DMAbuf_poll (kdev_t dev, struct fileinfo *file, poll_table * wait)
{ {
unsigned int mask = 0;
struct dma_buffparms *dmap; struct dma_buffparms *dmap;
unsigned long flags; unsigned long flags;
switch (sel_type) save_flags (flags);
{ cli ();
case SEL_IN:
if (!(audio_devs[dev]->open_mode))
return 0;
dmap = audio_devs[dev]->dmap_in;
if (dmap->mapping_flags & DMA_MAP_MAPPED)
{
if (dmap->qlen)
return 1;
save_flags (flags);
cli ();
in_sleep_flag[dev].opts = WK_SLEEP;
select_wait (&in_sleeper[dev], wait);
restore_flags (flags);
return 0;
}
if (dmap->dma_mode != DMODE_INPUT)
{
if (dmap->dma_mode == DMODE_NONE &&
audio_devs[dev]->enable_bits & PCM_ENABLE_INPUT &&
!dmap->qlen &&
audio_devs[dev]->go)
{
unsigned long flags;
save_flags (flags);
cli ();
activate_recording (dev, dmap);
restore_flags (flags);
}
return 0;
}
if (!dmap->qlen)
{
save_flags (flags);
cli ();
in_sleep_flag[dev].opts = WK_SLEEP;
select_wait (&in_sleeper[dev], wait);
restore_flags (flags);
return 0;
}
return 1;
break;
case SEL_OUT:
dmap = audio_devs[dev]->dmap_out;
if (dmap->mapping_flags & DMA_MAP_MAPPED)
{
if (dmap->qlen)
return 1;
save_flags (flags); in_sleep_flag[dev].opts = WK_SLEEP;
cli (); poll_wait (&in_sleeper[dev], wait);
out_sleep_flag[dev].opts = WK_SLEEP;
poll_wait (&out_sleeper[dev], wait);
out_sleep_flag[dev].opts = WK_SLEEP; restore_flags (flags);
select_wait (&out_sleeper[dev], wait);
restore_flags (flags);
return 0;
}
if (dmap->dma_mode == DMODE_INPUT)
{
return 0;
}
if (dmap->dma_mode == DMODE_NONE) /* sel_in */
{ dmap = audio_devs[dev]->dmap_in;
return 1; if (!(audio_devs[dev]->open_mode))
} goto sel_out;
if (dmap->mapping_flags & DMA_MAP_MAPPED) {
if (dmap->qlen)
mask |= POLLIN | POLLRDNORM;
goto sel_out;
}
if (dmap->dma_mode != DMODE_INPUT) {
if (dmap->dma_mode == DMODE_NONE &&
audio_devs[dev]->enable_bits & PCM_ENABLE_INPUT &&
!dmap->qlen &&
audio_devs[dev]->go) {
unsigned long flags;
if (!space_in_queue (dev)) save_flags (flags);
{ cli ();
save_flags (flags); activate_recording (dev, dmap);
cli (); restore_flags (flags);
}
goto sel_out;
}
if (!dmap->qlen)
goto sel_out;
mask |= POLLIN | POLLRDNORM;
out_sleep_flag[dev].opts = WK_SLEEP; sel_out:
select_wait (&out_sleeper[dev], wait); dmap = audio_devs[dev]->dmap_out;
restore_flags (flags);
return 0;
}
return 1;
break;
case SEL_EX: if (dmap->mapping_flags & DMA_MAP_MAPPED) {
return 0; if (dmap->qlen)
} mask |= POLLOUT | POLLWRNORM;
goto sel_ex;
}
if (dmap->dma_mode == DMODE_INPUT)
goto sel_ex;
if (dmap->dma_mode == DMODE_NONE) {
mask |= POLLOUT | POLLWRNORM;
goto sel_ex;
}
if (!space_in_queue (dev))
goto sel_ex;
mask |= POLLOUT | POLLWRNORM;
return 0; sel_ex:
return mask;
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
* for more info. * for more info.
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/poll.h>
#include "sound_config.h" #include "sound_config.h"
...@@ -497,40 +498,21 @@ MIDIbuf_ioctl (int dev, struct fileinfo *file, ...@@ -497,40 +498,21 @@ MIDIbuf_ioctl (int dev, struct fileinfo *file,
} }
} }
int unsigned int
MIDIbuf_select (int dev, struct fileinfo *file, int sel_type, select_table * wait) MIDIbuf_poll (kdev_t dev, struct fileinfo *file, poll_table * wait)
{ {
dev = dev >> 4; unsigned int mask = 0;
switch (sel_type) input_sleep_flag[dev].opts = WK_SLEEP;
{ poll_wait (&input_sleeper[dev], wait);
case SEL_IN: midi_sleep_flag[dev].opts = WK_SLEEP;
if (!DATA_AVAIL (midi_in_buf[dev])) poll_wait (&midi_sleeper[dev], wait);
{
if (DATA_AVAIL (midi_in_buf[dev]))
input_sleep_flag[dev].opts = WK_SLEEP; mask |= POLLIN | POLLRDNORM;
select_wait (&input_sleeper[dev], wait); if (!SPACE_AVAIL (midi_out_buf[dev]))
return 0; mask |= POLLOUT | POLLWRNORM;
} return mask;
return 1;
break;
case SEL_OUT:
if (SPACE_AVAIL (midi_out_buf[dev]))
{
midi_sleep_flag[dev].opts = WK_SLEEP;
select_wait (&midi_sleeper[dev], wait);
return 0;
}
return 1;
break;
case SEL_EX:
return 0;
}
return 0;
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
* for more info. * for more info.
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/poll.h>
#define SEQUENCER_C #define SEQUENCER_C
...@@ -1768,50 +1769,28 @@ sequencer_ioctl (int dev, struct fileinfo *file, ...@@ -1768,50 +1769,28 @@ sequencer_ioctl (int dev, struct fileinfo *file,
return -EINVAL; return -EINVAL;
} }
int unsigned int
sequencer_select (int dev, struct fileinfo *file, int sel_type, select_table * wait) sequencer_poll (kdev_t dev, struct fileinfo *file, poll_table * wait)
{ {
unsigned int mask = 0;
unsigned long flags; unsigned long flags;
dev = dev >> 4; save_flags (flags);
cli ();
switch (sel_type)
{
case SEL_IN:
save_flags (flags);
cli ();
if (!iqlen)
{
midi_sleep_flag.opts = WK_SLEEP;
select_wait (&midi_sleeper, wait);
restore_flags (flags);
return 0;
}
restore_flags (flags);
return 1;
break;
case SEL_OUT: midi_sleep_flag.opts = WK_SLEEP;
save_flags (flags); poll_wait (&midi_sleeper, wait);
cli (); seq_sleep_flag.opts = WK_SLEEP;
if ((SEQ_MAX_QUEUE - qlen) < output_threshold) poll_wait (&seq_sleeper, wait);
{
seq_sleep_flag.opts = WK_SLEEP; restore_flags (flags);
select_wait (&seq_sleeper, wait);
restore_flags (flags);
return 0;
}
restore_flags (flags);
return 1;
break;
case SEL_EX: if (iqlen)
return 0; mask |= POLLIN | POLLRDNORM;
} if ((SEQ_MAX_QUEUE - qlen) >= output_threshold)
mask |= POLLOUT | POLLWRNORM;
return 0; return mask;
} }
......
...@@ -18,7 +18,7 @@ void DMAbuf_close_dma (int dev); ...@@ -18,7 +18,7 @@ void DMAbuf_close_dma (int dev);
void DMAbuf_reset_dma (int dev); void DMAbuf_reset_dma (int dev);
void DMAbuf_inputintr(int dev); void DMAbuf_inputintr(int dev);
void DMAbuf_outputintr(int dev, int underflow_flag); void DMAbuf_outputintr(int dev, int underflow_flag);
int DMAbuf_select(int dev, struct fileinfo *file, int sel_type, select_table * wait); unsigned int DMAbuf_poll(kdev_t dev, struct fileinfo *file, poll_table * wait);
void DMAbuf_start_device(int dev); void DMAbuf_start_device(int dev);
void DMAbuf_start_devices(unsigned int devmask); void DMAbuf_start_devices(unsigned int devmask);
void DMAbuf_reset (int dev); void DMAbuf_reset (int dev);
...@@ -36,7 +36,7 @@ int audio_ioctl (int dev, struct fileinfo *file, ...@@ -36,7 +36,7 @@ int audio_ioctl (int dev, struct fileinfo *file,
unsigned int cmd, caddr_t arg); unsigned int cmd, caddr_t arg);
void audio_init_devices (void); void audio_init_devices (void);
int audio_select(int dev, struct fileinfo *file, int sel_type, select_table * wait); unsigned int audio_poll(kdev_t dev, struct fileinfo *file, poll_table * wait);
/* /*
* System calls for the /dev/sequencer * System calls for the /dev/sequencer
...@@ -56,7 +56,7 @@ unsigned long compute_finetune(unsigned long base_freq, int bend, int range); ...@@ -56,7 +56,7 @@ unsigned long compute_finetune(unsigned long base_freq, int bend, int range);
void seq_input_event(unsigned char *event, int len); void seq_input_event(unsigned char *event, int len);
void seq_copy_to_input (unsigned char *event, int len); void seq_copy_to_input (unsigned char *event, int len);
int sequencer_select(int dev, struct fileinfo *file, int sel_type, select_table * wait); unsigned int sequencer_poll(kdev_t dev, struct fileinfo *file, poll_table * wait);
/* /*
* System calls for the /dev/midi * System calls for the /dev/midi
...@@ -72,7 +72,7 @@ int MIDIbuf_lseek (int dev, struct fileinfo *file, off_t offset, int orig); ...@@ -72,7 +72,7 @@ int MIDIbuf_lseek (int dev, struct fileinfo *file, off_t offset, int orig);
void MIDIbuf_bytes_received(int dev, unsigned char *buf, int count); void MIDIbuf_bytes_received(int dev, unsigned char *buf, int count);
void MIDIbuf_init(void); void MIDIbuf_init(void);
int MIDIbuf_select(int dev, struct fileinfo *file, int sel_type, select_table * wait); unsigned int MIDIbuf_poll(kdev_t dev, struct fileinfo *file, poll_table * wait);
/* /*
* *
......
...@@ -192,29 +192,29 @@ sound_ioctl (struct inode *inode, struct file *file, ...@@ -192,29 +192,29 @@ sound_ioctl (struct inode *inode, struct file *file,
return err; return err;
} }
static int static unsigned int
sound_select (struct inode *inode, struct file *file, int sel_type, select_table * wait) sound_poll (struct file *file, poll_table * wait)
{ {
int dev; int dev;
dev = MINOR (inode->i_rdev); dev = MINOR (file->f_inode->i_rdev);
files[dev].flags = file->f_flags; files[dev].flags = file->f_flags;
DEB (printk ("sound_select(dev=%d, type=0x%x)\n", dev, sel_type)); DEB (printk ("sound_poll(dev=%d)\n", dev));
switch (dev & 0x0f) switch (dev & 0x0f)
{ {
#ifdef CONFIG_SEQUENCER #ifdef CONFIG_SEQUENCER
case SND_DEV_SEQ: case SND_DEV_SEQ:
case SND_DEV_SEQ2: case SND_DEV_SEQ2:
return sequencer_select (dev, &files[dev], sel_type, wait); return sequencer_poll (dev, &files[dev], wait);
break; break;
#endif #endif
#ifdef CONFIG_MIDI #ifdef CONFIG_MIDI
case SND_DEV_MIDIN: case SND_DEV_MIDIN:
return MIDIbuf_select (dev, &files[dev], sel_type, wait); return MIDIbuf_poll (dev, &files[dev], wait);
break; break;
#endif #endif
...@@ -222,7 +222,7 @@ sound_select (struct inode *inode, struct file *file, int sel_type, select_table ...@@ -222,7 +222,7 @@ sound_select (struct inode *inode, struct file *file, int sel_type, select_table
case SND_DEV_DSP: case SND_DEV_DSP:
case SND_DEV_DSP16: case SND_DEV_DSP16:
case SND_DEV_AUDIO: case SND_DEV_AUDIO:
return audio_select (dev, &files[dev], sel_type, wait); return audio_poll (dev, &files[dev], wait);
break; break;
#endif #endif
...@@ -327,7 +327,7 @@ static struct file_operations sound_fops = ...@@ -327,7 +327,7 @@ static struct file_operations sound_fops =
sound_read, sound_read,
sound_write, sound_write,
NULL, /* sound_readdir */ NULL, /* sound_readdir */
sound_select, sound_poll,
sound_ioctl, sound_ioctl,
sound_mmap, sound_mmap,
sound_open, sound_open,
......
...@@ -76,7 +76,6 @@ static int do_load_script(struct linux_binprm *bprm,struct pt_regs *regs) ...@@ -76,7 +76,6 @@ static int do_load_script(struct linux_binprm *bprm,struct pt_regs *regs)
/* /*
* OK, now restart the process with the interpreter's inode. * OK, now restart the process with the interpreter's inode.
*/ */
bprm->filename = interp;
retval = open_namei(interp, 0, 0, &bprm->inode, NULL); retval = open_namei(interp, 0, 0, &bprm->inode, NULL);
if (retval) if (retval)
return retval; return retval;
......
...@@ -1011,6 +1011,7 @@ extern int get_pci_list(char*); ...@@ -1011,6 +1011,7 @@ extern int get_pci_list(char*);
extern int get_md_status (char *); extern int get_md_status (char *);
extern int get_rtc_status (char *); extern int get_rtc_status (char *);
extern int get_locks_status (char *); extern int get_locks_status (char *);
extern int get_swaparea_info (char *);
#ifdef __SMP_PROF__ #ifdef __SMP_PROF__
extern int get_smp_prof_list(char *); extern int get_smp_prof_list(char *);
#endif #endif
...@@ -1088,6 +1089,9 @@ static long get_root_array(char * page, int type, char **start, ...@@ -1088,6 +1089,9 @@ static long get_root_array(char * page, int type, char **start,
case PROC_MTAB: case PROC_MTAB:
return get_filesystem_info( page ); return get_filesystem_info( page );
case PROC_SWAP:
return get_swaparea_info(page);
#ifdef CONFIG_RTC #ifdef CONFIG_RTC
case PROC_RTC: case PROC_RTC:
return get_rtc_status(page); return get_rtc_status(page);
......
...@@ -510,6 +510,10 @@ static struct proc_dir_entry proc_root_mounts = { ...@@ -510,6 +510,10 @@ static struct proc_dir_entry proc_root_mounts = {
PROC_MTAB, 6, "mounts", PROC_MTAB, 6, "mounts",
S_IFREG | S_IRUGO, 1, 0, 0, S_IFREG | S_IRUGO, 1, 0, 0,
}; };
static struct proc_dir_entry proc_root_swaps = {
PROC_MTAB, 5, "swaps",
S_IFREG | S_IRUGO, 1, 0, 0,
};
static struct proc_dir_entry proc_root_profile = { static struct proc_dir_entry proc_root_profile = {
PROC_PROFILE, 7, "profile", PROC_PROFILE, 7, "profile",
S_IFREG | S_IRUGO | S_IWUSR, 1, 0, 0, S_IFREG | S_IRUGO | S_IWUSR, 1, 0, 0,
...@@ -572,6 +576,7 @@ void proc_root_init(void) ...@@ -572,6 +576,7 @@ void proc_root_init(void)
proc_register(&proc_root, &proc_root_locks); proc_register(&proc_root, &proc_root_locks);
proc_register(&proc_root, &proc_root_mounts); proc_register(&proc_root, &proc_root_mounts);
proc_register(&proc_root, &proc_root_swaps);
#if defined(CONFIG_SUN_OPENPROMFS) || defined(CONFIG_SUN_OPENPROMFS_MODULE) #if defined(CONFIG_SUN_OPENPROMFS) || defined(CONFIG_SUN_OPENPROMFS_MODULE)
#ifdef CONFIG_SUN_OPENPROMFS #ifdef CONFIG_SUN_OPENPROMFS
......
/* $Id: namei.h,v 1.1 1996/12/13 14:48:20 jj Exp $ /* $Id: namei.h,v 1.3 1997/01/26 23:36:36 davem Exp $
* linux/include/asm-sparc/namei.h * linux/include/asm-sparc/namei.h
* *
* Routines to handle famous /usr/gnemul/s*. * Routines to handle famous /usr/gnemul/s*.
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
#define SPARC_BSD_EMUL "usr/gnemul/sunos/" #define SPARC_BSD_EMUL "usr/gnemul/sunos/"
#define SPARC_SOL_EMUL "usr/gnemul/solaris/" #define SPARC_SOL_EMUL "usr/gnemul/solaris/"
#if 1 #define translate_namei(pathname, base, follow_links, res_inode) ({ \
#define gnemul_namei(pathname, base, follow_links, res_inode) ({ \
if ((current->personality & (PER_BSD|PER_SVR4)) && !base && *pathname == '/') { \ if ((current->personality & (PER_BSD|PER_SVR4)) && !base && *pathname == '/') { \
struct inode *emul_ino; \ struct inode *emul_ino; \
int namelen; \ int namelen; \
...@@ -31,11 +30,8 @@ ...@@ -31,11 +30,8 @@
base->i_count++; \ base->i_count++; \
} \ } \
}) })
#else
#define gnemul_namei(pathname, base, follow_links, res_inode) do { } while (0)
#endif
#define gnemul_open_namei(pathname, flag, mode, res_inode, base) ({ \ #define translate_open_namei(pathname, flag, mode, res_inode, base) ({ \
if ((current->personality & (PER_BSD|PER_SVR4)) && !base && *pathname == '/') { \ if ((current->personality & (PER_BSD|PER_SVR4)) && !base && *pathname == '/') { \
struct inode *emul_ino; \ struct inode *emul_ino; \
int namelen; \ int namelen; \
......
...@@ -43,6 +43,7 @@ enum root_directory_inos { ...@@ -43,6 +43,7 @@ enum root_directory_inos {
PROC_CMDLINE, PROC_CMDLINE,
PROC_SYS, PROC_SYS,
PROC_MTAB, PROC_MTAB,
PROC_SWAP,
PROC_MD, PROC_MD,
PROC_RTC, PROC_RTC,
PROC_LOCKS, PROC_LOCKS,
......
...@@ -154,7 +154,7 @@ struct mm_struct { ...@@ -154,7 +154,7 @@ struct mm_struct {
#define INIT_MM { \ #define INIT_MM { \
1, \ 1, \
swapper_pg_dir, \ swapper_pg_dir, \
-1, \ 0, \
0, 0, 0, 0, \ 0, 0, 0, 0, \
0, 0, 0, 0, \ 0, 0, 0, 0, \
0, 0, 0, 0, \ 0, 0, 0, 0, \
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
struct swap_info_struct { struct swap_info_struct {
unsigned int flags; unsigned int flags;
kdev_t swap_device; kdev_t swap_device;
char *swap_filename;
struct inode * swap_file; struct inode * swap_file;
unsigned char * swap_map; unsigned char * swap_map;
unsigned char * swap_lockmap; unsigned char * swap_lockmap;
......
...@@ -293,6 +293,14 @@ struct tcp_opt ...@@ -293,6 +293,14 @@ struct tcp_opt
* } * }
*/ */
/* Define this to get the sk->debug debugging facility. */
#define SOCK_DEBUGGING
#ifdef SOCK_DEBUGGING
#define SOCK_DEBUG(sk, msg...) if((sk) && ((sk)->debug)) printk(KERN_DEBUG ## msg)
#else
#define SOCK_DEBUG(sk, msg...) do { } while (0)
#endif
/* /*
* TCP will start to use the new protinfo while *still using the old* fields * TCP will start to use the new protinfo while *still using the old* fields
*/ */
......
...@@ -432,8 +432,7 @@ static __inline__ void tcp_set_state(struct sock *sk, int state) ...@@ -432,8 +432,7 @@ static __inline__ void tcp_set_state(struct sock *sk, int state)
sk->state = state; sk->state = state;
#ifdef STATE_TRACE #ifdef STATE_TRACE
if(sk->debug) SOCK_DEBUG(sk, "TCP sk=%p, State %s -> %s\n",sk, statename[oldstate],statename[state]);
printk("TCP sk=%p, State %s -> %s\n",sk, statename[oldstate],statename[state]);
#endif #endif
switch (state) { switch (state) {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* 1996-04-21 Modified by Ulrich Windl to make NTP work * 1996-04-21 Modified by Ulrich Windl to make NTP work
* 1996-12-23 Modified by Dave Grothe to fix bugs in semaphores and * 1996-12-23 Modified by Dave Grothe to fix bugs in semaphores and
* make semaphores SMP safe * make semaphores SMP safe
* 1997-01-28 Modified by Finn Arne Gangstad to make timers scale better.
*/ */
/* /*
...@@ -630,74 +631,174 @@ void sleep_on(struct wait_queue **p) ...@@ -630,74 +631,174 @@ void sleep_on(struct wait_queue **p)
__sleep_on(p,TASK_UNINTERRUPTIBLE); __sleep_on(p,TASK_UNINTERRUPTIBLE);
} }
/*
* The head for the timer-list has a "expires" field of MAX_UINT, #define TVN_BITS 6
* and the sorting routine counts on this.. #define TVR_BITS 8
*/ #define TVN_SIZE (1 << TVN_BITS)
static struct timer_list timer_head = { &timer_head, &timer_head, ~0, 0, NULL }; #define TVR_SIZE (1 << TVR_BITS)
#define TVN_MASK (TVN_SIZE - 1)
#define TVR_MASK (TVR_SIZE - 1)
#define SLOW_BUT_DEBUGGING_TIMERS 0 #define SLOW_BUT_DEBUGGING_TIMERS 0
void add_timer(struct timer_list * timer) struct timer_vec {
int index;
struct timer_list *vec[TVN_SIZE];
};
struct timer_vec_root {
int index;
struct timer_list *vec[TVR_SIZE];
};
static struct timer_vec tv5 = { 0 };
static struct timer_vec tv4 = { 0 };
static struct timer_vec tv3 = { 0 };
static struct timer_vec tv2 = { 0 };
static struct timer_vec_root tv1 = { 0 };
static struct timer_vec * const tvecs[] = {
(struct timer_vec *)&tv1, &tv2, &tv3, &tv4, &tv5
};
#define NOOF_TVECS (sizeof(tvecs) / sizeof(tvecs[0]))
static unsigned long timer_jiffies = 0;
static inline void insert_timer(struct timer_list *timer,
struct timer_list **vec, int idx)
{ {
unsigned long flags; if ((timer->next = vec[idx]))
struct timer_list *p; vec[idx]->prev = timer;
vec[idx] = timer;
timer->prev = (struct timer_list *)&vec[idx];
}
#if SLOW_BUT_DEBUGGING_TIMERS static inline void internal_add_timer(struct timer_list *timer)
if (timer->next || timer->prev) { {
printk("add_timer() called with non-zero list from %p\n", /*
__builtin_return_address(0)); * must be cli-ed when calling this
return; */
unsigned long expires = timer->expires;
unsigned long idx = expires - timer_jiffies;
if (idx < TVR_SIZE) {
int i = expires & TVR_MASK;
insert_timer(timer, tv1.vec, i);
} else if (idx < 1 << (TVR_BITS + TVN_BITS)) {
int i = (expires >> TVR_BITS) & TVN_MASK;
insert_timer(timer, tv2.vec, i);
} else if (idx < 1 << (TVR_BITS + 2 * TVN_BITS)) {
int i = (expires >> (TVR_BITS + TVN_BITS)) & TVN_MASK;
insert_timer(timer, tv3.vec, i);
} else if (idx < 1 << (TVR_BITS + 3 * TVN_BITS)) {
int i = (expires >> (TVR_BITS + 2 * TVN_BITS)) & TVN_MASK;
insert_timer(timer, tv4.vec, i);
} else if ((idx + 1UL) == 0UL) {
/* can happen if you add a timer with expires == jiffies */
insert_timer(timer, tv1.vec, tv1.index);
} else if (idx < 0xffffffffUL) {
int i = (expires >> (TVR_BITS + 3 * TVN_BITS)) & TVN_MASK;
insert_timer(timer, tv5.vec, i);
} else {
/* Can only get here on architectures with 64-bit jiffies */
timer->next = timer->prev = timer;
} }
#endif }
p = &timer_head;
void add_timer(struct timer_list *timer)
{
unsigned long flags;
save_flags(flags); save_flags(flags);
cli(); cli();
do { #if SLOW_BUT_DEBUGGING_TIMERS
p = p->next; if (timer->next || timer->prev) {
} while (timer->expires > p->expires); printk("add_timer() called with non-zero list from %p\n",
timer->next = p; __builtin_return_address(0));
timer->prev = p->prev; goto out;
p->prev = timer; }
timer->prev->next = timer; #endif
internal_add_timer(timer);
#if SLOW_BUT_DEBUGGING_TIMERS
out:
#endif
restore_flags(flags); restore_flags(flags);
} }
int del_timer(struct timer_list * timer) static inline int detach_timer(struct timer_list *timer)
{ {
int ret = 0; int ret = 0;
if (timer->next) { struct timer_list *next, *prev;
unsigned long flags; next = timer->next;
struct timer_list * next; prev = timer->prev;
save_flags(flags); if (next) {
cli(); next->prev = prev;
if ((next = timer->next) != NULL) { }
(next->prev = timer->prev)->next = next; if (prev) {
timer->next = timer->prev = NULL; ret = 1;
ret = 1; prev->next = next;
}
restore_flags(flags);
} }
return ret; return ret;
} }
static inline void run_timer_list(void)
int del_timer(struct timer_list * timer)
{
int ret;
unsigned long flags;
save_flags(flags);
cli();
ret = detach_timer(timer);
timer->next = timer->prev = 0;
restore_flags(flags);
return ret;
}
static inline void cascade_timers(struct timer_vec *tv)
{ {
struct timer_list * timer; /* cascade all the timers from tv up one level */
struct timer_list *timer;
timer = tv->vec[tv->index];
/*
* We are removing _all_ timers from the list, so we don't have to
* detach them individually, just clear the list afterwards.
*/
while (timer) {
struct timer_list *tmp = timer;
timer = timer->next;
internal_add_timer(tmp);
}
tv->vec[tv->index] = NULL;
tv->index = (tv->index + 1) & TVN_MASK;
}
static inline void run_timer_list(void)
{
cli(); cli();
while ((timer = timer_head.next) != &timer_head && timer->expires <= jiffies) { while ((long)(jiffies - timer_jiffies) >= 0) {
void (*fn)(unsigned long) = timer->function; struct timer_list *timer;
unsigned long data = timer->data; if (!tv1.index) {
timer->next->prev = timer->prev; int n = 1;
timer->prev->next = timer->next; do {
timer->next = timer->prev = NULL; cascade_timers(tvecs[n]);
sti(); } while (tvecs[n]->index == 1 && ++n < NOOF_TVECS);
fn(data); }
cli(); while ((timer = tv1.vec[tv1.index])) {
void (*fn)(unsigned long) = timer->function;
unsigned long data = timer->data;
detach_timer(timer);
timer->next = timer->prev = NULL;
sti();
fn(data);
cli();
}
++timer_jiffies;
tv1.index = (tv1.index + 1) & TVR_MASK;
} }
sti(); sti();
} }
static inline void run_old_timers(void) static inline void run_old_timers(void)
{ {
struct timer_struct *tp; struct timer_struct *tp;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/swap.h> #include <linux/swap.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/swapctl.h> #include <linux/swapctl.h>
#include <linux/malloc.h>
#include <linux/blkdev.h> /* for blk_size */ #include <linux/blkdev.h> /* for blk_size */
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
...@@ -393,6 +394,8 @@ asmlinkage int sys_swapoff(const char * specialfile) ...@@ -393,6 +394,8 @@ asmlinkage int sys_swapoff(const char * specialfile)
nr_swap_pages -= p->pages; nr_swap_pages -= p->pages;
iput(p->swap_file); iput(p->swap_file);
if (p->swap_filename)
kfree(p->swap_filename);
p->swap_file = NULL; p->swap_file = NULL;
p->swap_device = 0; p->swap_device = 0;
vfree(p->swap_map); vfree(p->swap_map);
...@@ -406,6 +409,37 @@ asmlinkage int sys_swapoff(const char * specialfile) ...@@ -406,6 +409,37 @@ asmlinkage int sys_swapoff(const char * specialfile)
return err; return err;
} }
int get_swaparea_info(char *buf)
{
struct swap_info_struct *ptr = swap_info;
int i, j, len = 0, usedswap;
len += sprintf(buf, "Filename\t\t\tType\t\tSize\tUsed\tPriority\n");
for (i = 0 ; i < nr_swapfiles ; i++, ptr++)
if (ptr->flags & SWP_USED) {
if (ptr->swap_filename)
len += sprintf(buf + len, "%-31s ", ptr->swap_filename);
else
len += sprintf(buf + len, "(null)\t\t\t");
if (ptr->swap_file)
len += sprintf(buf + len, "file\t\t");
else
len += sprintf(buf + len, "partition\t");
usedswap = 0;
for (j = 0; j < ptr->max; ++j)
switch (ptr->swap_map[j]) {
case 128:
case 0:
continue;
default:
usedswap++;
}
len += sprintf(buf + len, "%d\t%d\t%d\n", ptr->pages << (PAGE_SHIFT - 10),
usedswap << (PAGE_SHIFT - 10), ptr->prio);
}
return len;
}
/* /*
* Written 01/25/92 by Simmule Turner, heavily changed by Linus. * Written 01/25/92 by Simmule Turner, heavily changed by Linus.
* *
...@@ -418,6 +452,7 @@ asmlinkage int sys_swapon(const char * specialfile, int swap_flags) ...@@ -418,6 +452,7 @@ asmlinkage int sys_swapon(const char * specialfile, int swap_flags)
unsigned int type; unsigned int type;
int i, j, prev; int i, j, prev;
int error = -EPERM; int error = -EPERM;
char *tmp;
struct file filp; struct file filp;
static int least_priority = 0; static int least_priority = 0;
...@@ -434,6 +469,7 @@ asmlinkage int sys_swapon(const char * specialfile, int swap_flags) ...@@ -434,6 +469,7 @@ asmlinkage int sys_swapon(const char * specialfile, int swap_flags)
if (type >= nr_swapfiles) if (type >= nr_swapfiles)
nr_swapfiles = type+1; nr_swapfiles = type+1;
p->flags = SWP_USED; p->flags = SWP_USED;
p->swap_filename = NULL;
p->swap_file = NULL; p->swap_file = NULL;
p->swap_device = 0; p->swap_device = 0;
p->swap_map = NULL; p->swap_map = NULL;
...@@ -541,6 +577,12 @@ asmlinkage int sys_swapon(const char * specialfile, int swap_flags) ...@@ -541,6 +577,12 @@ asmlinkage int sys_swapon(const char * specialfile, int swap_flags)
prev = i; prev = i;
} }
p->next = i; p->next = i;
if (!getname(specialfile, &tmp)) {
if ((p->swap_filename =
(char *) kmalloc(strlen(tmp)+1, GFP_KERNEL)) != (char *)NULL)
strcpy(p->swap_filename, tmp);
putname(tmp);
}
if (prev < 0) { if (prev < 0) {
swap_list.head = swap_list.next = p - swap_info; swap_list.head = swap_list.next = p - swap_info;
} else { } else {
......
...@@ -1484,8 +1484,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len, ...@@ -1484,8 +1484,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len,
/* Build a packet */ /* Build a packet */
if(sk->debug) SOCK_DEBUG(sk, "SK %p: Got address.\n",sk);
printk("SK %p: Got address.\n",sk);
size=sizeof(struct ddpehdr)+len+ddp_dl->header_length; /* For headers */ size=sizeof(struct ddpehdr)+len+ddp_dl->header_length; /* For headers */
...@@ -1507,8 +1506,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len, ...@@ -1507,8 +1506,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len,
dev=rt->dev; dev=rt->dev;
} }
if(sk->debug) SOCK_DEBUG(sk, "SK %p: Size needed %d, device %s\n", sk, size, dev->name);
printk("SK %p: Size needed %d, device %s\n", sk, size, dev->name);
size += dev->hard_header_len; size += dev->hard_header_len;
...@@ -1523,8 +1521,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len, ...@@ -1523,8 +1521,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len,
skb->dev=dev; skb->dev=dev;
if(sk->debug) SOCK_DEBUG(sk, "SK %p: Begin build.\n", sk);
printk("SK %p: Begin build.\n", sk);
ddp=(struct ddpehdr *)skb_put(skb,sizeof(struct ddpehdr)); ddp=(struct ddpehdr *)skb_put(skb,sizeof(struct ddpehdr));
ddp->deh_pad=0; ddp->deh_pad=0;
...@@ -1544,8 +1541,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len, ...@@ -1544,8 +1541,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len,
ddp->deh_dport=usat->sat_port; ddp->deh_dport=usat->sat_port;
ddp->deh_sport=sk->protinfo.af_at.src_port; ddp->deh_sport=sk->protinfo.af_at.src_port;
if(sk->debug) SOCK_DEBUG(sk, "SK %p: Copy user data (%d bytes).\n", sk, len);
printk("SK %p: Copy user data (%d bytes).\n", sk, len);
err = memcpy_fromiovec(skb_put(skb,len),msg->msg_iov,len); err = memcpy_fromiovec(skb_put(skb,len),msg->msg_iov,len);
if (err) if (err)
...@@ -1582,8 +1578,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len, ...@@ -1582,8 +1578,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len,
if(skb2) if(skb2)
{ {
loopback=1; loopback=1;
if(sk->debug) SOCK_DEBUG(sk, "SK %p: send out(copy).\n", sk);
printk("SK %p: send out(copy).\n", sk);
if(aarp_send_ddp(dev,skb2,&usat->sat_addr, NULL)==-1) if(aarp_send_ddp(dev,skb2,&usat->sat_addr, NULL)==-1)
kfree_skb(skb2, FREE_WRITE); kfree_skb(skb2, FREE_WRITE);
/* else queued/sent above in the aarp queue */ /* else queued/sent above in the aarp queue */
...@@ -1593,8 +1588,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len, ...@@ -1593,8 +1588,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len,
if((dev->flags&IFF_LOOPBACK) || loopback) if((dev->flags&IFF_LOOPBACK) || loopback)
{ {
if(sk->debug) SOCK_DEBUG(sk, "SK %p: Loop back.\n", sk);
printk("SK %p: Loop back.\n", sk);
/* loop back */ /* loop back */
skb_orphan(skb); skb_orphan(skb);
ddp_dl->datalink_header(ddp_dl, skb, dev->dev_addr); ddp_dl->datalink_header(ddp_dl, skb, dev->dev_addr);
...@@ -1606,9 +1600,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len, ...@@ -1606,9 +1600,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len,
} }
else else
{ {
if(sk->debug) SOCK_DEBUG(sk, "SK %p: send out.\n", sk);
printk("SK %p: send out.\n", sk);
if ( rt->flags & RTF_GATEWAY ) { if ( rt->flags & RTF_GATEWAY ) {
gsat.sat_addr = rt->gateway; gsat.sat_addr = rt->gateway;
usat = &gsat; usat = &gsat;
...@@ -1618,8 +1610,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len, ...@@ -1618,8 +1610,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len,
kfree_skb(skb, FREE_WRITE); kfree_skb(skb, FREE_WRITE);
/* else queued/sent above in the aarp queue */ /* else queued/sent above in the aarp queue */
} }
if(sk->debug) SOCK_DEBUG(sk, "SK %p: Done write (%d).\n", sk, len);
printk("SK %p: Done write (%d).\n", sk, len);
return len; return len;
} }
......
...@@ -1374,41 +1374,32 @@ static int ax25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -1374,41 +1374,32 @@ static int ax25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
else else
sk->protinfo.ax25->source_addr = *call; sk->protinfo.ax25->source_addr = *call;
if (sk->debug) SOCK_DEBUG(sk, "AX25: source address set to %s\n", ax2asc(&sk->protinfo.ax25->source_addr));
printk("AX25: source address set to %s\n", ax2asc(&sk->protinfo.ax25->source_addr));
if (addr_len == sizeof(struct full_sockaddr_ax25) && addr->fsa_ax25.sax25_ndigis == 1) { if (addr_len == sizeof(struct full_sockaddr_ax25) && addr->fsa_ax25.sax25_ndigis == 1) {
if (ax25cmp(&addr->fsa_digipeater[0], &null_ax25_address) == 0) { if (ax25cmp(&addr->fsa_digipeater[0], &null_ax25_address) == 0) {
dev = NULL; dev = NULL;
if (sk->debug) SOCK_DEBUG(sk, "AX25: bound to any device\n");
printk("AX25: bound to any device\n");
} else { } else {
if ((dev = ax25rtr_get_dev(&addr->fsa_digipeater[0])) == NULL) { if ((dev = ax25rtr_get_dev(&addr->fsa_digipeater[0])) == NULL) {
if (sk->debug) SOCK_DEBUG(sk, "AX25: bind failed - no device\n");
printk("AX25: bind failed - no device\n");
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
} }
if (sk->debug) SOCK_DEBUG(sk, "AX25: bound to device %s\n", dev->name);
printk("AX25: bound to device %s\n", dev->name);
} }
} else { } else {
if ((dev = ax25rtr_get_dev(&addr->fsa_ax25.sax25_call)) == NULL) { if ((dev = ax25rtr_get_dev(&addr->fsa_ax25.sax25_call)) == NULL) {
if (sk->debug) SOCK_DEBUG(sk, "AX25: bind failed - no device\n");
printk("AX25: bind failed - no device\n");
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
} }
if (sk->debug) SOCK_DEBUG(sk, "AX25: bound to device %s\n", dev->name);
printk("AX25: bound to device %s\n", dev->name);
} }
ax25_fillin_cb(sk->protinfo.ax25, dev); ax25_fillin_cb(sk->protinfo.ax25, dev);
ax25_insert_socket(sk->protinfo.ax25); ax25_insert_socket(sk->protinfo.ax25);
sk->zapped = 0; sk->zapped = 0;
SOCK_DEBUG(sk, "AX25: socket is bound\n");
if (sk->debug)
printk("AX25: socket is bound\n");
return 0; return 0;
} }
...@@ -2028,12 +2019,10 @@ static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, int len, ...@@ -2028,12 +2019,10 @@ static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, int len,
dp = sk->protinfo.ax25->digipeat; dp = sk->protinfo.ax25->digipeat;
} }
if (sk->debug) SOCK_DEBUG(sk, "AX.25: sendto: Addresses built.\n");
printk("AX.25: sendto: Addresses built.\n");
/* Build a packet */ /* Build a packet */
if (sk->debug) SOCK_DEBUG(sk, "AX.25: sendto: building packet.\n");
printk("AX.25: sendto: building packet.\n");
/* Assume the worst case */ /* Assume the worst case */
size = len + 3 + size_ax25_addr(dp) + AX25_BPQ_HEADER_LEN; size = len + 3 + size_ax25_addr(dp) + AX25_BPQ_HEADER_LEN;
...@@ -2045,8 +2034,7 @@ static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, int len, ...@@ -2045,8 +2034,7 @@ static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, int len,
skb_reserve(skb, size - len); skb_reserve(skb, size - len);
if (sk->debug) SOCK_DEBUG(sk, "AX.25: Appending user data\n");
printk("AX.25: Appending user data\n");
/* User data follows immediately after the AX.25 data */ /* User data follows immediately after the AX.25 data */
memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len); memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len);
...@@ -2055,8 +2043,7 @@ static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, int len, ...@@ -2055,8 +2043,7 @@ static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, int len,
asmptr = skb_push(skb, 1); asmptr = skb_push(skb, 1);
*asmptr = sk->protocol; *asmptr = sk->protocol;
if (sk->debug) SOCK_DEBUG(sk, "AX.25: Transmitting buffer\n");
printk("AX.25: Transmitting buffer\n");
if (sk->type == SOCK_SEQPACKET) { if (sk->type == SOCK_SEQPACKET) {
/* Connected mode sockets go via the LAPB machine */ /* Connected mode sockets go via the LAPB machine */
...@@ -2071,22 +2058,18 @@ static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, int len, ...@@ -2071,22 +2058,18 @@ static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, int len,
} else { } else {
asmptr = skb_push(skb, 1 + size_ax25_addr(dp)); asmptr = skb_push(skb, 1 + size_ax25_addr(dp));
if (sk->debug) { SOCK_DEBUG(sk, "Building AX.25 Header (dp=%p).\n", dp);
printk("Building AX.25 Header (dp=%p).\n", dp); if(dp != 0)
if (dp != 0) SOCK_DEBUG(sk, "Num digipeaters=%d\n", dp->ndigi);
printk("Num digipeaters=%d\n", dp->ndigi);
}
/* Build an AX.25 header */ /* Build an AX.25 header */
asmptr += (lv = build_ax25_addr(asmptr, &sk->protinfo.ax25->source_addr, &sax.sax25_call, dp, AX25_COMMAND, AX25_MODULUS)); asmptr += (lv = build_ax25_addr(asmptr, &sk->protinfo.ax25->source_addr, &sax.sax25_call, dp, AX25_COMMAND, AX25_MODULUS));
if (sk->debug) SOCK_DEBUG(sk, "Built header (%d bytes)\n",lv);
printk("Built header (%d bytes)\n",lv);
skb->h.raw = asmptr; skb->h.raw = asmptr;
if (sk->debug) SOCK_DEBUG(sk, "base=%p pos=%p\n", skb->data, asmptr);
printk("base=%p pos=%p\n", skb->data, asmptr);
*asmptr = AX25_UI; *asmptr = AX25_UI;
......
...@@ -528,8 +528,7 @@ void ax25_kiss_cmd(ax25_cb *ax25, unsigned char cmd, unsigned char param) ...@@ -528,8 +528,7 @@ void ax25_kiss_cmd(ax25_cb *ax25, unsigned char cmd, unsigned char param)
void ax25_dama_on(ax25_cb *ax25) void ax25_dama_on(ax25_cb *ax25)
{ {
if (ax25_dev_is_dama_slave(ax25->device) == 0) { if (ax25_dev_is_dama_slave(ax25->device) == 0) {
if (ax25->sk != NULL && ax25->sk->debug) SOCK_DEBUG(ax25->sk, "ax25_dama_on: DAMA on\n");
printk("ax25_dama_on: DAMA on\n");
ax25_kiss_cmd(ax25, 5, 1); ax25_kiss_cmd(ax25, 5, 1);
} }
} }
...@@ -541,8 +540,7 @@ void ax25_dama_off(ax25_cb *ax25) ...@@ -541,8 +540,7 @@ void ax25_dama_off(ax25_cb *ax25)
ax25->dama_slave = 0; ax25->dama_slave = 0;
if (ax25_dev_is_dama_slave(ax25->device) == 0) { if (ax25_dev_is_dama_slave(ax25->device) == 0) {
if (ax25->sk != NULL && ax25->sk->debug) SOCK_DEBUG(ax25->sk, "ax25_dama_off: DAMA off\n");
printk("ax25_dama_off: DAMA off\n");
ax25_kiss_cmd(ax25, 5, 0); ax25_kiss_cmd(ax25, 5, 0);
} }
} }
......
...@@ -149,8 +149,7 @@ static void ax25_timer(unsigned long param) ...@@ -149,8 +149,7 @@ static void ax25_timer(unsigned long param)
ax25->state = AX25_STATE_0; ax25->state = AX25_STATE_0;
if (ax25->sk != NULL) { if (ax25->sk != NULL) {
if (ax25->sk->debug) SOCK_DEBUG(ax25->sk, "AX.25 T3 Timeout\n");
printk(KERN_DEBUG "AX.25 T3 Timeout\n");
ax25->sk->state = TCP_CLOSE; ax25->sk->state = TCP_CLOSE;
ax25->sk->err = ETIMEDOUT; ax25->sk->err = ETIMEDOUT;
ax25->sk->shutdown |= SEND_SHUTDOWN; ax25->sk->shutdown |= SEND_SHUTDOWN;
...@@ -298,8 +297,7 @@ void ax25_t1_timeout(ax25_cb * ax25) ...@@ -298,8 +297,7 @@ void ax25_t1_timeout(ax25_cb * ax25)
ax25_send_control(ax25, AX25_DM, AX25_POLLON, AX25_RESPONSE); ax25_send_control(ax25, AX25_DM, AX25_POLLON, AX25_RESPONSE);
ax25->state = AX25_STATE_0; ax25->state = AX25_STATE_0;
if (ax25->sk != NULL) { if (ax25->sk != NULL) {
if (ax25->sk->debug) SOCK_DEBUG(ax25->sk, "AX.25 link Failure\n");
printk(KERN_DEBUG "AX.25 link Failure\n");
ax25->sk->state = TCP_CLOSE; ax25->sk->state = TCP_CLOSE;
ax25->sk->err = ETIMEDOUT; ax25->sk->err = ETIMEDOUT;
ax25->sk->shutdown |= SEND_SHUTDOWN; ax25->sk->shutdown |= SEND_SHUTDOWN;
......
...@@ -524,16 +524,13 @@ static int tcp_readable(struct sock *sk) ...@@ -524,16 +524,13 @@ static int tcp_readable(struct sock *sk)
int sum; int sum;
unsigned long flags; unsigned long flags;
if(sk && sk->debug) SOCK_DEBUG(sk, "tcp_readable: %p - ",sk);
printk("tcp_readable: %p - ",sk);
save_flags(flags); save_flags(flags);
cli(); cli();
if (sk == NULL || (skb = skb_peek(&sk->receive_queue)) == NULL) if (sk == NULL || (skb = skb_peek(&sk->receive_queue)) == NULL)
{ {
restore_flags(flags); restore_flags(flags);
if(sk && sk->debug) SOCK_DEBUG(sk, "empty\n");
printk("empty\n");
return(0); return(0);
} }
...@@ -592,8 +589,7 @@ static int tcp_readable(struct sock *sk) ...@@ -592,8 +589,7 @@ static int tcp_readable(struct sock *sk)
while(skb != (struct sk_buff *)&sk->receive_queue); while(skb != (struct sk_buff *)&sk->receive_queue);
restore_flags(flags); restore_flags(flags);
if(sk->debug) SOCK_DEBUG(sk, "got %lu bytes.\n",amount);
printk("got %lu bytes.\n",amount);
return(amount); return(amount);
} }
...@@ -1043,9 +1039,6 @@ int tcp_do_sendmsg(struct sock *sk, int iovlen, struct iovec *iov, ...@@ -1043,9 +1039,6 @@ int tcp_do_sendmsg(struct sock *sk, int iovlen, struct iovec *iov,
sk->write_seq += copy; sk->write_seq += copy;
tcp_send_skb(sk, skb); tcp_send_skb(sk, skb);
release_sock(sk);
lock_sock(sk);
} }
} }
...@@ -1159,7 +1152,7 @@ static int tcp_recv_urg(struct sock * sk, int nonblock, ...@@ -1159,7 +1152,7 @@ static int tcp_recv_urg(struct sock * sk, int nonblock,
static inline void tcp_eat_skb(struct sock *sk, struct sk_buff * skb) static inline void tcp_eat_skb(struct sock *sk, struct sk_buff * skb)
{ {
sk->ack_backlog++; sk->delayed_acks++;
__skb_unlink(skb, &sk->receive_queue); __skb_unlink(skb, &sk->receive_queue);
kfree_skb(skb, FREE_READ); kfree_skb(skb, FREE_READ);
...@@ -1169,41 +1162,36 @@ static inline void tcp_eat_skb(struct sock *sk, struct sk_buff * skb) ...@@ -1169,41 +1162,36 @@ static inline void tcp_eat_skb(struct sock *sk, struct sk_buff * skb)
static void cleanup_rbuf(struct sock *sk) static void cleanup_rbuf(struct sock *sk)
{ {
struct sk_buff *skb; struct sk_buff *skb;
struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
unsigned long pspace, rspace;
/* /*
* NOTE! The socket must be locked, so that we don't get * NOTE! The socket must be locked, so that we don't get
* a messed-up receive queue. * a messed-up receive queue.
*/ */
pspace = sock_rspace(sk);
while ((skb=skb_peek(&sk->receive_queue)) != NULL) { while ((skb=skb_peek(&sk->receive_queue)) != NULL) {
if (!skb->used || skb->users>1) if (!skb->used || skb->users>1)
break; break;
tcp_eat_skb(sk, skb); tcp_eat_skb(sk, skb);
} }
if(sk->debug) SOCK_DEBUG(sk, "sk->rspace = %lu\n", sock_rspace(sk));
printk("sk->rspace = %lu\n", sock_rspace(sk));
/* /*
* We send a ACK if the sender is blocked * We send a ACK if the sender is blocked
* else let tcp_data deal with the acking policy. * else let tcp_data deal with the acking policy.
*/ */
rspace = sock_rspace(sk); if (sk->delayed_acks)
if ((rspace > pspace) &&
(rspace > tp->rcv_wnd - (tp->rcv_nxt - tp->rcv_wup)) &&
(tp->rcv_wnd - (tp->rcv_nxt - tp->rcv_wup) < sk->mss))
{ {
/* Send an ack right now. */ struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
sk->delayed_acks++; __u32 rcv_wnd;
tcp_read_wakeup(sk);
} rcv_wnd = tp->rcv_wnd - (tp->rcv_nxt - tp->rcv_wup);
}
if ((rcv_wnd < sk->mss) && (sock_rspace(sk) > rcv_wnd))
tcp_read_wakeup(sk);
}
}
/* /*
...@@ -1413,7 +1401,8 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, ...@@ -1413,7 +1401,8 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg,
*/ */
*seq -= err; *seq -= err;
atomic_dec(&skb->users); atomic_dec(&skb->users);
return -EFAULT; copied = -EFAULT;
break;
} }
copied += used; copied += used;
...@@ -1467,7 +1456,7 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, ...@@ -1467,7 +1456,7 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg,
msg->msg_name); msg->msg_name);
} }
if(addr_len) if(addr_len)
*addr_len= tp->af_specific->sockaddr_len; *addr_len = tp->af_specific->sockaddr_len;
remove_wait_queue(sk->sleep, &wait); remove_wait_queue(sk->sleep, &wait);
current->state = TASK_RUNNING; current->state = TASK_RUNNING;
...@@ -1583,10 +1572,10 @@ void tcp_shutdown(struct sock *sk, int how) ...@@ -1583,10 +1572,10 @@ void tcp_shutdown(struct sock *sk, int how)
/* /*
* FIN if needed * FIN if needed
*/ */
if (tcp_close_state(sk,0)) if (tcp_close_state(sk,0))
tcp_send_fin(sk); tcp_send_fin(sk);
release_sock(sk); release_sock(sk);
} }
......
This diff is collapsed.
...@@ -346,7 +346,6 @@ void tcp_v4_err(struct sk_buff *skb, unsigned char *dp) ...@@ -346,7 +346,6 @@ void tcp_v4_err(struct sk_buff *skb, unsigned char *dp)
struct tcphdr *th = (struct tcphdr*)(dp+(iph->ihl<<2)); struct tcphdr *th = (struct tcphdr*)(dp+(iph->ihl<<2));
int type = skb->h.icmph->type; int type = skb->h.icmph->type;
int code = skb->h.icmph->code; int code = skb->h.icmph->code;
struct tcp_opt *tp;
struct sock *sk; struct sock *sk;
sk = get_sock(&tcp_prot, th->source, iph->daddr, th->dest, iph->saddr); sk = get_sock(&tcp_prot, th->source, iph->daddr, th->dest, iph->saddr);
...@@ -356,19 +355,12 @@ void tcp_v4_err(struct sk_buff *skb, unsigned char *dp) ...@@ -356,19 +355,12 @@ void tcp_v4_err(struct sk_buff *skb, unsigned char *dp)
if (type == ICMP_SOURCE_QUENCH) if (type == ICMP_SOURCE_QUENCH)
{ {
/* struct tcp_opt *tp = &sk->tp_pinfo.af_tcp;
* FIXME:
* Follow BSD for now and just reduce cong_window to 1 again.
* It is possible that we just want to reduce the
* window by 1/2, or that we want to reduce ssthresh by 1/2
* here as well.
*/
tp = &sk->tp_pinfo.af_tcp;
sk->cong_window = 1; sk->ssthresh = max(sk->cong_window >> 1, 2);
sk->cong_window = sk->ssthresh + 3;
tp->high_seq = tp->snd_nxt; tp->high_seq = tp->snd_nxt;
return; return;
} }
...@@ -629,10 +621,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb, void *ptr, __u32 i ...@@ -629,10 +621,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb, void *ptr, __u32 i
/* If the socket is dead, don't accept the connection. */ /* If the socket is dead, don't accept the connection. */
if (sk->dead) if (sk->dead)
{ {
if(sk->debug) SOCK_DEBUG(sk, "Reset on %p: Connect on dead socket.\n",sk);
{
printk("Reset on %p: Connect on dead socket.\n",sk);
}
tcp_statistics.TcpAttemptFails++; tcp_statistics.TcpAttemptFails++;
return -ENOTCONN; return -ENOTCONN;
} }
...@@ -1229,10 +1218,3 @@ struct proto tcp_prot = { ...@@ -1229,10 +1218,3 @@ struct proto tcp_prot = {
0, 0, 0, 0,
NULL NULL
}; };
/*
* Local variables:
* compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strength-reduce -pipe -m486 -DCPU=486 -c -o tcp_ipv4.o tcp_ipv4.c"
* c-file-style: "Linux"
* End:
*/
...@@ -377,7 +377,7 @@ void tcp_write_xmit(struct sock *sk) ...@@ -377,7 +377,7 @@ void tcp_write_xmit(struct sock *sk)
* c) not retransmiting [Nagle] * c) not retransmiting [Nagle]
*/ */
start_bh_atomic(); lock_sock(sk);
rcv_wnd = htons(tcp_select_window(sk)); rcv_wnd = htons(tcp_select_window(sk));
...@@ -456,7 +456,7 @@ void tcp_write_xmit(struct sock *sk) ...@@ -456,7 +456,7 @@ void tcp_write_xmit(struct sock *sk)
tcp_reset_xmit_timer(sk, TIME_RETRANS, tp->rto); tcp_reset_xmit_timer(sk, TIME_RETRANS, tp->rto);
} }
end_bh_atomic(); release_sock(sk);
} }
...@@ -637,7 +637,7 @@ void tcp_do_retransmit(struct sock *sk, int all) ...@@ -637,7 +637,7 @@ void tcp_do_retransmit(struct sock *sk, int all)
int ct=0; int ct=0;
struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp); struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
start_bh_atomic(); lock_sock(sk);
if (tp->retrans_head == NULL) if (tp->retrans_head == NULL)
tp->retrans_head = skb_peek(&sk->write_queue); tp->retrans_head = skb_peek(&sk->write_queue);
...@@ -693,9 +693,7 @@ void tcp_do_retransmit(struct sock *sk, int all) ...@@ -693,9 +693,7 @@ void tcp_do_retransmit(struct sock *sk, int all)
break; break;
} }
if (sk->debug) SOCK_DEBUG(sk, "retransmit sending\n");
printk("retransmit sending\n");
/* /*
* update ack and window * update ack and window
*/ */
...@@ -705,13 +703,13 @@ void tcp_do_retransmit(struct sock *sk, int all) ...@@ -705,13 +703,13 @@ void tcp_do_retransmit(struct sock *sk, int all)
size = skb->tail - (unsigned char *) th; size = skb->tail - (unsigned char *) th;
tp->af_specific->send_check(sk, th, size, skb); tp->af_specific->send_check(sk, th, size, skb);
skb->when = jiffies; skb->when = jiffies;
buff = skb_clone(skb, GFP_ATOMIC); buff = skb_clone(skb, GFP_ATOMIC);
skb_set_owner_w(buff, sk); skb_set_owner_w(buff, sk);
clear_delayed_acks(sk); clear_delayed_acks(sk);
tp->af_specific->queue_xmit(buff); tp->af_specific->queue_xmit(buff);
/* /*
...@@ -722,14 +720,8 @@ void tcp_do_retransmit(struct sock *sk, int all) ...@@ -722,14 +720,8 @@ void tcp_do_retransmit(struct sock *sk, int all)
sk->prot->retransmits ++; sk->prot->retransmits ++;
tcp_statistics.TcpRetransSegs++; tcp_statistics.TcpRetransSegs++;
/* tp->high_seq = tp->snd_nxt;
* Record the high sequence number to help avoid doing
* to much fast retransmission.
*/
if (sk->retransmits)
tp->high_seq = tp->snd_nxt;
/* /*
* Only one retransmit requested. * Only one retransmit requested.
*/ */
...@@ -756,7 +748,7 @@ void tcp_do_retransmit(struct sock *sk, int all) ...@@ -756,7 +748,7 @@ void tcp_do_retransmit(struct sock *sk, int all)
} }
} }
end_bh_atomic(); release_sock(sk);
} }
/* /*
...@@ -1035,12 +1027,8 @@ void tcp_send_ack(struct sock *sk) ...@@ -1035,12 +1027,8 @@ void tcp_send_ack(struct sock *sk)
tp->af_specific->send_check(sk, th, sizeof(struct tcphdr), buff); tp->af_specific->send_check(sk, th, sizeof(struct tcphdr), buff);
if (sk->debug) SOCK_DEBUG(sk, "\rtcp_send_ack: seq %x ack %x\n", tp->snd_nxt, tp->rcv_nxt);
printk("\rtcp_send_ack: seq %x ack %x\n",
tp->snd_nxt, tp->rcv_nxt);
tp->af_specific->queue_xmit(buff); tp->af_specific->queue_xmit(buff);
tcp_statistics.TcpOutSegs++; tcp_statistics.TcpOutSegs++;
} }
......
...@@ -477,10 +477,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb, void *ptr, ...@@ -477,10 +477,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb, void *ptr,
/* If the socket is dead, don't accept the connection. */ /* If the socket is dead, don't accept the connection. */
if (sk->dead) if (sk->dead)
{ {
if(sk->debug) SOCK_DEBUG(sk, "Reset on %p: Connect on dead socket.\n",sk);
{
printk("Reset on %p: Connect on dead socket.\n",sk);
}
tcp_statistics.TcpAttemptFails++; tcp_statistics.TcpAttemptFails++;
return -ENOTCONN; return -ENOTCONN;
} }
......
...@@ -1895,9 +1895,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -1895,9 +1895,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
sk->protinfo.af_ipx.node, sk->protinfo.af_ipx.node,
sk->protinfo.af_ipx.port) != NULL) sk->protinfo.af_ipx.port) != NULL)
{ {
if(sk->debug) SOCK_DEBUG(sk, "IPX: bind failed because port %X in use.\n", (int)addr->sipx_port);
printk("IPX: bind failed because port %X in"
" use.\n", (int)addr->sipx_port);
return -EADDRINUSE; return -EADDRINUSE;
} }
} }
...@@ -1912,9 +1910,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -1912,9 +1910,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
IPX_NODE_LEN); IPX_NODE_LEN);
if(ipxitf_find_socket(intrfc, addr->sipx_port)!=NULL) { if(ipxitf_find_socket(intrfc, addr->sipx_port)!=NULL) {
if(sk->debug) SOCK_DEBUG(sk, "IPX: bind failed because port %X in use.\n", (int)addr->sipx_port);
printk("IPX: bind failed because port %X in"
" use.\n", (int)addr->sipx_port);
return -EADDRINUSE; return -EADDRINUSE;
} }
} }
...@@ -1925,9 +1921,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -1925,9 +1921,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
an interface routed to IPX with the ipx routing ioctl() */ an interface routed to IPX with the ipx routing ioctl() */
if(ipxitf_find_socket(intrfc, addr->sipx_port)!=NULL) { if(ipxitf_find_socket(intrfc, addr->sipx_port)!=NULL) {
if(sk->debug) SOCK_DEBUG(sk, "IPX: bind failed because port %X in use.\n", (int)addr->sipx_port);
printk("IPX: bind failed because port %X in use.\n",
(int)addr->sipx_port);
return -EADDRINUSE; return -EADDRINUSE;
} }
...@@ -1935,8 +1929,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -1935,8 +1929,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
ipxitf_insert_socket(intrfc, sk); ipxitf_insert_socket(intrfc, sk);
sk->zapped=0; sk->zapped=0;
if(sk->debug) SOCK_DEBUG(sk, "IPX: socket is bound.\n");
printk("IPX: socket is bound.\n");
return 0; return 0;
} }
......
...@@ -510,10 +510,7 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int ...@@ -510,10 +510,7 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int
} }
/* Build a packet */ /* Build a packet */
SOCK_DEBUG(sk, "SK %p: Got address.\n",sk);
if(sk->debug)
printk("SK %p: Got address.\n",sk);
size=sizeof(struct ddpehdr)+len+nb_dl->header_length; /* For headers */ size=sizeof(struct ddpehdr)+len+nb_dl->header_length; /* For headers */
if(usat->sat_addr.s_net!=0 || usat->sat_addr.s_node == ATADDR_ANYNODE) if(usat->sat_addr.s_net!=0 || usat->sat_addr.s_node == ATADDR_ANYNODE)
...@@ -533,12 +530,8 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int ...@@ -533,12 +530,8 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int
return -ENETUNREACH; return -ENETUNREACH;
dev=rt->dev; dev=rt->dev;
} }
SOCK_DEBUG(sk, "SK %p: Size needed %d, device %s\n", sk, size, dev->name);
if(sk->debug)
printk("SK %p: Size needed %d, device %s\n", sk, size, dev->name);
size += dev->hard_header_len; size += dev->hard_header_len;
skb = sock_alloc_send_skb(sk, size, 0, 0 , &err); skb = sock_alloc_send_skb(sk, size, 0, 0 , &err);
if(skb==NULL) if(skb==NULL)
return err; return err;
...@@ -548,12 +541,8 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int ...@@ -548,12 +541,8 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int
skb->arp=1; skb->arp=1;
skb_reserve(skb,nb_dl->header_length); skb_reserve(skb,nb_dl->header_length);
skb_reserve(skb,dev->hard_header_len); skb_reserve(skb,dev->hard_header_len);
skb->dev=dev; skb->dev=dev;
SOCK_DEBUG(sk, "SK %p: Begin build.\n", sk);
if(sk->debug)
printk("SK %p: Begin build.\n", sk);
ddp=(struct ddpehdr *)skb_put(skb,sizeof(struct ddpehdr)); ddp=(struct ddpehdr *)skb_put(skb,sizeof(struct ddpehdr));
ddp->deh_pad=0; ddp->deh_pad=0;
ddp->deh_hops=0; ddp->deh_hops=0;
...@@ -571,10 +560,7 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int ...@@ -571,10 +560,7 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int
ddp->deh_snode=sk->protinfo.af_at.src_node; ddp->deh_snode=sk->protinfo.af_at.src_node;
ddp->deh_dport=usat->sat_port; ddp->deh_dport=usat->sat_port;
ddp->deh_sport=sk->protinfo.af_at.src_port; ddp->deh_sport=sk->protinfo.af_at.src_port;
SOCK_DEBUG(sk, "SK %p: Copy user data (%d bytes).\n", sk, len);
if(sk->debug)
printk("SK %p: Copy user data (%d bytes).\n", sk, len);
err = memcpy_fromiovec(skb_put(skb,len),msg->msg_iov,len); err = memcpy_fromiovec(skb_put(skb,len),msg->msg_iov,len);
if (err) if (err)
{ {
...@@ -610,8 +596,7 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int ...@@ -610,8 +596,7 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int
if(skb2) if(skb2)
{ {
loopback=1; loopback=1;
if(sk->debug) SOCK_DEBUG(sk, "SK %p: send out(copy).\n", sk);
printk("SK %p: send out(copy).\n", sk);
if(aarp_send_ddp(dev,skb2,&usat->sat_addr, NULL)==-1) if(aarp_send_ddp(dev,skb2,&usat->sat_addr, NULL)==-1)
kfree_skb(skb2, FREE_WRITE); kfree_skb(skb2, FREE_WRITE);
/* else queued/sent above in the aarp queue */ /* else queued/sent above in the aarp queue */
...@@ -621,8 +606,7 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int ...@@ -621,8 +606,7 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int
if((dev->flags&IFF_LOOPBACK) || loopback) if((dev->flags&IFF_LOOPBACK) || loopback)
{ {
if(sk->debug) SOCK_DEBUG(sk, "SK %p: Loop back.\n", sk);
printk("SK %p: Loop back.\n", sk);
/* loop back */ /* loop back */
atomic_sub(skb->truesize, &sk->wmem_alloc); atomic_sub(skb->truesize, &sk->wmem_alloc);
nb_dl->datalink_header(nb_dl, skb, dev->dev_addr); nb_dl->datalink_header(nb_dl, skb, dev->dev_addr);
...@@ -635,9 +619,7 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int ...@@ -635,9 +619,7 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int
} }
else else
{ {
if(sk->debug) SOCK_DEBUG(sk, "SK %p: send out.\n", sk);
printk("SK %p: send out.\n", sk);
if ( rt->flags & RTF_GATEWAY ) { if ( rt->flags & RTF_GATEWAY ) {
gsat.sat_addr = rt->gateway; gsat.sat_addr = rt->gateway;
usat = &gsat; usat = &gsat;
...@@ -647,8 +629,7 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int ...@@ -647,8 +629,7 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int
kfree_skb(skb, FREE_WRITE); kfree_skb(skb, FREE_WRITE);
/* else queued/sent above in the aarp queue */ /* else queued/sent above in the aarp queue */
} }
if(sk->debug) SOCK_DEBUG(sk, "SK %p: Done write (%d).\n", sk, len);
printk("SK %p: Done write (%d).\n", sk, len);
return len; return len;
} }
......
...@@ -735,8 +735,7 @@ static int nr_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -735,8 +735,7 @@ static int nr_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
return -EINVAL; return -EINVAL;
if ((dev = nr_dev_get(&addr->fsa_ax25.sax25_call)) == NULL) { if ((dev = nr_dev_get(&addr->fsa_ax25.sax25_call)) == NULL) {
if (sk->debug) SOCK_DEBUG(sk, "NET/ROM: bind failed: invalid node callsign\n");
printk("NET/ROM: bind failed: invalid node callsign\n");
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
} }
...@@ -765,10 +764,7 @@ static int nr_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -765,10 +764,7 @@ static int nr_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
nr_insert_socket(sk); nr_insert_socket(sk);
sk->zapped = 0; sk->zapped = 0;
SOCK_DEBUG(sk, "NET/ROM: socket is bound\n");
if (sk->debug)
printk("NET/ROM: socket is bound\n");
return 0; return 0;
} }
...@@ -1105,14 +1101,10 @@ static int nr_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct s ...@@ -1105,14 +1101,10 @@ static int nr_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct s
sax.sax25_family = AF_NETROM; sax.sax25_family = AF_NETROM;
sax.sax25_call = sk->protinfo.nr->dest_addr; sax.sax25_call = sk->protinfo.nr->dest_addr;
} }
SOCK_DEBUG(sk, "NET/ROM: sendto: Addresses built.\n");
if (sk->debug)
printk("NET/ROM: sendto: Addresses built.\n");
/* Build a packet */ /* Build a packet */
if (sk->debug) SOCK_DEBUG(sk, "NET/ROM: sendto: building packet.\n");
printk("NET/ROM: sendto: building packet.\n");
size = len + AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + NR_NETWORK_LEN + NR_TRANSPORT_LEN; size = len + AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + NR_NETWORK_LEN + NR_TRANSPORT_LEN;
if ((skb = sock_alloc_send_skb(sk, size, 0, msg->msg_flags & MSG_DONTWAIT, &err)) == NULL) if ((skb = sock_alloc_send_skb(sk, size, 0, msg->msg_flags & MSG_DONTWAIT, &err)) == NULL)
...@@ -1127,9 +1119,7 @@ static int nr_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct s ...@@ -1127,9 +1119,7 @@ static int nr_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct s
*/ */
asmptr = skb_push(skb, NR_TRANSPORT_LEN); asmptr = skb_push(skb, NR_TRANSPORT_LEN);
SOCK_DEBUG(sk, "Building NET/ROM Header.\n");
if (sk->debug)
printk("Building NET/ROM Header.\n");
/* Build a NET/ROM Transport header */ /* Build a NET/ROM Transport header */
...@@ -1138,9 +1128,7 @@ static int nr_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct s ...@@ -1138,9 +1128,7 @@ static int nr_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct s
*asmptr++ = 0; /* To be filled in later */ *asmptr++ = 0; /* To be filled in later */
*asmptr++ = 0; /* Ditto */ *asmptr++ = 0; /* Ditto */
*asmptr++ = NR_INFO; *asmptr++ = NR_INFO;
SOCK_DEBUG(sk, "Built header.\n");
if (sk->debug)
printk("Built header.\n");
/* /*
* Put the data on the end * Put the data on the end
...@@ -1149,15 +1137,11 @@ static int nr_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct s ...@@ -1149,15 +1137,11 @@ static int nr_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct s
skb->h.raw = skb_put(skb, len); skb->h.raw = skb_put(skb, len);
asmptr = skb->h.raw; asmptr = skb->h.raw;
SOCK_DEBUG(sk, "NET/ROM: Appending user data\n");
if (sk->debug)
printk("NET/ROM: Appending user data\n");
/* User data follows immediately after the NET/ROM transport header */ /* User data follows immediately after the NET/ROM transport header */
memcpy_fromiovec(asmptr, msg->msg_iov, len); memcpy_fromiovec(asmptr, msg->msg_iov, len);
SOCK_DEBUG(sk, "NET/ROM: Transmitting buffer\n");
if (sk->debug)
printk("NET/ROM: Transmitting buffer\n");
if (sk->state != TCP_ESTABLISHED) { if (sk->state != TCP_ESTABLISHED) {
kfree_skb(skb, FREE_WRITE); kfree_skb(skb, FREE_WRITE);
......
...@@ -797,8 +797,7 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -797,8 +797,7 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
return -EINVAL; return -EINVAL;
if ((dev = rose_dev_get(&addr->srose_addr)) == NULL) { if ((dev = rose_dev_get(&addr->srose_addr)) == NULL) {
if (sk->debug) SOCK_DEBUG(sk, "Rose: bind failed: invalid address\n");
printk("Rose: bind failed: invalid address\n");
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
} }
...@@ -822,10 +821,7 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -822,10 +821,7 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
rose_insert_socket(sk); rose_insert_socket(sk);
sk->zapped = 0; sk->zapped = 0;
SOCK_DEBUG(sk, "Rose: socket is bound\n");
if (sk->debug)
printk("Rose: socket is bound\n");
return 0; return 0;
} }
...@@ -1134,14 +1130,10 @@ static int rose_sendmsg(struct socket *sock, struct msghdr *msg, int len, ...@@ -1134,14 +1130,10 @@ static int rose_sendmsg(struct socket *sock, struct msghdr *msg, int len,
srose.srose_digi = sk->protinfo.rose->dest_digi; srose.srose_digi = sk->protinfo.rose->dest_digi;
} }
} }
SOCK_DEBUG(sk, "Rose: sendto: Addresses built.\n");
if (sk->debug)
printk("Rose: sendto: Addresses built.\n");
/* Build a packet */ /* Build a packet */
if (sk->debug) SOCK_DEBUG(sk, "Rose: sendto: building packet.\n");
printk("Rose: sendto: building packet.\n");
size = len + AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + ROSE_MIN_LEN; size = len + AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + ROSE_MIN_LEN;
if ((skb = sock_alloc_send_skb(sk, size, 0, msg->msg_flags & MSG_DONTWAIT, &err)) == NULL) if ((skb = sock_alloc_send_skb(sk, size, 0, msg->msg_flags & MSG_DONTWAIT, &err)) == NULL)
...@@ -1156,18 +1148,14 @@ static int rose_sendmsg(struct socket *sock, struct msghdr *msg, int len, ...@@ -1156,18 +1148,14 @@ static int rose_sendmsg(struct socket *sock, struct msghdr *msg, int len,
*/ */
asmptr = skb_push(skb, ROSE_MIN_LEN); asmptr = skb_push(skb, ROSE_MIN_LEN);
SOCK_DEBUG(sk, "Building Rose Header.\n");
if (sk->debug)
printk("Building Rose Header.\n");
/* Build a Rose Transport header */ /* Build a Rose Transport header */
*asmptr++ = ((sk->protinfo.rose->lci >> 8) & 0x0F) | ROSE_GFI; *asmptr++ = ((sk->protinfo.rose->lci >> 8) & 0x0F) | ROSE_GFI;
*asmptr++ = (sk->protinfo.rose->lci >> 0) & 0xFF; *asmptr++ = (sk->protinfo.rose->lci >> 0) & 0xFF;
*asmptr++ = ROSE_DATA; *asmptr++ = ROSE_DATA;
SOCK_DEBUG(sk, "Built header.\n");
if (sk->debug)
printk("Built header.\n");
/* /*
* Put the data on the end * Put the data on the end
...@@ -1176,15 +1164,11 @@ static int rose_sendmsg(struct socket *sock, struct msghdr *msg, int len, ...@@ -1176,15 +1164,11 @@ static int rose_sendmsg(struct socket *sock, struct msghdr *msg, int len,
skb->h.raw = skb_put(skb, len); skb->h.raw = skb_put(skb, len);
asmptr = skb->h.raw; asmptr = skb->h.raw;
SOCK_DEBUG(sk, "Rose: Appending user data\n");
if (sk->debug)
printk("Rose: Appending user data\n");
/* User data follows immediately after the Rose transport header */ /* User data follows immediately after the Rose transport header */
memcpy_fromiovec(asmptr, msg->msg_iov, len); memcpy_fromiovec(asmptr, msg->msg_iov, len);
SOCK_DEBUG(sk, "Rose: Transmitting buffer\n");
if (sk->debug)
printk("Rose: Transmitting buffer\n");
if (sk->state != TCP_ESTABLISHED) { if (sk->state != TCP_ESTABLISHED) {
kfree_skb(skb, FREE_WRITE); kfree_skb(skb, FREE_WRITE);
......
...@@ -652,10 +652,7 @@ static int x25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -652,10 +652,7 @@ static int x25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
x25_insert_socket(sk); x25_insert_socket(sk);
sk->zapped = 0; sk->zapped = 0;
SOCK_DEBUG(sk, "x25_bind: socket is bound\n");
if (sk->debug)
printk(KERN_DEBUG "x25_bind: socket is bound\n");
return 0; return 0;
} }
...@@ -937,14 +934,10 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct ...@@ -937,14 +934,10 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct
sx25.sx25_family = AF_X25; sx25.sx25_family = AF_X25;
sx25.sx25_addr = sk->protinfo.x25->dest_addr; sx25.sx25_addr = sk->protinfo.x25->dest_addr;
} }
SOCK_DEBUG(sk, "x25_sendmsg: sendto: Addresses built.\n");
if (sk->debug)
printk(KERN_DEBUG "x25_sendmsg: sendto: Addresses built.\n");
/* Build a packet */ /* Build a packet */
if (sk->debug) SOCK_DEBUG(sk, "x25_sendmsg: sendto: building packet.\n");
printk(KERN_DEBUG "x25_sendmsg: sendto: building packet.\n");
if ((msg->msg_flags & MSG_OOB) && len > 32) if ((msg->msg_flags & MSG_OOB) && len > 32)
len = 32; len = 32;
...@@ -958,9 +951,7 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct ...@@ -958,9 +951,7 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct
/* /*
* Put the data on the end * Put the data on the end
*/ */
if (sk->debug) SOCK_DEBUG(sk, "x25_sendmsg: Copying user data\n");
printk(KERN_DEBUG "x25_sendmsg: Copying user data\n");
skb->h.raw = skb_put(skb, len); skb->h.raw = skb_put(skb, len);
asmptr = skb->h.raw; asmptr = skb->h.raw;
...@@ -978,9 +969,7 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct ...@@ -978,9 +969,7 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct
/* /*
* Push down the X.25 header * Push down the X.25 header
*/ */
if (sk->debug) SOCK_DEBUG(sk, "x25_sendmsg: Building X.25 Header.\n");
printk(KERN_DEBUG "x25_sendmsg: Building X.25 Header.\n");
if (msg->msg_flags & MSG_OOB) { if (msg->msg_flags & MSG_OOB) {
if (sk->protinfo.x25->neighbour->extended) { if (sk->protinfo.x25->neighbour->extended) {
asmptr = skb_push(skb, X25_STD_MIN_LEN); asmptr = skb_push(skb, X25_STD_MIN_LEN);
...@@ -1012,12 +1001,8 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct ...@@ -1012,12 +1001,8 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct
if (qbit) if (qbit)
skb->data[0] |= X25_Q_BIT; skb->data[0] |= X25_Q_BIT;
} }
SOCK_DEBUG(sk, "x25_sendmsg: Built header.\n");
if (sk->debug) SOCK_DEBUG(sk, "x25_sendmsg: Transmitting buffer\n");
printk(KERN_DEBUG "x25_sendmsg: Built header.\n");
if (sk->debug)
printk(KERN_DEBUG "x25_sendmsg: Transmitting buffer\n");
if (sk->state != TCP_ESTABLISHED) { if (sk->state != TCP_ESTABLISHED) {
kfree_skb(skb, FREE_WRITE); kfree_skb(skb, FREE_WRITE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment