Whamcloud - gitweb
LU-4587 utils: remove llapi_ping_target() 66/10566/3
authorJohn L. Hammond <john.hammond@intel.com>
Tue, 3 Jun 2014 07:04:51 +0000 (02:04 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 16 Jun 2014 14:04:57 +0000 (14:04 +0000)
Remove llapi_ping_target(). This ioctl() based function was prototyped
in lustreapi.h but not provided by lustreapi. Replace its only use (in
lfs) with the equivalent /proc based function llapi_target_check(),
which is provided by lustreapi. Remove the now unnecessary calls to
ptl_initialize(), obd_initialize() and obd_finalize() in lfs main().

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I02d7ea706f02827bbd4bd1b9bf0d216b0e2c131b
Reviewed-on: http://review.whamcloud.com/10566
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
lustre/include/lustre/lustreapi.h
lustre/utils/Makefile.am
lustre/utils/lfs.c
lustre/utils/obd.c

index ce17f58..54b9d1c 100644 (file)
@@ -248,9 +248,6 @@ extern int llapi_search_mounts(const char *pathname, int index,
 extern int llapi_search_fsname(const char *pathname, char *fsname);
 extern int llapi_getname(const char *path, char *buf, size_t size);
 
 extern int llapi_search_fsname(const char *pathname, char *fsname);
 extern int llapi_getname(const char *path, char *buf, size_t size);
 
-extern void llapi_ping_target(char *obd_type, char *obd_name,
-                              char *obd_uuid, void *args);
-
 extern int llapi_search_rootpath(char *pathname, const char *fsname);
 extern int llapi_nodemap_exists(const char *name);
 extern int llapi_mv(char *path, struct find_param *param);
 extern int llapi_search_rootpath(char *pathname, const char *fsname);
 extern int llapi_nodemap_exists(const char *name);
 extern int llapi_mv(char *path, struct find_param *param);
index 67144f8..f737ddb 100644 (file)
@@ -11,9 +11,11 @@ AM_LDFLAGS := -L$(top_builddir)/lnet/utils
 MNTMODLDFLAGS := -rdynamic -ldl
 MNTMODCFLAGS := -DPLUGIN_DIR=\"${pkglibdir}\"
 
 MNTMODLDFLAGS := -rdynamic -ldl
 MNTMODCFLAGS := -DPLUGIN_DIR=\"${pkglibdir}\"
 
+LIBCFSUTIL := $(top_builddir)/libcfs/libcfs/libcfsutil.a
+
 LIBPTLCTL := $(top_builddir)/lnet/utils/libptlctl.a \
 LIBPTLCTL := $(top_builddir)/lnet/utils/libptlctl.a \
-            $(top_builddir)/libcfs/libcfs/libcfsutil.a \
-            $(top_builddir)/libcfs/libcfs/libcfs.a
+            $(top_builddir)/libcfs/libcfs/libcfs.a \
+            $(LIBCFSUTIL)
 
 sbin_scripts = lrun
 bin_scripts = llstat llobdstat plot-llstat llbackup
 
 sbin_scripts = lrun
 bin_scripts = llstat llobdstat plot-llstat llbackup
@@ -48,9 +50,9 @@ lctl_SOURCES = lustre_lfsck.c obd.c lustre_cfg.c lctl.c obdctl.h
 lctl_LDADD :=  liblustreapi.a $(LIBPTLCTL) $(PTHREAD_LIBS) $(LIBREADLINE)
 lctl_DEPENDENCIES := $(LIBPTLCTL) liblustreapi.a
 
 lctl_LDADD :=  liblustreapi.a $(LIBPTLCTL) $(PTHREAD_LIBS) $(LIBREADLINE)
 lctl_DEPENDENCIES := $(LIBPTLCTL) liblustreapi.a
 
-lfs_SOURCES = lfs.c obd.c lustre_cfg.c
-lfs_LDADD := liblustreapi.a $(LIBPTLCTL) $(PTHREAD_LIBS) $(LIBREADLINE)
-lfs_DEPENDENCIES := $(LIBPTLCTL) liblustreapi.a
+lfs_SOURCES = lfs.c
+lfs_LDADD := liblustreapi.a $(LIBCFSUTIL) $(LIBREADLINE)
+lfs_DEPENDENCIES := liblustreapi.a
 
 loadgen_SOURCES = loadgen.c lustre_cfg.c obd.c
 loadgen_LDADD := liblustreapi.a $(LIBPTLCTL) $(PTHREAD_LIBS) $(LIBREADLINE)
 
 loadgen_SOURCES = loadgen.c lustre_cfg.c obd.c
 loadgen_LDADD := liblustreapi.a $(LIBPTLCTL) $(PTHREAD_LIBS) $(LIBREADLINE)
index daba1eb..c34f9ba 100644 (file)
 
 #include <libcfs/libcfs.h>
 #include <libcfs/libcfsutil.h>
 
 #include <libcfs/libcfs.h>
 #include <libcfs/libcfsutil.h>
-#include <lnet/lnetctl.h>
 #include <lustre/lustreapi.h>
 #include <lustre_ver.h>
 #include <lustre/lustreapi.h>
 #include <lustre_ver.h>
-#include "obdctl.h"
 
 /* all functions */
 static int lfs_setstripe(int argc, char **argv);
 
 /* all functions */
 static int lfs_setstripe(int argc, char **argv);
@@ -2029,9 +2027,7 @@ static int lfs_check(int argc, char **argv)
                 return rc;
         }
 
                 return rc;
         }
 
