/usr/include/aal/types.h is in libaal-dev 1.0.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | /* Copyright (C) 2001, 2002, 2003 by Hans Reiser, licensing governed by
libaal/COPYING.
types.h -- libaal types declaration. */
#ifndef AAL_TYPES_H
#define AAL_TYPES_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
/* Some usefull return codes */
#undef EINVAL
#define EINVAL 22
#undef ENOSPC
#define ENOSPC 28
#undef ENOMEM
#define ENOMEM 12
#undef EIO
#define EIO 5
#undef ESTRUCT
#define ESTRUCT 50
#include <stdint.h>
#define MAX_UINT8 ((uint8_t)~0)
#define MAX_UINT16 ((uint16_t)~0)
#define MAX_UINT32 ((uint32_t)~0)
#define MAX_UINT64 ((uint64_t)~0)
/* Types and macros for working with variable length params. They are needed
because we don't want use gcc builtins in minimal mode for achive as small
binary size as possible. */
# include <stdarg.h>
#include <stdio.h>
/* Simple type for direction denoting */
enum aal_dir {
DIR_UP = 1 << 0,
DIR_DOWN = 1 << 1,
DIR_LEFT = 1 << 2,
DIR_RIGHT = 1 << 3
};
typedef enum aal_direction aal_direction_t;
typedef int bool_t;
/* This type is used for return of result of execution some function. */
typedef int64_t errno_t;
typedef struct aal_list aal_list_t;
/* This is the struct that describes one list element. It contains: pointer to
data assosiated with this item of list, pointer to next element of list and
pointer to prev element of list. */
struct aal_list {
void *data;
aal_list_t *next;
aal_list_t *prev;
};
typedef struct aal_hash_node aal_hash_node_t;
struct aal_hash_node {
void *key;
void *value;
aal_hash_node_t *next;
};
/* Type for hash fucntion */
typedef uint64_t (*hash_func_t) (void *);
/* Type for callback compare function. It is used in list and hash functions for
comparing their items. */
typedef int (*comp_func_t) (void *, void *, void *);
/* Key remove functions. */
typedef void (*keyrem_func_t) (void *);
typedef void (*valrem_func_t) (void *);
struct aal_hash_table {
uint32_t size;
uint32_t real;
hash_func_t hash_func;
comp_func_t comp_func;
keyrem_func_t keyrem_func;
valrem_func_t valrem_func;
aal_hash_node_t **nodes;
};
typedef struct aal_hash_table aal_hash_table_t;
/* Type for callback function that is called for each element of list or hash
table. */
typedef errno_t (*foreach_func_t) (void *, void *);
/* These types is used for keeping the block number and block count value. They
are needed to increase source code maintainability.
For instance, there is some function:
blk_t some_func(void);
It is clear to any reader, that this function is working with block number,
it returns block number.
Yet another variant of this function:
uint64_t some_func(void);
This variant of the function may return anything. This may be bytes, blocks,
etc. */
typedef uint64_t blk_t;
typedef uint64_t count_t;
#define INVAL_BLK MAX_UINT64
struct aal_device_ops;
/* Abstract device structure. It consists of flags device opened with, user
specified data, some opaque entity (for standard file it is file descriptor),
name of device (for instance, /dev/hda2), block size of device and device
operations. */
struct aal_device {
int flags;
void *data;
void *entity;
void *person;
char name[256];
char error[256];
uint32_t blksize;
struct aal_device_ops *ops;
};
typedef struct aal_device aal_device_t;
/* Operations which may be performed on the device. Some of them may not be
implemented. */
struct aal_device_ops {
errno_t (*open) (aal_device_t *, void *,
uint32_t, int);
errno_t (*read) (aal_device_t *,
void *, blk_t, count_t);
errno_t (*write) (aal_device_t *,
void *, blk_t, count_t);
errno_t (*discard) (aal_device_t *,
blk_t, count_t);
errno_t (*sync) (aal_device_t *);
errno_t (*equals) (aal_device_t *,
aal_device_t *);
count_t (*len) (aal_device_t *);
void (*close) (aal_device_t *);
};
/* Disk block structure. It is a replica of struct buffer_head from the linux
kernel. It consists of flags (dirty, clean, etc), data (pointer to data of
block), block size, offset (offset in bytes where block is placed on device),
and pointer to device, block opened on. */
struct aal_block {
blk_t nr;
int dirty;
void *data;
uint32_t size;
aal_device_t *device;
};
typedef struct aal_block aal_block_t;
/* This is the type of exception. */
enum aal_exception_type {
EXCEPTION_TYPE_INFO = 1,
EXCEPTION_TYPE_MESSAGE = 2,
EXCEPTION_TYPE_WARNING = 3,
EXCEPTION_TYPE_ERROR = 4,
EXCEPTION_TYPE_FATAL = 5,
EXCEPTION_TYPE_BUG = 6,
EXCEPTION_TYPE_LAST
};
typedef enum aal_exception_type aal_exception_type_t;
enum aal_exception_option {
EXCEPTION_OPT_UNHANDLED = 1 << 0,
EXCEPTION_OPT_YES = 1 << 1,
EXCEPTION_OPT_NO = 1 << 2,
EXCEPTION_OPT_OK = 1 << 3,
EXCEPTION_OPT_RETRY = 1 << 4,
EXCEPTION_OPT_IGNORE = 1 << 5,
EXCEPTION_OPT_CANCEL = 1 << 6,
EXCEPTION_OPT_LAST = 1 << 7
};
typedef enum aal_exception_option aal_exception_option_t;
#define EXCEPTION_OPT_YESNO (EXCEPTION_OPT_YES | EXCEPTION_OPT_NO)
#define EXCEPTION_OPT_OKCANCEL (EXCEPTION_OPT_OK | EXCEPTION_OPT_CANCEL)
#define EXCEPTION_OPT_RETRYIGNORE (EXCEPTION_OPT_RETRY | EXCEPTION_OPT_IGNORE)
/* Format checking stuff */
#ifdef __GNUC__
#define __aal_check_format(style, format, begin) \
__attribute__((__format__(style, format, begin)))
#else
#define __aal_check_format(style, format, begin)
#endif
/* This is exception structure. It contains: exception message, exception type,
exception options. Usualy, the life cycle of exception is very short.
Exception instance created by aal_exception_throw function and passed t
exception handler. After exception processed, it is destroyed by exception
factory. */
struct aal_exception {
char *message;
aal_exception_type_t type;
aal_exception_option_t options;
};
typedef struct aal_exception aal_exception_t;
typedef aal_exception_option_t (*aal_exception_handler_t) (aal_exception_t *ex);
/* Gauge related types. */
typedef struct aal_gauge aal_gauge_t;
enum aal_gauge_state {
GS_START,
GS_ACTIVE,
GS_PAUSE,
GS_RESUME,
GS_DONE,
GS_LAST
};
typedef enum aal_gauge_state aal_gauge_state_t;
typedef void (*aal_gauge_handler_t)(aal_gauge_t *);
struct aal_gauge_time {
/* Time in sec, millisec. */
uint64_t sec, misec;
/* Interval in milliseconds gauge should be shown once. */
uint64_t gap;
};
typedef struct aal_gauge_time aal_gauge_time_t;
struct aal_gauge {
aal_gauge_handler_t handler;
aal_gauge_state_t state;
char label[80];
/* Prepare the value if needed. */
aal_gauge_handler_t value_func;
aal_gauge_time_t time;
int64_t value;
void *data;
};
/* Stream types. */
typedef struct aal_stream aal_stream_t;
/* Stream protocol. It consist of read(), write() and fini() methods and needed
for implementing differnt streams with the same interface. There are two
implementation: memory stream and file stream. */
struct aal_proto {
int (*eof) (aal_stream_t *);
void (*fini) (aal_stream_t *);
int32_t (*read) (aal_stream_t *, void *, uint32_t);
int32_t (*write) (aal_stream_t *, void *, uint32_t);
};
typedef struct aal_proto aal_proto_t;
/* Stream itself. */
struct aal_stream {
void *entity;
uint32_t size;
uint32_t offset;
aal_proto_t *proto;
};
/* Public stream protocols. May be used for stream initializing. */
extern aal_proto_t file_stream;
extern aal_proto_t memory_stream;
/* Assert handler type. */
typedef void (*assert_handler_t) (char *, int, char *,
char *, int, char *);
#endif
|