Whamcloud - gitweb
LU-6142 lnet: replace white spaces with tabs for LNet core
[fs/lustre-release.git] / lnet / lnet / api-ni.c
index 641ee00..abb02d6 100644 (file)
@@ -40,7 +40,7 @@
 
 #define D_LNI D_CONSOLE
 
-lnet_t      the_lnet;                           /* THE state of the network */
+lnet_t     the_lnet;                           /* THE state of the network */
 EXPORT_SYMBOL(the_lnet);
 
 static char *ip2nets = "";
@@ -65,14 +65,14 @@ static int lnet_ping(lnet_process_id_t id, int timeout_ms,
 static char *
 lnet_get_routes(void)
 {
-        return routes;
+       return routes;
 }
 
 static char *
 lnet_get_networks(void)
 {
        char   *nets;
-       int     rc;
+       int     rc;
 
        if (*networks != 0 && *ip2nets != 0) {
                LCONSOLE_ERROR_MSG(0x101, "Please specify EITHER 'networks' or "
@@ -220,95 +220,95 @@ 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) */
-
-        /* Constants... */
-        CLASSERT (LNET_PROTO_TCP_MAGIC == 0xeebc0ded);
-        CLASSERT (LNET_PROTO_TCP_VERSION_MAJOR == 1);
-        CLASSERT (LNET_PROTO_TCP_VERSION_MINOR == 0);
-        CLASSERT (LNET_MSG_ACK == 0);
-        CLASSERT (LNET_MSG_PUT == 1);
-        CLASSERT (LNET_MSG_GET == 2);
-        CLASSERT (LNET_MSG_REPLY == 3);
-        CLASSERT (LNET_MSG_HELLO == 4);
-
-        /* Checks for struct ptl_handle_wire_t */
-        CLASSERT ((int)sizeof(lnet_handle_wire_t) == 16);
-        CLASSERT ((int)offsetof(lnet_handle_wire_t, wh_interface_cookie) == 0);
-        CLASSERT ((int)sizeof(((lnet_handle_wire_t *)0)->wh_interface_cookie) == 8);
-        CLASSERT ((int)offsetof(lnet_handle_wire_t, wh_object_cookie) == 8);
-        CLASSERT ((int)sizeof(((lnet_handle_wire_t *)0)->wh_object_cookie) == 8);
-
-        /* Checks for struct lnet_magicversion_t */
-        CLASSERT ((int)sizeof(lnet_magicversion_t) == 8);
-        CLASSERT ((int)offsetof(lnet_magicversion_t, magic) == 0);
-        CLASSERT ((int)sizeof(((lnet_magicversion_t *)0)->magic) == 4);
-        CLASSERT ((int)offsetof(lnet_magicversion_t, version_major) == 4);
-        CLASSERT ((int)sizeof(((lnet_magicversion_t *)0)->version_major) == 2);
-        CLASSERT ((int)offsetof(lnet_magicversion_t, version_minor) == 6);
-        CLASSERT ((int)sizeof(((lnet_magicversion_t *)0)->version_minor) == 2);
-
-        /* Checks for struct lnet_hdr_t */
-        CLASSERT ((int)sizeof(lnet_hdr_t) == 72);
-        CLASSERT ((int)offsetof(lnet_hdr_t, dest_nid) == 0);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->dest_nid) == 8);
-        CLASSERT ((int)offsetof(lnet_hdr_t, src_nid) == 8);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->src_nid) == 8);
-        CLASSERT ((int)offsetof(lnet_hdr_t, dest_pid) == 16);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->dest_pid) == 4);
-        CLASSERT ((int)offsetof(lnet_hdr_t, src_pid) == 20);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->src_pid) == 4);
-        CLASSERT ((int)offsetof(lnet_hdr_t, type) == 24);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->type) == 4);
-        CLASSERT ((int)offsetof(lnet_hdr_t, payload_length) == 28);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->payload_length) == 4);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg) == 32);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg) == 40);
-
-        /* Ack */
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.ack.dst_wmd) == 32);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.ack.dst_wmd) == 16);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.ack.match_bits) == 48);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.ack.match_bits) == 8);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.ack.mlength) == 56);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.ack.mlength) == 4);
-
-        /* Put */
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.put.ack_wmd) == 32);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.put.ack_wmd) == 16);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.put.match_bits) == 48);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.put.match_bits) == 8);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.put.hdr_data) == 56);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.put.hdr_data) == 8);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.put.ptl_index) == 64);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.put.ptl_index) == 4);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.put.offset) == 68);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.put.offset) == 4);
-
-        /* Get */
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.get.return_wmd) == 32);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.get.return_wmd) == 16);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.get.match_bits) == 48);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.get.match_bits) == 8);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.get.ptl_index) == 56);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.get.ptl_index) == 4);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.get.src_offset) == 60);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.get.src_offset) == 4);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.get.sink_length) == 64);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.get.sink_length) == 4);
-
-        /* Reply */
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.reply.dst_wmd) == 32);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.reply.dst_wmd) == 16);
-
-        /* Hello */
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.hello.incarnation) == 32);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.hello.incarnation) == 8);
-        CLASSERT ((int)offsetof(lnet_hdr_t, msg.hello.type) == 40);
-        CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.hello.type) == 4);
+       /* 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) */
+
+       /* Constants... */
+       CLASSERT(LNET_PROTO_TCP_MAGIC == 0xeebc0ded);
+       CLASSERT(LNET_PROTO_TCP_VERSION_MAJOR == 1);
+       CLASSERT(LNET_PROTO_TCP_VERSION_MINOR == 0);
+       CLASSERT(LNET_MSG_ACK == 0);
+       CLASSERT(LNET_MSG_PUT == 1);
+       CLASSERT(LNET_MSG_GET == 2);
+       CLASSERT(LNET_MSG_REPLY == 3);
+       CLASSERT(LNET_MSG_HELLO == 4);
+
+       /* Checks for struct ptl_handle_wire_t */
+       CLASSERT((int)sizeof(lnet_handle_wire_t) == 16);
+       CLASSERT((int)offsetof(lnet_handle_wire_t, wh_interface_cookie) == 0);
+       CLASSERT((int)sizeof(((lnet_handle_wire_t *)0)->wh_interface_cookie) == 8);
+       CLASSERT((int)offsetof(lnet_handle_wire_t, wh_object_cookie) == 8);
+       CLASSERT((int)sizeof(((lnet_handle_wire_t *)0)->wh_object_cookie) == 8);
+
+       /* Checks for struct lnet_magicversion_t */
+       CLASSERT((int)sizeof(lnet_magicversion_t) == 8);
+       CLASSERT((int)offsetof(lnet_magicversion_t, magic) == 0);
+       CLASSERT((int)sizeof(((lnet_magicversion_t *)0)->magic) == 4);
+       CLASSERT((int)offsetof(lnet_magicversion_t, version_major) == 4);
+       CLASSERT((int)sizeof(((lnet_magicversion_t *)0)->version_major) == 2);
+       CLASSERT((int)offsetof(lnet_magicversion_t, version_minor) == 6);
+       CLASSERT((int)sizeof(((lnet_magicversion_t *)0)->version_minor) == 2);
+
+       /* Checks for struct lnet_hdr_t */
+       CLASSERT((int)sizeof(lnet_hdr_t) == 72);
+       CLASSERT((int)offsetof(lnet_hdr_t, dest_nid) == 0);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->dest_nid) == 8);
+       CLASSERT((int)offsetof(lnet_hdr_t, src_nid) == 8);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->src_nid) == 8);
+       CLASSERT((int)offsetof(lnet_hdr_t, dest_pid) == 16);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->dest_pid) == 4);
+       CLASSERT((int)offsetof(lnet_hdr_t, src_pid) == 20);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->src_pid) == 4);
+       CLASSERT((int)offsetof(lnet_hdr_t, type) == 24);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->type) == 4);
+       CLASSERT((int)offsetof(lnet_hdr_t, payload_length) == 28);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->payload_length) == 4);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg) == 32);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg) == 40);
+
+       /* Ack */
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.ack.dst_wmd) == 32);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.ack.dst_wmd) == 16);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.ack.match_bits) == 48);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.ack.match_bits) == 8);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.ack.mlength) == 56);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.ack.mlength) == 4);
+
+       /* Put */
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.put.ack_wmd) == 32);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.put.ack_wmd) == 16);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.put.match_bits) == 48);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.put.match_bits) == 8);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.put.hdr_data) == 56);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.put.hdr_data) == 8);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.put.ptl_index) == 64);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.put.ptl_index) == 4);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.put.offset) == 68);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.put.offset) == 4);
+
+       /* Get */
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.get.return_wmd) == 32);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.get.return_wmd) == 16);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.get.match_bits) == 48);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.get.match_bits) == 8);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.get.ptl_index) == 56);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.get.ptl_index) == 4);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.get.src_offset) == 60);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.get.src_offset) == 4);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.get.sink_length) == 64);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.get.sink_length) == 4);
+
+       /* Reply */
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.reply.dst_wmd) == 32);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.reply.dst_wmd) == 16);
+
+       /* Hello */
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.hello.incarnation) == 32);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.hello.incarnation) == 8);
+       CLASSERT((int)offsetof(lnet_hdr_t, msg.hello.type) == 40);
+       CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.hello.type) == 4);
 }
 
 static lnd_t *lnet_find_lnd_by_type(__u32 type)
