aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2007-03-04 19:12:44 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:23:32 -0400
commit9d729f72dca9406025bcfa9c1f660d71d9ef0ff5 (patch)
tree69a3ca50c6e266853676a545a113f13f254ae535
parent39df232f1a9ba48d41c68ee7d4046756e709cf91 (diff)
[NET]: Convert xtime.tv_sec to get_seconds()
Where appropriate, convert references to xtime.tv_sec to the get_seconds() helper function. Signed-off-by: James Morris <jmorris@namei.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/tcp.h4
-rw-r--r--net/ipv4/route.c2
-rw-r--r--net/ipv4/tcp_input.c6
-rw-r--r--net/ipv4/tcp_ipv4.c10
-rw-r--r--net/ipv4/tcp_minisocks.c8
-rw-r--r--net/ipv6/xfrm6_output.c2
-rw-r--r--net/rxrpc/main.c2
-rw-r--r--net/xfrm/xfrm_policy.c12
-rw-r--r--net/xfrm/xfrm_state.c6
9 files changed, 26 insertions, 26 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index f0c9e3400a09..181c0600af1c 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1014,7 +1014,7 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int
1014{ 1014{
1015 if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0) 1015 if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0)
1016 return 0; 1016 return 0;
1017 if (xtime.tv_sec >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS) 1017 if (get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS)
1018 return 0; 1018 return 0;
1019 1019
1020 /* RST segments are not recommended to carry timestamp, 1020 /* RST segments are not recommended to carry timestamp,
@@ -1029,7 +1029,7 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int
1029 1029
1030 However, we can relax time bounds for RST segments to MSL. 1030 However, we can relax time bounds for RST segments to MSL.
1031 */ 1031 */
1032 if (rst && xtime.tv_sec >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL) 1032 if (rst && get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL)
1033 return 0; 1033 return 0;
1034 return 1; 1034 return 1;
1035} 1035}
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 37e0d4d5cf94..0b3d7bf40f4e 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2683,7 +2683,7 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
2683 id = rt->peer->ip_id_count; 2683 id = rt->peer->ip_id_count;
2684 if (rt->peer->tcp_ts_stamp) { 2684 if (rt->peer->tcp_ts_stamp) {
2685 ts = rt->peer->tcp_ts; 2685 ts = rt->peer->tcp_ts;
2686 tsage = xtime.tv_sec - rt->peer->tcp_ts_stamp; 2686 tsage = get_seconds() - rt->peer->tcp_ts_stamp;
2687 } 2687 }
2688 } 2688 }
2689 2689
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index d894bbcc1d24..d0a3630f41a7 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2933,7 +2933,7 @@ static int tcp_fast_parse_options(struct sk_buff *skb, struct tcphdr *th,
2933static inline void tcp_store_ts_recent(struct tcp_sock *tp) 2933static inline void tcp_store_ts_recent(struct tcp_sock *tp)
2934{ 2934{
2935 tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval; 2935 tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval;
2936 tp->rx_opt.ts_recent_stamp = xtime.tv_sec; 2936 tp->rx_opt.ts_recent_stamp = get_seconds();
2937} 2937}
2938 2938
2939static inline void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq) 2939static inline void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq)
@@ -2947,7 +2947,7 @@ static inline void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq)
2947 */ 2947 */
2948 2948
2949 if((s32)(tp->rx_opt.rcv_tsval - tp->rx_opt.ts_recent) >= 0 || 2949 if((s32)(tp->rx_opt.rcv_tsval - tp->rx_opt.ts_recent) >= 0 ||
2950 xtime.tv_sec >= tp->rx_opt.ts_recent_stamp + TCP_PAWS_24DAYS) 2950 get_seconds() >= tp->rx_opt.ts_recent_stamp + TCP_PAWS_24DAYS)
2951 tcp_store_ts_recent(tp); 2951 tcp_store_ts_recent(tp);
2952 } 2952 }
2953} 2953}
@@ -2999,7 +2999,7 @@ static inline int tcp_paws_discard(const struct sock *sk, const struct sk_buff *
2999{ 2999{
3000 const struct tcp_sock *tp = tcp_sk(sk); 3000 const struct tcp_sock *tp = tcp_sk(sk);
3001 return ((s32)(tp->rx_opt.ts_recent - tp->rx_opt.rcv_tsval) > TCP_PAWS_WINDOW && 3001 return ((s32)(tp->rx_opt.ts_recent - tp->rx_opt.rcv_tsval) > TCP_PAWS_WINDOW &&
3002 xtime.tv_sec < tp->rx_opt.ts_recent_stamp + TCP_PAWS_24DAYS && 3002 get_seconds() < tp->rx_opt.ts_recent_stamp + TCP_PAWS_24DAYS &&
3003 !tcp_disordered_ack(sk, skb)); 3003 !tcp_disordered_ack(sk, skb));
3004} 3004}
3005 3005
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index f6793b4cc669..addac1110f94 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -149,7 +149,7 @@ int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp)
149 */ 149 */
150 if (tcptw->tw_ts_recent_stamp && 150 if (tcptw->tw_ts_recent_stamp &&
151 (twp == NULL || (sysctl_tcp_tw_reuse && 151 (twp == NULL || (sysctl_tcp_tw_reuse &&
152 xtime.tv_sec - tcptw->tw_ts_recent_stamp > 1))) { 152 get_seconds() - tcptw->tw_ts_recent_stamp > 1))) {
153 tp->write_seq = tcptw->tw_snd_nxt + 65535 + 2; 153 tp->write_seq = tcptw->tw_snd_nxt + 65535 + 2;
154 if (tp->write_seq == 0) 154 if (tp->write_seq == 0)
155 tp->write_seq = 1; 155 tp->write_seq = 1;
@@ -224,7 +224,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
224 * when trying new connection. 224 * when trying new connection.
225 */ 225 */
226 if (peer != NULL && 226 if (peer != NULL &&
227 peer->tcp_ts_stamp + TCP_PAWS_MSL >= xtime.tv_sec) { 227 peer->tcp_ts_stamp + TCP_PAWS_MSL >= get_seconds()) {
228 tp->rx_opt.ts_recent_stamp = peer->tcp_ts_stamp; 228 tp->rx_opt.ts_recent_stamp = peer->tcp_ts_stamp;
229 tp->rx_opt.ts_recent = peer->tcp_ts; 229 tp->rx_opt.ts_recent = peer->tcp_ts;
230 } 230 }
@@ -1351,7 +1351,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
1351 (dst = inet_csk_route_req(sk, req)) != NULL && 1351 (dst = inet_csk_route_req(sk, req)) != NULL &&
1352 (peer = rt_get_peer((struct rtable *)dst)) != NULL && 1352 (peer = rt_get_peer((struct rtable *)dst)) != NULL &&
1353 peer->v4daddr == saddr) { 1353 peer->v4daddr == saddr) {
1354 if (xtime.tv_sec < peer->tcp_ts_stamp + TCP_PAWS_MSL && 1354 if (get_seconds() < peer->tcp_ts_stamp + TCP_PAWS_MSL &&
1355 (s32)(peer->tcp_ts - req->ts_recent) > 1355 (s32)(peer->tcp_ts - req->ts_recent) >
1356 TCP_PAWS_WINDOW) { 1356 TCP_PAWS_WINDOW) {
1357 NET_INC_STATS_BH(LINUX_MIB_PAWSPASSIVEREJECTED); 1357 NET_INC_STATS_BH(LINUX_MIB_PAWSPASSIVEREJECTED);
@@ -1770,7 +1770,7 @@ int tcp_v4_remember_stamp(struct sock *sk)
1770 1770
1771 if (peer) { 1771 if (peer) {
1772 if ((s32)(peer->tcp_ts - tp->rx_opt.ts_recent) <= 0 || 1772 if ((s32)(peer->tcp_ts - tp->rx_opt.ts_recent) <= 0 ||
1773 (peer->tcp_ts_stamp + TCP_PAWS_MSL < xtime.tv_sec && 1773 (peer->tcp_ts_stamp + TCP_PAWS_MSL < get_seconds() &&
1774 peer->tcp_ts_stamp <= tp->rx_opt.ts_recent_stamp)) { 1774 peer->tcp_ts_stamp <= tp->rx_opt.ts_recent_stamp)) {
1775 peer->tcp_ts_stamp = tp->rx_opt.ts_recent_stamp; 1775 peer->tcp_ts_stamp = tp->rx_opt.ts_recent_stamp;
1776 peer->tcp_ts = tp->rx_opt.ts_recent; 1776 peer->tcp_ts = tp->rx_opt.ts_recent;
@@ -1791,7 +1791,7 @@ int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw)
1791 const struct tcp_timewait_sock *tcptw = tcp_twsk((struct sock *)tw); 1791 const struct tcp_timewait_sock *tcptw = tcp_twsk((struct sock *)tw);
1792 1792
1793 if ((s32)(peer->tcp_ts - tcptw->tw_ts_recent) <= 0 || 1793 if ((s32)(peer->tcp_ts - tcptw->tw_ts_recent) <= 0 ||
1794 (peer->tcp_ts_stamp + TCP_PAWS_MSL < xtime.tv_sec && 1794 (peer->tcp_ts_stamp + TCP_PAWS_MSL < get_seconds() &&
1795 peer->tcp_ts_stamp <= tcptw->tw_ts_recent_stamp)) { 1795 peer->tcp_ts_stamp <= tcptw->tw_ts_recent_stamp)) {
1796 peer->tcp_ts_stamp = tcptw->tw_ts_recent_stamp; 1796 peer->tcp_ts_stamp = tcptw->tw_ts_recent_stamp;
1797 peer->tcp_ts = tcptw->tw_ts_recent; 1797 peer->tcp_ts = tcptw->tw_ts_recent;
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 706932726a11..ac4ce48a6599 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -149,7 +149,7 @@ kill_with_rst:
149 tw->tw_substate = TCP_TIME_WAIT; 149 tw->tw_substate = TCP_TIME_WAIT;
150 tcptw->tw_rcv_nxt = TCP_SKB_CB(skb)->end_seq; 150 tcptw->tw_rcv_nxt = TCP_SKB_CB(skb)->end_seq;
151 if (tmp_opt.saw_tstamp) { 151 if (tmp_opt.saw_tstamp) {
152 tcptw->tw_ts_recent_stamp = xtime.tv_sec; 152 tcptw->tw_ts_recent_stamp = get_seconds();
153 tcptw->tw_ts_recent = tmp_opt.rcv_tsval; 153 tcptw->tw_ts_recent = tmp_opt.rcv_tsval;
154 } 154 }
155 155
@@ -208,7 +208,7 @@ kill:
208 208
209 if (tmp_opt.saw_tstamp) { 209 if (tmp_opt.saw_tstamp) {
210 tcptw->tw_ts_recent = tmp_opt.rcv_tsval; 210 tcptw->tw_ts_recent = tmp_opt.rcv_tsval;
211 tcptw->tw_ts_recent_stamp = xtime.tv_sec; 211 tcptw->tw_ts_recent_stamp = get_seconds();
212 } 212 }
213 213
214 inet_twsk_put(tw); 214 inet_twsk_put(tw);
@@ -458,7 +458,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
458 458
459 if (newtp->rx_opt.tstamp_ok) { 459 if (newtp->rx_opt.tstamp_ok) {
460 newtp->rx_opt.ts_recent = req->ts_recent; 460 newtp->rx_opt.ts_recent = req->ts_recent;
461 newtp->rx_opt.ts_recent_stamp = xtime.tv_sec; 461 newtp->rx_opt.ts_recent_stamp = get_seconds();
462 newtp->tcp_header_len = sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED; 462 newtp->tcp_header_len = sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED;
463 } else { 463 } else {
464 newtp->rx_opt.ts_recent_stamp = 0; 464 newtp->rx_opt.ts_recent_stamp = 0;
@@ -504,7 +504,7 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
504 * it can be estimated (approximately) 504 * it can be estimated (approximately)
505 * from another data. 505 * from another data.
506 */ 506 */
507 tmp_opt.ts_recent_stamp = xtime.tv_sec - ((TCP_TIMEOUT_INIT/HZ)<<req->retrans); 507 tmp_opt.ts_recent_stamp = get_seconds() - ((TCP_TIMEOUT_INIT/HZ)<<req->retrans);
508 paws_reject = tcp_paws_check(&tmp_opt, th->rst); 508 paws_reject = tcp_paws_check(&tmp_opt, th->rst);
509 } 509 }
510 } 510 }
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
index d6d786b89d2b..8e4170f9a0da 100644
--- a/net/ipv6/xfrm6_output.c
+++ b/net/ipv6/xfrm6_output.c
@@ -76,7 +76,7 @@ static int xfrm6_output_one(struct sk_buff *skb)
76 x->curlft.bytes += skb->len; 76 x->curlft.bytes += skb->len;
77 x->curlft.packets++; 77 x->curlft.packets++;
78 if (x->props.mode == XFRM_MODE_ROUTEOPTIMIZATION) 78 if (x->props.mode == XFRM_MODE_ROUTEOPTIMIZATION)
79 x->lastused = (u64)xtime.tv_sec; 79 x->lastused = get_seconds();
80 80
81 spin_unlock_bh(&x->lock); 81 spin_unlock_bh(&x->lock);
82 82
diff --git a/net/rxrpc/main.c b/net/rxrpc/main.c
index baec1f7fd8b9..cead31b5bdf5 100644
--- a/net/rxrpc/main.c
+++ b/net/rxrpc/main.c
@@ -37,7 +37,7 @@ static int __init rxrpc_initialise(void)
37 int ret; 37 int ret;
38 38
39 /* my epoch value */ 39 /* my epoch value */
40 rxrpc_epoch = htonl(xtime.tv_sec); 40 rxrpc_epoch = htonl(get_seconds());
41 41
42 /* register the /proc interface */ 42 /* register the /proc interface */
43#ifdef CONFIG_PROC_FS 43#ifdef CONFIG_PROC_FS
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 785c3e39f062..194257554553 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -268,7 +268,7 @@ static inline unsigned long make_jiffies(long secs)
268static void xfrm_policy_timer(unsigned long data) 268static void xfrm_policy_timer(unsigned long data)
269{ 269{
270 struct xfrm_policy *xp = (struct xfrm_policy*)data; 270 struct xfrm_policy *xp = (struct xfrm_policy*)data;
271 unsigned long now = (unsigned long)xtime.tv_sec; 271 unsigned long now = get_seconds();
272 long next = LONG_MAX; 272 long next = LONG_MAX;
273 int warn = 0; 273 int warn = 0;
274 int dir; 274 int dir;
@@ -690,7 +690,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
690 } 690 }
691 policy->index = delpol ? delpol->index : xfrm_gen_index(policy->type, dir); 691 policy->index = delpol ? delpol->index : xfrm_gen_index(policy->type, dir);
692 hlist_add_head(&policy->byidx, xfrm_policy_byidx+idx_hash(policy->index)); 692 hlist_add_head(&policy->byidx, xfrm_policy_byidx+idx_hash(policy->index));
693 policy->curlft.add_time = (unsigned long)xtime.tv_sec; 693 policy->curlft.add_time = get_seconds();
694 policy->curlft.use_time = 0; 694 policy->curlft.use_time = 0;
695 if (!mod_timer(&policy->timer, jiffies + HZ)) 695 if (!mod_timer(&policy->timer, jiffies + HZ))
696 xfrm_pol_hold(policy); 696 xfrm_pol_hold(policy);
@@ -1133,7 +1133,7 @@ int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol)
1133 old_pol = sk->sk_policy[dir]; 1133 old_pol = sk->sk_policy[dir];
1134 sk->sk_policy[dir] = pol; 1134 sk->sk_policy[dir] = pol;
1135 if (pol) { 1135 if (pol) {
1136 pol->curlft.add_time = (unsigned long)xtime.tv_sec; 1136 pol->curlft.add_time = get_seconds();
1137 pol->index = xfrm_gen_index(pol->type, XFRM_POLICY_MAX+dir); 1137 pol->index = xfrm_gen_index(pol->type, XFRM_POLICY_MAX+dir);
1138 __xfrm_policy_link(pol, XFRM_POLICY_MAX+dir); 1138 __xfrm_policy_link(pol, XFRM_POLICY_MAX+dir);
1139 } 1139 }
@@ -1386,7 +1386,7 @@ restart:
1386 return 0; 1386 return 0;
1387 1387
1388 family = dst_orig->ops->family; 1388 family = dst_orig->ops->family;
1389 policy->curlft.use_time = (unsigned long)xtime.tv_sec; 1389 policy->curlft.use_time = get_seconds();
1390 pols[0] = policy; 1390 pols[0] = policy;
1391 npols ++; 1391 npols ++;
1392 xfrm_nr += pols[0]->xfrm_nr; 1392 xfrm_nr += pols[0]->xfrm_nr;
@@ -1682,7 +1682,7 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb,
1682 return 1; 1682 return 1;
1683 } 1683 }
1684 1684
1685 pol->curlft.use_time = (unsigned long)xtime.tv_sec; 1685 pol->curlft.use_time = get_seconds();
1686 1686
1687 pols[0] = pol; 1687 pols[0] = pol;
1688 npols ++; 1688 npols ++;
@@ -1694,7 +1694,7 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb,
1694 if (pols[1]) { 1694 if (pols[1]) {
1695 if (IS_ERR(pols[1])) 1695 if (IS_ERR(pols[1]))
1696 return 0; 1696 return 0;
1697 pols[1]->curlft.use_time = (unsigned long)xtime.tv_sec; 1697 pols[1]->curlft.use_time = get_seconds();
1698 npols ++; 1698 npols ++;
1699 } 1699 }
1700 } 1700 }
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index e3a0bcfa5df1..63a20e818164 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -233,7 +233,7 @@ static inline unsigned long make_jiffies(long secs)
233static void xfrm_timer_handler(unsigned long data) 233static void xfrm_timer_handler(unsigned long data)
234{ 234{
235 struct xfrm_state *x = (struct xfrm_state*)data; 235 struct xfrm_state *x = (struct xfrm_state*)data;
236 unsigned long now = (unsigned long)xtime.tv_sec; 236 unsigned long now = get_seconds();
237 long next = LONG_MAX; 237 long next = LONG_MAX;
238 int warn = 0; 238 int warn = 0;
239 int err = 0; 239 int err = 0;
@@ -326,7 +326,7 @@ struct xfrm_state *xfrm_state_alloc(void)
326 init_timer(&x->rtimer); 326 init_timer(&x->rtimer);
327 x->rtimer.function = xfrm_replay_timer_handler; 327 x->rtimer.function = xfrm_replay_timer_handler;
328 x->rtimer.data = (unsigned long)x; 328 x->rtimer.data = (unsigned long)x;
329 x->curlft.add_time = (unsigned long)xtime.tv_sec; 329 x->curlft.add_time = get_seconds();
330 x->lft.soft_byte_limit = XFRM_INF; 330 x->lft.soft_byte_limit = XFRM_INF;
331 x->lft.soft_packet_limit = XFRM_INF; 331 x->lft.soft_packet_limit = XFRM_INF;
332 x->lft.hard_byte_limit = XFRM_INF; 332 x->lft.hard_byte_limit = XFRM_INF;
@@ -1051,7 +1051,7 @@ EXPORT_SYMBOL(xfrm_state_update);
1051int xfrm_state_check_expire(struct xfrm_state *x) 1051int xfrm_state_check_expire(struct xfrm_state *x)
1052{ 1052{
1053 if (!x->curlft.use_time) 1053 if (!x->curlft.use_time)
1054 x->curlft.use_time = (unsigned long)xtime.tv_sec; 1054 x->curlft.use_time = get_seconds();
1055 1055
1056 if (x->km.state != XFRM_STATE_VALID) 1056 if (x->km.state != XFRM_STATE_VALID)
1057 return -EINVAL; 1057 return -EINVAL;