Remove lots of unnecessary white space.

Now that I am using white-space mode in Emacs I can see all of this,
and I don't like it :-)

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2013-06-19 12:31:45 +10:00
parent e6dd89da86
commit 1011e8344a
51 changed files with 68 additions and 201 deletions

View File

@ -1262,7 +1262,7 @@ try_again:
inargv, auto_assem); inargv, auto_assem);
if (num_devs < 0) if (num_devs < 0)
return 1; return 1;
if (!st || !st->sb || !content) if (!st || !st->sb || !content)
return 2; return 2;
@ -1897,4 +1897,3 @@ int assemble_container_content(struct supertype *st, int mdfd,
} }
} }
#endif #endif

View File

@ -24,9 +24,9 @@
#include "mdadm.h" #include "mdadm.h"
#define REGISTER_DEV _IO (MD_MAJOR, 1) #define REGISTER_DEV _IO (MD_MAJOR, 1)
#define START_MD _IO (MD_MAJOR, 2) #define START_MD _IO (MD_MAJOR, 2)
#define STOP_MD _IO (MD_MAJOR, 3) #define STOP_MD _IO (MD_MAJOR, 3)
int Build(char *mddev, struct mddev_dev *devlist, int Build(char *mddev, struct mddev_dev *devlist,
struct shape *s, struct context *c) struct shape *s, struct context *c)

2
Grow.c
View File

