[Ocfs2-tools-devel] [PATCH 3/6] Ocfs2-tools: Add main header for o2info.
Tristan
tristan.ye at oracle.com
Mon Nov 23 17:17:20 PST 2009
TaoMa wrote:
> Tristan Ye wrote:
>> Define prototypes for o2info's operations and some basic structures.
>>
>> Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
>> ---
>> o2info/o2info.h | 93
>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> 1 files changed, 93 insertions(+), 0 deletions(-)
>> create mode 100644 o2info/o2info.h
>>
>> diff --git a/o2info/o2info.h b/o2info/o2info.h
>> new file mode 100644
>> index 0000000..0483caf
>> --- /dev/null
>> +++ b/o2info/o2info.h
>> @@ -0,0 +1,93 @@
>> +/* -*- mode: c; c-basic-offset: 8; -*-
>> + * vim: noexpandtab sw=8 ts=8 sts=0:
>> + *
>> + * o2info.h
>> + *
>> + * o2info operation prototypes.
>> + *
>> + * Copyright (C) 2004, 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 _O2INFO_H
>> +#define _O2INFO_H
>> +
>> +#define _GNU_SOURCE
>> +#define _LARGEFILE64_SOURCE
>> +
>> +#include <stdio.h>
>> +#include <stdlib.h>
>> +#include <unistd.h>
>> +#include <string.h>
>> +#include <sys/types.h>
>> +#include <sys/stat.h>
>> +#include <sys/statfs.h>
>> +#include <fcntl.h>
>> +#include <errno.h>
>> +#include <pwd.h>
>> +#include <grp.h>
>> +#include <time.h>
>> +#include <signal.h>
>> +#include <sys/raw.h>
>> +#include <linux/kdev_t.h>
>> +#include <inttypes.h>
>> +#include <utime.h>
>> +#include <getopt.h>
>> +#include <assert.h>
>> +#include <glib.h>
>> +#include <linux/types.h>
>>
> Do we really need so much headers in a .h file?
> at least there is no need for the header like assert.h, errno.h etc.
>> +
>> +#include "ocfs2/ocfs2.h"
>> +#include "ocfs2/bitops.h"
>> +#include "tools-internal/verbose.h"
>>
> The same here I don't see any need for these 3 ocfs2 headers.
Good point, I'll remove useless headers.
>> +
>> +struct o2info_operation {
>> + char *to_name;
>> + int (*to_run)(struct o2info_operation *op,
>> + ocfs2_filesys *fs,
>> + void *arg);
>> + void *to_private;
>> +};
>> +
>> +struct o2info_option {
>> + struct option opt_option; /* For getopt_long(). If
>> + there is no short
>> + option, set .val to
>> + CHAR_MAX. A unique
>> + value will be inserted
>> + by the code. */
>> + struct o2info_operation *opt_op;
>> +
>> + char *opt_help; /* Help string */
>> + int opt_set; /* Was this option seen */
>> + int (*opt_handler)(struct o2info_option *opt, char *arg);
>> + void *opt_private;
>> +};
>> +
>> +struct o2info_op_task {
>> +
>> + struct list_head o2p_list;
>> + struct o2info_operation *o2p_task;
>> +};
>> +
>> +#define __O2INFO_OP(_name, _run, _private) \
>> +{ \
>> + .to_name = #_name, \
>> + .to_run = _run, \
>> + .to_private = _private \
>> +}
>> +
>> +#define DEFINE_O2INFO_OP(_name, _run, _private) \
>> +struct o2info_operation _name##_op = \
>> + __O2INFO_OP(_name, _run, _private)
>> +
>> +#endif /* _O2INFO_H */
>>
>
More information about the Ocfs2-tools-devel
mailing list