Whamcloud - gitweb
b=12302
[fs/lustre-release.git] / lnet / include / libcfs / linux / linux-tcpip.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
5  *
6  *   This file is part of Lustre, http://www.lustre.org.
7  *
8  *   Lustre is free software; you can redistribute it and/or
9  *   modify it under the terms of version 2 of the GNU General Public
10  *   License as published by the Free Software Foundation.
11  *
12  *   Lustre is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with Lustre; if not, write to the Free Software
19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  *
21  * Basic library routines. 
22  *
23  */
24
25 #ifndef __LIBCFS_LINUX_CFS_TCP_H__
26 #define __LIBCFS_LINUX_CFS_TCP_H__
27
28 #ifndef __LIBCFS_LIBCFS_H__
29 #error Do not #include this file directly. #include <libcfs/libcfs.h> instead
30 #endif
31
32 #ifdef __KERNEL__
33 #include <net/sock.h>
34
35 typedef struct socket   cfs_socket_t;
36
37 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,72))
38 # define sk_allocation  allocation
39 # define sk_data_ready  data_ready
40 # define sk_write_space write_space
41 # define sk_user_data   user_data
42 # define sk_prot        prot
43 # define sk_sndbuf      sndbuf
44 # define sk_rcvbuf      rcvbuf
45 # define sk_socket      socket
46 # define sk_sleep       sleep
47 #endif
48
49 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
50 # define sk_wmem_queued wmem_queued
51 # define sk_err         err
52 # define sk_route_caps  route_caps
53 #endif
54
55 #define SOCK_SNDBUF(so)         ((so)->sk->sk_sndbuf)
56 #define SOCK_WMEM_QUEUED(so)    ((so)->sk->sk_wmem_queued)
57 #define SOCK_ERROR(so)          ((so)->sk->sk_err)
58 #define SOCK_TEST_NOSPACE(so)   test_bit(SOCK_NOSPACE, &(so)->flags)
59
60 #else   /* !__KERNEL__ */
61
62 #include "../user-tcpip.h"
63
64 #endif /* __KERNEL__ */
65
66 #endif