diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-i386/io.h | 4 | ||||
| -rw-r--r-- | include/asm-i386/processor.h | 28 | ||||
| -rw-r--r-- | include/asm-i386/spinlock.h | 5 | ||||
| -rw-r--r-- | include/asm-i386/uaccess.h | 19 | ||||
| -rw-r--r-- | include/linux/ac97_codec.h | 39 | ||||
| -rw-r--r-- | include/linux/fs.h | 5 | ||||
| -rw-r--r-- | include/linux/kernel.h | 27 | ||||
| -rw-r--r-- | include/linux/mm.h | 2 | ||||
| -rw-r--r-- | include/linux/personality.h | 174 | ||||
| -rw-r--r-- | include/linux/sched.h | 9 | ||||
| -rw-r--r-- | include/linux/swap.h | 2 | ||||
| -rw-r--r-- | include/linux/sysctl.h | 14 | ||||
| -rw-r--r-- | include/net/sock.h | 2 | ||||
| -rw-r--r-- | include/net/tcp.h | 26 |
14 files changed, 274 insertions, 82 deletions
diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h index 55b2886e8181..0b68f5635d22 100644 --- a/include/asm-i386/io.h +++ b/include/asm-i386/io.h @@ -1,6 +1,8 @@ #ifndef _ASM_IO_H #define _ASM_IO_H +#include <linux/config.h> + /* * This file contains the definitions for the x86 IO instructions * inb/inw/inl/outb/outw/outl and the "string versions" of the same @@ -111,7 +113,7 @@ __OUTS(l) * Temporary debugging check to catch old code using * unmapped ISA addresses. Will be removed in 2.4. */ -#if 0 +#if CONFIG_DEBUG_IOVIRT extern void *__io_virt_debug(unsigned long x, const char *file, int line); extern unsigned long __io_phys_debug(unsigned long x, const char *file, int line); #define __io_virt(x) __io_virt_debug((unsigned long)(x), __FILE__, __LINE__) diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 2373655be738..a2f9b28d54de 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -477,4 +477,32 @@ static inline void rep_nop(void) __asm__ __volatile__("rep;nop"); } +/* Prefetch instructions for Pentium III and AMD Athlon */ +#ifdef CONFIG_MPENTIUMIII + +#define ARCH_HAS_PREFETCH +extern inline void prefetch(const void *x) +{ + __asm__ __volatile__ ("prefetchnta (%0)" : : "r"(x)); +} + +#elif CONFIG_X86_USE_3DNOW + +#define ARCH_HAS_PREFETCH +#define ARCH_HAS_PREFETCHW +#define ARCH_HAS_SPINLOCK_PREFETCH + +extern inline void prefetch(const void *x) +{ + __asm__ __volatile__ ("prefetch (%0)" : : "r"(x)); +} + +extern inline void prefetchw(const void *x) +{ + __asm__ __volatile__ ("prefetchw (%0)" : : "r"(x)); +} +#define spin_lock_prefetch(x) prefetchw(x) + +#endif + #endif /* __ASM_I386_PROCESSOR_H */ diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h index 2d6eb04bf05c..c893aa09ea2d 100644 --- a/include/asm-i386/spinlock.h +++ b/include/asm-i386/spinlock.h @@ -4,6 +4,7 @@ #include <asm/atomic.h> #include <asm/rwlock.h> #include <asm/page.h> +#include <linux/config.h> extern int printk(const char * fmt, ...) __attribute__ ((format (printf, 1, 2))); @@ -12,7 +13,11 @@ extern int printk(const char * fmt, ...) * initialize their spinlocks properly, tsk tsk. * Remember to turn this off in 2.4. -ben */ +#if defined(CONFIG_DEBUG_SPINLOCK) +#define SPINLOCK_DEBUG 1 +#else #define SPINLOCK_DEBUG 0 +#endif /* * Your basic SMP spinlocks, allowing only a single CPU anywhere diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h index db7eedb37bea..7d4a2ab1cc6f 100644 --- a/include/asm-i386/uaccess.h +++ b/include/asm-i386/uaccess.h @@ -126,6 +126,7 @@ extern void __get_user_4(void); extern void __put_user_1(void); extern void __put_user_2(void); extern void __put_user_4(void); +extern void __put_user_8(void); extern void __put_user_bad(void); @@ -154,6 +155,23 @@ extern void __put_user_bad(void); __pu_err; \ }) +#define __put_user_u64(x, addr, err) \ + __asm__ __volatile__( \ + "1: movl %%eax,0(%2)\n" \ + "2: movl %%edx,4(%2)\n" \ + "3:\n" \ + ".section .fixup,\"ax\"\n" \ + "4: movl %3,%0\n" \ + " jmp 3b\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .align 4\n" \ + " .long 1b,4b\n" \ + " .long 2b,4b\n" \ + ".previous" \ + : "=r"(err) \ + : "A" (x), "r" (addr), "i"(-EFAULT), "0"(err)) + #define __put_user_size(x,ptr,size,retval) \ do { \ retval = 0; \ @@ -161,6 +179,7 @@ do { \ case 1: __put_user_asm(x,ptr,retval,"b","b","iq"); break; \ case 2: __put_user_asm(x,ptr,retval,"w","w","ir"); break; \ case 4: __put_user_asm(x,ptr,retval,"l","","ir"); break; \ + case 8: __put_user_u64(x,ptr,retval); break; \ default: __put_user_bad(); \ } \ } while (0) diff --git a/include/linux/ac97_codec.h b/include/linux/ac97_codec.h index e2afb261601a..96944938fc18 100644 --- a/include/linux/ac97_codec.h +++ b/include/linux/ac97_codec.h @@ -36,7 +36,10 @@ #define AC97_PCM_MIC_ADC_RATE 0x0034 /* PCM MIC ADC Rate */ #define AC97_CENTER_LFE_MASTER 0x0036 /* Center + LFE Master Volume */ #define AC97_SURROUND_MASTER 0x0038 /* Surround (Rear) Master Volume */ -#define AC97_RESERVED_3A 0x003A /* Reserved */ +#define AC97_RESERVED_3A 0x003A /* Reserved in AC '97 < 2.2 */ + +/* AC'97 2.2 */ +#define AC97_SPDIF_CONTROL 0x003A /* S/PDIF Control */ /* range 0x3c-0x58 - MODEM */ #define AC97_EXTENDED_MODEM_ID 0x003C @@ -87,6 +90,40 @@ #define AC97_GP_ST 0x4000 /* Stereo Enhancement 1=on */ #define AC97_GP_POP 0x8000 /* Pcm Out Path, 0=pre 3D, 1=post 3D */ +/* extended audio status and control bit defines */ +#define AC97_EA_VRA 0x0001 /* Variable bit rate enable bit */ +#define AC97_EA_DRA 0x0002 /* Double-rate audio enable bit */ +#define AC97_EA_SPDIF 0x0004 /* S/PDIF Enable bit */ +#define AC97_EA_VRM 0x0008 /* Variable bit rate for MIC enable bit */ +#define AC97_EA_CDAC 0x0040 /* PCM Center DAC is ready (Read only) */ +#define AC97_EA_SDAC 0x0040 /* PCM Surround DACs are ready (Read only) */ +#define AC97_EA_LDAC 0x0080 /* PCM LFE DAC is ready (Read only) */ +#define AC97_EA_MDAC 0x0100 /* MIC ADC is ready (Read only) */ +#define AC97_EA_SPCV 0x0400 /* S/PDIF configuration valid (Read only) */ +#define AC97_EA_PRI 0x0800 /* Turns the PCM Center DAC off */ +#define AC97_EA_PRJ 0x1000 /* Turns the PCM Surround DACs off */ +#define AC97_EA_PRK 0x2000 /* Turns the PCM LFE DAC off */ +#define AC97_EA_PRL 0x4000 /* Turns the MIC ADC off */ +#define AC97_EA_SLOT_MASK 0xffcf /* Mask for slot assignment bits */ +#define AC97_EA_SPSA_3_4 0x0000 /* Slot assigned to 3 & 4 */ +#define AC97_EA_SPSA_7_8 0x0010 /* Slot assigned to 7 & 8 */ +#define AC97_EA_SPSA_6_9 0x0020 /* Slot assigned to 6 & 9 */ +#define AC97_EA_SPSA_10_11 0x0030 /* Slot assigned to 10 & 11 */ + +/* S/PDIF control bit defines */ +#define AC97_SC_PRO 0x0001 /* Professional status */ +#define AC97_SC_NAUDIO 0x0002 /* Non audio stream */ +#define AC97_SC_COPY 0x0004 /* Copyright status */ +#define AC97_SC_PRE 0x0008 /* Preemphasis status */ +#define AC97_SC_CC_MASK 0x07f0 /* Category Code mask */ +#define AC97_SC_L 0x0800 /* Generation Level status */ +#define AC97_SC_SPSR_MASK 0xcfff /* S/PDIF Sample Rate bits */ +#define AC97_SC_SPSR_44K 0x0000 /* Use 44.1kHz Sample rate */ +#define AC97_SC_SPSR_48K 0x2000 /* Use 48kHz Sample rate */ +#define AC97_SC_SPSR_32K 0x3000 /* Use 32kHz Sample rate */ +#define AC97_SC_DRS 0x4000 /* Double Rate S/PDIF */ +#define AC97_SC_V 0x8000 /* Validity status */ + /* powerdown control and status bit defines */ /* status */ diff --git a/include/linux/fs.h b/include/linux/fs.h index 953d87b4e165..dfe64dc82c10 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -167,7 +167,7 @@ extern int leases_enable, dir_notify_enable, lease_break_time; #define BLKROSET _IO(0x12,93) /* set device read-only (0 = read-write) */ #define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */ #define BLKRRPART _IO(0x12,95) /* re-read partition table */ -#define BLKGETSIZE _IO(0x12,96) /* return device size */ +#define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */ #define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */ #define BLKRASET _IO(0x12,98) /* Set read ahead for block device */ #define BLKRAGET _IO(0x12,99) /* get current read ahead setting */ @@ -186,6 +186,7 @@ extern int leases_enable, dir_notify_enable, lease_break_time; /* A jump here: 108-111 have been used for various private purposes. */ #define BLKBSZGET _IOR(0x12,112,sizeof(int)) #define BLKBSZSET _IOW(0x12,113,sizeof(int)) +#define BLKGETSIZE64 _IOR(0x12,114,sizeof(u64)) /* return device size in bytes (u64 *arg) */ #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ #define FIBMAP _IO(0x00,1) /* bmap access */ @@ -1397,7 +1398,7 @@ extern int generic_buffer_fdatasync(struct inode *inode, unsigned long start_idx extern int generic_osync_inode(struct inode *, int); extern int inode_change_ok(struct inode *, struct iattr *); -extern void inode_setattr(struct inode *, struct iattr *); +extern int inode_setattr(struct inode *, struct iattr *); /* * Common dentry functions for inclusion in the VFS diff --git a/include/linux/kernel.h b/include/linux/kernel.h index ea28234bd480..cd9e83570b0b 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -115,9 +115,32 @@ static inline void console_verbose(void) ((unsigned char *)&addr)[1], \ ((unsigned char *)&addr)[0] -#define min(type,x,y) \ +/* + * min()/max() macros that also do + * strict type-checking.. See the + * "unnecessary" pointer comparison. + */ +#define min(x,y) ({ \ + const typeof(x) _x = (x); \ + const typeof(y) _y = (y); \ + (void) (&_x == &_y); \ + _x < _y ? _x : _y; }) + +#define max(x,y) ({ \ + const typeof(x) _x = (x); \ + const typeof(y) _y = (y); \ + (void) (&_x == &_y); \ + _x > _y ? _x : _y; }) + +/* + * ..and if you can't take the strict + * types, you can specify one yourself. + * + * Or not use min/max at all, of course. + */ +#define min_t(type,x,y) \ ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; }) -#define max(type,x,y) \ +#define max_t(type,x,y) \ ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) #endif /* __KERNEL__ */ diff --git a/include/linux/mm.h b/include/linux/mm.h index d4464136cbe7..9bd982bb876b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -434,7 +434,7 @@ extern int copy_page_range(struct mm_struct *dst, struct mm_struct *src, struct extern int remap_page_range(unsigned long from, unsigned long to, unsigned long size, pgprot_t prot); extern int zeromap_page_range(unsigned long from, unsigned long size, pgprot_t prot); -extern void vmtruncate(struct inode * inode, loff_t offset); +extern int vmtruncate(struct inode * inode, loff_t offset); extern pmd_t *FASTCALL(__pmd_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)); extern pte_t *FASTCALL(pte_alloc(struct mm_struct *mm, pmd_t *pmd, unsigned long address)); extern int handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access); diff --git a/include/linux/personality.h b/include/linux/personality.h index 58cab509e3d7..230d39460364 100644 --- a/include/linux/personality.h +++ b/include/linux/personality.h @@ -1,68 +1,126 @@ -#ifndef _PERSONALITY_H -#define _PERSONALITY_H +#ifndef _LINUX_PERSONALITY_H +#define _LINUX_PERSONALITY_H -#include <linux/linkage.h> -#include <linux/ptrace.h> -#include <asm/current.h> +/* + * Handling of different ABIs (personalities). + */ + +struct exec_domain; +struct pt_regs; + +extern int register_exec_domain(struct exec_domain *); +extern int unregister_exec_domain(struct exec_domain *); +extern int __set_personality(unsigned long); + + +/* + * Sysctl variables related to binary emulation. + */ +extern unsigned long abi_defhandler_coff; +extern unsigned long abi_defhandler_elf; +extern unsigned long abi_defhandler_lcall7; +extern unsigned long abi_defhandler_libcso; +extern int abi_fake_utsname; -/* Flags for bug emulation. These occupy the top three bytes. */ -#define STICKY_TIMEOUTS 0x4000000 -#define WHOLE_SECONDS 0x2000000 -#define ADDR_LIMIT_32BIT 0x0800000 -/* Personality types. These go in the low byte. Avoid using the top bit, - * it will conflict with error returns. +/* + * Flags for bug emulation. + * + * These occupy the top three bytes. */ -#define PER_MASK (0x00ff) -#define PER_LINUX (0x0000) -#define PER_LINUX_32BIT (0x0000 | ADDR_LIMIT_32BIT) -#define PER_SVR4 (0x0001 | STICKY_TIMEOUTS) -#define PER_SVR3 (0x0002 | STICKY_TIMEOUTS) -#define PER_SCOSVR3 (0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS) -#define PER_WYSEV386 (0x0004 | STICKY_TIMEOUTS) -#define PER_ISCR4 (0x0005 | STICKY_TIMEOUTS) -#define PER_BSD (0x0006) -#define PER_SUNOS (PER_BSD | STICKY_TIMEOUTS) -#define PER_XENIX (0x0007 | STICKY_TIMEOUTS) -#define PER_LINUX32 (0x0008) -#define PER_IRIX32 (0x0009 | STICKY_TIMEOUTS) /* IRIX5 32-bit */ -#define PER_IRIXN32 (0x000a | STICKY_TIMEOUTS) /* IRIX6 new 32-bit */ -#define PER_IRIX64 (0x000b | STICKY_TIMEOUTS) /* IRIX6 64-bit */ -#define PER_RISCOS (0x000c) -#define PER_SOLARIS (0x000d | STICKY_TIMEOUTS) - -/* Prototype for an lcall7 syscall handler. */ -typedef void (*lcall7_func)(int, struct pt_regs *); - - -/* Description of an execution domain - personality range supported, - * lcall7 syscall handler, start up / shut down functions etc. - * N.B. The name and lcall7 handler must be where they are since the - * offset of the handler is hard coded in kernel/sys_call.S. +enum { + MMAP_PAGE_ZERO = 0x0100000, + ADDR_LIMIT_32BIT = 0x0800000, + SHORT_INODE = 0x1000000, + WHOLE_SECONDS = 0x2000000, + STICKY_TIMEOUTS = 0x4000000, +}; + +/* + * Personality types. + * + * These go in the low byte. Avoid using the top bit, it will + * conflict with error returns. + */ +enum { + PER_LINUX = 0x0000, + PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT, + PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, + PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE, + PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS | + WHOLE_SECONDS | SHORT_INODE, + PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS, + PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE, + PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS, + PER_BSD = 0x0006, + PER_SUNOS = 0x0006 | STICKY_TIMEOUTS, + PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE, + PER_LINUX32 = 0x0008, + PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS,/* IRIX5 32-bit */ + PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS,/* IRIX6 new 32-bit */ + PER_IRIX64 = 0x000b | STICKY_TIMEOUTS,/* IRIX6 64-bit */ + PER_RISCOS = 0x000c, + PER_SOLARIS = 0x000d | STICKY_TIMEOUTS, + PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, + PER_MASK = 0x00ff, +}; + + +/* + * Description of an execution domain. + * + * The first two members are refernced from assembly source + * and should stay where they are unless explicitly needed. */ +typedef void (*handler_t)(int, struct pt_regs *); + struct exec_domain { - const char *name; - lcall7_func handler; - unsigned char pers_low, pers_high; - unsigned long * signal_map; - unsigned long * signal_invmap; - struct module * module; - struct exec_domain *next; + const char *name; /* name of the execdomain */ + handler_t handler; /* handler for syscalls */ + unsigned char pers_low; /* lowest personality */ + unsigned char pers_high; /* highest personality */ + unsigned long *signal_map; /* signal mapping */ + unsigned long *signal_invmap; /* reverse signal mapping */ + struct map_segment *err_map; /* error mapping */ + struct map_segment *socktype_map; /* socket type mapping */ + struct map_segment *sockopt_map; /* socket option mapping */ + struct map_segment *af_map; /* address family mapping */ + struct module *module; /* module context of the ed. */ + struct exec_domain *next; /* linked list (internal) */ }; -extern struct exec_domain default_exec_domain; - -extern int register_exec_domain(struct exec_domain *it); -extern int unregister_exec_domain(struct exec_domain *it); -#define put_exec_domain(it) \ - if (it && it->module) __MOD_DEC_USE_COUNT(it->module); -#define get_exec_domain(it) \ - if (it && it->module) __MOD_INC_USE_COUNT(it->module); -extern void __set_personality(unsigned long personality); -#define set_personality(pers) do { \ - if (current->personality != pers) \ - __set_personality(pers); \ +/* + * Return the base personality without flags. + */ +#define personality(pers) (pers & PER_MASK) + +/* + * Personality of the currently running process. + */ +#define get_personality (current->personality) + +/* + * Change personality of the currently running process. + */ +#define set_personality(pers) \ + ((current->personality == pers) ? 0 : __set_personality(pers)) + +/* + * Load an execution domain. + */ +#define get_exec_domain(ep) \ +do { \ + if (ep != NULL && ep->module != NULL) \ + __MOD_INC_USE_COUNT(ep->module); \ +} while (0) + +/* + * Unload an execution domain. + */ +#define put_exec_domain(ep) \ +do { \ + if (ep != NULL && ep->module != NULL) \ + __MOD_DEC_USE_COUNT(ep->module); \ } while (0) -asmlinkage long sys_personality(unsigned long personality); -#endif /* _PERSONALITY_H */ +#endif /* _LINUX_PERSONALITY_H */ diff --git a/include/linux/sched.h b/include/linux/sched.h index 94957c39b4c3..594acbc48a34 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -7,7 +7,6 @@ extern unsigned long event; #include <linux/config.h> #include <linux/binfmts.h> -#include <linux/personality.h> #include <linux/threads.h> #include <linux/kernel.h> #include <linux/types.h> @@ -27,6 +26,8 @@ extern unsigned long event; #include <linux/securebits.h> #include <linux/fs_struct.h> +struct exec_domain; + /* * cloning flags: */ @@ -437,6 +438,12 @@ struct task_struct { #define MAX_COUNTER (20*HZ/100) #define DEF_NICE (0) + +/* + * The default (Linux) execution domain. + */ +extern struct exec_domain default_exec_domain; + /* * INIT_TASK is used to set up the first task table, touch at * your own risk!. Base=0, limit=0x1fffff (=2MB) diff --git a/include/linux/swap.h b/include/linux/swap.h index 26619cf335af..42d464b87ef8 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -256,7 +256,7 @@ extern spinlock_t pagemap_lru_lock; * 64 (1 << INACTIVE_SHIFT) seconds. */ #define INACTIVE_SHIFT 6 -#define inactive_target min(unsigned long, \ +#define inactive_target min_t(unsigned long, \ (memory_pressure >> INACTIVE_SHIFT), \ (num_physpages / 4)) diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 413f196ad4d2..0849bd3f617f 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -61,7 +61,8 @@ enum CTL_FS=5, /* Filesystems */ CTL_DEBUG=6, /* Debugging */ CTL_DEV=7, /* Devices */ - CTL_BUS=8 /* Buses */ + CTL_BUS=8, /* Buses */ + CTL_ABI=9 /* Binary emulation */ }; /* CTL_BUS names: */ @@ -606,6 +607,17 @@ enum { DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6 }; +/* /proc/sys/abi */ +enum +{ + ABI_DEFHANDLER_COFF=1, /* default handler for coff binaries */ + ABI_DEFHANDLER_ELF=2, /* default handler for ELF binaries */ + ABI_DEFHANDLER_LCALL7=3,/* default handler for procs using lcall7 */ + ABI_DEFHANDLER_LIBCSO=4,/* default handler for an libc.so ELF interp */ + ABI_TRACE=5, /* tracing flags */ + ABI_FAKE_UTSNAME=6, /* fake target utsname information */ +}; + #ifdef __KERNEL__ extern asmlinkage long sys_sysctl(struct __sysctl_args *); diff --git a/include/net/sock.h b/include/net/sock.h index 403e842f6d78..480f74267d32 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1245,7 +1245,7 @@ static inline long sock_sndtimeo(struct sock *sk, int noblock) static inline int sock_rcvlowat(struct sock *sk, int waitall, int len) { - return (waitall ? len : min(int, sk->rcvlowat, len)) ? : 1; + return (waitall ? len : min_t(int, sk->rcvlowat, len)) ? : 1; } /* Alas, with timeout socket operations are not restartable. diff --git a/include/net/tcp.h b/include/net/tcp.h index 8edcd920facd..4cb72ebec3f7 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -919,12 +919,12 @@ static __inline__ unsigned int tcp_current_mss(struct sock *sk) static inline void tcp_initialize_rcv_mss(struct sock *sk) { struct tcp_opt *tp = &sk->tp_pinfo.af_tcp; - unsigned int hint = min(unsigned int, tp->advmss, tp->mss_cache); + unsigned int hint = min_t(unsigned int, tp->advmss, tp->mss_cache); - hint = min(unsigned int, hint, tp->rcv_wnd/2); + hint = min_t(unsigned int, hint, tp->rcv_wnd/2); - tp->ack.rcv_mss = max(unsigned int, - min(unsigned int, + tp->ack.rcv_mss = max_t(unsigned int, + min_t(unsigned int, hint, TCP_MIN_RCVMSS), TCP_MIN_MSS); } @@ -1077,7 +1077,7 @@ static __inline__ int tcp_packets_in_flight(struct tcp_opt *tp) */ static inline __u32 tcp_recalc_ssthresh(struct tcp_opt *tp) { - return max(u32, tp->snd_cwnd >> 1, 2); + return max_t(u32, tp->snd_cwnd >> 1, 2); } /* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. @@ -1089,7 +1089,7 @@ static inline __u32 tcp_current_ssthresh(struct tcp_opt *tp) if ((1<<tp->ca_state)&(TCPF_CA_CWR|TCPF_CA_Recovery)) return tp->snd_ssthresh; else - return max(u32, tp->snd_ssthresh, + return max_t(u32, tp->snd_ssthresh, ((tp->snd_cwnd >> 1) + (tp->snd_cwnd >> 2))); } @@ -1126,7 +1126,7 @@ static inline void __tcp_enter_cwr(struct tcp_opt *tp) { tp->undo_marker = 0; tp->snd_ssthresh = tcp_recalc_ssthresh(tp); - tp->snd_cwnd = min(u32, tp->snd_cwnd, + tp->snd_cwnd = min_t(u32, tp->snd_cwnd, tcp_packets_in_flight(tp) + 1); tp->snd_cwnd_cnt = 0; tp->high_seq = tp->snd_nxt; @@ -1493,7 +1493,7 @@ static inline void tcp_select_initial_window(int space, __u32 mss, /* If no clamp set the clamp to the max possible scaled window */ if (*window_clamp == 0) (*window_clamp) = (65535 << 14); - space = min(u32, *window_clamp, space); + space = min_t(u32, *window_clamp, space); /* Quantize space offering to a multiple of mss if possible. */ if (space > mss) @@ -1505,7 +1505,7 @@ static inline void tcp_select_initial_window(int space, __u32 mss, * our initial window offering to 32k. There should also * be a sysctl option to stop being nice. */ - (*rcv_wnd) = min(int, space, MAX_TCP_WINDOW); + (*rcv_wnd) = min_t(int, space, MAX_TCP_WINDOW); (*rcv_wscale) = 0; if (wscale_ok) { /* See RFC1323 for an explanation of the limit to 14 */ @@ -1514,7 +1514,7 @@ static inline void tcp_select_initial_window(int space, __u32 mss, (*rcv_wscale)++; } if (*rcv_wscale && sysctl_tcp_app_win && space>=mss && - space - max(unsigned int, (space>>sysctl_tcp_app_win), mss>>*rcv_wscale) < 65536/2) + space - max_t(unsigned int, (space>>sysctl_tcp_app_win), mss>>*rcv_wscale) < 65536/2) (*rcv_wscale)--; } @@ -1532,7 +1532,7 @@ static inline void tcp_select_initial_window(int space, __u32 mss, *rcv_wnd = init_cwnd*mss; } /* Set the clamp no higher than max representable value */ - (*window_clamp) = min(u32, 65535 << (*rcv_wscale), *window_clamp); + (*window_clamp) = min_t(u32, 65535 << (*rcv_wscale), *window_clamp); } static inline int tcp_win_from_space(int space) @@ -1698,8 +1698,8 @@ static inline void tcp_enter_memory_pressure(void) static inline void tcp_moderate_sndbuf(struct sock *sk) { if (!(sk->userlocks&SOCK_SNDBUF_LOCK)) { - sk->sndbuf = min(int, sk->sndbuf, sk->wmem_queued/2); - sk->sndbuf = max(int, sk->sndbuf, SOCK_MIN_SNDBUF); + sk->sndbuf = min_t(int, sk->sndbuf, sk->wmem_queued/2); + sk->sndbuf = max_t(int, sk->sndbuf, SOCK_MIN_SNDBUF); } } |
