]> git.ipfire.org Git - thirdparty/mdadm.git/blob - mdctl.h
0e3b917612cc608626db86423c894bb12b16e0a0
[thirdparty/mdadm.git] / mdctl.h
1 /*
2 * mdctl - manage Linux "md" devices aka RAID arrays.
3 *
4 * Copyright (C) 2001 Neil Brown <neilb@cse.unsw.edu.au>
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>
32 extern __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
49
50 #include "md_u.h"
51
52 #define Name "mdctl"
53
54 extern char short_options[];
55 extern struct option long_options[];
56 extern char Version[], Usage[], Help[], Help_create[], Help_build[], Help_assemble[];
57
58 /* structures read from config file */
59 /* List of mddevice names and uuids */
60 typedef struct mddev_uuid_s {
61 char *devname;
62 __u32 uuid[4];
63 struct mddev_uuid_s *next;
64 } *mddev_uuid_t;
65
66 /* List of device names - wildcards expanded */
67 typedef struct mddev_dev_s {
68 char *devname;
69 struct mddev_dev_s *next;
70 } *mddev_dev_t;
71
72 typedef struct mapping {
73 char *name;
74 int num;
75 } mapping_t;
76
77 extern char *map_num(mapping_t *map, int num);
78 extern int map_name(mapping_t *map, char *name);
79 extern mapping_t r5layout[], pers[];
80
81
82
83 extern int Manage_ro(char *devname, int fd, int readonly);
84 extern int Manage_runstop(char *devname, int fd, int runstop);
85 extern int Manage_subdevs(char *devname, int fd,
86 int devcnt, char *devnames[], int devmodes[]);
87
88
89 extern int Assemble(char *mddev, int mdfd,
90 int uuid[4], int uuidset,
91 char *conffile, int scan,
92 int subdevs, char *subdev[],
93 int readonly, int runstop,
94 int verbose, int force);
95
96 extern int Build(char *mddev, int mdfd, int chunk, int level,
97 int raiddisks,
98 int subdevs, char *subdev[]);
99
100
101 extern int Create(char *mddev, int mdfd,
102 int chunk, int level, int layout, int size, int raiddisks, int sparedisks,
103 int subdevs, char *subdev[],
104 int runstop, int verbose);
105
106 extern int Detail(char *dev);
107 extern int Examine(char *dev);
108
109 extern int md_get_version(int fd);
110 extern int get_linux_version();
111 extern int parse_uuid(char *str, int uuid[4]);
112 extern int check_ext2(int fd, char *name);
113 extern int check_reiser(int fd, char *name);
114 extern int check_raid(int fd, char *name);
115
116 extern mddev_uuid_t conf_get_uuids(char *);
117 extern mddev_dev_t conf_get_devs(char *);