@ -1537,7 +1537,6 @@ int Grow_reshape(char *devname, int fd,
struct mdinfo info; struct mdinfo info;
struct mdinfo *sra; struct mdinfo *sra;
if (ioctl(fd, GET_ARRAY_INFO, &array) < 0) { if (ioctl(fd, GET_ARRAY_INFO, &array) < 0) {
pr_err("%s is not an active md array - aborting\n", pr_err("%s is not an active md array - aborting\n",
devname); devname);
@ -2793,7 +2792,6 @@ static int reshape_array(char *container, int fd, char *devname,
Manage_subdevs(devname, fd, devlist, verbose, Manage_subdevs(devname, fd, devlist, verbose,
0,NULL, 0); 0,NULL, 0);
if (reshape.backup_blocks == 0 && data_offset) if (reshape.backup_blocks == 0 && data_offset)
reshape.backup_blocks = reshape.before.data_disks * info->array.chunk_size/512; reshape.backup_blocks = reshape.before.data_disks * info->array.chunk_size/512;
if (reshape.backup_blocks == 0) { if (reshape.backup_blocks == 0) {

View File

@ -298,4 +298,3 @@ DISTRO_MAKEFILE := $(wildcard distropkg/Makefile)
ifdef DISTRO_MAKEFILE ifdef DISTRO_MAKEFILE
include $(DISTRO_MAKEFILE) include $(DISTRO_MAKEFILE)
endif endif

View File

@ -27,9 +27,9 @@
#include "md_p.h" #include "md_p.h"
#include <ctype.h> #include <ctype.h>
#define REGISTER_DEV _IO (MD_MAJOR, 1) #define REGISTER_DEV _IO (MD_MAJOR, 1)
#define START_MD _IO (MD_MAJOR, 2) #define START_MD _IO (MD_MAJOR, 2)
#define STOP_MD _IO (MD_MAJOR, 3) #define STOP_MD _IO (MD_MAJOR, 3)
int Manage_ro(char *devname, int fd, int readonly) int Manage_ro(char *devname, int fd, int readonly)
{ {
@ -1358,7 +1358,7 @@ int Manage_subdevs(char *devname, int fd,
*/ */
close(tfd); close(tfd);
tfd = dev_open(dv->devname, O_RDONLY); tfd = dev_open(dv->devname, O_RDONLY);
} }
if (tfd < 0) { if (tfd < 0) {
if (dv->disposition == 'M') if (dv->disposition == 'M')
continue; continue;

View File

@ -156,7 +156,7 @@ int Monitor(struct mddev_dev *devlist,
return rv; return rv;
} }
if (share) if (share)
if (check_one_sharer(c->scan)) if (check_one_sharer(c->scan))
return 1; return 1;
@ -204,7 +204,6 @@ int Monitor(struct mddev_dev *devlist,
} }
} }
while (! finished) { while (! finished) {
int new_found = 0; int new_found = 0;
struct state *st; struct state *st;
@ -218,7 +217,7 @@ int Monitor(struct mddev_dev *devlist,
if (check_array(st, mdstat, c->test, &info, if (check_array(st, mdstat, c->test, &info,
increments, c->prefer)) increments, c->prefer))
anydegraded = 1; anydegraded = 1;
/* now check if there are any new devices found in mdstat */ /* now check if there are any new devices found in mdstat */
if (c->scan) if (c->scan)
new_found = add_new_arrays(mdstat, &statelist, c->test, new_found = add_new_arrays(mdstat, &statelist, c->test,
@ -809,12 +808,12 @@ static dev_t container_choose_spare(struct state *from, struct state *to,
close(fd); close(fd);
return 0; return 0;
} }
err = st->ss->load_container(st, fd, NULL); err = st->ss->load_container(st, fd, NULL);
close(fd); close(fd);
if (err) if (err)
return 0; return 0;
if (from == to) { if (from == to) {
/* We must check if number of active disks has not increased /* We must check if number of active disks has not increased
* since ioctl in main loop. mdmon may have added spare * since ioctl in main loop. mdmon may have added spare
@ -855,7 +854,6 @@ static dev_t container_choose_spare(struct state *from, struct state *to,
return dev; return dev;
} }
static void try_spare_migration(struct state *statelist, struct alert_info *info) static void try_spare_migration(struct state *statelist, struct alert_info *info)
{ {
struct state *from; struct state *from;
@ -874,7 +872,7 @@ static void try_spare_migration(struct state *statelist, struct alert_info *info
/* subarray monitored without parent container /* subarray monitored without parent container
* we can't move spares here */ * we can't move spares here */
continue; continue;
if (to->parent) if (to->parent)
/* member of a container */ /* member of a container */
to = to->parent; to = to->parent;

View File

@ -124,4 +124,3 @@ int Query(char *dev)
} }
return 0; return 0;
} }

View File

@ -147,7 +147,6 @@ void free_line(char *line)
dl_free(line); dl_free(line);
} }
struct conf_dev { struct conf_dev {
struct conf_dev *next; struct conf_dev *next;
char *name; char *name;
@ -417,7 +416,7 @@ void arrayline(char *line)
if (strcasecmp(w, "<ignore>") == 0 || if (strcasecmp(w, "<ignore>") == 0 ||
strncmp(w, "/dev/md/", 8) == 0 || strncmp(w, "/dev/md/", 8) == 0 ||
(w[0] != '/' && w[0] != '<') || (w[0] != '/' && w[0] != '<') ||
(strncmp(w, "/dev/md", 7) == 0 && (strncmp(w, "/dev/md", 7) == 0 &&
is_number(w+7)) || is_number(w+7)) ||
(strncmp(w, "/dev/md_d", 9) == 0 && (strncmp(w, "/dev/md_d", 9) == 0 &&
is_number(w+9)) is_number(w+9))
@ -568,7 +567,6 @@ void mailfromline(char *line)
} }
} }
static char *alert_program = NULL; static char *alert_program = NULL;
void programline(char *line) void programline(char *line)
{ {
@ -987,7 +985,6 @@ int devname_matches(char *name, char *match)
else if (strncmp(match, "/dev/", 5) == 0) else if (strncmp(match, "/dev/", 5) == 0)
match += 5; match += 5;
if (strncmp(name, "md", 2) == 0 && if (strncmp(name, "md", 2) == 0 &&
isdigit(name[2])) isdigit(name[2]))
name += 2; name += 2;

View File

@ -11,7 +11,6 @@ char *strncpy(char *dest, const char *src, size_t n) __THROW;
void *xcalloc(size_t num, size_t size); void *xcalloc(size_t num, size_t size);
#include "dlink.h" #include "dlink.h"
void *dl_head() void *dl_head()
{ {
void *h; void *h;

4
lib.c
View File

@ -112,8 +112,6 @@ char *fd2devnm(int fd)
return NULL; return NULL;
} }
/* /*
* convert a major/minor pair for a block device into a name in /dev, if possible. * convert a major/minor pair for a block device into a name in /dev, if possible.
* On the first call, walk /dev collecting name. * On the first call, walk /dev collecting name.
@ -233,8 +231,6 @@ char *map_dev_preferred(int major, int minor, int create,
return preferred ? preferred : regular; return preferred ? preferred : regular;
} }
/* conf_word gets one word from the conf file. /* conf_word gets one word from the conf file.
* if "allow_key", then accept words at the start of a line, * if "allow_key", then accept words at the start of a line,
* otherwise stop when such a word is found. * otherwise stop when such a word is found.

View File

@ -343,7 +343,7 @@ static void manage_container(struct mdstat_ent *mdstat,
struct supertype *container) struct supertype *container)
{ {
/* Of interest here are: /* Of interest here are:
* - if a new device has been added to the container, we * - if a new device has been added to the container, we
* add it to the array ignoring any metadata on it. * add it to the array ignoring any metadata on it.
* - if a device has been removed from the container, we * - if a device has been removed from the container, we
* remove it from the device list and update the metadata. * remove it from the device list and update the metadata.
@ -639,7 +639,6 @@ static void manage_new(struct mdstat_ent *mdstat,
GET_LEVEL|GET_CHUNK|GET_DISKS|GET_COMPONENT| GET_LEVEL|GET_CHUNK|GET_DISKS|GET_COMPONENT|
GET_DEGRADED|GET_DEVS|GET_OFFSET|GET_SIZE|GET_STATE); GET_DEGRADED|GET_DEVS|GET_OFFSET|GET_SIZE|GET_STATE);
if (!mdi) if (!mdi)
return; return;
new = xcalloc(1, sizeof(*new)); new = xcalloc(1, sizeof(*new));
@ -769,7 +768,7 @@ static void handle_message(struct supertype *container, struct metadata_update *
if (msg->len == 0) { /* ping_monitor */ if (msg->len == 0) { /* ping_monitor */
int cnt; int cnt;
cnt = monitor_loop_cnt; cnt = monitor_loop_cnt;
if (cnt & 1) if (cnt & 1)
cnt += 2; /* wait until next pselect */ cnt += 2; /* wait until next pselect */

View File

@ -46,7 +46,6 @@
#include <sys/file.h> #include <sys/file.h>
#include <ctype.h> #include <ctype.h>
#define MAP_READ 0 #define MAP_READ 0
#define MAP_NEW 1 #define MAP_NEW 1
#define MAP_LOCK 2 #define MAP_LOCK 2
@ -105,7 +104,6 @@ int map_write(struct map_ent *mel)
mapname[0]) == 0; mapname[0]) == 0;
} }
static FILE *lf = NULL; static FILE *lf = NULL;
int map_lock(struct map_ent **melp) int map_lock(struct map_ent **melp)
{ {
@ -416,11 +414,11 @@ void RebuildMap(void)
* It needs to match what -I or -As would come * It needs to match what -I or -As would come
* up with. * up with.
* That means: * That means:
* Check if array is in mdadm.conf * Check if array is in mdadm.conf
* - if so use that. * - if so use that.
* determine trustworthy from homehost etc * determine trustworthy from homehost etc
* find a unique name based on metadata name. * find a unique name based on metadata name.
* *
*/ */
struct mddev_ident *match = conf_match(st, info, struct mddev_ident *match = conf_match(st, info,
NULL, 0, NULL, 0,

3
maps.c
View File

@ -24,7 +24,6 @@
#include "mdadm.h" #include "mdadm.h"
/* name/number mappings */ /* name/number mappings */
mapping_t r5layout[] = { mapping_t r5layout[] = {
@ -97,7 +96,6 @@ mapping_t pers[] = {
{ NULL, 0} { NULL, 0}
}; };
mapping_t modes[] = { mapping_t modes[] = {
{ "assemble", ASSEMBLE}, { "assemble", ASSEMBLE},
{ "build", BUILD}, { "build", BUILD},
@ -150,4 +148,3 @@ int map_name(mapping_t *map, char *name)
} }
return UnSet; return UnSet;
} }

3
md_p.h
View File

@ -112,7 +112,7 @@ typedef struct mdp_superblock_s {
/* /*
* Constant generic information * Constant generic information
*/ */
__u32 md_magic; /* 0 MD identifier */ __u32 md_magic; /* 0 MD identifier */
__u32 major_version; /* 1 major version to which the set conforms */ __u32 major_version; /* 1 major version to which the set conforms */
__u32 minor_version; /* 2 minor version ... */ __u32 minor_version; /* 2 minor version ... */
__u32 patch_version; /* 3 patchlevel version ... */ __u32 patch_version; /* 3 patchlevel version ... */
@ -196,4 +196,3 @@ static inline __u64 md_event(mdp_super_t *sb) {
} }
#endif #endif

1
md_u.h
View File

@ -120,4 +120,3 @@ typedef struct mdu_param_s
} mdu_param_t; } mdu_param_t;
#endif #endif

View File

@ -29,7 +29,6 @@
#include "md_p.h" #include "md_p.h"
#include <ctype.h> #include <ctype.h>
static int scan_assemble(struct supertype *ss, static int scan_assemble(struct supertype *ss,
struct context *c, struct context *c,
struct mddev_ident *ident); struct mddev_ident *ident);
@ -40,7 +39,6 @@ static int misc_list(struct mddev_dev *devlist,
char *dump_directory, char *dump_directory,
struct supertype *ss, struct context *c); struct supertype *ss, struct context *c);
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int mode = 0; int mode = 0;
@ -423,7 +421,6 @@ int main(int argc, char *argv[])
writemostly = 2; writemostly = 2;
continue; continue;
case O(GROW,'z'): case O(GROW,'z'):
case O(CREATE,'z'): case O(CREATE,'z'):
case O(BUILD,'z'): /* size */ case O(BUILD,'z'): /* size */
@ -1611,7 +1608,7 @@ static int scan_assemble(struct supertype *ss,
if (a->devname && if (a->devname &&
strcasecmp(a->devname, "<ignore>") == 0) strcasecmp(a->devname, "<ignore>") == 0)
continue; continue;
r = Assemble(ss, a->devname, r = Assemble(ss, a->devname,
a, NULL, c); a, NULL, c);
if (r == 0) { if (r == 0) {

View File

@ -621,4 +621,3 @@ AUTO +1.x homehost \-all
.SH SEE ALSO .SH SEE ALSO
.BR mdadm (8), .BR mdadm (8),
.BR md (4). .BR md (4).

16
mdadm.h
View File

@ -51,7 +51,6 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
#define srandom srand #define srandom srand
#endif #endif
#include <linux/kdev_t.h> #include <linux/kdev_t.h>
/*#include <linux/fs.h> */ /*#include <linux/fs.h> */
#include <sys/mount.h> #include <sys/mount.h>
@ -162,7 +161,6 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
#endif #endif
#endif /* __KLIBC__ */ #endif /* __KLIBC__ */
/* /*
* min()/max()/clamp() macros that also do * min()/max()/clamp() macros that also do
* strict type-checking.. See the * strict type-checking.. See the
@ -233,7 +231,7 @@ struct mdinfo {
int container_enough; /* flag external handlers can set to int container_enough; /* flag external handlers can set to
* indicate that subarrays have not enough (-1), * indicate that subarrays have not enough (-1),
* enough to start (0), or all expected disks (1) */ * enough to start (0), or all expected disks (1) */
char sys_name[20]; char sys_name[20];
struct mdinfo *devs; struct mdinfo *devs;
struct mdinfo *next; struct mdinfo *next;
@ -448,7 +446,6 @@ typedef struct mapping {
int num; int num;
} mapping_t; } mapping_t;
struct mdstat_ent { struct mdstat_ent {
char *dev; char *dev;
char devnm[32]; char devnm[32];
@ -463,7 +460,7 @@ struct mdstat_ent {
struct dev_member { struct dev_member {
char *name; char *name;
struct dev_member *next; struct dev_member *next;
} *members; } *members;
struct mdstat_ent *next; struct mdstat_ent *next;
}; };
@ -605,7 +602,6 @@ static inline char *map_dev(int major, int minor, int create)
struct active_array; struct active_array;
struct metadata_update; struct metadata_update;
/* 'struct reshape' records the intermediate states of /* 'struct reshape' records the intermediate states of
* a general reshape. * a general reshape.
* The starting geometry is converted to the 'before' geometry * The starting geometry is converted to the 'before' geometry
@ -892,7 +888,7 @@ extern struct superswitch {
* (in a->resync_start). * (in a->resync_start).
* resync status is really irrelevant if the array is not consistent, * resync status is really irrelevant if the array is not consistent,
* but some metadata (DDF!) have a place to record the distinction. * but some metadata (DDF!) have a place to record the distinction.
* If 'consistent' is '2', then the array can mark it dirty if a * If 'consistent' is '2', then the array can mark it dirty if a
* resync/recovery/whatever is required, or leave it clean if not. * resync/recovery/whatever is required, or leave it clean if not.
* Return value is 0 dirty (not consistent) and 1 if clean. * Return value is 0 dirty (not consistent) and 1 if clean.
* it is only really important if consistent is passed in as '2'. * it is only really important if consistent is passed in as '2'.
@ -1156,7 +1152,6 @@ struct stat64;
extern int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s); extern int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s);
extern int Manage_ro(char *devname, int fd, int readonly); extern int Manage_ro(char *devname, int fd, int readonly);
extern int Manage_run(char *devname, int fd, int quiet); extern int Manage_run(char *devname, int fd, int quiet);
extern int Manage_stop(char *devname, int fd, int quiet, extern int Manage_stop(char *devname, int fd, int quiet,
@ -1385,7 +1380,7 @@ extern char *fd2devnm(int fd);
static inline int is_subarray(char *vers) static inline int is_subarray(char *vers)
{ {
/* The version string for a 'subarray' (an array in a container) /* The version string for a 'subarray' (an array in a container)
* is * is
* /containername/componentname for normal read-write arrays * /containername/componentname for normal read-write arrays
* -containername/componentname for arrays which mdmon must not * -containername/componentname for arrays which mdmon must not
* reconfigure. They might be read-only * reconfigure. They might be read-only
@ -1436,7 +1431,6 @@ char *xstrdup(const char *str);
#define LEVEL_CONTAINER (-100) #define LEVEL_CONTAINER (-100)
#define LEVEL_UNSUPPORTED (-200) #define LEVEL_UNSUPPORTED (-200)
/* faulty stuff */ /* faulty stuff */
#define WriteTransient 0 #define WriteTransient 0
@ -1456,7 +1450,6 @@ char *xstrdup(const char *str);
#define ModeMask 0x1f #define ModeMask 0x1f
#define ModeShift 5 #define ModeShift 5
#ifdef __TINYC__ #ifdef __TINYC__
#undef minor #undef minor
#undef major #undef major
@ -1494,7 +1487,6 @@ char *xstrdup(const char *str);
#define ALGORITHM_ROTATING_N_RESTART 9 /* DDF PRL=6 RLQ=2 */ #define ALGORITHM_ROTATING_N_RESTART 9 /* DDF PRL=6 RLQ=2 */
#define ALGORITHM_ROTATING_N_CONTINUE 10 /*DDF PRL=6 RLQ=3 */ #define ALGORITHM_ROTATING_N_CONTINUE 10 /*DDF PRL=6 RLQ=3 */
/* For every RAID5 algorithm we define a RAID6 algorithm /* For every RAID5 algorithm we define a RAID6 algorithm
* with exactly the same layout for data and parity, and * with exactly the same layout for data and parity, and
* with the Q block always on the last device (N-1). * with the Q block always on the last device (N-1).

View File

@ -200,7 +200,7 @@ static void try_kill_monitor(pid_t pid, char *devname, int sock)
fcntl(sock, F_SETFL, fl); fcntl(sock, F_SETFL, fl);
n = read(sock, buf, 100); n = read(sock, buf, 100);
/* Ignore result, it is just the wait that /* Ignore result, it is just the wait that
* matters * matters
*/ */
} }

View File

@ -26,7 +26,6 @@ enum array_state { clear, inactive, suspended, readonly, read_auto,
enum sync_action { idle, reshape, resync, recover, check, repair, bad_action }; enum sync_action { idle, reshape, resync, recover, check, repair, bad_action };
struct active_array { struct active_array {
struct mdinfo info; struct mdinfo info;
struct supertype *container; struct supertype *container;
@ -73,7 +72,6 @@ extern struct active_array *discard_this;
extern struct active_array *pending_discard; extern struct active_array *pending_discard;
extern struct md_generic_cmd *active_cmd; extern struct md_generic_cmd *active_cmd;
void remove_pidfile(char *devname); void remove_pidfile(char *devname);
void do_monitor(struct supertype *container); void do_monitor(struct supertype *container);
void do_manager(struct supertype *container); void do_manager(struct supertype *container);
@ -97,4 +95,3 @@ static inline int is_resync_complete(struct mdinfo *array)
return 1; return 1;
return 0; return 0;
} }

View File

@ -53,5 +53,3 @@ chmod +x initramfs/init
) > init.cpio.gz ) > init.cpio.gz
rm -rf initramfs rm -rf initramfs
ls -l init.cpio.gz ls -l init.cpio.gz

3
msg.c
View File

@ -1,7 +1,7 @@
/* /*
* Copyright (C) 2008 Intel Corporation * Copyright (C) 2008 Intel Corporation
* *
* mdmon socket / message handling * mdmon socket / message handling
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@ -78,7 +78,6 @@ static int recv_buf(int fd, void* buf, int len, int tmo)
return 0; return 0;
} }
int send_message(int fd, struct metadata_update *msg, int tmo) int send_message(int fd, struct metadata_update *msg, int tmo)
{ {
__s32 len = msg->len; __s32 len = msg->len;

3
msg.h
View File

@ -1,7 +1,7 @@
/* /*
* Copyright (C) 2008 Intel Corporation * Copyright (C) 2008 Intel Corporation
* *
* mdmon socket / message handling * mdmon socket / message handling
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@ -17,7 +17,6 @@
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
struct mdinfo; struct mdinfo;
struct metadata_update; struct metadata_update;

3
part.h
View File

@ -26,7 +26,6 @@
/* Structure definitions ext for MBR and GPT partition tables /* Structure definitions ext for MBR and GPT partition tables
*/ */
#define MBR_SIGNATURE_MAGIC __cpu_to_le16(0xAA55) #define MBR_SIGNATURE_MAGIC __cpu_to_le16(0xAA55)
#define MBR_PARTITIONS 4 #define MBR_PARTITIONS 4
@ -49,8 +48,6 @@ struct MBR {
__u16 magic; __u16 magic;
} __attribute__((packed)); } __attribute__((packed));
#define GPT_SIGNATURE_MAGIC __cpu_to_le64(0x5452415020494645ULL) #define GPT_SIGNATURE_MAGIC __cpu_to_le64(0x5452415020494645ULL)
#define MBR_GPT_PARTITION_TYPE 0xEE #define MBR_GPT_PARTITION_TYPE 0xEE

View File

@ -30,7 +30,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <limits.h> #include <limits.h>
static int devpath_to_ll(const char *dev_path, const char *entry, static int devpath_to_ll(const char *dev_path, const char *entry,
unsigned long long *val); unsigned long long *val);
@ -125,7 +124,6 @@ struct sys_dev *find_driver_devices(const char *bus, const char *driver)
return head; return head;
} }
static struct sys_dev *intel_devices=NULL; static struct sys_dev *intel_devices=NULL;
static time_t valid_time = 0; static time_t valid_time = 0;
@ -155,7 +153,6 @@ static int devpath_to_ll(const char *dev_path, const char *entry, unsigned long
return n; return n;
} }
static __u16 devpath_to_vendor(const char *dev_path) static __u16 devpath_to_vendor(const char *dev_path)
{ {
char path[strlen(dev_path) + strlen("/vendor") + 1]; char path[strlen(dev_path) + strlen("/vendor") + 1];
@ -254,7 +251,6 @@ static int scan(const void *start, const void *end, const void *data)
return 0; return 0;
} }
const struct imsm_orom *imsm_platform_test(enum sys_dev_type hba_id, int *populated, const struct imsm_orom *imsm_platform_test(enum sys_dev_type hba_id, int *populated,
struct imsm_orom *imsm_orom) struct imsm_orom *imsm_orom)
{ {
@ -289,8 +285,6 @@ const struct imsm_orom *imsm_platform_test(enum sys_dev_type hba_id, int *popula
return imsm_orom; return imsm_orom;
} }
static const struct imsm_orom *find_imsm_hba_orom(enum sys_dev_type hba_id) static const struct imsm_orom *find_imsm_hba_orom(enum sys_dev_type hba_id)
{ {
unsigned long align; unsigned long align;
@ -346,7 +340,6 @@ static const struct imsm_orom *find_imsm_hba_orom(enum sys_dev_type hba_id)
(c) & 0xff, ((c) >> 8) & 0xff, \ (c) & 0xff, ((c) >> 8) & 0xff, \
(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}) (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
#define SYS_EFI_VAR_PATH "/sys/firmware/efi/vars" #define SYS_EFI_VAR_PATH "/sys/firmware/efi/vars"
#define SCU_PROP "RstScuV" #define SCU_PROP "RstScuV"
#define AHCI_PROP "RstSataV" #define AHCI_PROP "RstSataV"
@ -447,7 +440,6 @@ const struct imsm_orom *find_imsm_capability(enum sys_dev_type hba_id)
{ {
const struct imsm_orom *cap=NULL; const struct imsm_orom *cap=NULL;
if ((cap = find_imsm_efi(hba_id)) != NULL) if ((cap = find_imsm_efi(hba_id)) != NULL)
return cap; return cap;
if ((cap = find_imsm_hba_orom(hba_id)) != NULL) if ((cap = find_imsm_hba_orom(hba_id)) != NULL)

View File

@ -133,7 +133,6 @@ static inline int imsm_orom_has_chunk(const struct imsm_orom *orom, int chunk)
return !!(orom->sss & (1 << (fs - 1))); return !!(orom->sss & (1 << (fs - 1)));
} }
/** /**
* fls - find last (most-significant) bit set * fls - find last (most-significant) bit set
* @x: the word to search * @x: the word to search
@ -208,4 +207,3 @@ int disk_attached_to_hba(int fd, const char *hba_path);
char *devt_to_devpath(dev_t dev); char *devt_to_devpath(dev_t dev);
int path_attached_to_hba(const char *disk_path, const char *hba_path); int path_attached_to_hba(const char *disk_path, const char *hba_path);
const char *get_sys_dev_type(enum sys_dev_type); const char *get_sys_dev_type(enum sys_dev_type);

View File

@ -401,7 +401,6 @@ void pol_add(struct dev_policy **pol,
pol_dedup(*pol); pol_dedup(*pol);
} }
/* /*
* disk_policy() gathers policy information for the * disk_policy() gathers policy information for the
* disk described in the given mdinfo (disk.{major,minor}). * disk described in the given mdinfo (disk.{major,minor}).
@ -592,7 +591,6 @@ int disk_action_allows(struct mdinfo *disk, const char *metadata, enum policy_ac
return rv; return rv;
} }
/* Domain policy: /* Domain policy:
* Any device can have a list of domains asserted by different policy * Any device can have a list of domains asserted by different policy
* statements. * statements.
@ -703,7 +701,6 @@ void domain_add(struct domainlist **domp, char *domain)
domain_merge_one(domp, domain); domain_merge_one(domp, domain);
} }
void domain_free(struct domainlist *dl) void domain_free(struct domainlist *dl)
{ {
while (dl) { while (dl) {

View File

@ -109,7 +109,7 @@ int probe_roms_init(unsigned long align)
if (rc == 0) if (rc == 0)
rom_fd = fd; rom_fd = fd;
else { else {
if (fd >= 0) if (fd >= 0)
close(fd); close(fd);
probe_roms_exit(); probe_roms_exit();
} }
@ -150,39 +150,39 @@ static struct resource extension_rom_resource = {
}; };
static struct resource adapter_rom_resources[] = { { static struct resource adapter_rom_resources[] = { {
.name = "Adapter ROM", .name = "Adapter ROM",
.start = 0xc8000, .start = 0xc8000,
.data = 0, .data = 0,
.end = 0, .end = 0,
}, { }, {
.name = "Adapter ROM", .name = "Adapter ROM",
.start = 0, .start = 0,
.data = 0, .data = 0,
.end = 0, .end = 0,
}, { }, {
.name = "Adapter ROM", .name = "Adapter ROM",
.start = 0, .start = 0,
.data = 0, .data = 0,
.end = 0, .end = 0,
}, { }, {
.name = "Adapter ROM", .name = "Adapter ROM",
.start = 0, .start = 0,
.data = 0, .data = 0,
.end = 0, .end = 0,
}, { }, {
.name = "Adapter ROM", .name = "Adapter ROM",
.start = 0, .start = 0,
.data = 0, .data = 0,
.end = 0, .end = 0,
}, { }, {
.name = "Adapter ROM", .name = "Adapter ROM",
.start = 0, .start = 0,
.data = 0, .data = 0,
.end = 0, .end = 0,
} }; } };
static struct resource video_rom_resource = { static struct resource video_rom_resource = {
.name = "Video ROM", .name = "Video ROM",
.start = 0xc0000, .start = 0xc0000,
.data = 0, .data = 0,
.end = 0xc7fff, .end = 0xc7fff,

View File

@ -43,7 +43,6 @@ void raid6_2data_recov(int disks, size_t bytes, int faila, int failb,
uint8_t **ptrs); uint8_t **ptrs);
void xor_blocks(char *target, char **sources, int disks, int size); void xor_blocks(char *target, char **sources, int disks, int size);
/* Collect per stripe consistency information */ /* Collect per stripe consistency information */
void raid6_collect(int chunk_size, uint8_t *p, uint8_t *q, void raid6_collect(int chunk_size, uint8_t *p, uint8_t *q,
char *chunkP, char *chunkQ, int *results) char *chunkP, char *chunkQ, int *results)
@ -144,7 +143,6 @@ int unlock_all_stripes(struct mdinfo *info, sighandler_t *sig) {
return rv * 256; return rv * 256;
} }
int check_stripes(struct mdinfo *info, int *source, unsigned long long *offsets, int check_stripes(struct mdinfo *info, int *source, unsigned long long *offsets,
int raid_disks, int chunk_size, int level, int layout, int raid_disks, int chunk_size, int level, int layout,
unsigned long long start, unsigned long long length, char *name[], unsigned long long start, unsigned long long length, char *name[],
@ -308,7 +306,6 @@ int check_stripes(struct mdinfo *info, int *source, unsigned long long *offsets,
} }
write_res1 = write(source[failed_disk1], stripes[failed_disk1], chunk_size); write_res1 = write(source[failed_disk1], stripes[failed_disk1], chunk_size);
seek_res = lseek64(source[failed_disk2], seek_res = lseek64(source[failed_disk2],
offsets[failed_disk2] + start * chunk_size, SEEK_SET); offsets[failed_disk2] + start * chunk_size, SEEK_SET);
if (seek_res < 0) { if (seek_res < 0) {
@ -364,7 +361,6 @@ int check_stripes(struct mdinfo *info, int *source, unsigned long long *offsets,
} }
} }
length--; length--;
start++; start++;
} }

