~ubuntu-branches/ubuntu/maverick/grub2/maverick-proposed

« back to all changes in this revision

Viewing changes to disk/usbms.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2010-07-12 15:02:28 UTC
  • mfrom: (1.17.1 upstream) (17.3.24 sid)
  • Revision ID: james.westby@ubuntu.com-20100712150228-pcklwlp83nbgony1
Tags: 1.98+20100710-1ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Adjust for default Ubuntu boot options ("quiet splash").
  - Default to hiding the menu; holding down Shift at boot will show it.
  - Set a monochromatic theme for Ubuntu.
  - Apply Ubuntu GRUB Legacy changes to legacy update-grub script: title,
    recovery mode, quiet option, tweak how memtest86+ is displayed, and
    use UUIDs where appropriate.
  - Fix backslash-escaping in merge_debconf_into_conf.
  - Remove "GNU/Linux" from default distributor string.
  - Add crashkernel= options if kdump and makedumpfile are available.
  - If other operating systems are installed, then automatically unhide
    the menu.  Otherwise, if GRUB_HIDDEN_TIMEOUT is 0, then use keystatus
    if available to check whether Shift is pressed.  If it is, show the
    menu, otherwise boot immediately.  If keystatus is not available, then
    fall back to a short delay interruptible with Escape.
  - Allow Shift to interrupt 'sleep --interruptible'.
  - Don't display introductory message about line editing unless we're
    actually offering a shell prompt.  Don't clear the screen just before
    booting if we never drew the menu in the first place.
  - Remove some verbose messages printed before reading the configuration
    file.
  - Suppress progress messages as the kernel and initrd load for
    non-recovery kernel menu entries.
  - Keep the loopback file open so that subsequent changes to the "root"
    environment variable don't affect it.
  - Change prepare_grub_to_access_device to handle filesystems
    loop-mounted on file images.
  - Ignore devices loop-mounted from files in 10_linux.
  - Show the boot menu if the previous boot failed, that is if it failed
    to get to the end of one of the normal runlevels.
  - Handle RAID devices containing virtio components.
  - Don't generate /boot/grub/device.map during grub-install or
    grub-mkconfig by default.
  - Adjust upgrade version checks for Ubuntu.
  - Change priority to optional to match the priority of grub.
  - Don't display "GRUB loading" unless Shift is held down.
  - Adjust versions of grub-doc and grub-legacy-doc conflicts to tolerate
    our backport of the grub-doc split.
  - Fix LVM/RAID probing in the absence of /boot/grub/device.map.
  - Look for .mo files in /usr/share/locale-langpack as well, in
    preference.
  - Make sure GRUB_TIMEOUT isn't quoted unnecessarily.
  - Probe all devices in 'grub-probe --target=drive' if
    /boot/grub/device.map is missing.
  - Adjust hostdisk id for hard disks, allowing grub-setup to use its
    standard workaround for broken BIOSes.
  - grub-common Breaks: lupin-support (<< 0.30) due to a grub-mkimage
    syntax change.
  - Build-depend on qemu-kvm rather than qemu-system for grub-pc tests.
  - Use qemu rather than qemu-system-i386.
  - Extend the EFI version of grub-install to be able to install into an
    EFI System Partition mounted on /boot/efi in a location that complies
    with the EFI specification.
  - Upgrade the installed core image when upgrading grub-efi-ia32 or
    grub-efi-amd64, although only if /boot/efi/EFI/ubuntu already exists.
  - Make grub-efi-ia32 and grub-efi-amd64 depend on efibootmgr so that
    grub-install works properly.
* Canonicalise device paths when building a device map on the fly.
* Program vesafb on BIOS systems rather than efifb, and return to enabling
  gfxpayload=keep by default if the kernel has the necessary support
  built-in.

Show diffs side-by-side

added added

removed removed

Lines of Context:
222
222
 
223
223
 
224
224
static int
225
 
grub_usbms_iterate (int (*hook) (const char *name, int luns))
 
225
grub_usbms_iterate (int (*hook) (int bus, int luns))
226
226
{
227
227
  grub_usbms_dev_t p;
228
228
  int cnt = 0;
229
229
 
230
230
  for (p = grub_usbms_dev_list; p; p = p->next)
231
231
    {
232
 
      char *devname;
233
 
      devname = grub_xasprintf ("usb%d", cnt);
234
 
 
235
 
      if (hook (devname, p->luns))
236
 
        {
237
 
          grub_free (devname);
238
 
          return 1;
239
 
        }
240
 
      grub_free (devname);
 
232
      if (hook (cnt, p->luns))
 
233
        return 1;
241
234
      cnt++;
242
235
    }
243
236
 
398
391
}
399
392
 
400
393
static grub_err_t
401
 
grub_usbms_open (const char *name, struct grub_scsi *scsi)
 
394
grub_usbms_open (int devnum, struct grub_scsi *scsi)
402
395
{
403
396
  grub_usbms_dev_t p;
404
 
  int devnum;
405
397
  int i = 0;
406
398
 
407
 
  if (grub_strncmp (name, "usb", 3))
408
 
    return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
409
 
                       "not a USB Mass Storage device");
410
 
 
411
 
  devnum = grub_strtoul (name + 3, NULL, 10);
412
399
  for (p = grub_usbms_dev_list; p; p = p->next)
413
400
    {
414
401
      /* Check if this is the devnumth device.  */
415
402
      if (devnum == i)
416
403
        {
417
404
          scsi->data = p;
418
 
          scsi->name = grub_strdup (name);
419
405
          scsi->luns = p->luns;
420
 
          if (! scsi->name)
421
 
            return grub_errno;
422
 
 
423
406
          return GRUB_ERR_NONE;
424
407
        }
425
408
 
430
413
                     "not a USB Mass Storage device");
431
414
}
432
415
 
433
 
static void
434
 
grub_usbms_close (struct grub_scsi *scsi)
435
 
{
436
 
  grub_free (scsi->name);
437
 
}
438
 
 
439
416
static struct grub_scsi_dev grub_usbms_dev =
440
417
  {
441
418
    .name = "usb",
 
419
    .id = GRUB_SCSI_SUBSYSTEM_USBMS,
442
420
    .iterate = grub_usbms_iterate,
443
421
    .open = grub_usbms_open,
444
 
    .close = grub_usbms_close,
445
422
    .read = grub_usbms_read,
446
423
    .write = grub_usbms_write
447
424
  };