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

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

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  * tcp.h
  4  *
  5  * Function prototypes
  6  *
  7  * Copyright (C) 2004 Oracle.  All rights reserved.
  8  */
  9 
 10 #ifndef O2CLUSTER_TCP_H
 11 #define O2CLUSTER_TCP_H
 12 
 13 #include <linux/socket.h>
 14 #ifdef __KERNEL__
 15 #include <net/sock.h>
 16 #include <linux/tcp.h>
 17 #else
 18 #include <sys/socket.h>
 19 #endif
 20 #include <linux/inet.h>
 21 #include <linux/in.h>
 22 
 23 struct o2net_msg
 24 {
 25         __be16 magic;
 26         __be16 data_len;
 27         __be16 msg_type;
 28         __be16 pad1;
 29         __be32 sys_status;
 30         __be32 status;
 31         __be32 key;
 32         __be32 msg_num;
 33         __u8  buf[];
 34 };
 35 
 36 typedef int (o2net_msg_handler_func)(struct o2net_msg *msg, u32 len, void *data,
 37                                      void **ret_data);
 38 typedef void (o2net_post_msg_handler_func)(int status, void *data,
 39                                            void *ret_data);
 40 
 41 #define O2NET_MAX_PAYLOAD_BYTES  (4096 - sizeof(struct o2net_msg))
 42 
 43 /* same as hb delay, we're waiting for another node to recognize our hb */
 44 #define O2NET_RECONNECT_DELAY_MS_DEFAULT        2000
 45 
 46 #define O2NET_KEEPALIVE_DELAY_MS_DEFAULT        2000
 47 #define O2NET_IDLE_TIMEOUT_MS_DEFAULT           30000
 48 
 49 #define O2NET_TCP_USER_TIMEOUT                  0x7fffffff
 50 
 51 /* TODO: figure this out.... */
 52 static inline int o2net_link_down(int err, struct socket *sock)
 53 {
 54         if (sock) {
 55                 if (sock->sk->sk_state != TCP_ESTABLISHED &&
 56                     sock->sk->sk_state != TCP_CLOSE_WAIT)
 57                         return 1;
 58         }
 59 
 60         if (err >= 0)
 61                 return 0;
 62         switch (err) {
 63                 /* ????????????????????????? */
 64                 case -ERESTARTSYS:
 65                 case -EBADF:
 66                 /* When the server has died, an ICMP port unreachable
 67                  * message prompts ECONNREFUSED. */
 68                 case -ECONNREFUSED:
 69                 case -ENOTCONN:
 70                 case -ECONNRESET:
 71                 case -EPIPE:
 72                         return 1;
 73         }
 74         return 0;
 75 }
 76 
 77 enum {
 78         O2NET_DRIVER_UNINITED,
 79         O2NET_DRIVER_READY,
 80 };
 81 
 82 int o2net_send_message(u32 msg_type, u32 key, void *data, u32 len,
 83                        u8 target_node, int *status);
 84 int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *vec,
 85                            size_t veclen, u8 target_node, int *status);
 86 
 87 int o2net_register_handler(u32 msg_type, u32 key, u32 max_len,
 88                            o2net_msg_handler_func *func, void *data,
 89                            o2net_post_msg_handler_func *post_func,
 90                            struct list_head *unreg_list);
 91 void o2net_unregister_handler_list(struct list_head *list);
 92 
 93 void o2net_fill_node_map(unsigned long *map, unsigned bytes);
 94 
 95 struct o2nm_node;
 96 int o2net_register_hb_callbacks(void);
 97 void o2net_unregister_hb_callbacks(void);
 98 int o2net_start_listening(struct o2nm_node *node);
 99 void o2net_stop_listening(struct o2nm_node *node);
100 void o2net_disconnect_node(struct o2nm_node *node);
101 int o2net_num_connected_peers(void);
102 
103 int o2net_init(void);
104 void o2net_exit(void);
105 
106 struct o2net_send_tracking;
107 struct o2net_sock_container;
108 
109 #ifdef CONFIG_DEBUG_FS
110 void o2net_debugfs_init(void);
111 void o2net_debugfs_exit(void);
112 void o2net_debug_add_nst(struct o2net_send_tracking *nst);
113 void o2net_debug_del_nst(struct o2net_send_tracking *nst);
114 void o2net_debug_add_sc(struct o2net_sock_container *sc);
115 void o2net_debug_del_sc(struct o2net_sock_container *sc);
116 #else
117 static inline void o2net_debugfs_init(void)
118 {
119 }
120 static inline void o2net_debugfs_exit(void)
121 {
122 }
123 static inline void o2net_debug_add_nst(struct o2net_send_tracking *nst)
124 {
125 }
126 static inline void o2net_debug_del_nst(struct o2net_send_tracking *nst)
127 {
128 }
129 static inline void o2net_debug_add_sc(struct o2net_sock_container *sc)
130 {
131 }
132 static inline void o2net_debug_del_sc(struct o2net_sock_container *sc)
133 {
134 }
135 #endif  /* CONFIG_DEBUG_FS */
136 
137 #endif /* O2CLUSTER_TCP_H */
138 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php