View File

@ -83,7 +83,6 @@ int geo_map(int block, unsigned long long stripe, int raid_disks,
case 500 + ALGORITHM_PARITY_0: case 500 + ALGORITHM_PARITY_0:
return block + 1; return block + 1;
case 600 + ALGORITHM_PARITY_N_6: case 600 + ALGORITHM_PARITY_N_6:
if (block == -2) if (block == -2)
return raid_disks - 1; return raid_disks - 1;
@ -131,7 +130,6 @@ int geo_map(int block, unsigned long long stripe, int raid_disks,
return raid_disks - 1; return raid_disks - 1;
return block + 1; return block + 1;
case 600 + ALGORITHM_PARITY_0: case 600 + ALGORITHM_PARITY_0:
if (block == -1) if (block == -1)
return 0; return 0;
@ -173,7 +171,6 @@ int geo_map(int block, unsigned long long stripe, int raid_disks,
if (block == -2) return (pd+1) % raid_disks; if (block == -2) return (pd+1) % raid_disks;
return (pd + 2 + block) % raid_disks; return (pd + 2 + block) % raid_disks;
case 600 + ALGORITHM_ROTATING_N_RESTART: case 600 + ALGORITHM_ROTATING_N_RESTART:
/* Same a left_asymmetric, by first stripe is /* Same a left_asymmetric, by first stripe is
* D D D P Q rather than * D D D P Q rather than
@ -210,7 +207,6 @@ static int is_ddf(int layout)
} }
} }
void xor_blocks(char *target, char **sources, int disks, int size) void xor_blocks(char *target, char **sources, int disks, int size)
{ {
int i, j; int i, j;
@ -243,7 +239,6 @@ void qsyndrome(uint8_t *p, uint8_t *q, uint8_t **sources, int disks, int size)
} }
} }
/* /*
* The following was taken from linux/drivers/md/mktables.c, and modified * The following was taken from linux/drivers/md/mktables.c, and modified
* to create in-memory tables rather than C code * to create in-memory tables rather than C code
@ -436,11 +431,9 @@ int raid6_check_disks(int data_disks, int start, int chunk_size,
if((Px != 0) && (Qx == 0)) if((Px != 0) && (Qx == 0))
curr_broken_disk = diskP; curr_broken_disk = diskP;
if((Px == 0) && (Qx != 0)) if((Px == 0) && (Qx != 0))
curr_broken_disk = diskQ; curr_broken_disk = diskQ;
if((Px != 0) && (Qx != 0)) { if((Px != 0) && (Qx != 0)) {
data_id = (raid6_gflog[Qx] - raid6_gflog[Px]); data_id = (raid6_gflog[Qx] - raid6_gflog[Px]);
if(data_id < 0) data_id += 255; if(data_id < 0) data_id += 255;
@ -780,7 +773,7 @@ int restore_stripes(int *dest, unsigned long long *offsets,
syndrome_disks = data_disks; syndrome_disks = data_disks;
} }
qsyndrome((uint8_t*)stripes[disk], qsyndrome((uint8_t*)stripes[disk],
(uint8_t*)stripes[qdisk], (uint8_t*)stripes[qdisk],
(uint8_t**)blocks, (uint8_t**)blocks,
syndrome_disks, chunk_size); syndrome_disks, chunk_size);
break; break;
@ -953,7 +946,7 @@ main(int argc, char *argv[])
*p++ = '\0'; *p++ = '\0';
offsets[i] = atoll(p) * 512; offsets[i] = atoll(p) * 512;
} }
fds[i] = open(argv[9+i], O_RDWR); fds[i] = open(argv[9+i], O_RDWR);
if (fds[i] < 0) { if (fds[i] < 0) {
perror(argv[9+i]); perror(argv[9+i]);

View File

@ -1,7 +1,7 @@
/* /*
* Copyright (C) 2007-2008 Intel Corporation * Copyright (C) 2007-2008 Intel Corporation
* *
* Retrieve drive serial numbers for scsi disks * Retrieve drive serial numbers for scsi disks
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

1
sha1.c
View File

@ -50,7 +50,6 @@
64-byte boundary. (RFC 1321, 3.1: Step 1) */ 64-byte boundary. (RFC 1321, 3.1: Step 1) */
static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
/* Take a pointer to a 160 bit block of data (five 32 bit ints) and /* Take a pointer to a 160 bit block of data (five 32 bit ints) and
initialize it to the start constants of the SHA1 algorithm. This initialize it to the start constants of the SHA1 algorithm. This
must be called before using hash in the call to sha1_hash. */ must be called before using hash in the call to sha1_hash. */

3
sha1.h
View File

@ -84,7 +84,6 @@ struct sha1_ctx
sha1_uint32 buffer[32]; sha1_uint32 buffer[32];
}; };
/* Initialize structure containing state of computation. */ /* Initialize structure containing state of computation. */
extern void sha1_init_ctx (struct sha1_ctx *ctx); extern void sha1_init_ctx (struct sha1_ctx *ctx);
@ -111,7 +110,6 @@ extern void sha1_process_bytes (const void *buffer, size_t len,
aligned for a 32 bits value. */ aligned for a 32 bits value. */
extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf); extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf);
/* Put result from CTX in first 20 bytes following RESBUF. The result is /* Put result from CTX in first 20 bytes following RESBUF. The result is
always in little endian byte order, so that a byte-wise output yields always in little endian byte order, so that a byte-wise output yields
to the wanted ASCII representation of the message digest. to the wanted ASCII representation of the message digest.
@ -120,7 +118,6 @@ extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf);
aligned for a 32 bits value. */ aligned for a 32 bits value. */
extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf); extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf);
/* Compute SHA1 message digest for bytes read from STREAM. The /* Compute SHA1 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 20 bytes resulting message digest number will be written into the 20 bytes
beginning at RESBLOCK. */ beginning at RESBLOCK. */

