ia64/xen-unstable

changeset 728:37cb4dcb88fb

bitkeeper revision 1.432 (3f696aa9lQa4lV0Ot2Odpc0PKO7dfw)

Merge scramble.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into scramble.cl.cam.ac.uk:/local/scratch/kaf24/xeno
author kaf24@scramble.cl.cam.ac.uk
date Thu Sep 18 08:19:53 2003 +0000 (2003-09-18)
parents 3c39b32327e1 428e0cac6ccb
children 5dab2fb654cd f2b5ad4cc6b1
files xenolinux-2.4.22-sparse/fs/partitions/xeno.c
line diff
     1.1 --- a/xenolinux-2.4.22-sparse/fs/partitions/xeno.c	Wed Sep 17 17:26:29 2003 +0000
     1.2 +++ b/xenolinux-2.4.22-sparse/fs/partitions/xeno.c	Thu Sep 18 08:19:53 2003 +0000
     1.3 @@ -1,5 +1,4 @@
     1.4 -/* Simple hack so that client XenoLinux's can sort-of see parts of the
     1.5 -   host partition table. */
     1.6 +
     1.7  #include <linux/kernel.h>
     1.8  #include <asm/hypervisor.h>
     1.9  #include <linux/fs.h>
    1.10 @@ -17,9 +16,9 @@ extern unsigned short xldev_to_physdev(k
    1.11  
    1.12  /* Grab the physdisk partitions list from the hypervisor. */
    1.13  int xeno_partition(struct gendisk *hd,
    1.14 -		   struct block_device *bdev,
    1.15 -		   unsigned long first_sec,
    1.16 -		   int first_part_minor)
    1.17 +                   struct block_device *bdev,
    1.18 +                   unsigned long first_sec,
    1.19 +                   int first_part_minor)
    1.20  {
    1.21      physdisk_probebuf_t *buf;
    1.22      int i, minor;
    1.23 @@ -46,29 +45,39 @@ int xeno_partition(struct gendisk *hd,
    1.24      buf->n_aces = PHYSDISK_MAX_ACES_PER_REQUEST;
    1.25  
    1.26      xenolinux_control_msg(XEN_BLOCK_PHYSDEV_PROBE, (char *)buf,
    1.27 -			  sizeof(*buf));
    1.28 +                          sizeof(*buf));
    1.29  
    1.30      if ( buf->n_aces == PHYSDISK_MAX_ACES_PER_REQUEST )
    1.31          printk(KERN_ALERT "Too many returns for xeno partition parser\n");
    1.32  
    1.33 +    /* Check for access to whole disk, allowing direct p.t. access. */
    1.34      for ( i = 0; i < buf->n_aces; i++ )
    1.35      {
    1.36 -        if (buf->entries[i].partition == 0)
    1.37 -	    continue;
    1.38 -	if (buf->entries[i].device != xldev_to_physdev(bdev->bd_dev))
    1.39 -	    continue;
    1.40 +        if ( (buf->entries[i].device == xldev_to_physdev(bdev->bd_dev)) &&
    1.41 +             (buf->entries[i].partition == 0) )
    1.42 +        {
    1.43 +            kfree(buf);
    1.44 +            return 0;
    1.45 +        }
    1.46 +    }
    1.47 +
    1.48 +    /* No direct access so trawl through the access lists instead. */
    1.49 +    for ( i = 0; i < buf->n_aces; i++ )
    1.50 +    {
    1.51 +        if (buf->entries[i].device != xldev_to_physdev(bdev->bd_dev))
    1.52 +            continue;
    1.53          if (!(buf->entries[i].mode & PHYSDISK_MODE_W))
    1.54          {
    1.55              if (!(buf->entries[i].mode & PHYSDISK_MODE_R))
    1.56                  continue;
    1.57              set_device_ro(bdev->bd_dev, 1);
    1.58          }
    1.59 -	minor = buf->entries[i].partition + first_part_minor - 1;
    1.60 -	add_gd_partition(hd,
    1.61 -			 minor,
    1.62 -			 buf->entries[i].start_sect,
    1.63 -			 buf->entries[i].n_sectors);
    1.64 -    }  
    1.65 +        minor = buf->entries[i].partition + first_part_minor - 1;
    1.66 +        add_gd_partition(hd,
    1.67 +                         minor,
    1.68 +                         buf->entries[i].start_sect,
    1.69 +                         buf->entries[i].n_sectors);
    1.70 +    }
    1.71  
    1.72      kfree(buf);
    1.73