Whamcloud - gitweb
LU-7734 lnet: whitespace cleanup for wirecheck.c 25/22025/7
authorOlaf Weber <olaf@sgi.com>
Fri, 27 Jan 2017 15:16:45 +0000 (16:16 +0100)
committerOlaf Weber <olaf@sgi.com>
Fri, 27 Jan 2017 15:41:20 +0000 (16:41 +0100)
Clean up the whitespace use in wirecheck.c and in the generated code.

Test-Parameters: trivial
Signed-off-by: Olaf Weber <olaf@sgi.com>
Change-Id: I5c90d09fd694c8151f6f11f716c491ac3db79eb0

lnet/lnet/api-ni.c
lnet/utils/wirecheck.c

index 6d6c206..687affb 100644 (file)
@@ -242,10 +242,13 @@ lnet_create_locks(void)
 
 static void lnet_assert_wire_constants(void)
 {
-       /* Wire protocol assertions generated by 'wirecheck'
-        * running on Linux robert.bartonsoftware.com 2.6.8-1.521
-        * #1 Mon Aug 16 09:01:18 EDT 2004 i686 athlon i386 GNU/Linux
-        * with gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7) */
+       /*
+        * Wire protocol assertions generated by 'wirecheck'
+        * running on Linux lustre-build 3.10.0-327.el7_lustre.centos.x86_64
+        * #1 SMP Fri Jul 8 13:32:15 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux
+        * with gcc version 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)
+        */
+
 
        /* Constants... */
        CLASSERT(LNET_PROTO_TCP_MAGIC == 0xeebc0ded);
index 2d5d1b2..523eb94 100644 (file)
 #define strnlen(s, i) strlen(s)
 #endif
 
-#define BLANK_LINE()                            \
-do {                                            \
-        printf ("\n");                          \
+#define BLANK_LINE()                           \
+do {                                           \
+       printf("\n");                           \
 } while (0)
 
-#define COMMENT(c)                              \
-do {                                            \
-        printf ("        /* "c" */\n");         \
+#define COMMENT(c)                             \
+do {                                           \
+       printf("\t/* "c" */\n");                \
 } while (0)
 
 #define STRINGIFY(a) #a
 
-#define CHECK_DEFINE(a)                                                 \
-do {                                                                    \
-        printf ("        CLASSERT ("#a" == "STRINGIFY(a)");\n");        \
+#define CHECK_DEFINE(a)                                                        \
+do {                                                                   \
+       printf("\tCLASSERT("#a" == "STRINGIFY(a)");\n");                \
 } while (0)
 
-#define CHECK_VALUE(a)                                  \
-do {                                                    \
-        printf ("        CLASSERT ("#a" == %d);\n", a); \
+#define CHECK_VALUE(a)                                 \
+do {                                                   \
+       printf("\tCLASSERT("#a" == %d);\n", a);         \
 } while (0)
 
-#define CHECK_MEMBER_OFFSET(s,m)                \
-do {                                            \
-        CHECK_VALUE((int)offsetof(s, m));       \
+#define CHECK_MEMBER_OFFSET(s, m)              \
+do {                                           \
+       CHECK_VALUE((int)offsetof(s, m));       \
 } while (0)
 
-#define CHECK_MEMBER_SIZEOF(s,m)                \
-do {                                            \
-        CHECK_VALUE((int)sizeof(((s *)0)->m));  \
+#define CHECK_MEMBER_SIZEOF(s, m)              \
+do {                                           \
+       CHECK_VALUE((int)sizeof(((s *)0)->m));  \
 } while (0)
 
-#define CHECK_MEMBER(s,m)                       \
-do {                                            \
-        CHECK_MEMBER_OFFSET(s, m);              \
-        CHECK_MEMBER_SIZEOF(s, m);              \
+#define CHECK_MEMBER(s, m)                     \
+do {                                           \
+       CHECK_MEMBER_OFFSET(s, m);              \
+       CHECK_MEMBER_SIZEOF(s, m);              \
 } while (0)
 
-#define CHECK_STRUCT(s)                         \
-do {                                            \
-        BLANK_LINE ();                          \
-        COMMENT ("Checks for struct "#s);       \
-        CHECK_VALUE((int)sizeof(s));            \
+#define CHECK_STRUCT(s)                                \
+do {                                           \
+       BLANK_LINE();                           \
+       COMMENT("Checks for struct "#s);        \
+       CHECK_VALUE((int)sizeof(s));            \
 } while (0)
 
 void
@@ -101,147 +101,147 @@ check_lnet_handle_wire(void)
 }
 
 void
-check_lnet_magicversion (void)
+check_lnet_magicversion(void)
 {
-        CHECK_STRUCT (lnet_magicversion_t);
-        CHECK_MEMBER (lnet_magicversion_t, magic);
-        CHECK_MEMBER (lnet_magicversion_t, version_major);
-        CHECK_MEMBER (lnet_magicversion_t, version_minor);
+       CHECK_STRUCT(lnet_magicversion_t);
+       CHECK_MEMBER(lnet_magicversion_t, magic);
+       CHECK_MEMBER(lnet_magicversion_t, version_major);
+       CHECK_MEMBER(lnet_magicversion_t, version_minor);
 }
 
 void
-check_lnet_hdr (void)
+check_lnet_hdr(void)
 {
-        CHECK_STRUCT (lnet_hdr_t);
-        CHECK_MEMBER (lnet_hdr_t, dest_nid);
-        CHECK_MEMBER (lnet_hdr_t, src_nid);
-        CHECK_MEMBER (lnet_hdr_t, dest_pid);
-        CHECK_MEMBER (lnet_hdr_t, src_pid);
-        CHECK_MEMBER (lnet_hdr_t, type);
-        CHECK_MEMBER (lnet_hdr_t, payload_length);
-        CHECK_MEMBER (lnet_hdr_t, msg);
-
-        BLANK_LINE ();
-        COMMENT ("Ack");
-        CHECK_MEMBER (lnet_hdr_t, msg.ack.dst_wmd);
-        CHECK_MEMBER (lnet_hdr_t, msg.ack.match_bits);
-        CHECK_MEMBER (lnet_hdr_t, msg.ack.mlength);
-
-        BLANK_LINE ();
-        COMMENT ("Put");
-        CHECK_MEMBER (lnet_hdr_t, msg.put.ack_wmd);
-        CHECK_MEMBER (lnet_hdr_t, msg.put.match_bits);
-        CHECK_MEMBER (lnet_hdr_t, msg.put.hdr_data);
-        CHECK_MEMBER (lnet_hdr_t, msg.put.ptl_index);
-        CHECK_MEMBER (lnet_hdr_t, msg.put.offset);
-
-        BLANK_LINE ();
-        COMMENT ("Get");
-        CHECK_MEMBER (lnet_hdr_t, msg.get.return_wmd);
-        CHECK_MEMBER (lnet_hdr_t, msg.get.match_bits);
-        CHECK_MEMBER (lnet_hdr_t, msg.get.ptl_index);
-        CHECK_MEMBER (lnet_hdr_t, msg.get.src_offset);
-        CHECK_MEMBER (lnet_hdr_t, msg.get.sink_length);
-
-        BLANK_LINE ();
-        COMMENT ("Reply");
-        CHECK_MEMBER (lnet_hdr_t, msg.reply.dst_wmd);
-
-        BLANK_LINE ();
-        COMMENT ("Hello");
-        CHECK_MEMBER (lnet_hdr_t, msg.hello.incarnation);
-        CHECK_MEMBER (lnet_hdr_t, msg.hello.type);
+       CHECK_STRUCT(lnet_hdr_t);
+       CHECK_MEMBER(lnet_hdr_t, dest_nid);
+       CHECK_MEMBER(lnet_hdr_t, src_nid);
+       CHECK_MEMBER(lnet_hdr_t, dest_pid);
+       CHECK_MEMBER(lnet_hdr_t, src_pid);
+       CHECK_MEMBER(lnet_hdr_t, type);
+       CHECK_MEMBER(lnet_hdr_t, payload_length);
+       CHECK_MEMBER(lnet_hdr_t, msg);
+
+       BLANK_LINE();
+       COMMENT("Ack");
+       CHECK_MEMBER(lnet_hdr_t, msg.ack.dst_wmd);
+       CHECK_MEMBER(lnet_hdr_t, msg.ack.match_bits);
+       CHECK_MEMBER(lnet_hdr_t, msg.ack.mlength);
+
+       BLANK_LINE();
+       COMMENT("Put");
+       CHECK_MEMBER(lnet_hdr_t, msg.put.ack_wmd);
+       CHECK_MEMBER(lnet_hdr_t, msg.put.match_bits);
+       CHECK_MEMBER(lnet_hdr_t, msg.put.hdr_data);
+       CHECK_MEMBER(lnet_hdr_t, msg.put.ptl_index);
+       CHECK_MEMBER(lnet_hdr_t, msg.put.offset);
+
+       BLANK_LINE();
+       COMMENT("Get");
+       CHECK_MEMBER(lnet_hdr_t, msg.get.return_wmd);
+       CHECK_MEMBER(lnet_hdr_t, msg.get.match_bits);
+       CHECK_MEMBER(lnet_hdr_t, msg.get.ptl_index);
+       CHECK_MEMBER(lnet_hdr_t, msg.get.src_offset);
+       CHECK_MEMBER(lnet_hdr_t, msg.get.sink_length);
+
+       BLANK_LINE();
+       COMMENT("Reply");
+       CHECK_MEMBER(lnet_hdr_t, msg.reply.dst_wmd);
+
+       BLANK_LINE();
+       COMMENT("Hello");
+       CHECK_MEMBER(lnet_hdr_t, msg.hello.incarnation);
+       CHECK_MEMBER(lnet_hdr_t, msg.hello.type);
 }
 
 void
-system_string (char *cmdline, char *str, int len)
+system_string(char *cmdline, char *str, int len)
 {
-        int   fds[2];
-        int   rc;
-        pid_t pid;
+       int   fds[2];
+       int   rc;
+       pid_t pid;
 
-        rc = pipe (fds);
-        if (rc != 0)
-                abort ();
+       rc = pipe(fds);
+       if (rc != 0)
+               abort();
 
-        pid = fork ();
-        if (pid == 0) {
-                /* child */
-                int   fd = fileno(stdout);
+       pid = fork();
+       if (pid == 0) {
+               /* child */
+               int   fd = fileno(stdout);
 
-                rc = dup2(fds[1], fd);
-                if (rc != fd)
-                        abort();
+               rc = dup2(fds[1], fd);
+               if (rc != fd)
+                       abort();
 
-                exit(system(cmdline));
-                /* notreached */
-        } else if ((int)pid < 0) {
-                abort();
-        } else {
-                FILE *f = fdopen (fds[0], "r");
+               exit(system(cmdline));
+               /* notreached */
+       } else if ((int)pid < 0) {
+               abort();
+       } else {
+               FILE *f = fdopen(fds[0], "r");
 
-                if (f == NULL)
-                        abort();
+               if (f == NULL)
+                       abort();
 
-                close(fds[1]);
+               close(fds[1]);
 
-                if (fgets(str, len, f) == NULL)
-                        abort();
+               if (fgets(str, len, f) == NULL)
+                       abort();
 
-                if (waitpid(pid, &rc, 0) != pid)
-                        abort();
+               if (waitpid(pid, &rc, 0) != pid)
+                       abort();
 
-                if (!WIFEXITED(rc) ||
-                    WEXITSTATUS(rc) != 0)
-                        abort();
+               if (!WIFEXITED(rc) ||
+                   WEXITSTATUS(rc) != 0)
+                       abort();
 
-                if (strnlen(str, len) == len)
-                        str[len - 1] = 0;
+               if (strnlen(str, len) == len)
+                       str[len - 1] = 0;
 
-                if (str[strlen(str) - 1] == '\n')
-                        str[strlen(str) - 1] = 0;
+               if (str[strlen(str) - 1] == '\n')
+                       str[strlen(str) - 1] = 0;
 
-                fclose(f);
-        }
+               fclose(f);
+       }
 }
 
 int
 main (int argc, char **argv)
 {
-        char unameinfo[256];
-        char gccinfo[256];
+       char unameinfo[256];
+       char gccinfo[256];
 
-        system_string("uname -a", unameinfo, sizeof(unameinfo));
-        system_string("gcc -v 2>&1 | tail -1", gccinfo, sizeof(gccinfo));
+       system_string("uname -a", unameinfo, sizeof(unameinfo));
+       system_string("gcc -v 2>&1 | tail -1", gccinfo, sizeof(gccinfo));
 
-        printf ("void lnet_assert_wire_constants (void)\n"
-                "{\n"
-                "        /* Wire protocol assertions generated by 'wirecheck'\n"
-                "         * running on %s\n"
-                "         * with %s */\n"
-                "\n", unameinfo, gccinfo);
+       printf("void lnet_assert_wire_constants(void)\n"
+              "{\n"
+              "\t/*\n"
+              "\t * Wire protocol assertions generated by 'wirecheck'\n"
+              "\t * running on %s\n"
+              "\t * with %s\n"
+              "\t */\n"
+              "\n", unameinfo, gccinfo);
 
-        BLANK_LINE ();
+       BLANK_LINE();
 
-        COMMENT ("Constants...");
+       COMMENT("Constants...");
 
-        CHECK_DEFINE (LNET_PROTO_RA_MAGIC);
+       CHECK_DEFINE(LNET_PROTO_TCP_MAGIC);
+       CHECK_DEFINE(LNET_PROTO_TCP_VERSION_MAJOR);
+       CHECK_DEFINE(LNET_PROTO_TCP_VERSION_MINOR);
 
-        CHECK_DEFINE (LNET_PROTO_TCP_MAGIC);
-        CHECK_DEFINE (LNET_PROTO_TCP_VERSION_MAJOR);
-        CHECK_DEFINE (LNET_PROTO_TCP_VERSION_MINOR);
+       CHECK_VALUE(LNET_MSG_ACK);
+       CHECK_VALUE(LNET_MSG_PUT);
+       CHECK_VALUE(LNET_MSG_GET);
+       CHECK_VALUE(LNET_MSG_REPLY);
+       CHECK_VALUE(LNET_MSG_HELLO);
 
-        CHECK_VALUE (LNET_MSG_ACK);
-        CHECK_VALUE (LNET_MSG_PUT);
-        CHECK_VALUE (LNET_MSG_GET);
-        CHECK_VALUE (LNET_MSG_REPLY);
-        CHECK_VALUE (LNET_MSG_HELLO);
+       check_lnet_handle_wire();
+       check_lnet_magicversion();
+       check_lnet_hdr();
 
-        check_lnet_handle_wire ();
-        check_lnet_magicversion ();
-        check_lnet_hdr ();
+       printf("}\n\n");
 
-        printf ("}\n\n");
-
-        return (0);
+       return 0;
 }