summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@athlon.transmeta.com>2002-02-04 20:10:26 -0800
committerLinus Torvalds <torvalds@athlon.transmeta.com>2002-02-04 20:10:26 -0800
commitbb5b6e6c4dea4242f6ff75fa7adecea4f34935f1 (patch)
treedbdda6fdd7f0bfadb4c10a997bfb15660f3223c0 /net
parent0b9ded43ee424791d9283cee2a33dcb4a97da57d (diff)
v2.4.8.4 -> v2.4.9
- David Miller: sparc updates, FAT fs fixes, btaudio build fix - David Gibson: Orinoco driver update - Kevin Fleming: more disks the HPT controller doesn't like - David Miller: "min()/max()" cleanups. Understands signs and sizes. - Ben LaHaise: make vma merging more generous, help Mozilla /proc/<>/maps - Jens Axboe: CD updates - Trond Myklebust: save away NFS credentials in inode, so that mmap can writeout. - Mark Hemment: HIGHMEM ops cleanups - Jes Sorensen: use "unsigned long" for flags in various drivers
Diffstat (limited to 'net')
-rw-r--r--net/appletalk/ddp.c6
-rw-r--r--net/ax25/af_ax25.c4
-rw-r--r--net/bridge/br_device.c5
-rw-r--r--net/bridge/br_forward.c12
-rw-r--r--net/bridge/br_input.c6
-rw-r--r--net/core/iovec.c10
-rw-r--r--net/ipv4/ip_sockglue.c10
-rw-r--r--net/ipv4/ipmr.c8
-rw-r--r--net/ipv4/netfilter/ipchains_core.c2
-rw-r--r--net/ipv4/netfilter/ipfwadm_core.c6
-rw-r--r--net/ipv4/route.c10
-rw-r--r--net/ipv4/tcp.c8
-rw-r--r--net/ipv4/tcp_input.c88
-rw-r--r--net/ipv4/tcp_minisocks.c4
-rw-r--r--net/ipv4/tcp_output.c24
-rw-r--r--net/ipv4/tcp_timer.c11
-rw-r--r--net/ipv6/icmp.c4
-rw-r--r--net/ipv6/ipv6_sockglue.c4
-rw-r--r--net/ipv6/mcast.c5
-rw-r--r--net/ipv6/ndisc.c3
-rw-r--r--net/ipv6/raw.c4
-rw-r--r--net/ipv6/route.c10
-rw-r--r--net/ipx/af_ipx.c2
-rw-r--r--net/irda/af_irda.c2
-rw-r--r--net/khttpd/datasending.c4
-rw-r--r--net/khttpd/prototypes.h11
-rw-r--r--net/khttpd/rfc.c10
-rw-r--r--net/khttpd/waitheaders.c2
-rw-r--r--net/netrom/af_netrom.c2
-rw-r--r--net/rose/af_rose.c2
-rw-r--r--net/sched/sch_tbf.c2
-rw-r--r--net/sunrpc/auth.c111
-rw-r--r--net/sunrpc/auth_null.c11
-rw-r--r--net/sunrpc/auth_unix.c13
-rw-r--r--net/sunrpc/sunrpc_syms.c2
-rw-r--r--net/sunrpc/xprt.c13
-rw-r--r--net/unix/af_unix.c8
-rw-r--r--net/wanrouter/wanmain.c11
-rw-r--r--net/wanrouter/wanproc.c13
-rw-r--r--net/x25/af_x25.c2
40 files changed, 237 insertions, 228 deletions
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index d1a1ecf4893a..d40aefcfd712 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -113,8 +113,6 @@ extern inline void atalk_unregister_sysctl(void);
struct datalink_proto *ddp_dl, *aarp_dl;
static struct proto_ops atalk_dgram_ops;
-#define min(a,b) (((a)<(b))?(a):(b))
-
/**************************************************************************\
* *
* Handlers for the socket list. *
@@ -1392,7 +1390,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
/* Trim buffer in case of stray trailing data */
origlen = skb->len;
- skb_trim(skb, min(skb->len, ddphv.deh_len));
+ skb_trim(skb, min(unsigned int, skb->len, ddphv.deh_len));
/*
* Size check to see if ddp->deh_len was crap
@@ -1457,7 +1455,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
}
/* Fix up skb->len field */
- skb_trim(skb, min(origlen, rt->dev->hard_header_len +
+ skb_trim(skb, min(unsigned int, origlen, rt->dev->hard_header_len +
ddp_dl->header_length + ddphv.deh_len));
/* Mend the byte order */
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 1d767b9d7d50..da409ee20946 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -751,7 +751,7 @@ static int ax25_getsockopt(struct socket *sock, int level, int optname, char *op
return -EFAULT;
valptr = (void *) &val;
- length = min(maxlen, sizeof(int));
+ length = min(unsigned int, maxlen, sizeof(int));
switch (optname) {
case AX25_WINDOW:
@@ -803,7 +803,7 @@ static int ax25_getsockopt(struct socket *sock, int level, int optname, char *op
if (ax25_dev != NULL && ax25_dev->dev != NULL) {
strncpy(devname, ax25_dev->dev->name, IFNAMSIZ);
- length = min(strlen(ax25_dev->dev->name)+1, maxlen);
+ length = min(unsigned int, strlen(ax25_dev->dev->name)+1, maxlen);
devname[length-1] = '\0';
} else {
*devname = '\0';
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 3d047851d952..95772a1e3dc6 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -5,7 +5,7 @@
* Authors:
* Lennert Buytenhek <buytenh@gnu.org>
*
- * $Id: br_device.c,v 1.4 2001/06/01 09:28:28 davem Exp $
+ * $Id: br_device.c,v 1.5 2001/08/14 22:05:57 davem Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -53,7 +53,8 @@ static int __br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
br->statistics.tx_packets++;
br->statistics.tx_bytes += skb->len;
- dest = skb->data;
+ dest = skb->mac.raw = skb->data;
+ skb_pull(skb, ETH_HLEN);
if (dest[0] & 1) {
br_flood_deliver(br, skb, 0);
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index a3de3ed57ca5..405c44c90724 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -5,7 +5,7 @@
* Authors:
* Lennert Buytenhek <buytenh@gnu.org>
*
- * $Id: br_forward.c,v 1.3 2001/06/01 09:28:28 davem Exp $
+ * $Id: br_forward.c,v 1.4 2001/08/14 22:05:57 davem Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -30,10 +30,18 @@ static inline int should_deliver(struct net_bridge_port *p, struct sk_buff *skb)
return 1;
}
+static int __dev_queue_push_xmit(struct sk_buff *skb)
+{
+ skb_push(skb, ETH_HLEN);
+ dev_queue_xmit(skb);
+
+ return 0;
+}
+
static int __br_forward_finish(struct sk_buff *skb)
{
NF_HOOK(PF_BRIDGE, NF_BR_POST_ROUTING, skb, NULL, skb->dev,
- dev_queue_xmit);
+ __dev_queue_push_xmit);
return 0;
}
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index d76a6ba8b026..dc1e1561a051 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -5,7 +5,7 @@
* Authors:
* Lennert Buytenhek <buytenh@gnu.org>
*
- * $Id: br_input.c,v 1.8 2001/06/01 09:28:28 davem Exp $
+ * $Id: br_input.c,v 1.9 2001/08/14 22:05:57 davem Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -39,7 +39,7 @@ static void br_pass_frame_up(struct net_bridge *br, struct sk_buff *skb)
indev = skb->dev;
skb->dev = &br->dev;
skb->pkt_type = PACKET_HOST;
- skb_pull(skb, skb->mac.raw - skb->data);
+ skb_push(skb, ETH_HLEN);
skb->protocol = eth_type_trans(skb, &br->dev);
NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_IN, skb, indev, NULL,
@@ -64,8 +64,6 @@ static void __br_handle_frame(struct sk_buff *skb)
p->state == BR_STATE_DISABLED)
goto freeandout;
- skb_push(skb, skb->data - skb->mac.raw);
-
if (br->dev.flags & IFF_PROMISC) {
struct sk_buff *skb2;
diff --git a/net/core/iovec.c b/net/core/iovec.c
index d12468d7c4f6..50f4395724df 100644
--- a/net/core/iovec.c
+++ b/net/core/iovec.c
@@ -87,7 +87,7 @@ int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len)
{
if(iov->iov_len)
{
- int copy = min(iov->iov_len, len);
+ int copy = min(unsigned int, iov->iov_len, len);
if (copy_to_user(iov->iov_base, kdata, copy))
goto out;
kdata+=copy;
@@ -114,7 +114,7 @@ void memcpy_tokerneliovec(struct iovec *iov, unsigned char *kdata, int len)
{
if(iov->iov_len)
{
- int copy = min(iov->iov_len, len);
+ int copy = min(unsigned int, iov->iov_len, len);
memcpy(iov->iov_base, kdata, copy);
kdata+=copy;
len-=copy;
@@ -140,7 +140,7 @@ int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len)
{
if(iov->iov_len)
{
- int copy = min(len, iov->iov_len);
+ int copy = min(unsigned int, len, iov->iov_len);
if (copy_from_user(kdata, iov->iov_base, copy))
goto out;
len-=copy;
@@ -175,7 +175,7 @@ int memcpy_fromiovecend(unsigned char *kdata, struct iovec *iov, int offset,
while (len > 0)
{
u8 *base = iov->iov_base + offset;
- int copy = min(len, iov->iov_len - offset);
+ int copy = min(unsigned int, len, iov->iov_len - offset);
offset = 0;
if (copy_from_user(kdata, base, copy))
@@ -214,7 +214,7 @@ int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov,
while (len > 0)
{
u8 *base = iov->iov_base + offset;
- unsigned int copy = min(len, iov->iov_len - offset);
+ int copy = min(unsigned int, len, iov->iov_len - offset);
offset = 0;
/* There is a remnant from previous iov. */
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 43db547adc96..51b99b08826f 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -5,7 +5,7 @@
*
* The IP to API glue.
*
- * Version: $Id: ip_sockglue.c,v 1.56 2001/02/18 09:07:58 davem Exp $
+ * Version: $Id: ip_sockglue.c,v 1.59 2001/08/13 18:56:12 davem Exp $
*
* Authors: see ip.c
*
@@ -43,8 +43,6 @@
#include <linux/errqueue.h>
#include <asm/uaccess.h>
-#define MAX(a,b) ((a)>(b)?(a):(b))
-
#define IP_CMSG_PKTINFO 1
#define IP_CMSG_TTL 2
#define IP_CMSG_TOS 4
@@ -685,7 +683,7 @@ int ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *op
ip_options_undo(opt);
- len=min(len, opt->optlen);
+ len = min(unsigned int, len, opt->optlen);
if(put_user(len, optlen))
return -EFAULT;
if(copy_to_user(optval, opt->__data, len))
@@ -746,7 +744,7 @@ int ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *op
case IP_MULTICAST_IF:
{
struct in_addr addr;
- len = min(len,sizeof(struct in_addr));
+ len = min(unsigned int, len, sizeof(struct in_addr));
addr.s_addr = sk->protinfo.af_inet.mc_addr;
release_sock(sk);
@@ -810,7 +808,7 @@ int ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *op
if(copy_to_user(optval,&ucval,1))
return -EFAULT;
} else {
- len=min(sizeof(int),len);
+ len = min(unsigned int, sizeof(int), len);
if(put_user(len, optlen))
return -EFAULT;
if(copy_to_user(optval,&val,len))
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 6a696b74cf24..bc736375167e 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -9,7 +9,7 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
- * Version: $Id: ipmr.c,v 1.60 2001/06/29 21:33:22 davem Exp $
+ * Version: $Id: ipmr.c,v 1.63 2001/08/13 18:56:12 davem Exp $
*
* Fixes:
* Michael Chastain : Incorrect size of copying.
@@ -976,11 +976,11 @@ int ip_mroute_getsockopt(struct sock *sk,int optname,char *optval,int *optlen)
optname!=MRT_ASSERT)
return -ENOPROTOOPT;
- if(get_user(olr, optlen))
+ if (get_user(olr, optlen))
return -EFAULT;
- olr=min(olr,sizeof(int));
- if(olr<0)
+ olr = min(unsigned int, olr, sizeof(int));
+ if (olr < 0)
return -EINVAL;
if(put_user(olr,optlen))
diff --git a/net/ipv4/netfilter/ipchains_core.c b/net/ipv4/netfilter/ipchains_core.c
index 9c3434aa50d3..186e63ee3cf0 100644
--- a/net/ipv4/netfilter/ipchains_core.c
+++ b/net/ipv4/netfilter/ipchains_core.c
@@ -534,7 +534,7 @@ ip_fw_domatch(struct ip_fwkernel *f,
}
if (f->ipfw.fw_flg & IP_FW_F_NETLINK) {
#if defined(CONFIG_NETLINK_DEV) || defined(CONFIG_NETLINK_DEV_MODULE)
- size_t len = min(f->ipfw.fw_outputsize, ntohs(ip->tot_len))
+ size_t len = min(unsigned int, f->ipfw.fw_outputsize, ntohs(ip->tot_len))
+ sizeof(__u32) + sizeof(skb->nfmark) + IFNAMSIZ;
struct sk_buff *outskb=alloc_skb(len, GFP_ATOMIC);
diff --git a/net/ipv4/netfilter/ipfwadm_core.c b/net/ipv4/netfilter/ipfwadm_core.c
index b1ec4cbfda11..d59d540533b2 100644
--- a/net/ipv4/netfilter/ipfwadm_core.c
+++ b/net/ipv4/netfilter/ipfwadm_core.c
@@ -20,7 +20,7 @@
* license in recognition of the original copyright.
* -- Alan Cox.
*
- * $Id: ipfwadm_core.c,v 1.5 2001/06/01 14:56:53 davem Exp $
+ * $Id: ipfwadm_core.c,v 1.8 2001/08/13 18:56:12 davem Exp $
*
* Ported from BSD to Linux,
* Alan Cox 22/Nov/1994.
@@ -648,7 +648,9 @@ int ip_fw_chk(struct iphdr *ip, struct net_device *rif, __u16 *redirport,
struct sk_buff *skb=alloc_skb(128, GFP_ATOMIC);
if(skb)
{
- int len=min(128,ntohs(ip->tot_len));
+ int len = min(unsigned int,
+ 128, ntohs(ip->tot_len));
+
skb_put(skb,len);
memcpy(skb->data,ip,len);
if(netlink_post(NETLINK_FIREWALL, skb))
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index d5bed1ea9c43..e5432e639c09 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -5,7 +5,7 @@
*
* ROUTE - implementation of the IP router.
*
- * Version: $Id: route.c,v 1.95 2001/07/10 22:32:51 davem Exp $
+ * Version: $Id: route.c,v 1.98 2001/08/13 18:56:12 davem Exp $
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -515,14 +515,14 @@ static int rt_garbage_collect(void)
equilibrium = ipv4_dst_ops.gc_thresh;
goal = atomic_read(&ipv4_dst_ops.entries) - equilibrium;
if (goal > 0) {
- equilibrium += min(goal / 2, rt_hash_mask + 1);
+ equilibrium += min(unsigned int, goal / 2, rt_hash_mask + 1);
goal = atomic_read(&ipv4_dst_ops.entries) - equilibrium;
}
} else {
/* We are in dangerous area. Try to reduce cache really
* aggressively.
*/
- goal = max(goal / 2, rt_hash_mask + 1);
+ goal = max(unsigned int, goal / 2, rt_hash_mask + 1);
equilibrium = atomic_read(&ipv4_dst_ops.entries) - goal;
}
@@ -1207,8 +1207,8 @@ static void rt_set_nexthop(struct rtable *rt, struct fib_result *res, u32 itag)
if (rt->u.dst.pmtu > IP_MAX_MTU)
rt->u.dst.pmtu = IP_MAX_MTU;
if (rt->u.dst.advmss == 0)
- rt->u.dst.advmss = max(rt->u.dst.dev->mtu - 40,
- ip_rt_min_advmss);
+ rt->u.dst.advmss = max(unsigned int, rt->u.dst.dev->mtu - 40,
+ ip_rt_min_advmss);
if (rt->u.dst.advmss > 65535 - 40)
rt->u.dst.advmss = 65535 - 40;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index f8eff546c7ff..eb0f36fe9ac8 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -5,7 +5,7 @@
*
* Implementation of the Transmission Control Protocol(TCP).
*
- * Version: $Id: tcp.c,v 1.205 2001/05/05 22:25:30 davem Exp $
+ * Version: $Id: tcp.c,v 1.208 2001/08/13 18:56:12 davem Exp $
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -852,7 +852,7 @@ ssize_t do_tcp_sendpages(struct sock *sk, struct page **pages, int poffset, size
page = pages[poffset/PAGE_SIZE];
offset = poffset % PAGE_SIZE;
- size = min(psize, PAGE_SIZE-offset);
+ size = min(unsigned int, psize, PAGE_SIZE-offset);
if (tp->send_head==NULL || (copy = mss_now - skb->len) <= 0) {
new_segment:
@@ -2326,7 +2326,7 @@ int tcp_getsockopt(struct sock *sk, int level, int optname, char *optval,
if(get_user(len,optlen))
return -EFAULT;
- len = min(len, sizeof(int));
+ len = min(unsigned int, len, sizeof(int));
if(len < 0)
return -EINVAL;
@@ -2421,7 +2421,7 @@ int tcp_getsockopt(struct sock *sk, int level, int optname, char *optval,
info.tcpi_advmss = tp->advmss;
info.tcpi_reordering = tp->reordering;
- len = min(len, sizeof(info));
+ len = min(unsigned int, len, sizeof(info));
if(put_user(len, optlen))
return -EFAULT;
if(copy_to_user(optval, &info,len))
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 0c7e25da7c41..74563cde650a 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5,7 +5,7 @@
*
* Implementation of the Transmission Control Protocol(TCP).
*
- * Version: $Id: tcp_input.c,v 1.232 2001/05/24 22:32:49 davem Exp $
+ * Version: $Id: tcp_input.c,v 1.235 2001/08/13 18:56:12 davem Exp $
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -168,7 +168,7 @@ static void tcp_incr_quickack(struct tcp_opt *tp)
if (quickacks==0)
quickacks=2;
if (quickacks > tp->ack.quick)
- tp->ack.quick = min(quickacks, TCP_MAX_QUICKACKS);
+ tp->ack.quick = min(unsigned int, quickacks, TCP_MAX_QUICKACKS);
}
void tcp_enter_quickack_mode(struct tcp_opt *tp)
@@ -198,7 +198,7 @@ static void tcp_fixup_sndbuf(struct sock *sk)
int sndmem = tp->mss_clamp+MAX_TCP_HEADER+16+sizeof(struct sk_buff);
if (sk->sndbuf < 3*sndmem)
- sk->sndbuf = min(3*sndmem, sysctl_tcp_wmem[2]);
+ sk->sndbuf = min(int, 3*sndmem, sysctl_tcp_wmem[2]);
}
/* 2. Tuning advertised window (window_clamp, rcv_ssthresh)
@@ -262,7 +262,7 @@ tcp_grow_window(struct sock *sk, struct tcp_opt *tp, struct sk_buff *skb)
incr = __tcp_grow_window(sk, tp, skb);
if (incr) {
- tp->rcv_ssthresh = min(tp->rcv_ssthresh + incr, tp->window_clamp);
+ tp->rcv_ssthresh = min(u32, tp->rcv_ssthresh + incr, tp->window_clamp);
tp->ack.quick |= 1;
}
}
@@ -282,7 +282,7 @@ static void tcp_fixup_rcvbuf(struct sock *sk)
while (tcp_win_from_space(rcvmem) < tp->advmss)
rcvmem += 128;
if (sk->rcvbuf < 4*rcvmem)
- sk->rcvbuf = min(4*rcvmem, sysctl_tcp_rmem[2]);
+ sk->rcvbuf = min(int, 4*rcvmem, sysctl_tcp_rmem[2]);
}
/* 4. Try to fixup all. It is made iimediately after connection enters
@@ -304,16 +304,16 @@ static void tcp_init_buffer_space(struct sock *sk)
tp->window_clamp = maxwin;
if (sysctl_tcp_app_win && maxwin>4*tp->advmss)
- tp->window_clamp = max(maxwin-(maxwin>>sysctl_tcp_app_win), 4*tp->advmss);
+ tp->window_clamp = max(u32, maxwin-(maxwin>>sysctl_tcp_app_win), 4*tp->advmss);
}
/* Force reservation of one segment. */
if (sysctl_tcp_app_win &&
tp->window_clamp > 2*tp->advmss &&
tp->window_clamp + tp->advmss > maxwin)
- tp->window_clamp = max(2*tp->advmss, maxwin-tp->advmss);
+ tp->window_clamp = max(u32, 2*tp->advmss, maxwin-tp->advmss);
- tp->rcv_ssthresh = min(tp->rcv_ssthresh, tp->window_clamp);
+ tp->rcv_ssthresh = min(u32, tp->rcv_ssthresh, tp->window_clamp);
tp->snd_cwnd_stamp = tcp_time_stamp;
}
@@ -338,7 +338,7 @@ static void tcp_clamp_window(struct sock *sk, struct tcp_opt *tp)
!(sk->userlocks&SOCK_RCVBUF_LOCK) &&
!tcp_memory_pressure &&
atomic_read(&tcp_memory_allocated) < sysctl_tcp_mem[0])
- sk->rcvbuf = min(atomic_read(&sk->rmem_alloc), sysctl_tcp_rmem[2]);
+ sk->rcvbuf = min(int, atomic_read(&sk->rmem_alloc), sysctl_tcp_rmem[2]);
}
if (atomic_read(&sk->rmem_alloc) > sk->rcvbuf) {
app_win += ofo_win;
@@ -346,11 +346,11 @@ static void tcp_clamp_window(struct sock *sk, struct tcp_opt *tp)
app_win >>= 1;
if (app_win > tp->ack.rcv_mss)
app_win -= tp->ack.rcv_mss;
- app_win = max(app_win, 2*tp->advmss);
+ app_win = max(unsigned int, app_win, 2*tp->advmss);
if (!ofo_win)
- tp->window_clamp = min(tp->window_clamp, app_win);
- tp->rcv_ssthresh = min(tp->window_clamp, 2*tp->advmss);
+ tp->window_clamp = min(u32, tp->window_clamp, app_win);
+ tp->rcv_ssthresh = min(u32, tp->window_clamp, 2*tp->advmss);
}
}
@@ -472,7 +472,7 @@ static __inline__ void tcp_rtt_estimator(struct tcp_opt *tp, __u32 mrtt)
/* no previous measure. */
tp->srtt = m<<3; /* take the measured time to be rtt */
tp->mdev = m<<2; /* make sure rto = 3*rtt */
- tp->mdev_max = tp->rttvar = max(tp->mdev, TCP_RTO_MIN);
+ tp->mdev_max = tp->rttvar = max(u32, tp->mdev, TCP_RTO_MIN);
tp->rtt_seq = tp->snd_nxt;
}
}
@@ -575,7 +575,7 @@ void tcp_update_metrics(struct sock *sk)
tp->ca_state == TCP_CA_Open) {
/* Cong. avoidance phase, cwnd is reliable. */
if (!(dst->mxlock&(1<<RTAX_SSTHRESH)))
- dst->ssthresh = max(tp->snd_cwnd>>1, tp->snd_ssthresh);
+ dst->ssthresh = max(u32, tp->snd_cwnd>>1, tp->snd_ssthresh);
if (!(dst->mxlock&(1<<RTAX_CWND)))
dst->cwnd = (dst->cwnd + tp->snd_cwnd)>>1;
} else {
@@ -617,7 +617,7 @@ __u32 tcp_init_cwnd(struct tcp_opt *tp)
else if (cwnd > tp->snd_ssthresh)
cwnd = tp->snd_ssthresh;
- return min(cwnd, tp->snd_cwnd_clamp);
+ return min(u32, cwnd, tp->snd_cwnd_clamp);
}
/* Initialize metrics on socket. */
@@ -668,7 +668,7 @@ static void tcp_init_metrics(struct sock *sk)
tp->srtt = dst->rtt;
if (dst->rttvar > tp->mdev) {
tp->mdev = dst->rttvar;
- tp->mdev_max = tp->rttvar = max(tp->mdev, TCP_RTO_MIN);
+ tp->mdev_max = tp->rttvar = max(u32, tp->mdev, TCP_RTO_MIN);
}
tcp_set_rto(tp);
tcp_bound_rto(tp);
@@ -693,7 +693,7 @@ reset:
static void tcp_update_reordering(struct tcp_opt *tp, int metric, int ts)
{
if (metric > tp->reordering) {
- tp->reordering = min(TCP_MAX_REORDERING, metric);
+ tp->reordering = min(unsigned int, TCP_MAX_REORDERING, metric);
/* This exciting event is worth to be remembered. 8) */
if (ts)
@@ -848,12 +848,12 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
if (sacked&TCPCB_RETRANS) {
if ((dup_sack && in_sack) &&
(sacked&TCPCB_SACKED_ACKED))
- reord = min(fack_count, reord);
+ reord = min(int, fack_count, reord);
} else {
/* If it was in a hole, we detected reordering. */
if (fack_count < prior_fackets &&
!(sacked&TCPCB_SACKED_ACKED))
- reord = min(fack_count, reord);
+ reord = min(int, fack_count, reord);
}
/* Nothing to do; acked frame is about to be dropped. */
@@ -885,7 +885,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
*/
if (!(sacked & TCPCB_RETRANS) &&
fack_count < prior_fackets)
- reord = min(fack_count, reord);
+ reord = min(int, fack_count, reord);
if (sacked & TCPCB_LOST) {
TCP_SKB_CB(skb)->sacked &= ~TCPCB_LOST;
@@ -901,7 +901,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
tp->fackets_out = fack_count;
} else {
if (dup_sack && (sacked&TCPCB_RETRANS))
- reord = min(fack_count, reord);
+ reord = min(int, fack_count, reord);
}
/* D-SACK. We can detect redundant retransmission
@@ -1019,7 +1019,7 @@ void tcp_enter_loss(struct sock *sk, int how)
}
tcp_sync_left_out(tp);
- tp->reordering = min(tp->reordering, sysctl_tcp_reordering);
+ tp->reordering = min(unsigned int, tp->reordering, sysctl_tcp_reordering);
tp->ca_state = TCP_CA_Loss;
tp->high_seq = tp->snd_nxt;
TCP_ECN_queue_cwr(tp);
@@ -1177,7 +1177,7 @@ tcp_time_to_recover(struct sock *sk, struct tcp_opt *tp)
* recovery more?
*/
if (tp->packets_out <= tp->reordering &&
- tp->sacked_out >= max(tp->packets_out/2, sysctl_tcp_reordering) &&
+ tp->sacked_out >= max(u32, tp->packets_out/2, sysctl_tcp_reordering) &&
!tcp_may_send_now(sk, tp)) {
/* We have nothing to send. This connection is limited
* either by receiver window or by application.
@@ -1194,7 +1194,9 @@ tcp_time_to_recover(struct sock *sk, struct tcp_opt *tp)
*/
static void tcp_check_reno_reordering(struct tcp_opt *tp, int addend)
{
- int holes = min(max(tp->lost_out, 1), tp->packets_out);
+ u32 holes = min(unsigned int,
+ max(unsigned int, tp->lost_out, 1),
+ tp->packets_out);
if (tp->sacked_out + holes > tp->packets_out) {
tp->sacked_out = tp->packets_out - holes;
@@ -1289,7 +1291,7 @@ static void tcp_update_scoreboard(struct sock *sk, struct tcp_opt *tp)
*/
static __inline__ void tcp_moderate_cwnd(struct tcp_opt *tp)
{
- tp->snd_cwnd = min(tp->snd_cwnd,
+ tp->snd_cwnd = min(u32, tp->snd_cwnd,
tcp_packets_in_flight(tp)+tcp_max_burst(tp));
tp->snd_cwnd_stamp = tcp_time_stamp;
}
@@ -1306,7 +1308,7 @@ static void tcp_cwnd_down(struct tcp_opt *tp)
if (decr && tp->snd_cwnd > tp->snd_ssthresh/2)
tp->snd_cwnd -= decr;
- tp->snd_cwnd = min(tp->snd_cwnd, tcp_packets_in_flight(tp)+1);
+ tp->snd_cwnd = min(u32, tp->snd_cwnd, tcp_packets_in_flight(tp)+1);
tp->snd_cwnd_stamp = tcp_time_stamp;
}
@@ -1338,13 +1340,15 @@ static void DBGUNDO(struct sock *sk, struct tcp_opt *tp, const char *msg)
static void tcp_undo_cwr(struct tcp_opt *tp, int undo)
{
if (tp->prior_ssthresh) {
- tp->snd_cwnd = max(tp->snd_cwnd, tp->snd_ssthresh<<1);
+ tp->snd_cwnd = max(unsigned int,
+ tp->snd_cwnd, tp->snd_ssthresh<<1);
+
if (undo && tp->prior_ssthresh > tp->snd_ssthresh) {
tp->snd_ssthresh = tp->prior_ssthresh;
TCP_ECN_withdraw_cwr(tp);
}
} else {
- tp->snd_cwnd = max(tp->snd_cwnd, tp->snd_ssthresh);
+ tp->snd_cwnd = max(unsigned int, tp->snd_cwnd, tp->snd_ssthresh);
}
tcp_moderate_cwnd(tp);
tp->snd_cwnd_stamp = tcp_time_stamp;
@@ -1446,7 +1450,7 @@ static int tcp_try_undo_loss(struct sock *sk, struct tcp_opt *tp)
static __inline__ void tcp_complete_cwr(struct tcp_opt *tp)
{
- tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh);
+ tp->snd_cwnd = min(u32, tp->snd_cwnd, tp->snd_ssthresh);
tp->snd_cwnd_stamp = tcp_time_stamp;
}
@@ -1832,7 +1836,7 @@ static void tcp_ack_probe(struct sock *sk)
*/
} else {
tcp_reset_xmit_timer(sk, TCP_TIME_PROBE0,
- min(tp->rto << tp->backoff, TCP_RTO_MAX));
+ min(u32, tp->rto << tp->backoff, TCP_RTO_MAX));
}
}
@@ -2319,7 +2323,7 @@ static __inline__ void tcp_dsack_set(struct tcp_opt *tp, u32 seq, u32 end_seq)
tp->dsack = 1;
tp->duplicate_sack[0].start_seq = seq;
tp->duplicate_sack[0].end_seq = end_seq;
- tp->eff_sacks = min(tp->num_sacks+1, 4-tp->tstamp_ok);
+ tp->eff_sacks = min(unsigned int, tp->num_sacks+1, 4-tp->tstamp_ok);
}
}
@@ -2372,7 +2376,7 @@ static void tcp_sack_maybe_coalesce(struct tcp_opt *tp)
* Decrease num_sacks.
*/
tp->num_sacks--;
- tp->eff_sacks = min(tp->num_sacks+tp->dsack, 4-tp->tstamp_ok);
+ tp->eff_sacks = min(unsigned int, tp->num_sacks+tp->dsack, 4-tp->tstamp_ok);
for(i=this_sack; i < tp->num_sacks; i++)
sp[i] = sp[i+1];
continue;
@@ -2434,7 +2438,7 @@ new_sack:
sp->start_seq = seq;
sp->end_seq = end_seq;
tp->num_sacks++;
- tp->eff_sacks = min(tp->num_sacks+tp->dsack, 4-tp->tstamp_ok);
+ tp->eff_sacks = min(unsigned int, tp->num_sacks+tp->dsack, 4-tp->tstamp_ok);
}
/* RCV.NXT advances, some SACKs should be eaten. */
@@ -2471,7 +2475,7 @@ static void tcp_sack_remove(struct tcp_opt *tp)
}
if (num_sacks != tp->num_sacks) {
tp->num_sacks = num_sacks;
- tp->eff_sacks = min(tp->num_sacks+tp->dsack, 4-tp->tstamp_ok);
+ tp->eff_sacks = min(unsigned int, tp->num_sacks+tp->dsack, 4-tp->tstamp_ok);
}
}
@@ -2537,7 +2541,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
if (tp->dsack) {
tp->dsack = 0;
- tp->eff_sacks = min(tp->num_sacks, 4-tp->tstamp_ok);
+ tp->eff_sacks = min(unsigned int, tp->num_sacks, 4-tp->tstamp_ok);
}
/* Queue data for delivery to the user.
@@ -2554,7 +2558,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
tp->ucopy.len &&
sk->lock.users &&
!tp->urg_data) {
- int chunk = min(skb->len, tp->ucopy.len);
+ int chunk = min(unsigned int, skb->len, tp->ucopy.len);
__set_current_state(TASK_RUNNING);
@@ -2803,7 +2807,7 @@ tcp_collapse(struct sock *sk, struct sk_buff *head,
if (offset < 0) BUG();
if (size > 0) {
- size = min(copy, size);
+ size = min(int, copy, size);
if (skb_copy_bits(skb, offset, skb_put(nskb, size), size))
BUG();
TCP_SKB_CB(nskb)->end_seq += size;
@@ -2882,7 +2886,7 @@ static int tcp_prune_queue(struct sock *sk)
if (atomic_read(&sk->rmem_alloc) >= sk->rcvbuf)
tcp_clamp_window(sk, tp);
else if (tcp_memory_pressure)
- tp->rcv_ssthresh = min(tp->rcv_ssthresh, 4*tp->advmss);
+ tp->rcv_ssthresh = min(u32, tp->rcv_ssthresh, 4*tp->advmss);
tcp_collapse_ofo_queue(sk);
tcp_collapse(sk, sk->receive_queue.next,
@@ -2937,7 +2941,7 @@ void tcp_cwnd_application_limited(struct sock *sk)
if (tp->ca_state == TCP_CA_Open &&
sk->socket && !test_bit(SOCK_NOSPACE, &sk->socket->flags)) {
/* Limited by application or receiver window. */
- u32 win_used = max(tp->snd_cwnd_used, 2);
+ u32 win_used = max(u32, tp->snd_cwnd_used, 2);
if (win_used < tp->snd_cwnd) {
tp->snd_ssthresh = tcp_current_ssthresh(tp);
tp->snd_cwnd = (tp->snd_cwnd+win_used)>>1;
@@ -2963,10 +2967,10 @@ static void tcp_new_space(struct sock *sk)
int sndmem, demanded;
sndmem = tp->mss_clamp+MAX_TCP_HEADER+16+sizeof(struct sk_buff);
- demanded = max(tp->snd_cwnd, tp->reordering+1);
+ demanded = max(unsigned int, tp->snd_cwnd, tp->reordering+1);
sndmem *= 2*demanded;
if (sndmem > sk->sndbuf)
- sk->sndbuf = min(sndmem, sysctl_tcp_wmem[2]);
+ sk->sndbuf = min(int, sndmem, sysctl_tcp_wmem[2]);
tp->snd_cwnd_stamp = tcp_time_stamp;
}
@@ -3516,7 +3520,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
if (tp->wscale_ok == 0) {
tp->snd_wscale = tp->rcv_wscale = 0;
- tp->window_clamp = min(tp->window_clamp,65535);
+ tp->window_clamp = min(u32, tp->window_clamp, 65535);
}
if (tp->saw_tstamp) {
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 97fb6c8ca97b..701834143a98 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -5,7 +5,7 @@
*
* Implementation of the Transmission Control Protocol(TCP).
*
- * Version: $Id: tcp_minisocks.c,v 1.11 2001/08/03 14:27:25 davem Exp $
+ * Version: $Id: tcp_minisocks.c,v 1.12 2001/08/13 18:56:13 davem Exp $
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -766,7 +766,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct open_request *req,
newtp->rcv_wscale = req->rcv_wscale;
} else {
newtp->snd_wscale = newtp->rcv_wscale = 0;
- newtp->window_clamp = min(newtp->window_clamp,65535);
+ newtp->window_clamp = min(u32, newtp->window_clamp, 65535);
}
newtp->snd_wnd = ntohs(skb->h.th->window) << newtp->snd_wscale;
newtp->max_window = newtp->snd_wnd;
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 91e4a7b848b2..f4ec7c94a400 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -5,7 +5,7 @@
*
* Implementation of the Transmission Control Protocol(TCP).
*
- * Version: $Id: tcp_output.c,v 1.137 2001/06/29 21:11:28 davem Exp $
+ * Version: $Id: tcp_output.c,v 1.140 2001/08/13 18:56:12 davem Exp $
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -105,11 +105,11 @@ static void tcp_cwnd_restart(struct tcp_opt *tp)
u32 cwnd = tp->snd_cwnd;
tp->snd_ssthresh = tcp_current_ssthresh(tp);
- restart_cwnd = min(restart_cwnd, cwnd);
+ restart_cwnd = min(u32, restart_cwnd, cwnd);
while ((delta -= tp->rto) > 0 && cwnd > restart_cwnd)
cwnd >>= 1;
- tp->snd_cwnd = max(cwnd, restart_cwnd);
+ tp->snd_cwnd = max(u32, cwnd, restart_cwnd);
tp->snd_cwnd_stamp = tcp_time_stamp;
tp->snd_cwnd_used = 0;
}
@@ -526,7 +526,7 @@ int tcp_sync_mss(struct sock *sk, u32 pmtu)
/* Bound mss with half of window */
if (tp->max_window && mss_now > (tp->max_window>>1))
- mss_now = max((tp->max_window>>1), 68 - tp->tcp_header_len);
+ mss_now = max(u32, (tp->max_window>>1), 68 - tp->tcp_header_len);
/* And store cached results */
tp->pmtu_cookie = pmtu;
@@ -651,7 +651,7 @@ u32 __tcp_select_window(struct sock *sk)
*/
int mss = tp->ack.rcv_mss;
int free_space = tcp_space(sk);
- int full_space = min(tp->window_clamp, tcp_full_space(sk));
+ int full_space = min(unsigned int, tp->window_clamp, tcp_full_space(sk));
int window;
if (mss > full_space)
@@ -661,7 +661,7 @@ u32 __tcp_select_window(struct sock *sk)
tp->ack.quick = 0;
if (tcp_memory_pressure)
- tp->rcv_ssthresh = min(tp->rcv_ssthresh, 4*tp->advmss);
+ tp->rcv_ssthresh = min(u32, tp->rcv_ssthresh, 4*tp->advmss);
if (free_space < mss)
return 0;
@@ -817,7 +817,7 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
/* Do not sent more than we queued. 1/4 is reserved for possible
* copying overhead: frgagmentation, tunneling, mangling etc.
*/
- if (atomic_read(&sk->wmem_alloc) > min(sk->wmem_queued+(sk->wmem_queued>>2),sk->sndbuf))
+ if (atomic_read(&sk->wmem_alloc) > min(int, sk->wmem_queued+(sk->wmem_queued>>2),sk->sndbuf))
return -EAGAIN;
/* If receiver has shrunk his window, and skb is out of
@@ -1264,13 +1264,13 @@ void tcp_send_delayed_ack(struct sock *sk)
* directly.
*/
if (tp->srtt) {
- int rtt = max(tp->srtt>>3, TCP_DELACK_MIN);
+ int rtt = max(unsigned int, tp->srtt>>3, TCP_DELACK_MIN);
if (rtt < max_ato)
max_ato = rtt;
}
- ato = min(ato, max_ato);
+ ato = min(int, ato, max_ato);
}
/* Stay within the limit we were given */
@@ -1386,7 +1386,7 @@ int tcp_write_wakeup(struct sock *sk)
*/
if (seg_size < TCP_SKB_CB(skb)->end_seq - TCP_SKB_CB(skb)->seq ||
skb->len > mss) {
- seg_size = min(seg_size, mss);
+ seg_size = min(int, seg_size, mss);
TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH;
if (tcp_fragment(sk, skb, seg_size))
return -1;
@@ -1429,7 +1429,7 @@ void tcp_send_probe0(struct sock *sk)
tp->backoff++;
tp->probes_out++;
tcp_reset_xmit_timer (sk, TCP_TIME_PROBE0,
- min(tp->rto << tp->backoff, TCP_RTO_MAX));
+ min(u32, tp->rto << tp->backoff, TCP_RTO_MAX));
} else {
/* If packet was not sent due to local congestion,
* do not backoff and do not remember probes_out.
@@ -1440,6 +1440,6 @@ void tcp_send_probe0(struct sock *sk)
if (!tp->probes_out)
tp->probes_out=1;
tcp_reset_xmit_timer (sk, TCP_TIME_PROBE0,
- min(tp->rto << tp->backoff, TCP_RESOURCE_PROBE_INTERVAL));
+ min(unsigned int, tp->rto << tp->backoff, TCP_RESOURCE_PROBE_INTERVAL));
}
}
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 1ee26fde4cb1..421bfef2e427 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -5,7 +5,7 @@
*
* Implementation of the Transmission Control Protocol(TCP).
*
- * Version: $Id: tcp_timer.c,v 1.83 2001/03/07 22:00:57 davem Exp $
+ * Version: $Id: tcp_timer.c,v 1.85 2001/08/13 18:56:12 davem Exp $
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -248,7 +248,7 @@ static void tcp_delack_timer(unsigned long data)
if (tcp_ack_scheduled(tp)) {
if (!tp->ack.pingpong) {
/* Delayed ACK missed: inflate ATO. */
- tp->ack.ato = min(tp->ack.ato<<1, tp->rto);
+ tp->ack.ato = min(u32, tp->ack.ato << 1, tp->rto);
} else {
/* Delayed ACK missed: leave pingpong mode and
* deflate ATO.
@@ -381,7 +381,7 @@ static void tcp_retransmit_timer(struct sock *sk)
if (!tp->retransmits)
tp->retransmits=1;
tcp_reset_xmit_timer(sk, TCP_TIME_RETRANS,
- min(tp->rto, TCP_RESOURCE_PROBE_INTERVAL));
+ min(u32, tp->rto, TCP_RESOURCE_PROBE_INTERVAL));
goto out;
}
@@ -404,7 +404,7 @@ static void tcp_retransmit_timer(struct sock *sk)
tp->retransmits++;
out_reset_timer:
- tp->rto = min(tp->rto << 1, TCP_RTO_MAX);
+ tp->rto = min(u32, tp->rto << 1, TCP_RTO_MAX);
tcp_reset_xmit_timer(sk, TCP_TIME_RETRANS, tp->rto);
if (tp->retransmits > sysctl_tcp_retries1)
__sk_dst_reset(sk);
@@ -517,7 +517,8 @@ static void tcp_synack_timer(struct sock *sk)
if (req->retrans++ == 0)
lopt->qlen_young--;
- timeo = min((TCP_TIMEOUT_INIT << req->retrans),
+ timeo = min(unsigned long,
+ (TCP_TIMEOUT_INIT << req->retrans),
TCP_RTO_MAX);
req->expires = now + timeo;
reqp = &req->dl_next;
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index fc1c9f392909..fbc0e6bd77ed 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -5,7 +5,7 @@
* Authors:
* Pedro Roque <roque@di.fc.ul.pt>
*
- * $Id: icmp.c,v 1.32 2001/06/10 09:20:07 davem Exp $
+ * $Id: icmp.c,v 1.35 2001/08/13 18:56:13 davem Exp $
*
* Based on net/ipv4/icmp.c
*
@@ -365,7 +365,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
msg.daddr = &hdr->saddr;
len = skb->len - msg.offset + sizeof(struct icmp6hdr);
- len = min(len, IPV6_MIN_MTU - sizeof(struct ipv6hdr));
+ len = min(unsigned int, len, IPV6_MIN_MTU - sizeof(struct ipv6hdr));
if (len < 0) {
printk(KERN_DEBUG "icmp: len problem\n");
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 2332f754928a..81b5341eeb81 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -7,7 +7,7 @@
*
* Based on linux/net/ipv4/ip_sockglue.c
*
- * $Id: ipv6_sockglue.c,v 1.36 2001/02/26 05:59:07 davem Exp $
+ * $Id: ipv6_sockglue.c,v 1.39 2001/08/13 18:56:13 davem Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -535,7 +535,7 @@ int ipv6_getsockopt(struct sock *sk, int level, int optname, char *optval,
return -EINVAL;
#endif
}
- len=min(sizeof(int),len);
+ len = min(unsigned int, sizeof(int), len);
if(put_user(len, optlen))
return -EFAULT;
if(copy_to_user(optval,&val,len))
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index d9970663ae42..3d243fabd47a 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -5,7 +5,7 @@
* Authors:
* Pedro Roque <roque@di.fc.ul.pt>
*
- * $Id: mcast.c,v 1.37 2001/04/25 20:46:34 davem Exp $
+ * $Id: mcast.c,v 1.38 2001/08/15 07:36:31 davem Exp $
*
* Based on linux/ipv4/igmp.c and linux/ipv4/ip_sockglue.c
*
@@ -90,7 +90,6 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, struct in6_addr *addr)
mc_lst->next = NULL;
memcpy(&mc_lst->addr, addr, sizeof(struct in6_addr));
- mc_lst->ifindex = ifindex;
if (ifindex == 0) {
struct rt6_info *rt;
@@ -108,6 +107,8 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, struct in6_addr *addr)
return -ENODEV;
}
+ mc_lst->ifindex = dev->ifindex;
+
/*
* now add/increase the group membership on the device
*/
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index e4257e9f3b15..2812b12b2066 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -846,7 +846,8 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
}
}
- rd_len = min(IPV6_MIN_MTU-sizeof(struct ipv6hdr)-len, skb->len + 8);
+ rd_len = min(unsigned int,
+ IPV6_MIN_MTU-sizeof(struct ipv6hdr)-len, skb->len + 8);
rd_len &= ~0x7;
len += rd_len;
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index bee18b4e13fc..cb144410d15e 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -7,7 +7,7 @@
*
* Adapted from linux/net/ipv4/raw.c
*
- * $Id: raw.c,v 1.46 2001/06/05 11:36:55 davem Exp $
+ * $Id: raw.c,v 1.49 2001/08/13 18:56:13 davem Exp $
*
* Fixes:
* Hideaki YOSHIFUJI : sin6_scope_id support
@@ -699,7 +699,7 @@ static int rawv6_getsockopt(struct sock *sk, int level, int optname,
return -ENOPROTOOPT;
}
- len=min(sizeof(int),len);
+ len = min(unsigned int, sizeof(int), len);
if (put_user(len, optlen))
return -EFAULT;
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index f6e0e4787bb7..2448e18f9098 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -5,7 +5,7 @@
* Authors:
* Pedro Roque <roque@di.fc.ul.pt>
*
- * $Id: route.c,v 1.51 2001/05/03 07:02:47 davem Exp $
+ * $Id: route.c,v 1.54 2001/08/13 18:56:13 davem Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -785,7 +785,7 @@ int ip6_route_add(struct in6_rtmsg *rtmsg)
install_route:
rt->u.dst.pmtu = ipv6_get_mtu(dev);
- rt->u.dst.advmss = max(rt->u.dst.pmtu - 60, ip6_rt_min_advmss);
+ rt->u.dst.advmss = max(unsigned int, rt->u.dst.pmtu - 60, ip6_rt_min_advmss);
/* Maximal non-jumbo IPv6 payload is 65535 and corresponding
MSS is 65535 - tcp_header_size. 65535 is also valid and
means: "any MSS, rely only on pmtu discovery"
@@ -944,7 +944,7 @@ source_ok:
nrt->rt6i_nexthop = neigh_clone(neigh);
/* Reset pmtu, it may be better */
nrt->u.dst.pmtu = ipv6_get_mtu(neigh->dev);
- nrt->u.dst.advmss = max(nrt->u.dst.pmtu - 60, ip6_rt_min_advmss);
+ nrt->u.dst.advmss = max(unsigned int, nrt->u.dst.pmtu - 60, ip6_rt_min_advmss);
if (rt->u.dst.advmss > 65535-20)
rt->u.dst.advmss = 65535;
nrt->rt6i_hoplimit = ipv6_get_hoplimit(neigh->dev);
@@ -1199,7 +1199,7 @@ int ip6_rt_addr_add(struct in6_addr *addr, struct net_device *dev)
rt->u.dst.output = ip6_output;
rt->rt6i_dev = dev_get_by_name("lo");
rt->u.dst.pmtu = ipv6_get_mtu(rt->rt6i_dev);
- rt->u.dst.advmss = max(rt->u.dst.pmtu - 60, ip6_rt_min_advmss);
+ rt->u.dst.advmss = max(unsigned int, rt->u.dst.pmtu - 60, ip6_rt_min_advmss);
if (rt->u.dst.advmss > 65535-20)
rt->u.dst.advmss = 65535;
rt->rt6i_hoplimit = ipv6_get_hoplimit(rt->rt6i_dev);
@@ -1390,7 +1390,7 @@ static int rt6_mtu_change_route(struct rt6_info *rt, void *p_arg)
rt->u.dst.pmtu > arg->mtu &&
!(rt->u.dst.mxlock&(1<<RTAX_MTU)))
rt->u.dst.pmtu = arg->mtu;
- rt->u.dst.advmss = max(arg->mtu - 60, ip6_rt_min_advmss);
+ rt->u.dst.advmss = max(unsigned int, arg->mtu - 60, ip6_rt_min_advmss);
if (rt->u.dst.advmss > 65535-20)
rt->u.dst.advmss = 65535;
return 0;
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index 669cdbb06c3f..36df373aa1bb 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -1890,7 +1890,7 @@ static int ipx_getsockopt(struct socket *sock, int level, int optname,
if (get_user(len, optlen))
goto out;
- len = min(len, sizeof(int));
+ len = min(unsigned int, len, sizeof(int));
ret = -EINVAL;
if(len < 0)
goto out;
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index 49d2110d8f85..e42a9abf228b 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -1400,7 +1400,7 @@ static int irda_recvmsg_stream(struct socket *sock, struct msghdr *msg,
continue;
}
- chunk = min(skb->len, size);
+ chunk = min(unsigned int, skb->len, size);
if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) {
skb_queue_head(&sk->receive_queue, skb);
if (copied == 0)
diff --git a/net/khttpd/datasending.c b/net/khttpd/datasending.c
index 5726dca3297e..b0f58dca0006 100644
--- a/net/khttpd/datasending.c
+++ b/net/khttpd/datasending.c
@@ -105,8 +105,8 @@ int DataSending(const int CPUNR)
Space = sock_wspace(CurrentRequest->sock->sk);
- ReadSize = min(4*4096,CurrentRequest->FileLength - CurrentRequest->BytesSent);
- ReadSize = min(ReadSize , Space );
+ ReadSize = min(int, 4 * 4096, CurrentRequest->FileLength - CurrentRequest->BytesSent);
+ ReadSize = min(int, ReadSize, Space);
if (ReadSize>0)
{
diff --git a/net/khttpd/prototypes.h b/net/khttpd/prototypes.h
index 78e891d8e7f2..c47830886897 100644
--- a/net/khttpd/prototypes.h
+++ b/net/khttpd/prototypes.h
@@ -19,17 +19,6 @@
#define CONFIG_KHTTPD_NUMCPU 16 /* Maximum number of threads */
-/* the TCP/IP stack defines a __BROKEN__ set of min/max functions !! */
-/* So we better define our own. */
-
-/* Broken means: working on unsigned data only, which is not acceptable
- for kHTTPd and probably a lot of other functions. */
-
-#undef min
-#undef max
-#define min(a,b) ( (a) < (b) ? (a) : (b) )
-#define max(a,b) ( (a) > (b) ? (a) : (b) )
-
#ifdef OOPSTRACE
#define EnterFunction(x) printk("Enter: %s, %s line %i\n",x,__FILE__,__LINE__)
#define LeaveFunction(x) printk("Leave: %s, %s line %i\n",x,__FILE__,__LINE__)
diff --git a/net/khttpd/rfc.c b/net/khttpd/rfc.c
index a9f2491781e9..6070ef563406 100644
--- a/net/khttpd/rfc.c
+++ b/net/khttpd/rfc.c
@@ -326,9 +326,9 @@ void ParseHeader(char *Buffer,const int length, struct http_request *Head)
strncpy(Head->FileName,sysctl_khttpd_docroot,sizeof(Head->FileName));
PrefixLen = strlen(sysctl_khttpd_docroot);
- Head->FileNameLength = min(255,tmp-Buffer+PrefixLen);
+ Head->FileNameLength = min(unsigned int, 255, tmp - Buffer + PrefixLen);
- strncat(Head->FileName,Buffer,min(255-PrefixLen,tmp-Buffer));
+ strncat(Head->FileName,Buffer,min(unsigned int, 255 - PrefixLen, tmp - Buffer));
Buffer=EOL+1;
#ifdef BENCHMARK
@@ -341,7 +341,7 @@ void ParseHeader(char *Buffer,const int length, struct http_request *Head)
{
Buffer+=19;
- strncpy(Head->IMS,Buffer,min(127,EOL-Buffer-1));
+ strncpy(Head->IMS,Buffer,min(unsigned int, 127,EOL-Buffer-1));
Buffer=EOL+1;
continue;
@@ -351,7 +351,7 @@ void ParseHeader(char *Buffer,const int length, struct http_request *Head)
{
Buffer+=12;
- strncpy(Head->Agent,Buffer,min(127,EOL-Buffer-1));
+ strncpy(Head->Agent,Buffer,min(unsigned int, 127,EOL-Buffer-1));
Buffer=EOL+1;
continue;
@@ -362,7 +362,7 @@ void ParseHeader(char *Buffer,const int length, struct http_request *Head)
{
Buffer+=6;
- strncpy(Head->Host,Buffer,min(127,EOL-Buffer-1));
+ strncpy(Head->Host,Buffer,min(unsigned int, 127,EOL-Buffer-1));
Buffer=EOL+1;
continue;
diff --git a/net/khttpd/waitheaders.c b/net/khttpd/waitheaders.c
index 2c24f3744c83..1d49822b7400 100644
--- a/net/khttpd/waitheaders.c
+++ b/net/khttpd/waitheaders.c
@@ -244,7 +244,7 @@ static int DecodeHeader(const int CPUNR, struct http_request *Request)
Request->Time = Request->filp->f_dentry->d_inode->i_mtime;
Request->IMS_Time = mimeTime_to_UnixTime(Request->IMS);
sprintf(Request->LengthS,"%i",Request->FileLength);
- time_Unix2RFC(min(Request->Time,CurrentTime_i),Request->TimeS);
+ time_Unix2RFC(min(unsigned int, Request->Time,CurrentTime_i),Request->TimeS);
/* The min() is required by rfc1945, section 10.10:
It is not allowed to send a filetime in the future */
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index c6df629dc6e7..2b94267d85dd 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -435,7 +435,7 @@ static int nr_getsockopt(struct socket *sock, int level, int optname,
return -ENOPROTOOPT;
}
- len = min(len, sizeof(int));
+ len = min(unsigned int, len, sizeof(int));
if (put_user(len, optlen))
return -EFAULT;
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index b9220b31a3ed..dd554124a876 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -508,7 +508,7 @@ static int rose_getsockopt(struct socket *sock, int level, int optname,
return -ENOPROTOOPT;
}
- len = min(len, sizeof(int));
+ len = min(unsigned int, len, sizeof(int));
if (put_user(len, optlen))
return -EFAULT;
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index 7b5248e74de7..7c8aea21c5c9 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -227,7 +227,7 @@ tbf_dequeue(struct Qdisc* sch)
}
if (!netif_queue_stopped(sch->dev)) {
- long delay = PSCHED_US2JIFFIE(max(-toks, -ptoks));
+ long delay = PSCHED_US2JIFFIE(max(long, -toks, -ptoks));
if (delay == 0)
delay = 1;
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index 9cda62023cf0..6f079e3bd2d8 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -81,42 +81,61 @@ rpcauth_init_credcache(struct rpc_auth *auth)
auth->au_nextgc = jiffies + (auth->au_expire >> 1);
}
+/*
+ * Destroy an unreferenced credential
+ */
static inline void
-rpcauth_crdestroy(struct rpc_auth *auth, struct rpc_cred *cred)
+rpcauth_crdestroy(struct rpc_cred *cred)
{
#ifdef RPC_DEBUG
if (cred->cr_magic != RPCAUTH_CRED_MAGIC)
BUG();
cred->cr_magic = 0;
+ if (atomic_read(&cred->cr_count) || cred->cr_auth)
+ BUG();
#endif
- if (auth->au_ops->crdestroy)
- auth->au_ops->crdestroy(cred);
- else
- rpc_free(cred);
+ cred->cr_ops->crdestroy(cred);
+}
+
+/*
+ * Destroy a list of credentials
+ */
+static inline
+void rpcauth_destroy_credlist(struct rpc_cred *head)
+{
+ struct rpc_cred *cred;
+
+ while ((cred = head) != NULL) {
+ head = cred->cr_next;
+ rpcauth_crdestroy(cred);
+ }
}
/*
- * Clear the RPC credential cache
+ * Clear the RPC credential cache, and delete those credentials
+ * that are not referenced.
*/
void
rpcauth_free_credcache(struct rpc_auth *auth)
{
- struct rpc_cred **q, *cred;
- void (*destroy)(struct rpc_cred *);
+ struct rpc_cred **q, *cred, *free = NULL;
int i;
- if (!(destroy = auth->au_ops->crdestroy))
- destroy = (void (*)(struct rpc_cred *)) rpc_free;
-
spin_lock(&rpc_credcache_lock);
for (i = 0; i < RPC_CREDCACHE_NR; i++) {
q = &auth->au_credcache[i];
while ((cred = *q) != NULL) {
*q = cred->cr_next;
- destroy(cred);
+ cred->cr_auth = NULL;
+ if (atomic_read(&cred->cr_count) == 0) {
+ cred->cr_next = free;
+ free = cred;
+ } else
+ cred->cr_next = NULL;
}
}
spin_unlock(&rpc_credcache_lock);
+ rpcauth_destroy_credlist(free);
}
/*
@@ -133,9 +152,10 @@ rpcauth_gc_credcache(struct rpc_auth *auth)
for (i = 0; i < RPC_CREDCACHE_NR; i++) {
q = &auth->au_credcache[i];
while ((cred = *q) != NULL) {
- if (!cred->cr_count &&
+ if (!atomic_read(&cred->cr_count) &&
time_before(cred->cr_expire, jiffies)) {
*q = cred->cr_next;
+ cred->cr_auth = NULL;
cred->cr_next = free;
free = cred;
continue;
@@ -144,10 +164,7 @@ rpcauth_gc_credcache(struct rpc_auth *auth)
}
}
spin_unlock(&rpc_credcache_lock);
- while ((cred = free) != NULL) {
- free = cred->cr_next;
- rpcauth_crdestroy(auth, cred);
- }
+ rpcauth_destroy_credlist(free);
auth->au_nextgc = jiffies + auth->au_expire;
}
@@ -163,8 +180,8 @@ rpcauth_insert_credcache(struct rpc_auth *auth, struct rpc_cred *cred)
spin_lock(&rpc_credcache_lock);
cred->cr_next = auth->au_credcache[nr];
auth->au_credcache[nr] = cred;
- cred->cr_count++;
- cred->cr_expire = jiffies + auth->au_expire;
+ cred->cr_auth = auth;
+ get_rpccred(cred);
spin_unlock(&rpc_credcache_lock);
}
@@ -187,7 +204,7 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, int taskflags)
q = &auth->au_credcache[nr];
while ((cred = *q) != NULL) {
if (!(cred->cr_flags & RPCAUTH_CRED_DEAD) &&
- auth->au_ops->crmatch(cred, taskflags)) {
+ cred->cr_ops->crmatch(cred, taskflags)) {
*q = cred->cr_next;
break;
}
@@ -213,23 +230,23 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, int taskflags)
* Remove cred handle from cache
*/
static void
-rpcauth_remove_credcache(struct rpc_auth *auth, struct rpc_cred *cred)
+rpcauth_remove_credcache(struct rpc_cred *cred)
{
+ struct rpc_auth *auth = cred->cr_auth;
struct rpc_cred **q, *cr;
int nr;
nr = (cred->cr_uid & RPC_CREDCACHE_MASK);
- spin_lock(&rpc_credcache_lock);
q = &auth->au_credcache[nr];
while ((cr = *q) != NULL) {
if (cred == cr) {
*q = cred->cr_next;
cred->cr_next = NULL;
+ cred->cr_auth = NULL;
break;
}
q = &cred->cr_next;
}
- spin_unlock(&rpc_credcache_lock);
}
struct rpc_cred *
@@ -258,7 +275,7 @@ rpcauth_matchcred(struct rpc_auth *auth, struct rpc_cred *cred, int taskflags)
{
dprintk("RPC: matching %s cred %d\n",
auth->au_ops->au_name, taskflags);
- return auth->au_ops->crmatch(cred, taskflags);
+ return cred->cr_ops->crmatch(cred, taskflags);
}
void
@@ -266,26 +283,25 @@ rpcauth_holdcred(struct rpc_task *task)
{
dprintk("RPC: %4d holding %s cred %p\n",
task->tk_pid, task->tk_auth->au_ops->au_name, task->tk_msg.rpc_cred);
- if (task->tk_msg.rpc_cred) {
- spin_lock(&rpc_credcache_lock);
- task->tk_msg.rpc_cred->cr_count++;
- task->tk_msg.rpc_cred->cr_expire = jiffies + task->tk_auth->au_expire;
- spin_unlock(&rpc_credcache_lock);
- }
+ if (task->tk_msg.rpc_cred)
+ get_rpccred(task->tk_msg.rpc_cred);
}
void
-rpcauth_releasecred(struct rpc_auth *auth, struct rpc_cred *cred)
+put_rpccred(struct rpc_cred *cred)
{
- spin_lock(&rpc_credcache_lock);
- if (cred != NULL && cred->cr_count > 0) {
- if (!--cred->cr_count && (cred->cr_flags & RPCAUTH_CRED_DEAD)) {
- spin_unlock(&rpc_credcache_lock);
- rpcauth_remove_credcache(auth, cred);
- rpcauth_crdestroy(auth, cred);
- return;
- }
+ if (!atomic_dec_and_lock(&cred->cr_count, &rpc_credcache_lock))
+ return;
+
+ if (cred->cr_auth && cred->cr_flags & RPCAUTH_CRED_DEAD)
+ rpcauth_remove_credcache(cred);
+
+ if (!cred->cr_auth) {
+ spin_unlock(&rpc_credcache_lock);
+ rpcauth_crdestroy(cred);
+ return;
}
+ cred->cr_expire = jiffies + cred->cr_auth->au_expire;
spin_unlock(&rpc_credcache_lock);
}
@@ -298,7 +314,7 @@ rpcauth_unbindcred(struct rpc_task *task)
dprintk("RPC: %4d releasing %s cred %p\n",
task->tk_pid, auth->au_ops->au_name, cred);
- rpcauth_releasecred(auth, cred);
+ put_rpccred(cred);
task->tk_msg.rpc_cred = NULL;
}
@@ -306,10 +322,11 @@ u32 *
rpcauth_marshcred(struct rpc_task *task, u32 *p)
{
struct rpc_auth *auth = task->tk_auth;
+ struct rpc_cred *cred = task->tk_msg.rpc_cred;
dprintk("RPC: %4d marshaling %s cred %p\n",
- task->tk_pid, auth->au_ops->au_name, task->tk_msg.rpc_cred);
- return auth->au_ops->crmarshal(task, p,
+ task->tk_pid, auth->au_ops->au_name, cred);
+ return cred->cr_ops->crmarshal(task, p,
task->tk_flags & RPC_CALL_REALUID);
}
@@ -317,20 +334,22 @@ u32 *
rpcauth_checkverf(struct rpc_task *task, u32 *p)
{
struct rpc_auth *auth = task->tk_auth;
+ struct rpc_cred *cred = task->tk_msg.rpc_cred;
dprintk("RPC: %4d validating %s cred %p\n",
- task->tk_pid, auth->au_ops->au_name, task->tk_msg.rpc_cred);
- return auth->au_ops->crvalidate(task, p);
+ task->tk_pid, auth->au_ops->au_name, cred);
+ return cred->cr_ops->crvalidate(task, p);
}
int
rpcauth_refreshcred(struct rpc_task *task)
{
struct rpc_auth *auth = task->tk_auth;
+ struct rpc_cred *cred = task->tk_msg.rpc_cred;
dprintk("RPC: %4d refreshing %s cred %p\n",
- task->tk_pid, auth->au_ops->au_name, task->tk_msg.rpc_cred);
- task->tk_status = auth->au_ops->crrefresh(task);
+ task->tk_pid, auth->au_ops->au_name, cred);
+ task->tk_status = cred->cr_ops->crrefresh(task);
return task->tk_status;
}
diff --git a/net/sunrpc/auth_null.c b/net/sunrpc/auth_null.c
index 0e9fddb2807b..17e8370a0f15 100644
--- a/net/sunrpc/auth_null.c
+++ b/net/sunrpc/auth_null.c
@@ -17,6 +17,8 @@
# define RPCDBG_FACILITY RPCDBG_AUTH
#endif
+static struct rpc_credops null_credops;
+
static struct rpc_auth *
nul_create(struct rpc_clnt *clnt)
{
@@ -52,9 +54,10 @@ nul_create_cred(int flags)
if (!(cred = (struct rpc_cred *) rpc_allocate(flags, sizeof(*cred))))
return NULL;
- cred->cr_count = 0;
+ atomic_set(&cred->cr_count, 0);
cred->cr_flags = RPCAUTH_CRED_UPTODATE;
cred->cr_uid = current->uid;
+ cred->cr_ops = &null_credops;
return cred;
}
@@ -124,7 +127,11 @@ struct rpc_authops authnull_ops = {
#endif
nul_create,
nul_destroy,
- nul_create_cred,
+ nul_create_cred
+};
+
+static
+struct rpc_credops null_credops = {
nul_destroy_cred,
nul_match,
nul_marshal,
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c
index dae3067b55f2..cb0804f2ef19 100644
--- a/net/sunrpc/auth_unix.c
+++ b/net/sunrpc/auth_unix.c
@@ -33,6 +33,8 @@ struct unx_cred {
# define RPCDBG_FACILITY RPCDBG_AUTH
#endif
+static struct rpc_credops unix_credops;
+
static struct rpc_auth *
unx_create(struct rpc_clnt *clnt)
{
@@ -71,7 +73,7 @@ unx_create_cred(int flags)
if (!(cred = (struct unx_cred *) rpc_allocate(flags, sizeof(*cred))))
return NULL;
- cred->uc_count = 0;
+ atomic_set(&cred->uc_count, 0);
cred->uc_flags = RPCAUTH_CRED_UPTODATE;
if (flags & RPC_TASK_ROOTCREDS) {
cred->uc_uid = cred->uc_fsuid = 0;
@@ -91,6 +93,7 @@ unx_create_cred(int flags)
if (i < NFS_NGROUPS)
cred->uc_gids[i] = NOGROUP;
}
+ cred->uc_base.cr_ops = &unix_credops;
return (struct rpc_cred *) cred;
}
@@ -106,7 +109,7 @@ authunix_fake_cred(struct rpc_task *task, uid_t uid, gid_t gid)
if (!(cred = (struct unx_cred *) rpc_malloc(task, sizeof(*cred))))
return NULL;
- cred->uc_count = 1;
+ atomic_set(&cred->uc_count, 1);
cred->uc_flags = RPCAUTH_CRED_DEAD|RPCAUTH_CRED_UPTODATE;
cred->uc_uid = uid;
cred->uc_gid = gid;
@@ -236,7 +239,11 @@ struct rpc_authops authunix_ops = {
#endif
unx_create,
unx_destroy,
- unx_create_cred,
+ unx_create_cred
+};
+
+static
+struct rpc_credops unix_credops = {
unx_destroy_cred,
unx_match,
unx_marshal,
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index 1c5fd37406c4..369358b73e20 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -65,7 +65,7 @@ EXPORT_SYMBOL(rpcauth_insert_credcache);
EXPORT_SYMBOL(rpcauth_lookupcred);
EXPORT_SYMBOL(rpcauth_bindcred);
EXPORT_SYMBOL(rpcauth_matchcred);
-EXPORT_SYMBOL(rpcauth_releasecred);
+EXPORT_SYMBOL(put_rpccred);
/* RPC server stuff */
EXPORT_SYMBOL(svc_create);
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 67f430b9dcc3..39e9afa70a60 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -84,11 +84,6 @@ spinlock_t xprt_lock = SPIN_LOCK_UNLOCKED;
# define RPCDBG_FACILITY RPCDBG_XPRT
#endif
-#ifndef MAX
-# define MAX(a, b) ((a) > (b)? (a) : (b))
-# define MIN(a, b) ((a) < (b)? (a) : (b))
-#endif
-
/*
* Local functions
*/
@@ -749,7 +744,7 @@ tcp_read_xid(struct rpc_xprt *xprt, int avail)
if (xprt->tcp_copied >= sizeof(xprt->tcp_xid) || !avail)
goto done;
- want = MIN(sizeof(xprt->tcp_xid) - xprt->tcp_copied, avail);
+ want = min(unsigned int, sizeof(xprt->tcp_xid) - xprt->tcp_copied, avail);
do {
dprintk("RPC: reading xid (%d bytes)\n", want);
riov.iov_base = ((u8*) &xprt->tcp_xid) + xprt->tcp_copied;
@@ -776,7 +771,7 @@ tcp_read_request(struct rpc_xprt *xprt, struct rpc_rqst *req, int avail)
if (req->rq_rlen <= xprt->tcp_copied || !avail)
goto done;
- want = MIN(req->rq_rlen - xprt->tcp_copied, avail);
+ want = min(unsigned int, req->rq_rlen - xprt->tcp_copied, avail);
do {
dprintk("RPC: %4d TCP receiving %d bytes\n",
req->rq_task->tk_pid, want);
@@ -810,7 +805,7 @@ tcp_read_discard(struct rpc_xprt *xprt, int avail)
int want, result = 0;
while (avail) {
- want = MIN(avail, sizeof(dummy));
+ want = min(unsigned int, avail, sizeof(dummy));
riov.iov_base = dummy;
riov.iov_len = want;
dprintk("RPC: TCP skipping %d bytes\n", want);
@@ -1072,7 +1067,7 @@ udp_write_space(struct sock *sk)
/* Wait until we have enough socket memory */
- if (sock_wspace(sk) < min(sk->sndbuf,XPRT_MIN_WRITE_SPACE))
+ if (sock_wspace(sk) < min(int, sk->sndbuf,XPRT_MIN_WRITE_SPACE))
return;
if (!xprt_test_and_set_wspace(xprt)) {
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 1147480aa3a5..728548457cd1 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -8,7 +8,7 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
- * Version: $Id: af_unix.c,v 1.118 2001/07/18 07:52:37 davem Exp $
+ * Version: $Id: af_unix.c,v 1.121 2001/08/13 18:56:13 davem Exp $
*
* Fixes:
* Linus Torvalds : Assorted bug cures.
@@ -111,8 +111,6 @@
#include <asm/checksum.h>
-#define min(a,b) (((a)<(b))?(a):(b))
-
int sysctl_unix_max_dgram_qlen = 10;
unix_socket *unix_socket_table[UNIX_HASH_SIZE+1];
@@ -1338,7 +1336,7 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, int len,
* fallback size buffer which is under a page and will
* succeed. [Alan]
*/
- size = min(size, skb_tailroom(skb));
+ size = min(int, size, skb_tailroom(skb));
memcpy(UNIXCREDS(skb), &scm->creds, sizeof(struct ucred));
if (scm->fp)
@@ -1570,7 +1568,7 @@ static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg, int size
sunaddr = NULL;
}
- chunk = min(skb->len, size);
+ chunk = min(unsigned int, skb->len, size);
if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) {
skb_queue_head(&sk->receive_queue, skb);
if (copied == 0)
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c
index 74fb480baddf..b58338f52f06 100644
--- a/net/wanrouter/wanmain.c
+++ b/net/wanrouter/wanmain.c
@@ -139,17 +139,6 @@ static void dbg_kfree(void * v, int line) {
/*
- * Defines and Macros
- */
-
-#ifndef min
-#define min(a,b) (((a)<(b))?(a):(b))
-#endif
-#ifndef max
-#define max(a,b) (((a)>(b))?(a):(b))
-#endif
-
-/*
* Function Prototypes
*/
diff --git a/net/wanrouter/wanproc.c b/net/wanrouter/wanproc.c
index 9dd10ce27fef..92156ea3086a 100644
--- a/net/wanrouter/wanproc.c
+++ b/net/wanrouter/wanproc.c
@@ -46,13 +46,6 @@
/****** Defines and Macros **************************************************/
-#ifndef min
-#define min(a,b) (((a)<(b))?(a):(b))
-#endif
-#ifndef max
-#define max(a,b) (((a)>(b))?(a):(b))
-#endif
-
#define PROC_BUFSZ 4000 /* buffer size for printing proc info */
#define PROT_DECODE(prot) ((prot == WANCONFIG_FR) ? " FR" :\
@@ -266,7 +259,7 @@ typedef struct wan_stat_entry
pos = dent->get_info(page, dent->data, 0, 0);
offs = file->f_pos;
if (offs < pos) {
- len = min(pos - offs, count);
+ len = min(unsigned int, pos - offs, count);
if (copy_to_user(buf, (page + offs), len)) {
kfree(page);
return -EFAULT;
@@ -812,7 +805,7 @@ typedef struct wan_stat_entry
pos = dent->get_info(page, dent->data, 0, 0, 0);
offs = file->f_pos;
if (offs < pos) {
- len = min(pos - offs, count);
+ len = min(unsigned int, pos - offs, count);
if (copy_to_user(buf, (page + offs), len)) {
kfree(page);
return -EFAULT;
@@ -848,7 +841,7 @@ typedef struct wan_stat_entry
pos = dent->get_info(page, dent->data, 0, 0, 0);
offs = file->f_pos;
if (offs < pos) {
- len = min(pos - offs, count);
+ len = min(unsigned int, pos - offs, count);
memcpy_tofs((void*)buf, (void*)(page + offs), len);
file->f_pos += len;
}
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index a4c425392dd2..95f1037061ec 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -407,7 +407,7 @@ static int x25_getsockopt(struct socket *sock, int level, int optname,
return -ENOPROTOOPT;
}
- len = min(len, sizeof(int));
+ len = min(unsigned int, len, sizeof(int));
if (len < 0)
return -EINVAL;