Whamcloud - gitweb
LU-2785 osc: remove unused obd methods
[fs/lustre-release.git] / lnet / utils / debug.c
index ec4393e..a0c0ce1 100644 (file)
@@ -56,23 +56,8 @@ static int debug_mask = ~0;
 
 #define MAX_MARK_SIZE 256
 
-static const char *libcfs_debug_subsystems[] =
-        {"undefined", "mdc", "mds", "osc",
-         "ost", "class", "log", "llite",
-         "rpc", "mgmt", "lnet", "lnd",
-         "pinger", "filter", "", "echo",
-         "ldlm", "lov", "lquota", "",
-         "", "", "", "lmv",
-         "", "sec", "gss", "", 
-         "mgc", "mgs", "fid", "fld", NULL};
-static const char *libcfs_debug_masks[] =
-        {"trace", "inode", "super", "ext2",
-         "malloc", "cache", "info", "ioctl",
-         "neterror", "net", "warning", "buffs",
-         "other", "dentry", "nettrace", "page",
-         "dlmtrace", "error", "emerg", "ha",
-         "rpctrace", "vfstrace", "reada", "mmap",
-         "config", "console", "quota", "sec", NULL};
+static const char *libcfs_debug_subsystems[] = LIBCFS_DEBUG_SUBSYS_NAMES;
+static const char *libcfs_debug_masks[] = LIBCFS_DEBUG_MASKS_NAMES;
 
 #ifdef __linux__
 
@@ -600,11 +585,21 @@ int jt_dbg_debug_kernel(int argc, char **argv)
         /* If we are dumping raw (which means no conversion step to ASCII)
          * then dump directly to any supplied filename, otherwise this is
          * just a temp file and we dump to the real file at convert time. */
-        if (argc > 1 && raw)
-                strcpy(filename, argv[1]);
-        else
-                sprintf(filename, "%s"CFS_TIME_T".%u",
-                       LIBCFS_DEBUG_FILE_PATH_DEFAULT, time(NULL), getpid());
+       if (argc > 1 && raw) {
+               if (strlen(argv[1]) > sizeof(filename)-1) {
+                       fprintf(stderr, "File name too long: %s\n", argv[1]);
+                       return 1;
+               }
+               strncpy(filename, argv[1], sizeof(filename));
+       } else {
+               if (snprintf(filename, sizeof(filename), "%s"CFS_TIME_T".%u",
+                            LIBCFS_DEBUG_FILE_PATH_DEFAULT, time(NULL),
+                            getpid()) >=
+                   sizeof(filename)) {
+                       fprintf(stderr, "File name too long\n");
+                       return 1;
+               }
+       }
 
         if (stat(filename, &st) == 0 && S_ISREG(st.st_mode))
                 unlink(filename);
@@ -855,13 +850,11 @@ static struct mod_paths {
        { "lnet", "lnet/lnet" },
        { "kmxlnd", "lnet/klnds/mxlnd" },
        { "ko2iblnd", "lnet/klnds/o2iblnd" },
-       { "kptllnd", "lnet/klnds/ptllnd" },
        { "kgnilnd", "lnet/klnds/gnilnd"},
        { "kqswlnd", "lnet/klnds/qswlnd" },
        { "kralnd", "lnet/klnds/ralnd" },
        { "ksocklnd", "lnet/klnds/socklnd" },
        { "ktdilnd", "lnet/klnds/tdilnd" },
-       { "lvfs", "lustre/lvfs" },
        { "obdclass", "lustre/obdclass" },
        { "llog_test", "lustre/obdclass" },
        { "ptlrpc_gss", "lustre/ptlrpc/gss" },
@@ -874,13 +867,12 @@ static struct mod_paths {
        { "mdc", "lustre/mdc" },
        { "lustre", "lustre/llite" },
        { "llite_lloop", "lustre/llite" },
-       { "ldiskfs", "ldiskfs/ldiskfs" },
+       { "ldiskfs", "ldiskfs" },
        { "obdecho", "lustre/obdecho" },
        { "ldlm", "lustre/ldlm" },
        { "obdfilter", "lustre/obdfilter" },
        { "lov", "lustre/lov" },
        { "lmv", "lustre/lmv" },
-       { "fsfilt_ldiskfs", "lustre/lvfs" },
        { "lquota", "lustre/quota" },
        { "mgs", "lustre/mgs" },
        { "mgc", "lustre/mgc" },
@@ -892,6 +884,7 @@ static struct mod_paths {
         {"fld", "lustre/fld"},
        {"lod", "lustre/lod"},
        {"osp", "lustre/osp"},
+       { "lfsck", "lustre/lfsck" },
         {NULL, NULL}
 };