-        rc = llapi_target_iterate(num_types, obd_types,
-                                  mntdir, llapi_ping_target);
-
+       rc = llapi_target_check(num_types, obd_types, mntdir);
         if (rc)
                 fprintf(stderr, "error: %s: %s status failed\n",
                                 argv[0],argv[1]);
         if (rc)
                 fprintf(stderr, "error: %s: %s status failed\n",
                                 argv[0],argv[1]);
@@ -3849,10 +3845,6 @@ int main(int argc, char **argv)
 
         setlinebuf(stdout);
 
 
         setlinebuf(stdout);
 
-        ptl_initialize(argc, argv);
-        if (obd_initialize(argc, argv) < 0)
-                exit(2);
-
         Parser_init("lfs > ", cmdlist);
 
         if (argc > 1) {
         Parser_init("lfs > ", cmdlist);
 
         if (argc > 1) {
@@ -3861,7 +3853,6 @@ int main(int argc, char **argv)
                 rc = Parser_commands();
         }
 
                 rc = Parser_commands();
         }
 
-        obd_finalize(argc, argv);
         return rc < 0 ? -rc : rc;
 }
 
         return rc < 0 ? -rc : rc;
 }
 
index 75a4422..dcc263f 100644 (file)
@@ -4241,35 +4241,6 @@ int jt_get_obj_version(int argc, char **argv)
         return 0;
 }
 
         return 0;
 }
 
-void  llapi_ping_target(char *obd_type, char *obd_name,
-                        char *obd_uuid, void *args)
-{
-        int  rc;
-        struct obd_ioctl_data data;
-        char rawbuf[MAX_IOC_BUFLEN], *buf = rawbuf;
-
-        memset(&data, 0, sizeof(data));
-        data.ioc_inlbuf4 = obd_name;
-        data.ioc_inllen4 = strlen(obd_name) + 1;
-        data.ioc_dev = OBD_DEV_BY_DEVNAME;
-        memset(buf, 0, sizeof(rawbuf));
-        if (obd_ioctl_pack(&data, &buf, sizeof(rawbuf))) {
-                fprintf(stderr, "error: invalid ioctl\n");
-                return;
-        }
-        rc = l_ioctl(OBD_DEV_ID, OBD_IOC_PING_TARGET, buf);
-        if (rc)
-                rc = errno;
-        if (rc == ENOTCONN || rc == ESHUTDOWN) {
-                printf("%s: INACTIVE\n", obd_name);
-        } else if (rc) {
-                printf("%s: check error: %s\n",
-                        obd_name, strerror(errno));
-        } else {
-                printf("%s: active\n", obd_name);
-        }
-}
-
 int jt_changelog_register(int argc, char **argv)
 {
         char rawbuf[MAX_IOC_BUFLEN], *buf = rawbuf;
 int jt_changelog_register(int argc, char **argv)
 {
         char rawbuf[MAX_IOC_BUFLEN], *buf = rawbuf;