]> git.ipfire.org Git - thirdparty/mdadm.git/blame - mdadm.h
mdadm-0.7.1
[thirdparty/mdadm.git] / mdadm.h
CommitLineData
64c4757e 1/*
9a9dab36 2 * mdadm - manage Linux "md" devices aka RAID arrays.
64c4757e 3 *
cd29a5c8 4 * Copyright (C) 2001-2002 Neil Brown <neilb@cse.unsw.edu.au>
64c4757e
NB
5 *
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * Author: Neil Brown
22 * Email: <neilb@cse.unsw.edu.au>
23 * Paper: Neil Brown
24 * School of Computer Science and Engineering
25 * The University of New South Wales
26 * Sydney, 2052
27 * Australia
28 */
29
30#define __USE_LARGEFILE64
31#include <unistd.h>
32extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
33
34#include <sys/types.h>
35#include <sys/stat.h>
36#include <stdlib.h>
37#include <time.h>
38#include <getopt.h>
39#include <fcntl.h>
40#include <stdio.h>
41#include <errno.h>
42#include <string.h>
43
44#include <linux/kdev_t.h>
45#include <linux/fs.h>
46#include <sys/ioctl.h>
47#define MD_MAJOR 9
48
56eb10c0
NB
49/* I seem to need this to make BLKGETSIZE64 to work... */
50#define u64 __u64
51
64c4757e
NB
52
53#include "md_u.h"
54
9a9dab36 55#define Name "mdadm"
682c7051 56
64c4757e
NB
57extern char short_options[];
58extern struct option long_options[];
59extern char Version[], Usage[], Help[], Help_create[], Help_build[], Help_assemble[];
60
61/* structures read from config file */
52826846
NB
62/* List of mddevice names and identifiers
63 * Identifiers can be:
64 * uuid=128-hex-uuid
65 * super-minor=decimal-minor-number-from-superblock
66 * devices=comma,separated,list,of,device,names,with,wildcards
67 *
68 * If multiple fields are present, the intersection of all matching
69 * devices is considered
70 */
71typedef struct mddev_ident_s {
64c4757e 72 char *devname;
52826846
NB
73
74 int uuid_set;
64c4757e 75 __u32 uuid[4];
52826846
NB
76
77 int super_minor; /* -1 if not set */
78
79 char *devices; /* comma separated list of device
80 * names with wild cards
81 */
cd29a5c8
NB
82 int level; /* -10 if not set */
83 int raid_disks; /* -1 if not set */
52826846
NB
84 char *spare_group;
85 struct mddev_ident_s *next;
86} *mddev_ident_t;
64c4757e
NB
87
88/* List of device names - wildcards expanded */
89typedef struct mddev_dev_s {
90 char *devname;
cd29a5c8
NB
91 char disposition; /* 'a' for add, 'r' for remove, 'f' for fail.
92 * Not set for names read from .config
93 */
64c4757e
NB
94 struct mddev_dev_s *next;
95} *mddev_dev_t;
96
682c7051
NB
97typedef struct mapping {
98 char *name;
99 int num;
100} mapping_t;
101
52826846
NB
102#ifndef Sendmail
103#define Sendmail "/usr/lib/sendmail -t"
104#endif
105
682c7051
NB
106extern char *map_num(mapping_t *map, int num);
107extern int map_name(mapping_t *map, char *name);
108extern mapping_t r5layout[], pers[];
109
82b27616 110extern char *map_dev(int major, int minor);
64c4757e
NB
111
112
113extern int Manage_ro(char *devname, int fd, int readonly);
114extern int Manage_runstop(char *devname, int fd, int runstop);
115extern int Manage_subdevs(char *devname, int fd,
cd29a5c8 116 mddev_dev_t devlist);
64c4757e
NB
117
118
119extern int Assemble(char *mddev, int mdfd,
52826846
NB
120 mddev_ident_t ident,
121 char *conffile,
cd29a5c8 122 mddev_dev_t devlist,
64c4757e
NB
123 int readonly, int runstop,
124 int verbose, int force);
125
126extern int Build(char *mddev, int mdfd, int chunk, int level,
127 int raiddisks,
cd29a5c8 128 mddev_dev_t devlist);
64c4757e
NB
129
130
131extern int Create(char *mddev, int mdfd,
682c7051 132 int chunk, int level, int layout, int size, int raiddisks, int sparedisks,
cd29a5c8 133 int subdevs, mddev_dev_t devlist,
52826846 134 int runstop, int verbose, int force);
64c4757e 135
cd29a5c8
NB
136extern int Detail(char *dev, int brief);
137extern int Examine(mddev_dev_t devlist, int brief, char *conffile);
138extern int Monitor(mddev_dev_t devlist,
52826846
NB
139 char *mailaddr, char *alert_cmd,
140 int period,
141 char *config);
64c4757e 142
9a9dab36
NB
143extern int Kill(char *dev, int force);
144
64c4757e
NB
145extern int md_get_version(int fd);
146extern int get_linux_version();
147extern int parse_uuid(char *str, int uuid[4]);
682c7051
NB
148extern int check_ext2(int fd, char *name);
149extern int check_reiser(int fd, char *name);
150extern int check_raid(int fd, char *name);
64c4757e 151
52826846 152extern mddev_ident_t conf_get_ident(char *, char*);
64c4757e 153extern mddev_dev_t conf_get_devs(char *);
cd29a5c8 154
56eb10c0 155extern char *human_size(long long bytes);