From: Maxim Patlasov Date: Fri, 19 Mar 2010 18:19:39 +0000 (-0700) Subject: b=22079 Moving definition of cfs_trace_buf_type_t back to linux-tracefile.h X-Git-Tag: 1.10.0.39~40 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=1b2aaa45c18d7935fe2747df1cbbd6d4ae14f0bc b=22079 Moving definition of cfs_trace_buf_type_t back to linux-tracefile.h 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. --- diff --git a/libcfs/include/libcfs/libcfs_debug.h b/libcfs/include/libcfs/libcfs_debug.h index 66f2f2c..691c40d 100644 --- a/libcfs/include/libcfs/libcfs_debug.h +++ b/libcfs/include/libcfs/libcfs_debug.h @@ -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 { diff --git a/libcfs/include/libcfs/libcfsutil.h b/libcfs/include/libcfs/libcfsutil.h index 1eb8934..c5d5e04 100644 --- a/libcfs/include/libcfs/libcfsutil.h +++ b/libcfs/include/libcfs/libcfsutil.h @@ -52,5 +52,9 @@ #include #include +/* + * Defined by libcfs/libcfs/util/util.c + */ +int libcfs_tcd_type_max(void); #endif /* __LIBCFSUTIL_H__ */ diff --git a/libcfs/libcfs/autoMakefile.am b/libcfs/libcfs/autoMakefile.am index c759665..f679067 100644 --- a/libcfs/libcfs/autoMakefile.am +++ b/libcfs/libcfs/autoMakefile.am @@ -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 diff --git a/libcfs/libcfs/linux/linux-tracefile.h b/libcfs/libcfs/linux/linux-tracefile.h index 8ad632c..4bae601 100644 --- a/libcfs/libcfs/linux/linux-tracefile.h +++ b/libcfs/libcfs/linux/linux-tracefile.h @@ -37,4 +37,14 @@ #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 diff --git a/libcfs/libcfs/util/Makefile.am b/libcfs/libcfs/util/Makefile.am index 7c00676..74e14889 100644 --- a/libcfs/libcfs/util/Makefile.am +++ b/libcfs/libcfs/util/Makefile.am @@ -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 index 0000000..f830223 --- /dev/null +++ b/libcfs/libcfs/util/util.c @@ -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 +#include "../tracefile.h" + +int +libcfs_tcd_type_max(void) +{ + return CFS_TCD_TYPE_MAX; +} diff --git a/lnet/utils/debug.c b/lnet/utils/debug.c index ca17a3d..bcd7099 100644 --- a/lnet/utils/debug.c +++ b/lnet/utils/debug.c @@ -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 ||