Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tipc: cleanup core.c and core.h files

Only the works of initializing and shutting down tipc module are done
in core.h and core.c files, so all stuffs which are not closely
associated with the two tasks should be moved to appropriate places.

Signed-off-by: Ying Xue <ying.xue@windriver.com>
Tested-by: Tero Aho <Tero.Aho@coriant.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ying Xue and committed by
David S. Miller
859fc7c0 2f55c437

+74 -89
-2
net/tipc/addr.h
··· 37 37 #ifndef _TIPC_ADDR_H 38 38 #define _TIPC_ADDR_H 39 39 40 - #include "core.h" 41 - 42 40 #define TIPC_ZONE_MASK 0xff000000u 43 41 #define TIPC_CLUSTER_MASK 0xfffff000u 44 42
+2 -2
net/tipc/config.h
··· 37 37 #ifndef _TIPC_CONFIG_H 38 38 #define _TIPC_CONFIG_H 39 39 40 - /* ---------------------------------------------------------------------- */ 41 - 42 40 #include "link.h" 41 + 42 + #define ULTRA_STRING_MAX_LEN 32768 43 43 44 44 struct sk_buff *tipc_cfg_reply_alloc(int payload_size); 45 45 int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
-23
net/tipc/core.c
··· 52 52 int tipc_net_id __read_mostly; 53 53 int sysctl_tipc_rmem[3] __read_mostly; /* min/default/max */ 54 54 55 - /** 56 - * tipc_buf_acquire - creates a TIPC message buffer 57 - * @size: message size (including TIPC header) 58 - * 59 - * Returns a new buffer with data pointers set to the specified size. 60 - * 61 - * NOTE: Headroom is reserved to allow prepending of a data link header. 62 - * There may also be unrequested tailroom present at the buffer's end. 63 - */ 64 - struct sk_buff *tipc_buf_acquire(u32 size) 65 - { 66 - struct sk_buff *skb; 67 - unsigned int buf_size = (BUF_HEADROOM + size + 3) & ~3u; 68 - 69 - skb = alloc_skb_fclone(buf_size, GFP_ATOMIC); 70 - if (skb) { 71 - skb_reserve(skb, BUF_HEADROOM); 72 - skb_put(skb, size); 73 - skb->next = NULL; 74 - } 75 - return skb; 76 - } 77 - 78 55 static int __init tipc_init(void) 79 56 { 80 57 int err;
-53
net/tipc/core.h
··· 60 60 61 61 #define TIPC_MOD_VER "2.0.0" 62 62 63 - #define ULTRA_STRING_MAX_LEN 32768 64 - #define TIPC_MAX_SUBSCRIPTIONS 65535 65 - #define TIPC_MAX_PUBLICATIONS 65535 66 - 67 - struct tipc_msg; /* msg.h */ 68 - 69 63 int tipc_snprintf(char *buf, int len, const char *fmt, ...); 70 - 71 - /* 72 - * TIPC-specific error codes 73 - */ 74 - #define ELINKCONG EAGAIN /* link congestion <=> resource unavailable */ 75 64 76 65 /* 77 66 * Global configuration variables ··· 75 86 */ 76 87 extern int tipc_random __read_mostly; 77 88 78 - /* 79 - * Routines available to privileged subsystems 80 - */ 81 - int tipc_netlink_start(void); 82 - void tipc_netlink_stop(void); 83 - int tipc_socket_init(void); 84 - void tipc_socket_stop(void); 85 - int tipc_sock_create_local(int type, struct socket **res); 86 - void tipc_sock_release_local(struct socket *sock); 87 - int tipc_sock_accept_local(struct socket *sock, struct socket **newsock, 88 - int flags); 89 - 90 89 #ifdef CONFIG_SYSCTL 91 90 int tipc_register_sysctl(void); 92 91 void tipc_unregister_sysctl(void); ··· 82 105 #define tipc_register_sysctl() 0 83 106 #define tipc_unregister_sysctl() 84 107 #endif 85 - 86 - /* 87 - * TIPC message buffer code 88 - * 89 - * TIPC message buffer headroom reserves space for the worst-case 90 - * link-level device header (in case the message is sent off-node). 91 - * 92 - * Note: Headroom should be a multiple of 4 to ensure the TIPC header fields 93 - * are word aligned for quicker access 94 - */ 95 - #define BUF_HEADROOM LL_MAX_HEADER 96 - 97 - struct tipc_skb_cb { 98 - void *handle; 99 - struct sk_buff *tail; 100 - bool deferred; 101 - bool wakeup_pending; 102 - bool bundling; 103 - u16 chain_sz; 104 - u16 chain_imp; 105 - }; 106 - 107 - #define TIPC_SKB_CB(__skb) ((struct tipc_skb_cb *)&((__skb)->cb[0])) 108 - 109 - static inline struct tipc_msg *buf_msg(struct sk_buff *skb) 110 - { 111 - return (struct tipc_msg *)skb->data; 112 - } 113 - 114 - struct sk_buff *tipc_buf_acquire(u32 size); 115 108 116 109 #endif
+4
net/tipc/link.h
··· 41 41 #include "msg.h" 42 42 #include "node.h" 43 43 44 + /* TIPC-specific error codes 45 + */ 46 + #define ELINKCONG EAGAIN /* link congestion <=> resource unavailable */ 47 + 44 48 /* Out-of-range value for link sequence numbers 45 49 */ 46 50 #define INVALID_LINK_SEQ 0x10000
+23
net/tipc/msg.c
··· 46 46 return (i + 3) & ~3u; 47 47 } 48 48 49 + /** 50 + * tipc_buf_acquire - creates a TIPC message buffer 51 + * @size: message size (including TIPC header) 52 + * 53 + * Returns a new buffer with data pointers set to the specified size. 54 + * 55 + * NOTE: Headroom is reserved to allow prepending of a data link header. 56 + * There may also be unrequested tailroom present at the buffer's end. 57 + */ 58 + struct sk_buff *tipc_buf_acquire(u32 size) 59 + { 60 + struct sk_buff *skb; 61 + unsigned int buf_size = (BUF_HEADROOM + size + 3) & ~3u; 62 + 63 + skb = alloc_skb_fclone(buf_size, GFP_ATOMIC); 64 + if (skb) { 65 + skb_reserve(skb, BUF_HEADROOM); 66 + skb_put(skb, size); 67 + skb->next = NULL; 68 + } 69 + return skb; 70 + } 71 + 49 72 void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type, u32 hsize, 50 73 u32 destnode) 51 74 {
+29 -8
net/tipc/msg.h
··· 77 77 78 78 #define TIPC_MEDIA_ADDR_OFFSET 5 79 79 80 + /** 81 + * TIPC message buffer code 82 + * 83 + * TIPC message buffer headroom reserves space for the worst-case 84 + * link-level device header (in case the message is sent off-node). 85 + * 86 + * Note: Headroom should be a multiple of 4 to ensure the TIPC header fields 87 + * are word aligned for quicker access 88 + */ 89 + #define BUF_HEADROOM LL_MAX_HEADER 90 + 91 + struct tipc_skb_cb { 92 + void *handle; 93 + struct sk_buff *tail; 94 + bool deferred; 95 + bool wakeup_pending; 96 + bool bundling; 97 + u16 chain_sz; 98 + u16 chain_imp; 99 + }; 100 + 101 + #define TIPC_SKB_CB(__skb) ((struct tipc_skb_cb *)&((__skb)->cb[0])) 102 + 80 103 struct tipc_msg { 81 104 __be32 hdr[15]; 82 105 }; 106 + 107 + static inline struct tipc_msg *buf_msg(struct sk_buff *skb) 108 + { 109 + return (struct tipc_msg *)skb->data; 110 + } 83 111 84 112 static inline u32 msg_word(struct tipc_msg *m, u32 pos) 85 113 { ··· 747 719 return msg_origport(m); 748 720 } 749 721 722 + struct sk_buff *tipc_buf_acquire(u32 size); 750 723 bool tipc_msg_reverse(struct sk_buff *buf, u32 *dnode, int err); 751 - 752 724 int tipc_msg_eval(struct sk_buff *buf, u32 *dnode); 753 - 754 725 void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type, u32 hsize, 755 726 u32 destnode); 756 - 757 727 struct sk_buff *tipc_msg_create(uint user, uint type, uint hdr_sz, 758 728 uint data_sz, u32 dnode, u32 onode, 759 729 u32 dport, u32 oport, int errcode); 760 - 761 730 int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf); 762 - 763 731 bool tipc_msg_bundle(struct sk_buff_head *list, struct sk_buff *skb, u32 mtu); 764 - 765 732 bool tipc_msg_make_bundle(struct sk_buff_head *list, struct sk_buff *skb, 766 733 u32 mtu, u32 dnode); 767 - 768 734 int tipc_msg_build(struct tipc_msg *mhdr, struct msghdr *m, int offset, 769 735 int dsz, int mtu, struct sk_buff_head *list); 770 - 771 736 struct sk_buff *tipc_msg_reassemble(struct sk_buff_head *list); 772 737 773 738 #endif
+3
net/tipc/netlink.h
··· 45 45 u32 seq; 46 46 }; 47 47 48 + int tipc_netlink_start(void); 49 + void tipc_netlink_stop(void); 50 + 48 51 #endif
+1
net/tipc/server.c
··· 35 35 36 36 #include "server.h" 37 37 #include "core.h" 38 + #include "socket.h" 38 39 #include <net/sock.h> 39 40 40 41 /* Number of messages to send before rescheduling */
+2 -1
net/tipc/server.h
··· 36 36 #ifndef _TIPC_SERVER_H 37 37 #define _TIPC_SERVER_H 38 38 39 - #include "core.h" 39 + #include <linux/idr.h> 40 + #include <linux/tipc.h> 40 41 41 42 #define TIPC_SERVER_NAME_LEN 32 42 43
+7
net/tipc/socket.h
··· 42 42 #define TIPC_FLOWCTRL_WIN (TIPC_CONNACK_INTV * 2) 43 43 #define TIPC_CONN_OVERLOAD_LIMIT ((TIPC_FLOWCTRL_WIN * 2 + 1) * \ 44 44 SKB_TRUESIZE(TIPC_MAX_USER_MSG_SIZE)) 45 + 46 + int tipc_socket_init(void); 47 + void tipc_socket_stop(void); 48 + int tipc_sock_create_local(int type, struct socket **res); 49 + void tipc_sock_release_local(struct socket *sock); 50 + int tipc_sock_accept_local(struct socket *sock, struct socket **newsock, 51 + int flags); 45 52 int tipc_sk_rcv(struct sk_buff *buf); 46 53 struct sk_buff *tipc_sk_socks_show(void); 47 54 void tipc_sk_mcast_rcv(struct sk_buff *buf);
+3
net/tipc/subscr.h
··· 39 39 40 40 #include "server.h" 41 41 42 + #define TIPC_MAX_SUBSCRIPTIONS 65535 43 + #define TIPC_MAX_PUBLICATIONS 65535 44 + 42 45 struct tipc_subscription; 43 46 struct tipc_subscriber; 44 47