@@ -407,7 +407,7 @@ static __u64 lnet_create_interface_cookie(void)
         * even if it's only implemented to millisecond resolution is probably
         * easily good enough. */
        struct timeval tv;
-       __u64          cookie;
+       __u64          cookie;
        do_gettimeofday(&tv);
        cookie = tv.tv_sec;
        cookie *= 1000000;
@@ -1095,7 +1095,7 @@ lnet_ping_target_update(lnet_ping_info_t *pinfo, lnet_handle_md_t md_handle)
 static void
 lnet_ping_target_fini(void)
 {
-       int             rc;
+       int             rc;
 
        lnet_ping_md_unlink(the_lnet.ln_ping_info,
                            &the_lnet.ln_ping_target_md);
@@ -1675,30 +1675,30 @@ LNetNIFini()
 {
        mutex_lock(&the_lnet.ln_api_mutex);
 
-        LASSERT (the_lnet.ln_refcount > 0);
+       LASSERT(the_lnet.ln_refcount > 0);
 
-        if (the_lnet.ln_refcount != 1) {
-                the_lnet.ln_refcount--;
-        } else {
+       if (the_lnet.ln_refcount != 1) {
+               the_lnet.ln_refcount--;
+       } else {
                LASSERT(!the_lnet.ln_niinit_self);
 
                lnet_fault_fini();
 
-                lnet_proc_fini();
-                lnet_router_checker_stop();
-                lnet_ping_target_fini();
+               lnet_proc_fini();
+               lnet_router_checker_stop();
+               lnet_ping_target_fini();
 
-                /* Teardown fns that use my own API functions BEFORE here */
-                the_lnet.ln_refcount = 0;
+               /* Teardown fns that use my own API functions BEFORE here */
+               the_lnet.ln_refcount = 0;
 
-                lnet_acceptor_stop();
-                lnet_destroy_routes();
-                lnet_shutdown_lndnis();
-                lnet_unprepare();
-        }
+               lnet_acceptor_stop();
+               lnet_destroy_routes();
+               lnet_shutdown_lndnis();
+               lnet_unprepare();
+       }
 
        mutex_unlock(&the_lnet.ln_api_mutex);
-        return 0;
+       return 0;
 }
 EXPORT_SYMBOL(LNetNIFini);
 
@@ -1944,9 +1944,9 @@ LNetCtl(unsigned int cmd, void *arg)
 {
        struct libcfs_ioctl_data *data = arg;
        struct lnet_ioctl_config_data *config;
-       lnet_process_id_t         id = {0};
-       lnet_ni_t                *ni;
-       int                       rc;
+       lnet_process_id_t         id = {0};
+       lnet_ni_t                *ni;
+       int                       rc;
 
        CLASSERT(LIBCFS_IOC_DATA_MAX >= sizeof(struct lnet_ioctl_net_config) +
                                        sizeof(struct lnet_ioctl_config_data));
@@ -2206,20 +2206,20 @@ lnet_ping(lnet_process_id_t id, int timeout_ms, lnet_process_id_t __user *ids,
 {
        lnet_handle_eq_t     eqh;
        lnet_handle_md_t     mdh;
-       lnet_event_t         event;
-       lnet_md_t            md = { NULL };
-       int                  which;
-       int                  unlinked = 0;
-       int                  replied = 0;
-       const int            a_long_time = 60000; /* mS */
-       int                  infosz;
+       lnet_event_t         event;
+       lnet_md_t            md = { NULL };
+       int                  which;
+       int                  unlinked = 0;
+       int                  replied = 0;
+       const int            a_long_time = 60000; /* mS */
+       int                  infosz;
        lnet_ping_info_t    *info;
        lnet_process_id_t    tmpid;
-       int                  i;
-       int                  nob;
-       int                  rc;
-       int                  rc2;
-       sigset_t         blocked;
+       int                  i;
+       int                  nob;
+       int                  rc;
+       int                  rc2;
+       sigset_t         blocked;
 
        infosz = offsetof(lnet_ping_info_t, pi_ni[n_ids]);
 
@@ -2288,7 +2288,7 @@ lnet_ping(lnet_process_id_t id, int timeout_ms, lnet_process_id_t __user *ids,
                       (rc2 <= 0) ? -1 : event.status,
                       (rc2 > 0 && event.unlinked) ? " unlinked" : "");
 
-               LASSERT(rc2 != -EOVERFLOW);     /* can't miss anything */
+               LASSERT(rc2 != -EOVERFLOW);     /* can't miss anything */
 
                if (rc2 <= 0 || event.status != 0) {
                        /* timeout or error */
@@ -2326,7 +2326,7 @@ lnet_ping(lnet_process_id_t id, int timeout_ms, lnet_process_id_t __user *ids,
        nob = rc;
        LASSERT(nob >= 0 && nob <= infosz);
 
-       rc = -EPROTO;                           /* if I can't parse... */
+       rc = -EPROTO;                           /* if I can't parse... */
 
        if (nob < 8) {
                /* can't check magic/version */
@@ -2364,7 +2364,7 @@ lnet_ping(lnet_process_id_t id, int timeout_ms, lnet_process_id_t __user *ids,
                goto out_1;
        }
 
-       rc = -EFAULT;                           /* If I SEGV... */
+       rc = -EFAULT;                           /* If I SEGV... */
 
        memset(&tmpid, 0, sizeof(tmpid));
        for (i = 0; i < n_ids; i++) {