From: John L. Hammond Date: Fri, 1 Feb 2013 03:10:24 +0000 (-0600) Subject: LU-2675 cleanup: remove unused mkdirdeep.c and lltrace.h X-Git-Tag: 2.3.63~26 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=380d84f8222486cfc320a0edeae05d17aba220d8;p=fs%2Flustre-release.git LU-2675 cleanup: remove unused mkdirdeep.c and lltrace.h That's all. Signed-off-by: John L. Hammond Change-Id: I547623a98541d545057776a01424fa6a362f06ee Reviewed-on: http://review.whamcloud.com/5177 Reviewed-by: Jian Yu Reviewed-by: Bob Glossman Tested-by: Hudson Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/libcfs/include/libcfs/Makefile.am b/libcfs/include/libcfs/Makefile.am index 8ef76b7..4025898 100644 --- a/libcfs/include/libcfs/Makefile.am +++ b/libcfs/include/libcfs/Makefile.am @@ -4,7 +4,7 @@ SUBDIRS += darwin endif DIST_SUBDIRS = linux posix util darwin -EXTRA_DIST = curproc.h libcfs_private.h libcfs.h list.h lltrace.h \ +EXTRA_DIST = curproc.h libcfs_private.h libcfs.h list.h \ user-lock.h user-prim.h user-time.h user-mem.h \ user-tcpip.h user-bitops.h bitmap.h user-crypto.h \ libcfs_prim.h libcfs_time.h libcfs_hash.h libcfs_cpu.h \ diff --git a/libcfs/include/libcfs/darwin/Makefile.am b/libcfs/include/libcfs/darwin/Makefile.am index 318717a..3ccd204 100644 --- a/libcfs/include/libcfs/darwin/Makefile.am +++ b/libcfs/include/libcfs/darwin/Makefile.am @@ -1,3 +1,3 @@ EXTRA_DIST = darwin-mem.h darwin-types.h libcfs.h \ - darwin-fs.h darwin-prim.h darwin-utils.h lltrace.h \ + darwin-fs.h darwin-prim.h darwin-utils.h \ darwin-lock.h darwin-sync.h darwin-tcpip.h kp30.h diff --git a/libcfs/include/libcfs/darwin/lltrace.h b/libcfs/include/libcfs/darwin/lltrace.h deleted file mode 100644 index 569fbec..0000000 --- a/libcfs/include/libcfs/darwin/lltrace.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#ifndef __LIBCFS_DARWIN_LLTRACE_H__ -#define __LIBCFS_DARWIN_LLTRACE_H__ - -#ifndef __LIBCFS_LLTRACE_H__ -#error Do not #include this file directly. #include instead -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif diff --git a/libcfs/include/libcfs/linux/Makefile.am b/libcfs/include/libcfs/linux/Makefile.am index 1349217..68cb94e 100644 --- a/libcfs/include/libcfs/linux/Makefile.am +++ b/libcfs/include/libcfs/linux/Makefile.am @@ -1,3 +1,3 @@ EXTRA_DIST = kp30.h libcfs.h linux-fs.h linux-lock.h linux-mem.h \ - linux-prim.h linux-time.h linux-tcpip.h lltrace.h linux-cpu.h \ + linux-prim.h linux-time.h linux-tcpip.h linux-cpu.h \ portals_compat25.h linux-bitops.h linux-types.h linux-crypto.h diff --git a/libcfs/include/libcfs/linux/lltrace.h b/libcfs/include/libcfs/linux/lltrace.h deleted file mode 100644 index 1ae6c65..0000000 --- a/libcfs/include/libcfs/linux/lltrace.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#ifndef __LIBCFS_LINUX_LLTRACE_H__ -#define __LIBCFS_LINUX_LLTRACE_H__ - -#ifndef __LIBCFS_LLTRACE_H__ -#error Do not #include this file directly. #include instead -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif diff --git a/libcfs/include/libcfs/lltrace.h b/libcfs/include/libcfs/lltrace.h deleted file mode 100644 index 2712dd9..0000000 --- a/libcfs/include/libcfs/lltrace.h +++ /dev/null @@ -1,190 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - * - * libcfs/include/libcfs/lltrace.h - * - * Compile with: - * cc -I../../portals/include -o fio fio.c -L../../portals/linux/utils -lptlctl - */ - -#ifndef __LIBCFS_LLTRACE_H__ -#define __LIBCFS_LLTRACE_H__ - -#if defined(__linux__) -#include -#elif defined(__APPLE__) -#include -#elif defined(__WINNT__) -#include -#else -#error Unsupported Operating System -#endif - -static inline int ltrace_write_file(char* fname) -{ - char* argv[3]; - - argv[0] = "debug_kernel"; - argv[1] = fname; - argv[2] = "1"; - - fprintf(stderr, "[ptlctl] %s %s %s\n", argv[0], argv[1], argv[2]); - - return jt_dbg_debug_kernel(3, argv); -} - -static inline int ltrace_clear() -{ - char* argv[1]; - - argv[0] = "clear"; - - fprintf(stderr, "[ptlctl] %s\n", argv[0]); - - return jt_dbg_clear_debug_buf(1, argv); -} - -static inline int ltrace_mark(int indent_level, char* text) -{ - char* argv[2]; - char mark_buf[PATH_MAX]; - - snprintf(mark_buf, PATH_MAX, "====%d=%s", indent_level, text); - - argv[0] = "mark"; - argv[1] = mark_buf; - return jt_dbg_mark_debug_buf(2, argv); -} - -static inline int ltrace_applymasks() -{ - char* argv[2]; - argv[0] = "list"; - argv[1] = "applymasks"; - - fprintf(stderr, "[ptlctl] %s %s\n", argv[0], argv[1]); - - return jt_dbg_list(2, argv); -} - - -static inline int ltrace_filter(char* subsys_or_mask) -{ - char* argv[2]; - argv[0] = "filter"; - argv[1] = subsys_or_mask; - return jt_dbg_filter(2, argv); -} - -static inline int ltrace_show(char* subsys_or_mask) -{ - char* argv[2]; - argv[0] = "show"; - argv[1] = subsys_or_mask; - return jt_dbg_show(2, argv); -} - -static inline int ltrace_start() -{ - int rc = 0; - dbg_initialize(0, NULL); -#ifdef LNET_DEV_ID - rc = register_ioc_dev(LNET_DEV_ID, LNET_DEV_PATH, - LNET_DEV_MAJOR, LNET_DEV_MINOR); -#endif - ltrace_filter("class"); - ltrace_filter("nal"); - ltrace_filter("portals"); - - ltrace_show("all_types"); - ltrace_filter("trace"); - ltrace_filter("malloc"); - ltrace_filter("net"); - ltrace_filter("page"); - ltrace_filter("other"); - ltrace_filter("info"); - ltrace_applymasks(); - - return rc; -} - - -static inline void ltrace_stop() -{ -#ifdef LNET_DEV_ID - unregister_ioc_dev(LNET_DEV_ID); -#endif -} - -static inline int not_uml() -{ - /* Return Values: - * 0 when run under UML - * 1 when run on host - * <0 when lookup failed - */ - struct stat buf; - int rc = stat("/dev/ubd", &buf); - rc = ((rc<0) && (errno == ENOENT)) ? 1 : rc; - if (rc<0) { - fprintf(stderr, "Cannot stat /dev/ubd: %s\n", strerror(errno)); - rc = 1; /* Assume host */ - } - return rc; -} - -#define LTRACE_MAX_NOB 256 -static inline void ltrace_add_processnames(char* fname) -{ - char cmdbuf[LTRACE_MAX_NOB]; - struct timeval tv; - struct timezone tz; - int nob; - int underuml = !not_uml(); - - gettimeofday(&tv, &tz); - - nob = snprintf(cmdbuf, LTRACE_MAX_NOB, "ps --no-headers -eo \""); - - /* Careful - these format strings need to match the CDEBUG - * formats in portals/linux/debug.c EXACTLY - */ - nob += snprintf(cmdbuf+nob, LTRACE_MAX_NOB, "%02x:%06x:%d:%lu.%06lu ", - S_RPC >> 24, D_VFSTRACE, 0, tv.tv_sec, tv.tv_usec); - nob += snprintf (cmdbuf+nob, LTRACE_MAX_NOB, "(%s:%d:%s() %d+%lu): ", - "lltrace.h", __LINE__, __FUNCTION__, 0, 0L); - nob += snprintf(cmdbuf+nob, LTRACE_MAX_NOB, " %%p %%c\" >> %s", fname); - system(cmdbuf); -} - -#endif diff --git a/libcfs/include/libcfs/winnt/lltrace.h b/libcfs/include/libcfs/winnt/lltrace.h deleted file mode 100644 index ce5699f..0000000 --- a/libcfs/include/libcfs/winnt/lltrace.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - * - * libcfs/include/libcfs/winnt/lltrace.h - * - * Basic library routines. - */ - -#ifndef __LIBCFS_WINNT_LLTRACE_H__ -#define __LIBCFS_WINNT_LLTRACE_H__ - -#ifndef __LIBCFS_LLTRACE_H__ -#error Do not #include this file directly. #include instead -#endif - - -#endif diff --git a/lustre/tests/.gitignore b/lustre/tests/.gitignore index e7bf4b4..19c0faa 100644 --- a/lustre/tests/.gitignore +++ b/lustre/tests/.gitignore @@ -36,7 +36,6 @@ /fchdir_test /getdents /o_directory -/mkdirdeep /utime /small_write /multiop diff --git a/lustre/tests/Makefile.am b/lustre/tests/Makefile.am index 1ae7af5..12deeb8 100644 --- a/lustre/tests/Makefile.am +++ b/lustre/tests/Makefile.am @@ -67,7 +67,7 @@ noinst_PROGRAMS += ll_sparseness_write mrename ll_dirstripe_verify mkdirmany noinst_PROGRAMS += openfilleddirunlink rename_many memhog noinst_PROGRAMS += mmap_sanity writemany reads flocks_test noinst_PROGRAMS += write_time_limit rwv copytool lgetxattr_size_check -# noinst_PROGRAMS += copy_attr mkdirdeep + bin_PROGRAMS = mcreate munlink testdir = $(libdir)/lustre/tests test_SCRIPTS = $(noinst_SCRIPTS) $(noinst_PROGRAMS) @@ -76,7 +76,6 @@ test_DATA = $(noinst_DATA) nobase_test_DATA = $(nobase_noinst_DATA) endif # TESTS -# mkdirdeep_LDADD=-L$(top_builddir)/lnet/utils -lptlctl $(LIBREADLINE) mmap_sanity_SOURCES= mmap_sanity.c LIBLUSTREAPI := $(top_builddir)/lustre/utils/liblustreapi.a diff --git a/lustre/tests/mkdirdeep.c b/lustre/tests/mkdirdeep.c deleted file mode 100644 index e260ee2..0000000 --- a/lustre/tests/mkdirdeep.c +++ /dev/null @@ -1,290 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - * - * lustre/tests/mkdirdeep.c - * - * Compile with: - * cc -I../../lnet/include -o mkdirdeep mkdirdeep.c - * -L../../lnet/linux/utils -lptlctl - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static int opt_verbose = 0; -static int opt_trace = 0; - -void usage(const char *pname) -{ - fprintf(stderr, "Usage: %s --depth [--output ]" - " [--mknod] [--verbose] [--notrace] \n", pname); - exit(1); -} - -int do_mkdir(char *path) -{ - int rc = mkdir(path, 0755); - - if (rc) { - fprintf(stderr, "mkdir(%s) failed: %s\n", - path, strerror(errno)); - exit(1); - } - if (opt_verbose) - printf("mkdir %s\n", path); - - return rc; -} - - -int do_mknod(char *path) -{ - int rc = mknod(path, 0755, S_IFIFO); - - if (rc) { - fprintf(stderr, "mkdir(%s) failed: %s\n", - path, strerror(errno)); - exit(1); - } - if (opt_verbose) - printf("mknod %s\n", path); - - return rc; -} - -int do_chdir(char* path) -{ - int rc = chdir(path); - - if (rc) { - fprintf(stderr, "chdir(%s) failed: %s\n", - path, strerror(errno)); - exit(1); - } - if (opt_verbose) - printf("chdir %s\n", path); - - return rc; -} - -int do_stat(char *path) -{ - char mark_buf[PATH_MAX + 50]; - struct stat mystat; - int rc = stat(path, &mystat); - - if (rc) { - fprintf(stderr, "stat(%s) failed: %s\n", - path, strerror(errno)); - exit(1); - } - if (opt_verbose) - printf("stat %s = inode %lu\n", path, - (unsigned long)mystat.st_ino); - - if (opt_trace) { - snprintf(mark_buf, PATH_MAX, "stat %s = inode %lu", - path, (unsigned long)mystat.st_ino); - ltrace_mark(0, mark_buf); - } - - return rc; -} - -int main(int argc, char** argv) -{ - int c, i, mypid; - int opt_depth = 1; - int opt_mknod = 0; - - static struct option long_opt[] = { - {"depth", 1, 0, 'd' }, - {"help", 0, 0, 'h' }, - {"mknod", 0, 0, 'm' }, - {"output", 1, 0, 'o' }, - {"trace", 1, 0, 't' }, - {"verbose", 0, 0, 'v' }, - {0,0,0,0} - }; - - char *outputfilename = NULL; - char *base_pathname; - char pathname[PATH_MAX]; - char mark_buf[PATH_MAX + 50]; - char mycwd[PATH_MAX]; - char *pname = argv[0]; - - while ((c = getopt_long(argc, argv, "d:mhvo:", long_opt, NULL)) != -1) { - switch (c) { - case 'd': - opt_depth = atoi(optarg); - if ((opt_depth == 0) || (opt_depth > 1100)) - usage(pname); - break; - case 'm': - opt_mknod = 1; - break; - case 't': - opt_trace = 1; - break; - case 'v': - opt_verbose = 1; - break; - case 'o': - outputfilename = optarg; - break; - case 'h': - case '?': - case ':': - default: - usage(pname); - break; - } - } - - if (optind != (argc - 1)) - usage(pname); - - base_pathname = argv[optind]; - mypid = getpid(); - - if (!getcwd(&mycwd[0], sizeof(mycwd))) { - fprintf(stderr, "%s: unable to getcwd()\n", pname); - exit(1); - } - - printf("%s(pid=%d) depth=%d mknod=%d, basepathname=%s, trace=%d\n", - pname, mypid, opt_depth, opt_mknod, base_pathname, opt_trace); - - if (outputfilename) - printf("outputfilename=%s\n", outputfilename); - - if (opt_trace) { - ltrace_start(); - ltrace_clear(); - snprintf(mark_buf, PATH_MAX, "Initialize - mkdir %s; chdir %s", - base_pathname, base_pathname); - ltrace_mark(2, mark_buf); - } - - if (do_mkdir(base_pathname)!=0) - exit(1); - if (do_chdir(base_pathname)!=0) - exit(1); - - /* Create directory tree with depth level of subdirectories */ - - if (opt_trace) { - snprintf(mark_buf, PATH_MAX, - "Create Directory Tree (depth %d)", opt_depth); - ltrace_mark(2, mark_buf); - } - - for (i = 0; i < opt_depth; i++) { - snprintf(pathname, sizeof(pathname), "%d", i + 1); - - if (i == (opt_depth - 1)) { - /* Last Iteration */ - - if (opt_trace) { - snprintf(mark_buf, PATH_MAX, - "Tree Leaf (%d) %s/stat", i, - (opt_mknod ? "mknod" : "mkdir")); - ltrace_mark(3, mark_buf); - } - - if (opt_mknod) - do_mknod(pathname); - else - do_mkdir(pathname); - /* Now stat it */ - do_stat(pathname); - } else { - /* Not Leaf */ - - if (opt_trace) { - snprintf(mark_buf, sizeof(mark_buf), - "Tree Level (%d) mkdir/stat/chdir", i); - ltrace_mark(3, mark_buf); - } - - do_mkdir(pathname); - do_stat(pathname); - do_chdir(pathname); - } - } - - /* Stat through directory tree with fullpaths */ - - if (opt_trace) { - snprintf(mark_buf, PATH_MAX, "Walk Directory Tree"); - ltrace_mark(2, mark_buf); - } - - do_chdir(base_pathname); - - strncpy(pathname, base_pathname, sizeof(pathname)); - - c = strlen(base_pathname); - for (i = 0; i < opt_depth; i++) { - c += snprintf(pathname + c, sizeof(pathname) - c, "/%d", i+1); - - if (opt_trace) { - snprintf(mark_buf, PATH_MAX, "stat %s", pathname); - ltrace_mark(2, mark_buf); - } - - do_stat(pathname); - } - - if (opt_trace && outputfilename) { - ltrace_write_file(outputfilename); - ltrace_add_processnames(outputfilename); - ltrace_stop(); - } - - do_chdir(base_pathname); - - printf("%s (pid=%d) done.\n", pname, mypid); - - return 0; -}