~hamo/ubuntu/precise/grub2/grub2.hi_res

« back to all changes in this revision

Viewing changes to util/raid.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson, Colin Watson, Robert Millan, Updated translations
  • Date: 2010-11-22 12:24:56 UTC
  • mfrom: (1.26.4 upstream) (17.3.36 sid)
  • mto: (17.3.43 sid)
  • mto: This revision was merged to the branch mainline in revision 89.
  • Revision ID: james.westby@ubuntu.com-20101122122456-y82z3sfb7k4zfdcc
Tags: 1.99~20101122-1
[ Colin Watson ]
* New Bazaar snapshot.  Too many changes to list in full, but some of the
  more user-visible ones are as follows:
  - GRUB script:
    + Function parameters, "break", "continue", "shift", "setparams",
      "return", and "!".
    + "export" command supports multiple variable names.
    + Multi-line quoted strings support.
    + Wildcard expansion.
  - sendkey support.
  - USB hotunplugging and USB serial support.
  - Rename CD-ROM to cd on BIOS.
  - Add new --boot-directory option to grub-install, grub-reboot, and
    grub-set-default; the old --root-directory option is still accepted
    but was often confusing.
  - Basic btrfs detection/UUID support (but no file reading yet).
  - bash-completion for utilities.
  - If a device is listed in device.map, always assume that it is
    BIOS-visible rather than using extra layers such as LVM or RAID.
  - Add grub-mknetdir script (closes: #550658).
  - Remove deprecated "root" command.
  - Handle RAID devices containing virtio components.
  - GRUB Legacy configuration file support (via grub-menulst2cfg).
  - Keyboard layout support (via grub-mklayout and grub-kbdcomp).
  - Check generated grub.cfg for syntax errors before saving.
  - Pause execution for at most ten seconds if any errors are displayed,
    so that the user has a chance to see them.
  - Support submenus.
  - Write embedding zone using Reed-Solomon, so that it's robust against
    being partially overwritten (closes: #550702, #591416, #593347).
  - GRUB_DISABLE_LINUX_RECOVERY and GRUB_DISABLE_NETBSD_RECOVERY merged
    into a single GRUB_DISABLE_RECOVERY variable.
  - Fix loader memory allocation failure (closes: #551627).
  - Don't call savedefault on recovery entries (closes: #589325).
  - Support triple-indirect blocks on ext2 (closes: #543924).
  - Recognise DDF1 fake RAID (closes: #603354).

[ Robert Millan ]
* Use dpkg architecture wildcards.

[ Updated translations ]
* Slovenian (Vanja Cvelbar).  Closes: #604003
* Dzongkha (dawa pemo via Tenzin Dendup).  Closes: #604102

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
/* We only support RAID on Linux.  */
21
21
#ifdef __linux__
 
22
#include <grub/emu/misc.h>
22
23
#include <grub/util/misc.h>
23
24
#include <grub/util/raid.h>
 
25
#include <grub/emu/getroot.h>
24
26
 
25
27
#include <string.h>
26
28
#include <fcntl.h>
27
29
#include <sys/ioctl.h>
28
30
#include <errno.h>
 
31
#include <sys/types.h>
29
32
 
30
33
#include <linux/types.h>
31
34
#include <linux/major.h>
32
35
#include <linux/raid/md_p.h>
33
36
#include <linux/raid/md_u.h>
34
37
 
35
 
static char *
36
 
grub_util_getdiskname (int major, int minor)
37
 
{
38
 
  char *name = xmalloc (15);
39
 
 
40
 
  if (major == LOOP_MAJOR)
41
 
    sprintf (name, "/dev/loop%d", minor);
42
 
  else if (major == IDE0_MAJOR)
43
 
    sprintf (name, "/dev/hd%c", 'a' + minor / 64);
44
 
  else if (major == IDE1_MAJOR)
45
 
    sprintf (name, "/dev/hd%c", 'c' + minor / 64);
46
 
  else if (major == IDE2_MAJOR)
47
 
    sprintf (name, "/dev/hd%c", 'e' + minor / 64);
48
 
  else if (major == IDE3_MAJOR)
49
 
    sprintf (name, "/dev/hd%c", 'g' + minor / 64);
50
 
  else if (major == SCSI_DISK0_MAJOR)
51
 
    sprintf (name, "/dev/sd%c", 'a' + minor / 16);
52
 
  else
53
 
    grub_util_error ("unknown device number: %d, %d", major, minor);
54
 
 
55
 
  return name;
56
 
}
57
 
 
58
38
char **
59
39
grub_util_raid_getmembers (char *name)
60
40
{
99
79
 
100
80
      if (disk.state & (1 << MD_DISK_ACTIVE))
101
81
        {
102
 
          devicelist[j] = grub_util_getdiskname (disk.major, disk.minor);
 
82
          devicelist[j] = grub_find_device (NULL,
 
83
                                            makedev (disk.major, disk.minor));
103
84
          j++;
104
85
        }
105
86
    }