[Ocfs2-tools-devel] [PATCH] libtools-internal: Move verbosef to an internal library.

Tao Ma tao.ma at oracle.com
Fri Aug 29 00:53:19 PDT 2008



Joel Becker wrote:
> The verbosity routines would love to be used by other programs.  Take
> them out of libocfs2ne and move them to their own place,
> libtools-internal.  Rename the functions as appropriate.
> 
> Signed-off-by: Joel Becker <joel.becker at oracle.com>
> ---

> +include $(TOPDIR)/Postamble.make
> diff --git a/include/tools-internal/verbose.h b/include/tools-internal/verbose.h
> new file mode 100644
> index 0000000..bd60c9f
> --- /dev/null
> +++ b/include/tools-internal/verbose.h
> @@ -0,0 +1,72 @@
> +/* -*- mode: c; c-basic-offset: 8; -*-
> + * vim: noexpandtab sw=8 ts=8 sts=0:
> + *
> + * verbose.h
> + *
> + * Internal verbose output functions.
> + *
> + * Copyright (C) 2008 Oracle.  All rights reserved.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License.
> + *
> + * 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 for more details.
> + */
> +
> +#ifndef _INTERNAL_VERBOSE_H
> +#define _INTERNAL_VERBOSE_H
> +
> +/* Verbosity levels for verbosef/errorf/tcom_err */
> +#define VL_FLAG_STDOUT	0x100	/* or'd with a level, output to stdout */
> +enum tools_verbosity_level {
> +	VL_CRIT	 	= 0,	/* Don't use this!  I still haven't
> +				   thought of anything so critical that
> +				   -q should be ignored */
> +	VL_ERR		= 1,	/* Error messages */
> +
> +/* Regular output is the same level as errors */
> +#define VL_OUT		(VL_ERR | VL_FLAG_STDOUT)
> +
> +	VL_APP		= 2,	/* Verbose application status */
> +	VL_LIB		= 3, 	/* Status from shared code */
> +	VL_DEBUG	= 4, 	/* Debugging output */
> +};
> +
> +/* Call this to set the program name */
> +void tools_setup_argv0(const char *argv0);
> +
> +/* Returns the program name from argv0 */
> +const char *tools_progname(void);
> +
> +/* Prints the version of ocfs2ne */
Now it isn't ocfs2ne any more. ;)

Other parts looks ok.
btw, I can't compile it in my box. So do you miss something?

...
make[1]: Entering directory `/home/taoma/ocfs2-tools/libtools-internal'
gcc -O2 -Wall -Wstrict-prototypes -Wmissing-prototypes 
-Wmissing-declarations -pipe -fPIC    -I. -I../include 
-DVERSION=\"1.4.1\"  -MD -MP -MF ./.verbose.d -o verbose.o -c verbose.c
verbose.c:28:21: error: com_err.h: No such file or directory
In file included from verbose.c:30:
../include/tools-internal/verbose.h:65: error: expected ‘)’ before ‘code’
verbose.c: In function ‘tools_verbose’:
verbose.c:58: warning: implicit declaration of function ‘reset_com_err_hook’
verbose.c: In function ‘tools_quiet’:
verbose.c:64: warning: implicit declaration of function ‘set_com_err_hook’
verbose.c: At top level:
verbose.c:110: error: expected ‘)’ before ‘code’
make[1]: *** [verbose.o] Error 1
make[1]: Leaving directory `/home/taoma/ocfs2-tools/libtools-internal'
make: *** [libtools-internal] Error 2

Regards,
Tao



More information about the Ocfs2-tools-devel mailing list