diff options
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 91c1c8baf020..9c0553b9e451 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -357,6 +357,7 @@ struct sock { | |||
357 | struct page *sk_sndmsg_page; | 357 | struct page *sk_sndmsg_page; |
358 | struct sk_buff *sk_send_head; | 358 | struct sk_buff *sk_send_head; |
359 | __u32 sk_sndmsg_off; | 359 | __u32 sk_sndmsg_off; |
360 | __s32 sk_peek_off; | ||
360 | int sk_write_pending; | 361 | int sk_write_pending; |
361 | #ifdef CONFIG_SECURITY | 362 | #ifdef CONFIG_SECURITY |
362 | void *sk_security; | 363 | void *sk_security; |
@@ -373,6 +374,30 @@ struct sock { | |||
373 | void (*sk_destruct)(struct sock *sk); | 374 | void (*sk_destruct)(struct sock *sk); |
374 | }; | 375 | }; |
375 | 376 | ||
377 | static inline int sk_peek_offset(struct sock *sk, int flags) | ||
378 | { | ||
379 | if ((flags & MSG_PEEK) && (sk->sk_peek_off >= 0)) | ||
380 | return sk->sk_peek_off; | ||
381 | else | ||
382 | return 0; | ||
383 | } | ||
384 | |||
385 | static inline void sk_peek_offset_bwd(struct sock *sk, int val) | ||
386 | { | ||
387 | if (sk->sk_peek_off >= 0) { | ||
388 | if (sk->sk_peek_off >= val) | ||
389 | sk->sk_peek_off -= val; | ||
390 | else | ||
391 | sk->sk_peek_off = 0; | ||
392 | } | ||
393 | } | ||
394 | |||
395 | static inline void sk_peek_offset_fwd(struct sock *sk, int val) | ||
396 | { | ||
397 | if (sk->sk_peek_off >= 0) | ||
398 | sk->sk_peek_off += val; | ||
399 | } | ||
400 | |||
376 | /* | 401 | /* |
377 | * Hashed lists helper routines | 402 | * Hashed lists helper routines |
378 | */ | 403 | */ |