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

sctp: Turn the enum socket options into defines

Recent attempt to remove deprecated socket options demonstrated
that removing options from the enum space will have severe
binary compatibility issues. The reason is that it changes
the subsequent enum space and causes option values to be redefined.
To solve this, and to get rid of the ugly double statements for
every option, we simply convert to the #define scheme.

Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>

+42 -81
+42 -81
include/net/sctp/user.h
··· 60 60 /* The following symbols come from the Sockets API Extensions for 61 61 * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>. 62 62 */ 63 - enum sctp_optname { 64 - SCTP_RTOINFO, 65 - #define SCTP_RTOINFO SCTP_RTOINFO 66 - SCTP_ASSOCINFO, 67 - #define SCTP_ASSOCINFO SCTP_ASSOCINFO 68 - SCTP_INITMSG, 69 - #define SCTP_INITMSG SCTP_INITMSG 70 - SCTP_NODELAY, /* Get/set nodelay option. */ 71 - #define SCTP_NODELAY SCTP_NODELAY 72 - SCTP_AUTOCLOSE, 73 - #define SCTP_AUTOCLOSE SCTP_AUTOCLOSE 74 - SCTP_SET_PEER_PRIMARY_ADDR, 75 - #define SCTP_SET_PEER_PRIMARY_ADDR SCTP_SET_PEER_PRIMARY_ADDR 76 - SCTP_PRIMARY_ADDR, 77 - #define SCTP_PRIMARY_ADDR SCTP_PRIMARY_ADDR 78 - SCTP_ADAPTATION_LAYER, 79 - #define SCTP_ADAPTATION_LAYER SCTP_ADAPTATION_LAYER 80 - SCTP_DISABLE_FRAGMENTS, 81 - #define SCTP_DISABLE_FRAGMENTS SCTP_DISABLE_FRAGMENTS 82 - SCTP_PEER_ADDR_PARAMS, 83 - #define SCTP_PEER_ADDR_PARAMS SCTP_PEER_ADDR_PARAMS 84 - SCTP_DEFAULT_SEND_PARAM, 85 - #define SCTP_DEFAULT_SEND_PARAM SCTP_DEFAULT_SEND_PARAM 86 - SCTP_EVENTS, 87 - #define SCTP_EVENTS SCTP_EVENTS 88 - SCTP_I_WANT_MAPPED_V4_ADDR, /* Turn on/off mapped v4 addresses */ 89 - #define SCTP_I_WANT_MAPPED_V4_ADDR SCTP_I_WANT_MAPPED_V4_ADDR 90 - SCTP_MAXSEG, /* Get/set maximum fragment. */ 91 - #define SCTP_MAXSEG SCTP_MAXSEG 92 - SCTP_STATUS, 93 - #define SCTP_STATUS SCTP_STATUS 94 - SCTP_GET_PEER_ADDR_INFO, 95 - #define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO 96 - SCTP_DELAYED_ACK, 97 - #define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK 98 - #define SCTP_DELAYED_ACK SCTP_DELAYED_ACK 99 - SCTP_CONTEXT, /* Receive Context */ 100 - #define SCTP_CONTEXT SCTP_CONTEXT 101 - SCTP_FRAGMENT_INTERLEAVE, 102 - #define SCTP_FRAGMENT_INTERLEAVE SCTP_FRAGMENT_INTERLEAVE 103 - SCTP_PARTIAL_DELIVERY_POINT, /* Set/Get partial delivery point */ 104 - #define SCTP_PARTIAL_DELIVERY_POINT SCTP_PARTIAL_DELIVERY_POINT 105 - SCTP_MAX_BURST, /* Set/Get max burst */ 106 - #define SCTP_MAX_BURST SCTP_MAX_BURST 107 - SCTP_AUTH_CHUNK, /* Set only: add a chunk type to authenticat */ 108 - #define SCTP_AUTH_CHUNK SCTP_AUTH_CHUNK 109 - SCTP_HMAC_IDENT, 110 - #define SCTP_HMAC_IDENT SCTP_HMAC_IDENT 111 - SCTP_AUTH_KEY, 112 - #define SCTP_AUTH_KEY SCTP_AUTH_KEY 113 - SCTP_AUTH_ACTIVE_KEY, 114 - #define SCTP_AUTH_ACTIVE_KEY SCTP_AUTH_ACTIVE_KEY 115 - SCTP_AUTH_DELETE_KEY, 116 - #define SCTP_AUTH_DELETE_KEY SCTP_AUTH_DELETE_KEY 117 - SCTP_PEER_AUTH_CHUNKS, /* Read only */ 118 - #define SCTP_PEER_AUTH_CHUNKS SCTP_PEER_AUTH_CHUNKS 119 - SCTP_LOCAL_AUTH_CHUNKS, /* Read only */ 120 - #define SCTP_LOCAL_AUTH_CHUNKS SCTP_LOCAL_AUTH_CHUNKS 121 - SCTP_GET_ASSOC_NUMBER, /* Read only */ 122 - #define SCTP_GET_ASSOC_NUMBER SCTP_GET_ASSOC_NUMBER 63 + #define SCTP_RTOINFO 0 64 + #define SCTP_ASSOCINFO 1 65 + #define SCTP_INITMSG 2 66 + #define SCTP_NODELAY 3 /* Get/set nodelay option. */ 67 + #define SCTP_AUTOCLOSE 4 68 + #define SCTP_SET_PEER_PRIMARY_ADDR 5 69 + #define SCTP_PRIMARY_ADDR 6 70 + #define SCTP_ADAPTATION_LAYER 7 71 + #define SCTP_DISABLE_FRAGMENTS 8 72 + #define SCTP_PEER_ADDR_PARAMS 9 73 + #define SCTP_DEFAULT_SEND_PARAM 10 74 + #define SCTP_EVENTS 11 75 + #define SCTP_I_WANT_MAPPED_V4_ADDR 12 /* Turn on/off mapped v4 addresses */ 76 + #define SCTP_MAXSEG 13 /* Get/set maximum fragment. */ 77 + #define SCTP_STATUS 14 78 + #define SCTP_GET_PEER_ADDR_INFO 15 79 + #define SCTP_DELAYED_ACK_TIME 16 80 + #define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME 81 + #define SCTP_CONTEXT 17 82 + #define SCTP_FRAGMENT_INTERLEAVE 18 83 + #define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */ 84 + #define SCTP_MAX_BURST 20 /* Set/Get max burst */ 85 + #define SCTP_AUTH_CHUNK 21 /* Set only: add a chunk type to authenticate */ 86 + #define SCTP_HMAC_IDENT 22 87 + #define SCTP_AUTH_KEY 23 88 + #define SCTP_AUTH_ACTIVE_KEY 24 89 + #define SCTP_AUTH_DELETE_KEY 25 90 + #define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */ 91 + #define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */ 92 + #define SCTP_GET_ASSOC_NUMBER 28 /* Read only */ 123 93 124 - 125 - /* Internal Socket Options. Some of the sctp library functions are 126 - * implemented using these socket options. 127 - */ 128 - SCTP_SOCKOPT_BINDX_ADD = 100,/* BINDX requests for adding addresses. */ 129 - #define SCTP_SOCKOPT_BINDX_ADD SCTP_SOCKOPT_BINDX_ADD 130 - SCTP_SOCKOPT_BINDX_REM, /* BINDX requests for removing addresses. */ 131 - #define SCTP_SOCKOPT_BINDX_REM SCTP_SOCKOPT_BINDX_REM 132 - SCTP_SOCKOPT_PEELOFF, /* peel off association. */ 133 - #define SCTP_SOCKOPT_PEELOFF SCTP_SOCKOPT_PEELOFF 134 - SCTP_SOCKOPT_CONNECTX_OLD, /* CONNECTX old requests. */ 135 - #define SCTP_SOCKOPT_CONNECTX_OLD SCTP_SOCKOPT_CONNECTX_OLD 136 - SCTP_GET_PEER_ADDRS, /* Get all peer addresss. */ 137 - #define SCTP_GET_PEER_ADDRS SCTP_GET_PEER_ADDRS 138 - SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */ 139 - #define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS 140 - SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */ 141 - #define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX 142 - SCTP_SOCKOPT_CONNECTX3, /* CONNECTX requests. (new implementation) */ 143 - #define SCTP_SOCKOPT_CONNECTX3 SCTP_SOCKOPT_CONNECTX3 144 - }; 94 + /* Internal Socket Options. Some of the sctp library functions are 95 + * implemented using these socket options. 96 + */ 97 + #define SCTP_SOCKOPT_BINDX_ADD 100 /* BINDX requests for adding addrs */ 98 + #define SCTP_SOCKOPT_BINDX_REM 101 /* BINDX requests for removing addrs. */ 99 + #define SCTP_SOCKOPT_PEELOFF 102 /* peel off association. */ 100 + /* Options 104-106 are deprecated and removed. Do not use this space */ 101 + #define SCTP_SOCKOPT_CONNECTX_OLD 107 /* CONNECTX old requests. */ 102 + #define SCTP_GET_PEER_ADDRS 108 /* Get all peer addresss. */ 103 + #define SCTP_GET_LOCAL_ADDRS 109 /* Get all local addresss. */ 104 + #define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */ 105 + #define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */ 145 106 146 107 /* 147 108 * 5.2.1 SCTP Initiation Structure (SCTP_INIT)