~xnox/ubuntu/quantal/mdadm/merge

« back to all changes in this revision

Viewing changes to Examine.c

  • Committer: Dmitrijs Ledkovs
  • Author(s): Surbhi Palande
  • Date: 2010-09-30 17:46:19 UTC
  • mfrom: (1.1.25 sid)
  • Revision ID: dmitrijs.ledkovs@canonical.com-20100930174619-cqsokylnluraiyr8
Tags: 3.1.4-1+8efb9d1ubuntu1
* Merge from debian unstable. (LP: #603582) 
* Remaining changes
  - Assemble.c, config.c: upgraded to the mdadm-3.1.4 version of these files
    from Debian.
  - debian/control: we need udev and util-linux in the right version. We
    also remove the build dependency from quilt and docbook-to-man as both
    are not used in Ubuntus mdadm.
  - debian/initramfs/hook: kept the Ubuntus version for handling the absence
    of active raid arrays in <initramfs>/etc/mdadm/mdadm.conf
  - debian/initramfs/script.local-top.DEBIAN, debian/mdadm-startall,
    debian/mdadm.raid.DEBIAN: removed. udev does its job now instead.
  - debian/mdadm-startall.sgml, debian/mdadm-startall.8: documentation of
    unused startall script
  - debian/mdadm.config, debian/mdadm.postinst - let udev do the handling
    instead. Resolved merge conflict by keeping Ubuntu's version.
  - debian/rules: kept debian's switch to using dh_lintian
  - debian/mdadm.links, debian/mdadm.manpages: dropped owing to the fact
    that these are not used in Ubuntu. Also dropped the build-dep on docbook
    to man)
  - debian/mdadm.postinst, debian/mdadm.config, initramfs/init-premount:
    boot-degraded enablement; maintain udev starting of RAID devices;
    init-premount hook script for the initramfs, to provide information at
    boot
  - debian/mkconf.in is the older mkconf. Kept the Ubuntus version.
  - debian/rules: Kept Ubuntus version for installing apport hooks, not
    installing un-used startall script and for adding a udev rule
    corresponding to mdadm.
  - debian/install-rc, check.d/_numbers, check.d/root_on_raid: Ubuntu partman
    installer changes
  - debian/presubj: Dropped this unused bug reporting file. Instead use
    source_mdadm.py act as an apport hook for bug handling.
  - rename debian/mdadm.vol_id.udev to debian/mdadm.mdadm-blkid.udev so that
    the rules file ends up with a more reasonable name

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * mdadm - manage Linux "md" devices aka RAID arrays.
3
3
 *
4
 
 * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
 
4
 * Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
5
5
 *
6
6
 *
7
7
 *    This program is free software; you can redistribute it and/or modify
19
19
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
20
 *
21
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
 
22
 *    Email: <neilb@suse.de>
28
23
 */
29
24
 
30
25
#include        "mdadm.h"
68
63
        } *arrays = NULL;
69
64
 
70
65
        for (; devlist ; devlist=devlist->next) {
71
 
                struct supertype *st = forcest;
 
66
                struct supertype *st;
72
67
 
73
68
                fd = dev_open(devlist->devname, O_RDONLY);
74
69
                if (fd < 0) {
80
75
                        err = 1;
81
76
                }
82
77
                else {
83
 
                        if (!st)
 
78
                        if (forcest)
 
79
                                st = dup_super(forcest);
 
80
                        else
84
81
                                st = guess_super(fd);
85
82
                        if (st)
86
83
                                err = st->ss->load_super(st, fd,
119
116
                                ap->st = st;
120
117
                                arrays = ap;
121
118
                                st->ss->getinfo_super(st, &ap->info);
122
 
                        } else {
 
119
                        } else
123
120
                                st->ss->getinfo_super(st, &ap->info);
124
 
                                st->ss->free_super(st);
125
 
                        }
126
 
                        if (!(ap->info.disk.state & MD_DISK_SYNC))
 
121
                        if (!st->loaded_container &&
 
122
                            !(ap->info.disk.state & (1<<MD_DISK_SYNC)))
127
123
                                ap->spares++;
128
124
                        d = dl_strdup(devlist->devname);
129
125
                        dl_add(ap->devs, d);
130
126
                } else if (export) {
131
 
                        st->ss->export_examine_super(st);
 
127
                        if (st->ss->export_examine_super)
 
128
                                st->ss->export_examine_super(st);
132
129
                } else {
133
130
                        printf("%s:\n",devlist->devname);
134
131
                        st->ss->examine_super(st, homehost);
140
137
                for (ap=arrays; ap; ap=ap->next) {
141
138
                        char sep='=';
142
139
                        char *d;
143
 
                        ap->st->ss->brief_examine_super(ap->st);
144
 
                        if (ap->spares) printf("   spares=%d", ap->spares);
 
140
                        int newline = 0;
 
141
 
 
142
                        ap->st->ss->brief_examine_super(ap->st, brief > 1);
 
143
                        if (ap->spares)
 
144
                                newline += printf("   spares=%d", ap->spares);
145
145
                        if (brief > 1) {
146
 
                                printf("   devices");
 
146
                                newline += printf("   devices");
147
147
                                for (d=dl_next(ap->devs); d!= ap->devs; d=dl_next(d)) {
148
148
                                        printf("%c%s", sep, d);
149
149
                                        sep=',';
150
150
                                }
151
151
                        }
 
152
                        if (ap->st->ss->brief_examine_subarrays) {
 
153
                                if (newline)
 
154
                                        printf("\n");
 
155
                                ap->st->ss->brief_examine_subarrays(ap->st, brief > 1);
 
156
                        }
152
157
                        ap->st->ss->free_super(ap->st);
153
158
                        /* FIXME free ap */
154
159
                        if (ap->spares || brief > 1)