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
|
/*
* quik-md.h - definitions for md handling in quik
*
* Copyright (C) 2005 Simon Vallet <svallet@gmail.com>
*
* Information retrieval code for md devices is derived from
* Detail.c in mdadm version 1.9.0, and therefore:
*
* Copyright (C) 2001-2002 Neil Brown <neilb@cse.unsw.edu.au>
*
* 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, or
* (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _QUIKMD_H
#define _QUIKMD_H
#define __u32 u_int32_t
#define __u64 u_int64_t
#define MD_MAJOR 9
#define DEV_BUFSZ 1024
#define u32 u_int32_t
#define u8 u_int8_t
#include <sys/ioctl.h>
#include <asm/ioctl.h>
/* From md_p.h */
#define MD_SB_DISKS 27
/*
* Device "operational" state bits
*/
#define MD_DISK_FAULTY 0 /* disk is faulty / operational */
#define MD_DISK_ACTIVE 1 /* disk is running or spare disk */
#define MD_DISK_SYNC 2 /* disk is in sync with the raid set */
#define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */
#include <linux/raid/md_u.h>
struct devmap {
int major, minor;
char *name;
struct devmap *next;
};
typedef struct mapping {
char *name;
int num;
} mapping_t;
#define __USE_XOPEN_EXTENDED
#include <ftw.h>
char *map_num(mapping_t *, int);
char *map_dev(int, int);
int is_standard(char *, int *);
int add_dev(const char *, const struct stat *, int, struct FTW *);
int digit_offset (const char *);
/* void fatal (const char *); */
typedef struct dev_info {
char * bootdev; /* Physical device, e.g. /dev/hda */
char * spart; /* Filesystem device for second.b, e.g. /dev/hda2 */
int cpart; /* Conffile part. number */
int part_block; /* Block # of partition map entry */
int secsize; /* Disk sector size */
int first_bootable; /* Part. map entry # of 1st bootable part */
unsigned long doff; /* Start of part. containing second.b */
struct first_info finfo; /* Boot block structure */
} dev_info_t;
typedef struct mdev_info {
char * metadev; /* Metadevice, e.g. /dev/md0, if necessary */
char * fs_dev; /* Device containing the filesystem */
dev_info_t ** devs;
unsigned int bs;
unsigned int nsect;
unsigned char ndevs;
int rlevel;
} mdev_info_t;
#define BOOTDEV(dev,i) (((dev)->devs[(i)]) ? (dev)->devs[(i)]->bootdev : NULL)
#define SPART(dev,i) (((dev)->devs[(i)]) ? (dev)->devs[(i)]->spart : NULL)
dev_info_t * new_dev_info (void);
void free_dev_info (dev_info_t *);
int md_get_version (int);
mdev_info_t * md_get_info (const char *);
mdev_info_t * new_mdev_info (unsigned char);
#endif
|