~ubuntu-branches/ubuntu/oneiric/cryptsetup/oneiric

« back to all changes in this revision

Viewing changes to lib/utils.c

  • Committer: Bazaar Package Importer
  • Author(s): Lorenzo De Liso
  • Date: 2010-11-27 17:37:43 UTC
  • mfrom: (0.1.16 sid)
  • Revision ID: james.westby@ubuntu.com-20101127173743-j2bogiz72hsd3blz
Tags: 2:1.1.3-4ubuntu1
* Merge from debian unstable (LP: #682177), remaining changes:
  - debian/control:
    + Bump initramfs-tools Suggests to Depends: so system is not
      potentially rendered unbootable.
    + Depend on plymouth.
  - Add debian/cryptdisks-{enable,udev}.upstart.
  - debian/cryptdisks.functions:
    + new function, crypttab_start_one_disk, to look for the named source
      device in /etc/crypttab (by device name, UUID, or label) and start it
      if configured to do so
    + wrap the call to /lib/cryptsetup/askpass with watershed, to make sure
      we only ever have one of these running at a time; otherwise multiple
      invocations could steal each other's input and/or write over each
      other's output
    + when called by cryptdisks-enable, check that we don't already have a
      corresponding cryptdisks-udev job running (probably waiting for a
      passphrase); if there is, wait until it's finished before continuing.
  - debian/cryptdisks{,-early}.init: Make the 'start' action of the init
    script a no-op, this should be handled entirely by the upstart job;
    and fix the LSB header to not declare this should be started in
    runlevel 'S'
  - debian/cryptsetup.postinst: Remove any symlinks from /etc/rcS.d on
    upgrade.
  - debian/rules: 
    + Do not install start symlinks for init scripts, and
      install debian/cryptdisks-{enable,udev}.upstart scripts.
    + link dynamically against libgcrypt and libgpg-error.
  - Add debian/cryptsetup.apport: Apport package hook. Install in
    debian/rules and create dir in debian/cryptsetup.dirs.
  - debian/cryptsetup.postrm: call update-initramfs on package removal.

Show diffs side-by-side

added added

removed removed

Lines of Context:
690
690
                            unsigned long *alignment_offset,   /* bytes */
691
691
                            unsigned long default_alignment)
692
692
{
693
 
        unsigned int dev_alignment_offset = 0;
694
 
        unsigned long min_io_size = 0, opt_io_size = 0;
 
693
        int dev_alignment_offset = 0;
 
694
        unsigned int min_io_size = 0, opt_io_size = 0;
695
695
        int fd;
696
696
 
697
697
        *required_alignment = default_alignment;
713
713
                opt_io_size = min_io_size;
714
714
 
715
715
        /* alignment offset, bogus -1 means misaligned/unknown */
716
 
        if (ioctl(fd, BLKALIGNOFF, &dev_alignment_offset) == -1 || (int)dev_alignment_offset < 0)
 
716
        if (ioctl(fd, BLKALIGNOFF, &dev_alignment_offset) == -1 || dev_alignment_offset < 0)
717
717
                dev_alignment_offset = 0;
718
718
 
719
 
        if (*required_alignment < min_io_size)
720
 
                *required_alignment = min_io_size;
 
719
        if (*required_alignment < (unsigned long)min_io_size)
 
720
                *required_alignment = (unsigned long)min_io_size;
721
721
 
722
 
        if (*required_alignment < opt_io_size)
723
 
                *required_alignment = opt_io_size;
 
722
        if (*required_alignment < (unsigned long)opt_io_size)
 
723
                *required_alignment = (unsigned long)opt_io_size;
724
724
 
725
725
        *alignment_offset = (unsigned long)dev_alignment_offset;
726
726
 
727
 
        log_dbg("Topology: IO (%lu/%lu), offset = %lu; Required alignment is %lu bytes.",
 
727
        log_dbg("Topology: IO (%u/%u), offset = %lu; Required alignment is %lu bytes.",
728
728
                min_io_size, opt_io_size, *alignment_offset, *required_alignment);
729
729
out:
730
730
        (void)close(fd);