View File

@ -91,7 +91,7 @@ static int load_gpt(struct supertype *st, int fd, char *devname)
free(super); free(super);
return 1; return 1;
} }
if (super->magic != MBR_SIGNATURE_MAGIC || if (super->magic != MBR_SIGNATURE_MAGIC ||
super->parts[0].part_type != MBR_GPT_PARTITION_TYPE) { super->parts[0].part_type != MBR_GPT_PARTITION_TYPE) {
not_found: not_found:

View File

@ -101,7 +101,7 @@ struct imsm_disk {
#define CONFIGURED_DISK __cpu_to_le32(0x02) /* Member of some RaidDev */ #define CONFIGURED_DISK __cpu_to_le32(0x02) /* Member of some RaidDev */
#define FAILED_DISK __cpu_to_le32(0x04) /* Permanent failure */ #define FAILED_DISK __cpu_to_le32(0x04) /* Permanent failure */
__u32 status; /* 0xF0 - 0xF3 */ __u32 status; /* 0xF0 - 0xF3 */
__u32 owner_cfg_num; /* which config 0,1,2... owns this disk */ __u32 owner_cfg_num; /* which config 0,1,2... owns this disk */
__u32 total_blocks_hi; /* 0xF4 - 0xF5 total blocks hi */ __u32 total_blocks_hi; /* 0xF4 - 0xF5 total blocks hi */
#define IMSM_DISK_FILLERS 3 #define IMSM_DISK_FILLERS 3
__u32 filler[IMSM_DISK_FILLERS]; /* 0xF5 - 0x107 MPB_DISK_FILLERS for future expansion */ __u32 filler[IMSM_DISK_FILLERS]; /* 0xF5 - 0x107 MPB_DISK_FILLERS for future expansion */
@ -235,7 +235,6 @@ struct bbm_log {
struct bbm_log_entry mapped_block_entries[BBM_LOG_MAX_ENTRIES]; struct bbm_log_entry mapped_block_entries[BBM_LOG_MAX_ENTRIES];
} __attribute__ ((__packed__)); } __attribute__ ((__packed__));
#ifndef MDASSEMBLE #ifndef MDASSEMBLE
static char *map_state_str[] = { "normal", "uninitialized", "degraded", "failed" }; static char *map_state_str[] = { "normal", "uninitialized", "degraded", "failed" };
#endif #endif
@ -249,7 +248,6 @@ static char *map_state_str[] = { "normal", "uninitialized", "degraded", "failed"
* MIGR_REC_BUF_SIZE <= MIGR_REC_POSITION * MIGR_REC_BUF_SIZE <= MIGR_REC_POSITION
*/ */
#define UNIT_SRC_NORMAL 0 /* Source data for curr_migr_unit must #define UNIT_SRC_NORMAL 0 /* Source data for curr_migr_unit must
* be recovered using srcMap */ * be recovered using srcMap */
#define UNIT_SRC_IN_CP_AREA 1 /* Source data for curr_migr_unit has #define UNIT_SRC_IN_CP_AREA 1 /* Source data for curr_migr_unit has
@ -508,7 +506,6 @@ struct imsm_update_add_remove_disk {
enum imsm_update_type type; enum imsm_update_type type;
}; };
static const char *_sys_dev_type[] = { static const char *_sys_dev_type[] = {
[SYS_DEV_UNKNOWN] = "Unknown", [SYS_DEV_UNKNOWN] = "Unknown",
[SYS_DEV_SAS] = "SAS", [SYS_DEV_SAS] = "SAS",
@ -591,7 +588,6 @@ static struct sys_dev* find_disk_attached_hba(int fd, const char *devname)
return NULL; return NULL;
} }
static int find_intel_hba_capability(int fd, struct intel_super *super, static int find_intel_hba_capability(int fd, struct intel_super *super,
char *devname); char *devname);
@ -954,7 +950,7 @@ static struct extent *get_extents(struct intel_super *super, struct dl *dl)
} }
qsort(rv, memberships, sizeof(*rv), cmp_extent); qsort(rv, memberships, sizeof(*rv), cmp_extent);
/* determine the start of the metadata /* determine the start of the metadata
* when no raid devices are defined use the default * when no raid devices are defined use the default
* ...otherwise allow the metadata to truncate the value * ...otherwise allow the metadata to truncate the value
* as is the case with older versions of imsm * as is the case with older versions of imsm
@ -1298,12 +1294,12 @@ void examine_migr_rec_imsm(struct intel_super *super)
/******************************************************************************* /*******************************************************************************
* function: imsm_check_attributes * function: imsm_check_attributes
* Description: Function checks if features represented by attributes flags * Description: Function checks if features represented by attributes flags
* are supported by mdadm. * are supported by mdadm.
* Parameters: * Parameters:
* attributes - Attributes read from metadata * attributes - Attributes read from metadata
* Returns: * Returns:
* 0 - passed attributes contains unsupported features flags * 0 - passed attributes contains unsupported features flags
* 1 - all features are supported * 1 - all features are supported
******************************************************************************/ ******************************************************************************/
static int imsm_check_attributes(__u32 attributes) static int imsm_check_attributes(__u32 attributes)
{ {
@ -1998,7 +1994,7 @@ static void uuid_from_super_imsm(struct supertype *st, int uuid[4])
* not the device-set. * not the device-set.
* uuid to recognise same set when adding a missing device back * uuid to recognise same set when adding a missing device back
* to an array. This is a uuid for the device-set. * to an array. This is a uuid for the device-set.
* *
* For each of these we can make do with a truncated * For each of these we can make do with a truncated
* or hashed uuid rather than the original, as long as * or hashed uuid rather than the original, as long as
* everyone agrees. * everyone agrees.
@ -2427,7 +2423,6 @@ static int imsm_create_metadata_checkpoint_update(
return update_memory_size; return update_memory_size;
} }
static void imsm_update_metadata_locally(struct supertype *st, static void imsm_update_metadata_locally(struct supertype *st,
void *buf, int len); void *buf, int len);
@ -2770,7 +2765,6 @@ static __u8 imsm_check_degraded(struct intel_super *super, struct imsm_dev *dev,
static int imsm_count_failed(struct intel_super *super, struct imsm_dev *dev, static int imsm_count_failed(struct intel_super *super, struct imsm_dev *dev,
int look_in_map); int look_in_map);
#ifndef MDASSEMBLE #ifndef MDASSEMBLE
static void manage_second_map(struct intel_super *super, struct imsm_dev *dev) static void manage_second_map(struct intel_super *super, struct imsm_dev *dev)
{ {
@ -2821,7 +2815,7 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info, char *
info->array.level = LEVEL_CONTAINER; info->array.level = LEVEL_CONTAINER;
info->array.layout = 0; info->array.layout = 0;
info->array.md_minor = -1; info->array.md_minor = -1;
info->array.ctime = 0; /* N/A for imsm */ info->array.ctime = 0; /* N/A for imsm */
info->array.utime = 0; info->array.utime = 0;
info->array.chunk_size = 0; info->array.chunk_size = 0;
@ -3130,7 +3124,6 @@ static int compare_super_imsm(struct supertype *st, struct supertype *tst)
} }
/* if 'first' is a spare promote it to a populated mpb with sec's /* if 'first' is a spare promote it to a populated mpb with sec's
* family number * family number
*/ */
@ -3502,7 +3495,7 @@ struct bbm_log *__get_imsm_bbm_log(struct imsm_super *mpb)
if (__le32_to_cpu(mpb->bbm_log_size)) { if (__le32_to_cpu(mpb->bbm_log_size)) {
ptr = mpb; ptr = mpb;
ptr += mpb->mpb_size - __le32_to_cpu(mpb->bbm_log_size); ptr += mpb->mpb_size - __le32_to_cpu(mpb->bbm_log_size);
} }
return ptr; return ptr;
} }
@ -4202,7 +4195,6 @@ imsm_thunderdome(struct intel_super **super_list, int len)
return champion; return champion;
} }
static int static int
get_sra_super_block(int fd, struct intel_super **super_list, char *devname, int *max, int keep_fd); get_sra_super_block(int fd, struct intel_super **super_list, char *devname, int *max, int keep_fd);
static int get_super_block(struct intel_super **super_list, char *devnm, char *devname, static int get_super_block(struct intel_super **super_list, char *devnm, char *devname,
@ -4211,7 +4203,6 @@ static int
get_devlist_super_block(struct md_list *devlist, struct intel_super **super_list, get_devlist_super_block(struct md_list *devlist, struct intel_super **super_list,
int *max, int keep_fd); int *max, int keep_fd);
static int load_super_imsm_all(struct supertype *st, int fd, void **sbp, static int load_super_imsm_all(struct supertype *st, int fd, void **sbp,
char *devname, struct md_list *devlist, char *devname, struct md_list *devlist,
int keep_fd) int keep_fd)
@ -4274,7 +4265,6 @@ static int load_super_imsm_all(struct supertype *st, int fd, void **sbp,
free_imsm(s); free_imsm(s);
} }
if (err) if (err)
return err; return err;
@ -4291,7 +4281,6 @@ static int load_super_imsm_all(struct supertype *st, int fd, void **sbp,
return 0; return 0;
} }
static int static int
get_devlist_super_block(struct md_list *devlist, struct intel_super **super_list, get_devlist_super_block(struct md_list *devlist, struct intel_super **super_list,
int *max, int keep_fd) int *max, int keep_fd)
@ -5019,7 +5008,6 @@ static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk,
return 0; return 0;
} }
static int remove_from_super_imsm(struct supertype *st, mdu_disk_info_t *dk) static int remove_from_super_imsm(struct supertype *st, mdu_disk_info_t *dk)
{ {
struct intel_super *super = st->sb; struct intel_super *super = st->sb;
@ -5044,7 +5032,6 @@ static int remove_from_super_imsm(struct supertype *st, mdu_disk_info_t *dk)
dd->next = super->disk_mgmt_list; dd->next = super->disk_mgmt_list;
super->disk_mgmt_list = dd; super->disk_mgmt_list = dd;
return 0; return 0;
} }
@ -5201,7 +5188,6 @@ static int write_super_imsm(struct supertype *st, int doclose)
return 0; return 0;
} }
static int create_array(struct supertype *st, int dev_idx) static int create_array(struct supertype *st, int dev_idx)
{ {
size_t len; size_t len;
@ -5500,7 +5486,6 @@ static int is_raid_level_supported(const struct imsm_orom *orom, int level, int
return 0; return 0;
} }
static int static int
active_arrays_by_format(char *name, char* hba, struct md_list **devlist, active_arrays_by_format(char *name, char* hba, struct md_list **devlist,
int dpa, int verbose) int dpa, int verbose)
@ -5624,7 +5609,6 @@ get_devices(const char *hba_path)
continue; continue;
} }
dv = xcalloc(1, sizeof(*dv)); dv = xcalloc(1, sizeof(*dv));
dv->devname = xstrdup(buf); dv->devname = xstrdup(buf);
dv->next = devlist; dv->next = devlist;
@ -5806,7 +5790,6 @@ count_volumes_list(struct md_list *devlist, char *homehost,
return count; return count;
} }
static int static int
count_volumes(char *hba, int dpa, int verbose) count_volumes(char *hba, int dpa, int verbose)
{ {
@ -5899,7 +5882,7 @@ validate_geometry_imsm_orom(struct intel_super *super, int level, int layout,
return 1; return 1;
} }
/* validate_geometry_imsm_volume - lifted from validate_geometry_ddf_bvd /* validate_geometry_imsm_volume - lifted from validate_geometry_ddf_bvd
* FIX ME add ahci details * FIX ME add ahci details
*/ */
static int validate_geometry_imsm_volume(struct supertype *st, int level, static int validate_geometry_imsm_volume(struct supertype *st, int level,
@ -6563,7 +6546,6 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
sb_errors = 1; sb_errors = 1;
} }
/* count spare devices, not used in maps /* count spare devices, not used in maps
*/ */
for (d = super->disks; d; d = d->next) for (d = super->disks; d; d = d->next)
@ -6655,7 +6637,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
if (ord & IMSM_ORD_REBUILD) if (ord & IMSM_ORD_REBUILD)
recovery_start = 0; recovery_start = 0;
/* /*
* if we skip some disks the array will be assmebled degraded; * if we skip some disks the array will be assmebled degraded;
* reset resync start to avoid a dirty-degraded * reset resync start to avoid a dirty-degraded
* situation when performing the intial sync * situation when performing the intial sync
@ -6709,7 +6691,6 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
return rest; return rest;
} }
static __u8 imsm_check_degraded(struct intel_super *super, struct imsm_dev *dev, static __u8 imsm_check_degraded(struct intel_super *super, struct imsm_dev *dev,
int failed, int look_in_map) int failed, int look_in_map)
{ {
@ -6718,7 +6699,7 @@ static __u8 imsm_check_degraded(struct intel_super *super, struct imsm_dev *dev,
map = get_imsm_map(dev, look_in_map); map = get_imsm_map(dev, look_in_map);
if (!failed) if (!failed)
return map->map_state == IMSM_T_STATE_UNINITIALIZED ? return map->map_state == IMSM_T_STATE_UNINITIALIZED ?
IMSM_T_STATE_UNINITIALIZED : IMSM_T_STATE_NORMAL; IMSM_T_STATE_UNINITIALIZED : IMSM_T_STATE_NORMAL;
switch (get_imsm_raid_level(map)) { switch (get_imsm_raid_level(map)) {
@ -6748,7 +6729,7 @@ static __u8 imsm_check_degraded(struct intel_super *super, struct imsm_dev *dev,
struct imsm_disk *disk; struct imsm_disk *disk;
/* reset the potential in-sync count on even-numbered /* reset the potential in-sync count on even-numbered
* slots. num_copies is always 2 for imsm raid10 * slots. num_copies is always 2 for imsm raid10
*/ */
if ((i & 1) == 0) if ((i & 1) == 0)
insync = 2; insync = 2;
@ -7525,7 +7506,6 @@ static struct dl *imsm_add_spare(struct intel_super *super, int slot,
return dl; return dl;
} }
static int imsm_rebuild_allowed(struct supertype *cont, int dev_idx, int failed) static int imsm_rebuild_allowed(struct supertype *cont, int dev_idx, int failed)
{ {
struct imsm_dev *dev2; struct imsm_dev *dev2;
@ -7669,7 +7649,7 @@ static struct mdinfo *imsm_activate_spare(struct active_array *a,
dl = imsm_add_spare(super, i, a, 1, rv); dl = imsm_add_spare(super, i, a, 1, rv);
if (!dl) if (!dl)
continue; continue;
/* found a usable disk with enough space */ /* found a usable disk with enough space */
di = xcalloc(1, sizeof(*di)); di = xcalloc(1, sizeof(*di));
@ -7710,7 +7690,7 @@ static struct mdinfo *imsm_activate_spare(struct active_array *a,
* disk_ord_tbl for the array * disk_ord_tbl for the array
*/ */
mu = xmalloc(sizeof(*mu)); mu = xmalloc(sizeof(*mu));
mu->buf = xcalloc(num_spares, mu->buf = xcalloc(num_spares,
sizeof(struct imsm_update_activate_spare)); sizeof(struct imsm_update_activate_spare));
mu->space = NULL; mu->space = NULL;
mu->space_list = NULL; mu->space_list = NULL;
@ -7753,7 +7733,6 @@ static int disks_overlap(struct intel_super *super, int idx, struct imsm_update_
return 0; return 0;
} }
static struct dl *get_disk_super(struct intel_super *super, int major, int minor) static struct dl *get_disk_super(struct intel_super *super, int major, int minor)
{ {
struct dl *dl = NULL; struct dl *dl = NULL;
@ -7831,7 +7810,6 @@ static int add_remove_disk_update(struct intel_super *super)
return check_degraded; return check_degraded;
} }
static int apply_reshape_migration_update(struct imsm_update_reshape_migration *u, static int apply_reshape_migration_update(struct imsm_update_reshape_migration *u,
struct intel_super *super, struct intel_super *super,
void ***space_list) void ***space_list)
@ -7991,7 +7969,6 @@ static int apply_size_change_update(struct imsm_update_size_change *u,
return ret_val; return ret_val;
} }
static int apply_update_activate_spare(struct imsm_update_activate_spare *u, static int apply_update_activate_spare(struct imsm_update_activate_spare *u,
struct intel_super *super, struct intel_super *super,
struct active_array *active_array) struct active_array *active_array)
@ -8327,9 +8304,9 @@ static void imsm_process_update(struct supertype *st,
* the arrays for general migration and convert selected spares * the arrays for general migration and convert selected spares
* into active devices. * into active devices.
* update_activate_spare - a spare device has replaced a failed * update_activate_spare - a spare device has replaced a failed
* device in an array, update the disk_ord_tbl. If this disk is * device in an array, update the disk_ord_tbl. If this disk is
* present in all member arrays then also clear the SPARE_DISK * present in all member arrays then also clear the SPARE_DISK
* flag * flag
* update_create_array * update_create_array
* update_kill_array * update_kill_array
* update_rename_array * update_rename_array
@ -8406,7 +8383,7 @@ static void imsm_process_update(struct supertype *st,
break; break;
} }
case update_activate_spare: { case update_activate_spare: {
struct imsm_update_activate_spare *u = (void *) update->buf; struct imsm_update_activate_spare *u = (void *) update->buf;
if (apply_update_activate_spare(u, super, st->arrays)) if (apply_update_activate_spare(u, super, st->arrays))
super->updates_pending++; super->updates_pending++;
break; break;
@ -8955,7 +8932,6 @@ static int imsm_get_allowed_degradation(int level, int raid_disks,
} }
} }
/******************************************************************************* /*******************************************************************************
* Function: open_backup_targets * Function: open_backup_targets
* Description: Function opens file descriptors for all devices given in * Description: Function opens file descriptors for all devices given in
@ -9067,7 +9043,6 @@ void init_migr_record_imsm(struct supertype *st, struct imsm_dev *dev,
migr_rec->post_migr_vol_cap = dev->size_low; migr_rec->post_migr_vol_cap = dev->size_low;
migr_rec->post_migr_vol_cap_hi = dev->size_high; migr_rec->post_migr_vol_cap_hi = dev->size_high;
/* Find the smallest dev */ /* Find the smallest dev */
for (sd = info->devs ; sd ; sd = sd->next) { for (sd = info->devs ; sd ; sd = sd->next) {
sprintf(nm, "%d:%d", sd->disk.major, sd->disk.minor); sprintf(nm, "%d:%d", sd->disk.major, sd->disk.minor);
@ -9377,7 +9352,7 @@ static const char *imsm_get_disk_controller_domain(const char *path)
drv = "isci"; drv = "isci";
else if (hba && hba->type == SYS_DEV_SATA) else if (hba && hba->type == SYS_DEV_SATA)
drv = "ahci"; drv = "ahci";
else else
drv = "unknown"; drv = "unknown";
dprintf("path: %s hba: %s attached: %s\n", dprintf("path: %s hba: %s attached: %s\n",
path, (hba) ? hba->path : "NULL", drv); path, (hba) ? hba->path : "NULL", drv);
@ -9515,10 +9490,10 @@ static int imsm_reshape_is_allowed_on_container(struct supertype *st,
/* Function: get_spares_for_grow /* Function: get_spares_for_grow
* Description: Allocates memory and creates list of spare devices * Description: Allocates memory and creates list of spare devices
* avaliable in container. Checks if spare drive size is acceptable. * avaliable in container. Checks if spare drive size is acceptable.
* Parameters: Pointer to the supertype structure * Parameters: Pointer to the supertype structure
* Returns: Pointer to the list of spare devices (mdinfo structure) on success, * Returns: Pointer to the list of spare devices (mdinfo structure) on success,
* NULL if fail * NULL if fail
*/ */
static struct mdinfo *get_spares_for_grow(struct supertype *st) static struct mdinfo *get_spares_for_grow(struct supertype *st)
{ {
@ -9611,7 +9586,6 @@ abort:
return 0; return 0;
} }
/****************************************************************************** /******************************************************************************
* function: imsm_create_metadata_update_for_size_change() * function: imsm_create_metadata_update_for_size_change()
* Creates update for IMSM array for array size change. * Creates update for IMSM array for array size change.
@ -9736,7 +9710,7 @@ static void imsm_update_metadata_locally(struct supertype *st,
/*************************************************************************** /***************************************************************************
* Function: imsm_analyze_change * Function: imsm_analyze_change
* Description: Function analyze change for single volume * Description: Function analyze change for single volume
* and validate if transition is supported * and validate if transition is supported
* Parameters: Geometry parameters, supertype structure, * Parameters: Geometry parameters, supertype structure,
* metadata change direction (apply/rollback) * metadata change direction (apply/rollback)
* Returns: Operation type code on success, -1 if fail * Returns: Operation type code on success, -1 if fail
@ -10069,7 +10043,7 @@ static int imsm_reshape_super(struct supertype *st, unsigned long long size,
dprintf("imsm: info: Volume operation\n"); dprintf("imsm: info: Volume operation\n");
/* find requested device */ /* find requested device */
while (dev) { while (dev) {
char *devnm = char *devnm =
imsm_find_array_devnm_by_subdev( imsm_find_array_devnm_by_subdev(
dev->index, st->container_devnm); dev->index, st->container_devnm);
if (devnm && strcmp(devnm, geo.devnm) == 0) if (devnm && strcmp(devnm, geo.devnm) == 0)
@ -10536,7 +10510,6 @@ struct superswitch super_imsm = {
.match_metadata_desc = match_metadata_desc_imsm, .match_metadata_desc = match_metadata_desc_imsm,
.container_content = container_content_imsm, .container_content = container_content_imsm,
.external = 1, .external = 1,
.name = "imsm", .name = "imsm",

View File

@ -94,7 +94,7 @@ static int load_super_mbr(struct supertype *st, int fd, char *devname)
free(super); free(super);
return 1; return 1;
} }
if (super->magic != MBR_SIGNATURE_MAGIC) { if (super->magic != MBR_SIGNATURE_MAGIC) {
if (devname) if (devname)
pr_err("No partition table found on %s\n", pr_err("No partition table found on %s\n",
@ -154,7 +154,7 @@ static void getinfo_mbr(struct supertype *st, struct mdinfo *info, char *map)
for (i = 0; i < MBR_PARTITIONS ; i++) for (i = 0; i < MBR_PARTITIONS ; i++)
if (sb->parts[i].blocks_num) { if (sb->parts[i].blocks_num) {
unsigned long last = unsigned long last =
(unsigned long)__le32_to_cpu(sb->parts[i].blocks_num) (unsigned long)__le32_to_cpu(sb->parts[i].blocks_num)
+ (unsigned long)__le32_to_cpu(sb->parts[i].first_sect_lba); + (unsigned long)__le32_to_cpu(sb->parts[i].first_sect_lba);
if (last > info->component_size) if (last > info->component_size)

View File

@ -36,7 +36,6 @@
* .. other stuff * .. other stuff
*/ */
static unsigned long calc_sb0_csum(mdp_super_t *super) static unsigned long calc_sb0_csum(mdp_super_t *super)
{ {
unsigned long csum = super->sb_csum; unsigned long csum = super->sb_csum;
@ -690,7 +689,6 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
* host name * host name
*/ */
static int init_super0(struct supertype *st, mdu_array_info_t *info, static int init_super0(struct supertype *st, mdu_array_info_t *info,
unsigned long long size, char *ignored_name, char *homehost, unsigned long long size, char *ignored_name, char *homehost,
int *uuid, unsigned long long data_offset) int *uuid, unsigned long long data_offset)
@ -861,7 +859,7 @@ static int store_super0(struct supertype *st, int fd)
if (super->state & (1<<MD_SB_BITMAP_PRESENT)) { if (super->state & (1<<MD_SB_BITMAP_PRESENT)) {
struct bitmap_super_s * bm = (struct bitmap_super_s*)(super+1); struct bitmap_super_s * bm = (struct bitmap_super_s*)(super+1);
if (__le32_to_cpu(bm->magic) == BITMAP_MAGIC) if (__le32_to_cpu(bm->magic) == BITMAP_MAGIC)
if (write(fd, bm, ROUND_UP(sizeof(*bm),4096)) != if (write(fd, bm, ROUND_UP(sizeof(*bm),4096)) !=
ROUND_UP(sizeof(*bm),4096)) ROUND_UP(sizeof(*bm),4096))
return 5; return 5;
} }
@ -920,7 +918,7 @@ static int compare_super0(struct supertype *st, struct supertype *tst)
return 1; return 1;
if (!first) { if (!first) {
if (posix_memalign((void**)&first, 4096, if (posix_memalign((void**)&first, 4096,
MD_SB_BYTES + MD_SB_BYTES +
ROUND_UP(sizeof(struct bitmap_super_s), 4096)) != 0) { ROUND_UP(sizeof(struct bitmap_super_s), 4096)) != 0) {
pr_err("%s could not allocate superblock\n", __func__); pr_err("%s could not allocate superblock\n", __func__);
return 1; return 1;
@ -947,7 +945,6 @@ static int compare_super0(struct supertype *st, struct supertype *tst)
return 0; return 0;
} }
static void free_super0(struct supertype *st); static void free_super0(struct supertype *st);
static int load_super0(struct supertype *st, int fd, char *devname) static int load_super0(struct supertype *st, int fd, char *devname)
@ -1118,7 +1115,6 @@ static int add_internal_bitmap0(struct supertype *st, int *chunkp,
bitmap_super_t *bms = (bitmap_super_t*)(((char*)sb) + MD_SB_BYTES); bitmap_super_t *bms = (bitmap_super_t*)(((char*)sb) + MD_SB_BYTES);
int uuid[4]; int uuid[4];
min_chunk = 4096; /* sub-page chunks don't work yet.. */ min_chunk = 4096; /* sub-page chunks don't work yet.. */
bits = (size * 512) / min_chunk + 1; bits = (size * 512) / min_chunk + 1;
while (bits > max_bits) { while (bits > max_bits) {
@ -1150,7 +1146,6 @@ static int add_internal_bitmap0(struct supertype *st, int *chunkp,
return 1; return 1;
} }
static void locate_bitmap0(struct supertype *st, int fd) static void locate_bitmap0(struct supertype *st, int fd)
{ {
unsigned long long dsize; unsigned long long dsize;

View File

@ -411,7 +411,6 @@ static void examine_super1(struct supertype *st, char *homehost)
printf("\n"); printf("\n");
} }
if (calc_sb_1_csum(sb) == sb->sb_csum) if (calc_sb_1_csum(sb) == sb->sb_csum)
printf(" Checksum : %x - correct\n", __le32_to_cpu(sb->sb_csum)); printf(" Checksum : %x - correct\n", __le32_to_cpu(sb->sb_csum));
else else
@ -507,7 +506,6 @@ static void examine_super1(struct supertype *st, char *homehost)
printf("\n"); printf("\n");
} }
static void brief_examine_super1(struct supertype *st, int verbose) static void brief_examine_super1(struct supertype *st, int verbose)
{ {
struct mdp_superblock_1 *sb = st->sb; struct mdp_superblock_1 *sb = st->sb;
@ -998,7 +996,6 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
info->disk.state |= 1 << MD_DISK_REPLACEMENT; info->disk.state |= 1 << MD_DISK_REPLACEMENT;
} }
if (sb->feature_map & __le32_to_cpu(MD_FEATURE_RECOVERY_OFFSET)) if (sb->feature_map & __le32_to_cpu(MD_FEATURE_RECOVERY_OFFSET))
info->recovery_start = __le32_to_cpu(sb->recovery_offset); info->recovery_start = __le32_to_cpu(sb->recovery_offset);
else else
@ -1470,8 +1467,6 @@ static int store_super1(struct supertype *st, int fd)
return -EINVAL; return -EINVAL;
} }
if (sb_offset != __le64_to_cpu(sb->super_offset) && if (sb_offset != __le64_to_cpu(sb->super_offset) &&
0 != __le64_to_cpu(sb->super_offset) 0 != __le64_to_cpu(sb->super_offset)
) { ) {
@ -1559,7 +1554,7 @@ static int write_init_super1(struct supertype *st)
sb->events = 0; sb->events = 0;
refst = dup_super(st); refst = dup_super(st);
if (load_super1(refst, di->fd, NULL)==0) { if (load_super1(refst, di->fd, NULL)==0) {
struct mdp_superblock_1 *refsb = refst->sb; struct mdp_superblock_1 *refsb = refst->sb;
memcpy(sb->device_uuid, refsb->device_uuid, 16); memcpy(sb->device_uuid, refsb->device_uuid, 16);
@ -1589,7 +1584,6 @@ static int write_init_super1(struct supertype *st)
goto error_out; goto error_out;
} }
/* /*
* Calculate the position of the superblock. * Calculate the position of the superblock.
* It is always aligned to a 4K boundary and * It is always aligned to a 4K boundary and
@ -1923,7 +1917,6 @@ static int load_super1(struct supertype *st, int fd, char *devname)
return 0; return 0;
} }
static struct supertype *match_metadata_desc1(char *arg) static struct supertype *match_metadata_desc1(char *arg)
{ {
struct supertype *st = xcalloc(1, sizeof(*st)); struct supertype *st = xcalloc(1, sizeof(*st));
@ -1993,7 +1986,6 @@ static __u64 _avail_size1(struct supertype *st, __u64 devsize,
else else
devsize -= 8; devsize -= 8;
if (st->minor_version < 0) if (st->minor_version < 0)
/* not specified, so time to set default */ /* not specified, so time to set default */
st->minor_version = 2; st->minor_version = 2;
@ -2069,7 +2061,6 @@ add_internal_bitmap1(struct supertype *st,
bitmap_super_t *bms = (bitmap_super_t*)(((char*)sb) + MAX_SB_SIZE); bitmap_super_t *bms = (bitmap_super_t*)(((char*)sb) + MAX_SB_SIZE);
int uuid[4]; int uuid[4];
if (__le64_to_cpu(sb->data_size) == 0) if (__le64_to_cpu(sb->data_size) == 0)
/* Must be creating the array, else data_size would be non-zero */ /* Must be creating the array, else data_size would be non-zero */
creating = 1; creating = 1;

View File

@ -47,7 +47,6 @@ int main(int argc, char *argv[])
exit(1); exit(1);
} }
for (i=0; i < 4096 ; i+=4) { for (i=0; i < 4096 ; i+=4) {
char t = super[i]; char t = super[i];
super[i] = super[i+3]; super[i] = super[i+3];
@ -69,7 +68,6 @@ int main(int argc, char *argv[])
super[32*4+10*4 +i] = t; super[32*4+10*4 +i] = t;
} }
if (lseek64(fd, offset, 0) < 0LL) { if (lseek64(fd, offset, 0) < 0LL) {
perror("lseek64"); perror("lseek64");
exit(1); exit(1);
@ -81,5 +79,3 @@ int main(int argc, char *argv[])
exit(0); exit(0);
} }

View File

@ -88,7 +88,6 @@ void sysfs_init(struct mdinfo *mdi, int fd, char *devnm)
strcpy(mdi->sys_name, devnm); strcpy(mdi->sys_name, devnm);
} }
struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options) struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options)
{ {
char fname[PATH_MAX]; char fname[PATH_MAX];
@ -456,7 +455,7 @@ int sysfs_uevent(struct mdinfo *sra, char *event)
return -1; return -1;
} }
return 0; return 0;
} }
int sysfs_attribute_available(struct mdinfo *sra, struct mdinfo *dev, char *name) int sysfs_attribute_available(struct mdinfo *sra, struct mdinfo *dev, char *name)
{ {
@ -771,7 +770,6 @@ int sysfs_disk_to_scsi_id(int fd, __u32 *id)
return 0; return 0;
} }
int sysfs_unique_holder(char *devnm, long rdev) int sysfs_unique_holder(char *devnm, long rdev)
{ {
/* Check that devnm is a holder of rdev, /* Check that devnm is a holder of rdev,

View File

@ -23,4 +23,3 @@ mdadm -B $md0 -l linear -n5 $dev0 $dev1 $dev2 $dev3 $dev4
check linear check linear
testdev $md0 5 $size 64 testdev $md0 5 $size 64
mdadm -S $md0 mdadm -S $md0

View File

@ -31,4 +31,3 @@ do
done done
mdadm -S $md0 mdadm -S $md0
done done

View File

@ -55,4 +55,3 @@ do
done done
mdadm -S $md0 mdadm -S $md0
done done

View File

@ -10,4 +10,3 @@ mdadm -S $md0
mdadm -A $md0 --name="Fred" $devlist mdadm -A $md0 --name="Fred" $devlist
#mdadm -Db $md0 #mdadm -Db $md0
mdadm -S $md0 mdadm -S $md0

View File

@ -11,4 +11,3 @@ mdadm -S $md0
mdadm -CR $md0 -l1 -n3 --write-behind --bitmap=internal --bitmap-chunk=4 $dev0 $dev1 --write-mostly $dev2 mdadm -CR $md0 -l1 -n3 --write-behind --bitmap=internal --bitmap-chunk=4 $dev0 $dev1 --write-mostly $dev2
testdev $md0 1 $mdsize1a 64 testdev $md0 1 $mdsize1a 64
mdadm -S $md0 mdadm -S $md0

View File

@ -43,4 +43,3 @@ do
done done
done done
exit 0 exit 0

View File

@ -76,4 +76,3 @@ imsm_check_removal $container $dev0
mdadm --add $container $dev4 mdadm --add $container $dev4
check wait check wait
imsm_check_hold $container $dev4 imsm_check_hold $container $dev4

View File

@ -28,4 +28,3 @@ vol0_new_num_comps=$((num_disks - 1))
vol0_new_chunk=64 vol0_new_chunk=64
. tests/imsm-grow-template 1 1 . tests/imsm-grow-template 1 1

View File

@ -18,7 +18,4 @@ vol0_new_level=0
vol0_new_num_comps=$vol0_num_comps vol0_new_num_comps=$vol0_num_comps
vol0_new_chunk=256 vol0_new_chunk=256
. tests/imsm-grow-template 0 1 . tests/imsm-grow-template 0 1

View File

@ -11,4 +11,3 @@ then
echo "ERROR: size is wrong for $dev: $cnt * $size (chunk=$chunk) = $rasize, not `/sbin/blockdev --getsize $dev`" echo "ERROR: size is wrong for $dev: $cnt * $size (chunk=$chunk) = $rasize, not `/sbin/blockdev --getsize $dev`"
exit 1; exit 1;
fi fi

1
util.c
View File

@ -778,7 +778,6 @@ int get_data_disks(int level, int layout, int raid_disks)
return data_disks; return data_disks;
} }
int devnm2devid(char *devnm) int devnm2devid(char *devnm)
{ {
/* First look in /sys/block/$DEVNM/dev for %d:%d /* First look in /sys/block/$DEVNM/dev for %d:%d