~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/ocfs2/cluster/tcp.h

Version: ~ [ linux-4.19-rc4 ] ~ [ linux-4.18.8 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.70 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.127 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.156 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.122 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.57 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.31.14 ] ~ [ linux-2.6.30.10 ] ~ [ linux-2.6.29.6 ] ~ [ linux-2.6.28.10 ] ~ [ linux-2.6.27.62 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* -*- mode: c; c-basic-offset: 8; -*-
  2  * vim: noexpandtab sw=8 ts=8 sts=0:
  3  *
  4  * tcp.h
  5  *
  6  * Function prototypes
  7  *
  8  * Copyright (C) 2004 Oracle.  All rights reserved.
  9  *
 10  * This program is free software; you can redistribute it and/or
 11  * modify it under the terms of the GNU General Public
 12  * License as published by the Free Software Foundation; either
 13  * version 2 of the License, or (at your option) any later version.
 14  *
 15  * This program is distributed in the hope that it will be useful,
 16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 18  * General Public License for more details.
 19  *
 20  * You should have received a copy of the GNU General Public
 21  * License along with this program; if not, write to the
 22  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 23  * Boston, MA 021110-1307, USA.
 24  *
 25  */
 26 
 27 #ifndef O2CLUSTER_TCP_H
 28 #define O2CLUSTER_TCP_H
 29 
 30 #include <linux/socket.h>
 31 #ifdef __KERNEL__
 32 #include <net/sock.h>
 33 #include <linux/tcp.h>
 34 #else
 35 #include <sys/socket.h>
 36 #endif
 37 #include <linux/inet.h>
 38 #include <linux/in.h>
 39 
 40 struct o2net_msg
 41 {
 42         __be16 magic;
 43         __be16 data_len;
 44         __be16 msg_type;
 45         __be16 pad1;
 46         __be32 sys_status;
 47         __be32 status;
 48         __be32 key;
 49         __be32 msg_num;
 50         __u8  buf[0];
 51 };
 52 
 53 typedef int (o2net_msg_handler_func)(struct o2net_msg *msg, u32 len, void *data,
 54                                      void **ret_data);
 55 typedef void (o2net_post_msg_handler_func)(int status, void *data,
 56                                            void *ret_data);
 57 
 58 #define O2NET_MAX_PAYLOAD_BYTES  (4096 - sizeof(struct o2net_msg))
 59 
 60 /* same as hb delay, we're waiting for another node to recognize our hb */
 61 #define O2NET_RECONNECT_DELAY_MS_DEFAULT        2000
 62 
 63 #define O2NET_KEEPALIVE_DELAY_MS_DEFAULT        2000
 64 #define O2NET_IDLE_TIMEOUT_MS_DEFAULT           30000
 65 
 66 #define O2NET_TCP_USER_TIMEOUT                  0x7fffffff
 67 
 68 /* TODO: figure this out.... */
 69 static inline int o2net_link_down(int err, struct socket *sock)
 70 {
 71         if (sock) {
 72                 if (sock->sk->sk_state != TCP_ESTABLISHED &&
 73                     sock->sk->sk_state != TCP_CLOSE_WAIT)
 74                         return 1;
 75         }
 76 
 77         if (err >= 0)
 78                 return 0;
 79         switch (err) {
 80                 /* ????????????????????????? */
 81                 case -ERESTARTSYS:
 82                 case -EBADF:
 83                 /* When the server has died, an ICMP port unreachable
 84                  * message prompts ECONNREFUSED. */
 85                 case -ECONNREFUSED:
 86                 case -ENOTCONN:
 87                 case -ECONNRESET:
 88                 case -EPIPE:
 89                         return 1;
 90         }
 91         return 0;
 92 }
 93 
 94 enum {
 95         O2NET_DRIVER_UNINITED,
 96         O2NET_DRIVER_READY,
 97 };
 98 
 99 int o2net_send_message(u32 msg_type, u32 key, void *data, u32 len,
100                        u8 target_node, int *status);
101 int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *vec,
102                            size_t veclen, u8 target_node, int *status);
103 
104 int o2net_register_handler(u32 msg_type, u32 key, u32 max_len,
105                            o2net_msg_handler_func *func, void *data,
106                            o2net_post_msg_handler_func *post_func,
107                            struct list_head *unreg_list);
108 void o2net_unregister_handler_list(struct list_head *list);
109 
110 void o2net_fill_node_map(unsigned long *map, unsigned bytes);
111 
112 struct o2nm_node;
113 int o2net_register_hb_callbacks(void);
114 void o2net_unregister_hb_callbacks(void);
115 int o2net_start_listening(struct o2nm_node *node);
116 void o2net_stop_listening(struct o2nm_node *node);
117 void o2net_disconnect_node(struct o2nm_node *node);
118 int o2net_num_connected_peers(void);
119 
120 int o2net_init(void);
121 void o2net_exit(void);
122 
123 struct o2net_send_tracking;
124 struct o2net_sock_container;
125 
126 #ifdef CONFIG_DEBUG_FS
127 int o2net_debugfs_init(void);
128 void o2net_debugfs_exit(void);
129 void o2net_debug_add_nst(struct o2net_send_tracking *nst);
130 void o2net_debug_del_nst(struct o2net_send_tracking *nst);
131 void o2net_debug_add_sc(struct o2net_sock_container *sc);
132 void o2net_debug_del_sc(struct o2net_sock_container *sc);
133 #else
134 static inline int o2net_debugfs_init(void)
135 {
136         return 0;
137 }
138 static inline void o2net_debugfs_exit(void)
139 {
140 }
141 static inline void o2net_debug_add_nst(struct o2net_send_tracking *nst)
142 {
143 }
144 static inline void o2net_debug_del_nst(struct o2net_send_tracking *nst)
145 {
146 }
147 static inline void o2net_debug_add_sc(struct o2net_sock_container *sc)
148 {
149 }
150 static inline void o2net_debug_del_sc(struct o2net_sock_container *sc)
151 {
152 }
153 #endif  /* CONFIG_DEBUG_FS */
154 
155 #endif /* O2CLUSTER_TCP_H */
156 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp