netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Sacren <sakiwit@gmail.com>
To: netdev@vger.kernel.org
Subject: [PATCH net-next 1/2] net: convert lists of macros to enumerations
Date: Sun, 23 Jun 2013 15:56:16 -0600	[thread overview]
Message-ID: <1372024577-6343-1-git-send-email-sakiwit@gmail.com> (raw)

Use enumerations to replace macros for simpler preprocessing. Map numeric
values to enumerators. Where required, prepend the list with an additional
enumerator to accommodate the rest.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
---
 include/linux/net.h      | 15 +++++++++------
 include/uapi/linux/net.h | 43 +++++++++++++++++++++++--------------------
 2 files changed, 32 insertions(+), 26 deletions(-)

diff --git a/include/linux/net.h b/include/linux/net.h
index 4f27575..84444bb 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -32,12 +32,15 @@ struct inode;
 struct file;
 struct net;
 
-#define SOCK_ASYNC_NOSPACE	0
-#define SOCK_ASYNC_WAITDATA	1
-#define SOCK_NOSPACE		2
-#define SOCK_PASSCRED		3
-#define SOCK_PASSSEC		4
-#define SOCK_EXTERNALLY_ALLOCATED 5
+/* Bit value for {set,clear,test{,_and_clear}}_bit() */
+enum {
+	SOCK_ASYNC_NOSPACE,		/* 0 */
+	SOCK_ASYNC_WAITDATA,		/* 1 */
+	SOCK_NOSPACE,			/* 2 */
+	SOCK_PASSCRED,			/* 3 */
+	SOCK_PASSSEC,			/* 4 */
+	SOCK_EXTERNALLY_ALLOCATED,	/* 5 */
+};
 
 #ifndef ARCH_HAS_SOCKET_TYPES
 /**
diff --git a/include/uapi/linux/net.h b/include/uapi/linux/net.h
index 9457239..9136b54 100644
--- a/include/uapi/linux/net.h
+++ b/include/uapi/linux/net.h
@@ -23,26 +23,29 @@
 
 #define NPROTO		AF_MAX
 
-#define SYS_SOCKET	1		/* sys_socket(2)		*/
-#define SYS_BIND	2		/* sys_bind(2)			*/
-#define SYS_CONNECT	3		/* sys_connect(2)		*/
-#define SYS_LISTEN	4		/* sys_listen(2)		*/
-#define SYS_ACCEPT	5		/* sys_accept(2)		*/
-#define SYS_GETSOCKNAME	6		/* sys_getsockname(2)		*/
-#define SYS_GETPEERNAME	7		/* sys_getpeername(2)		*/
-#define SYS_SOCKETPAIR	8		/* sys_socketpair(2)		*/
-#define SYS_SEND	9		/* sys_send(2)			*/
-#define SYS_RECV	10		/* sys_recv(2)			*/
-#define SYS_SENDTO	11		/* sys_sendto(2)		*/
-#define SYS_RECVFROM	12		/* sys_recvfrom(2)		*/
-#define SYS_SHUTDOWN	13		/* sys_shutdown(2)		*/
-#define SYS_SETSOCKOPT	14		/* sys_setsockopt(2)		*/
-#define SYS_GETSOCKOPT	15		/* sys_getsockopt(2)		*/
-#define SYS_SENDMSG	16		/* sys_sendmsg(2)		*/
-#define SYS_RECVMSG	17		/* sys_recvmsg(2)		*/
-#define SYS_ACCEPT4	18		/* sys_accept4(2)		*/
-#define SYS_RECVMMSG	19		/* sys_recvmmsg(2)		*/
-#define SYS_SENDMMSG	20		/* sys_sendmmsg(2)		*/
+enum {
+	SYS_DUMMY,			/* 0  - place holder		*/
+	SYS_SOCKET,			/* 1  - sys_socket(2)		*/
+	SYS_BIND,			/* 2  - sys_bind(2)		*/
+	SYS_CONNECT,			/* 3  - sys_connect(2)		*/
+	SYS_LISTEN,			/* 4  - sys_listen(2)		*/
+	SYS_ACCEPT,			/* 5  - sys_accept(2)		*/
+	SYS_GETSOCKNAME,		/* 6  - sys_getsockname(2)	*/
+	SYS_GETPEERNAME,		/* 7  - sys_getpeername(2)	*/
+	SYS_SOCKETPAIR,			/* 8  - sys_socketpair(2)	*/
+	SYS_SEND,			/* 9  - sys_send(2)		*/
+	SYS_RECV,			/* 10 - sys_recv(2)		*/
+	SYS_SENDTO,			/* 11 - sys_sendto(2)		*/
+	SYS_RECVFROM,			/* 12 - sys_recvfrom(2)		*/
+	SYS_SHUTDOWN,			/* 13 - sys_shutdown(2)		*/
+	SYS_SETSOCKOPT,			/* 14 - sys_setsockopt(2)	*/
+	SYS_GETSOCKOPT,			/* 15 - sys_getsockopt(2)	*/
+	SYS_SENDMSG,			/* 16 - sys_sendmsg(2)		*/
+	SYS_RECVMSG,			/* 17 - sys_recvmsg(2)		*/
+	SYS_ACCEPT4,			/* 18 - sys_accept4(2)		*/
+	SYS_RECVMMSG,			/* 19 - sys_recvmmsg(2)		*/
+	SYS_SENDMMSG,			/* 20 - sys_sendmmsg(2)		*/
+};
 
 typedef enum {
 	SS_FREE = 0,			/* not allocated		*/

             reply	other threads:[~2013-06-23 21:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-23 21:56 Jean Sacren [this message]
2013-06-23 21:56 ` [PATCH net-next 2/2] net: uapi: do not manually set the first enumerator to zero Jean Sacren
2013-06-24 15:14 ` [PATCH net-next 1/2] net: convert lists of macros to enumerations Stephen Hemminger
2013-06-25 23:26   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1372024577-6343-1-git-send-email-sakiwit@gmail.com \
    --to=sakiwit@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).