Whamcloud - gitweb
LU-1154 clio: rename coo_attr_set to coo_attr_update
[fs/lustre-release.git] / lnet / utils / lst.c
index 7695866..7917e3e 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
  * Author: Liang Zhen <liangzhen@clusterfs.com>
  */
 
-#define _GNU_SOURCE
-
+#include <getopt.h>
+#include <pwd.h>
 #include <libcfs/libcfsutil.h>
 #include <lnet/lnetctl.h>
 #include <lnet/lnetst.h>
+#include <lnet/nidstr.h>
 /* NB: these includes are layering violation */
 #include <lustre_ver.h>
 #include <lustre/lustre_idl.h>
@@ -51,19 +52,14 @@ lst_sid_t LST_INVALID_SID = {LNET_NID_ANY, -1};
 static lst_sid_t           session_id;
 static int                 session_key;
 
-#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 6, 50, 0)
-/* assume all nodes can understand feature LST_FEAT_BULK_LEN */
-static unsigned                   session_features = LST_FEATS_MASK;
-#else
-static unsigned                   session_features = LST_FEATS_EMPTY;
-#endif
-
-static lstcon_trans_stat_t trans_stat;
+/* All nodes running 2.6.50 or later understand feature LST_FEAT_BULK_LEN */
+static unsigned                session_features = LST_FEATS_MASK;
+static lstcon_trans_stat_t     trans_stat;
 
 typedef struct list_string {
-        struct list_string *lstr_next;
-        int                 lstr_sz;
-        char                lstr_str[0];
+       struct list_string *lstr_next;
+       int                 lstr_sz;
+       char                lstr_str[0];
 } lstr_t;
 
 #ifndef offsetof
@@ -289,7 +285,7 @@ out:
                                 rc = -1;
                         }
 
-                        (*idspp)[i].pid = LUSTRE_LNET_PID;
+                       (*idspp)[i].pid = LNET_PID_LUSTRE;
                         i++;
                 }
 
@@ -602,7 +598,7 @@ jt_lst_new_session(int argc,  char **argv)
                 if (rc != 0)
                         snprintf(host, sizeof(host), "unknown_host");
 
-                snprintf(buf, LST_NAME_SIZE, "%s@%s", user, host);
+               snprintf(buf, sizeof(buf), "%s@%s", user, host);
                 name = buf;
 
         } else {
@@ -648,7 +644,7 @@ jt_lst_show_session(int argc, char **argv)
        int                 key;
        int                 rc;
 
-       rc = lst_session_info_ioctl(name, LST_NAME_SIZE, &key,
+       rc = lst_session_info_ioctl(name, sizeof(name), &key,
                                    &feats, &sid, &ndinfo);
 
         if (rc != 0) {