/*
 * common.h : Utility for the Linux Multiple Devices driver
 *            Copyright (C) 1997 Ingo Molnar, Miguel de Icaza, Gadi Oxman
 *            Copyright (C) 1998 Erik Troan
 *
 * Common includes and declarations.
 *
 * This source is covered by the GNU GPL, the same as all Linux kernel
 * sources.
 */

#ifndef H_COMMON
#define H_COMMON

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <errno.h>
#include <mntent.h>

#define MD_MAJOR 9
#include <asm/types.h>

#define MD_RESERVED       0UL
#define LINEAR            1UL
#define RAID0             2UL
#define RAID1             3UL
#define RAID5             4UL
#define TRANSLUCENT       5UL
#define HSM               6UL
#define MULTIPATH         7UL
#define MAX_PERSONALITY   8UL

#include "md_p.h"
#include "md_u.h"

typedef int kdev_t;
#include <linux/unistd.h>

#define DEBUG				(0)
#define EXIT_USAGE			(EXIT_FAILURE)
#define EXIT_VERSION			(0)
#define MAX_LINE_LENGTH			(100)
#define ZERO_BUFFER_SIZE		(64)	/* 64kB */
#define MD_BLK_SIZ			(0x400)
#define RAID_CONFIG			"/etc/raidtab"

#define MKRAID_MAJOR_VERSION            (0)
#define MKRAID_MINOR_VERSION            (90)
#define MKRAID_PATCHLEVEL_VERSION       (0)

extern int do_quiet_flag;

#define MIN(a,b)	((a) < (b) ? (a) : (b))
#define OUT(x...) do { if (!do_quiet_flag) fprintf(stderr,##x); } while (0)
#define ERR(x...) fprintf(stderr,##x)

/*
 * Our supported algorithms
 */
#define RAID5_ALGORITHM_LEFT_ASYMMETRIC       0
#define RAID5_ALGORITHM_RIGHT_ASYMMETRIC      1
#define RAID5_ALGORITHM_LEFT_SYMMETRIC        2
#define RAID5_ALGORITHM_RIGHT_SYMMETRIC       3

#endif
