~wb-munzinger/+junk/ocfs2-tools

« back to all changes in this revision

Viewing changes to fswreck/include/main.h

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2009-07-06 07:26:30 UTC
  • mfrom: (1.1.7 upstream) (0.1.5 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090706072630-59335sl51k3rvu74
Tags: 1.4.2-1
* New upstream release (Closes: #535471).
* Drop patch for limits.h, included upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * main.h
3
 
 *
4
 
 * Function prototypes, macros, etc. for related 'C' files
5
 
 *
6
 
 * Copyright (C) 2006 Oracle.  All rights reserved.
7
 
 *
8
 
 * This program is free software; you can redistribute it and/or
9
 
 * modify it under the terms of the GNU General Public
10
 
 * License as published by the Free Software Foundation; either
11
 
 * version 2 of the License, or (at your option) any later version.
12
 
 * 
13
 
 * This program is distributed in the hope that it will be useful,
14
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 
 * General Public License for more details.
17
 
 * 
18
 
 * You should have received a copy of the GNU General Public
19
 
 * License along with this program; if not, write to the
20
 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21
 
 * Boston, MA 021110-1307, USA.
22
 
 *
23
 
 */
24
 
 
25
 
#ifndef __MAIN_H__
26
 
#define __MAIN_H__
27
 
 
28
 
#define _GNU_SOURCE
29
 
 
30
 
#include <stdio.h>
31
 
#include <stdlib.h>
32
 
#include <unistd.h>
33
 
#include <string.h>
34
 
#include <sys/types.h>
35
 
#include <sys/stat.h>
36
 
#include <fcntl.h>
37
 
#include <errno.h>
38
 
#include <pwd.h>
39
 
#include <grp.h>
40
 
#include <time.h>
41
 
#include <sys/socket.h>
42
 
#include <netinet/in.h>
43
 
#include <arpa/inet.h>
44
 
#include <netinet/in.h>
45
 
#include <signal.h>
46
 
#include <sys/raw.h>
47
 
#include <linux/kdev_t.h>
48
 
#include <inttypes.h>
49
 
 
50
 
#include <glib.h>
51
 
 
52
 
#include <linux/types.h>
53
 
 
54
 
#include "ocfs2.h"
55
 
#include "ocfs2_fs.h"
56
 
#include "ocfs1_fs_compat.h"
57
 
 
58
 
#define FSWRK_FATAL(fmt, arg...)        ({ fprintf(stderr, "ERROR at %s, %d: " fmt ".  EXITING!!!\n", \
59
 
                                                   __FILE__, __LINE__, ##arg);  \
60
 
                                           raise (SIGTERM);     \
61
 
                                           exit(1); \
62
 
                                         })
63
 
 
64
 
#define FSWRK_COM_FATAL(__p, __r)       do { com_err(__p, __r, "(%s,%d)", __FILE__, __LINE__); raise (SIGTERM); exit(1); } while(0)
65
 
 
66
 
#define FSWRK_FATAL_STR(str)            FSWRK_FATAL(str, "")
67
 
 
68
 
#define FSWRK_WARN(fmt, arg...)         fprintf(stderr, "WARNING at %s, %d: " fmt ".\n", \
69
 
                                                __FILE__, __LINE__, ##arg)
70
 
 
71
 
#define FSWRK_WARN_STR(str)             FSWRK_WARN(str, "")
72
 
 
73
 
#undef max
74
 
#define max(a,b)        ((a) > (b) ? (a) : (b))
75
 
#undef min
76
 
#define min(a,b)        ((a) < (b) ? (a) : (b))
77
 
 
78
 
enum{
79
 
        CORRUPT_EXTENT_BLOCK = 13,
80
 
        CORRUPT_EXTENT_LIST,
81
 
        CORRUPT_EXTENT_REC,
82
 
        CORRUPT_CHAIN_LIST,
83
 
        CORRUPT_CHAIN_REC,
84
 
        CORRUPT_CHAIN_INODE,
85
 
        CORRUPT_CHAIN_GROUP,
86
 
        CORRUPT_CHAIN_GROUP_MAGIC,
87
 
        CORRUPT_CHAIN_CPG,
88
 
        CORRUPT_SUPERBLOCK_CLUSTERS_EXCESS,
89
 
        CORRUPT_SUPERBLOCK_CLUSTERS_LACK,
90
 
        CORRUPT_GROUP_MINOR,
91
 
        CORRUPT_GROUP_GENERATION,
92
 
        CORRUPT_GROUP_LIST,
93
 
        CORRUPT_INODE_FIELD,
94
 
        CORRUPT_INODE_NOT_CONNECTED,
95
 
        CORRUPT_INODE_ORPHANED,
96
 
        CORRUPT_INODE_ALLOC_REPAIR,
97
 
        CORRUPT_LOCAL_ALLOC_EMPTY,
98
 
        CORRUPT_LOCAL_ALLOC_BITMAP,
99
 
        CORRUPT_LOCAL_ALLOC_USED,
100
 
        CORRUPT_TRUNCATE_LOG_LIST,
101
 
        CORRUPT_TRUNCATE_LOG_REC,
102
 
        CORRUPT_SYMLINK,
103
 
        CORRUPT_SPECIAL_FILE,
104
 
        CORRUPT_DIR_INODE,
105
 
        CORRUPT_DIR_DOT,
106
 
        CORRUPT_DIR_ENT,
107
 
        CORRUPT_DIR_PARENT_DUP,
108
 
        CORRUPT_DIR_NOT_CONNECTED,
109
 
        CORRUPT_CLUSTER_AND_GROUP_DESC,
110
 
        MAX_CORRUPT
111
 
        
112
 
};
113
 
 
114
 
#define ARRAY_ELEMENTS(arr) (sizeof(arr) / sizeof(arr[0]))
115
 
 
116
 
/* remaining headers */
117
 
#include <corrupt.h>
118
 
#include <chain.h>
119
 
#include <extent.h>
120
 
#include <group.h>
121
 
#include <inode.h>
122
 
#include <local_alloc.h>
123
 
#include <truncate_log.h>
124
 
#include <symlink.h>
125
 
#include <special.h>
126
 
#include <dir.h>
127
 
#include <fsck_type.h>
128
 
 
129
 
#endif          /* __MAIN_H__ */