Whamcloud - gitweb
b=22079 Moving definition of cfs_trace_buf_type_t back to linux-tracefile.h
authorMaxim Patlasov <Maxim.Patlasov@Sun.COM>
Fri, 19 Mar 2010 18:19:39 +0000 (11:19 -0700)
committerRobert Read <rread@sun.com>
Fri, 19 Mar 2010 18:19:39 +0000 (11:19 -0700)
i=rread
Linux-specific version of cfs_trace_buf_type_t was mistakenly moved to common libcfs_debug.h by a patch for bug #15977. Fixing the problem by moving it back and adding trivial libcfs_tcd_type_max() API for utilities who need to know CFS_TCD_TYPE_MAX.

libcfs/include/libcfs/libcfs_debug.h
libcfs/include/libcfs/libcfsutil.h
libcfs/libcfs/autoMakefile.am
libcfs/libcfs/linux/linux-tracefile.h
libcfs/libcfs/util/Makefile.am
libcfs/libcfs/util/util.c [new file with mode: 0644]
lnet/utils/debug.c

index 66f2f2c..691c40d 100644 (file)
@@ -65,16 +65,6 @@ extern unsigned int libcfs_catastrophe;
 extern unsigned int libcfs_panic_on_lbug;
 
 /**
- * three types of trace_data in linux
- */
-typedef enum {
-       CFS_TCD_TYPE_PROC = 0,
-       CFS_TCD_TYPE_SOFTIRQ,
-       CFS_TCD_TYPE_IRQ,
-       CFS_TCD_TYPE_MAX
-} cfs_trace_buf_type_t;
-
-/**
  * Format for debug message headers
  */
 struct ptldebug_header {
index 1eb8934..c5d5e04 100644 (file)
@@ -52,5 +52,9 @@
 #include <libcfs/util/parser.h>
 #include <libcfs/util/libcfsutil_ioctl.h>
 
+/*
+ * Defined by libcfs/libcfs/util/util.c
+ */
+int libcfs_tcd_type_max(void);
 
 #endif /* __LIBCFSUTIL_H__ */
index c759665..f679067 100644 (file)
@@ -49,7 +49,8 @@ libcfs_a_CFLAGS = $(LLCFLAGS)
 endif
 
 lib_LIBRARIES = libcfsutil.a
-libcfsutil_a_SOURCES = nidstrings.c util/parser.c util/parser.h util/platform.h util/l_ioctl.c
+libcfsutil_a_SOURCES = nidstrings.c util/parser.c util/parser.h util/platform.h \
+                       util/l_ioctl.c util/util.c
 libcfsutil_a_CPPFLAGS = $(LLCPPFLAGS) 
 libcfsutil_a_CFLAGS = $(LLCFLAGS) -DLUSTRE_UTILS=1
 
index 8ad632c..4bae601 100644 (file)
 #ifndef __LIBCFS_LINUX_TRACEFILE_H__
 #define __LIBCFS_LINUX_TRACEFILE_H__
 
+/**
+ * three types of trace_data in linux
+ */
+typedef enum {
+       CFS_TCD_TYPE_PROC = 0,
+       CFS_TCD_TYPE_SOFTIRQ,
+       CFS_TCD_TYPE_IRQ,
+       CFS_TCD_TYPE_MAX
+} cfs_trace_buf_type_t;
+
 #endif
index 7c00676..74e1488 100644 (file)
@@ -1,2 +1,2 @@
-EXTRA_DIST := parser.c l_ioctl.c
+EXTRA_DIST := parser.c l_ioctl.c util.c
 
diff --git a/libcfs/libcfs/util/util.c b/libcfs/libcfs/util/util.c
new file mode 100644 (file)
index 0000000..f830223
--- /dev/null
@@ -0,0 +1,47 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ * 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  2010 Sun Microsystems, Inc. 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/libcfs/util/util.c
+ *
+ */
+
+#include <libcfs/libcfsutil.h>
+#include "../tracefile.h"
+
+int
+libcfs_tcd_type_max(void)
+{
+        return CFS_TCD_TYPE_MAX;
+}
index ca17a3d..bcd7099 100644 (file)
@@ -457,7 +457,7 @@ static int parse_buffer(int fdin, int fdout)
                         goto readhdr;
                 
                 if (hdr->ph_len > 4094 ||       /* is this header bogus? */
-                    hdr->ph_type >= CFS_TCD_TYPE_MAX ||
+                    hdr->ph_type >= libcfs_tcd_type_max() ||
                     hdr->ph_stack > 65536 ||
                     hdr->ph_sec < (1 << 30) ||
                     hdr->ph_usec > 1000000000 ||