ia64/xen-unstable

changeset 408:c1dae0dfefff

bitkeeper revision 1.196 (3eafa27fjD1i7ThWSspo1AefQXCtxQ)

xl_ide.c:
Further fixes to Xenolinux IDE code -- properly tested this time :-)
author kaf24@scramble.cl.cam.ac.uk
date Wed Apr 30 10:16:31 2003 +0000 (2003-04-30)
parents b780057c9d40
children 0afe9ac81deb
files xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_ide.c
line diff
     1.1 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_ide.c	Tue Apr 29 18:45:45 2003 +0000
     1.2 +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_ide.c	Wed Apr 30 10:16:31 2003 +0000
     1.3 @@ -13,7 +13,9 @@ static int xlide_blksize_size[XLIDE_MAX]
     1.4  static int xlide_hardsect_size[XLIDE_MAX];
     1.5  static int xlide_max_sectors[XLIDE_MAX];
     1.6  
     1.7 -struct gendisk *xlide_gendisk[2] = { NULL };
     1.8 +#define XLIDE_NR_MAJORS     2
     1.9 +
    1.10 +struct gendisk *xlide_gendisk[XLIDE_NR_MAJORS] = { NULL };
    1.11  
    1.12  static struct block_device_operations xlide_block_fops = 
    1.13  {
    1.14 @@ -37,9 +39,10 @@ static int get_major(int major)
    1.15      return r;
    1.16  }
    1.17  
    1.18 -static struct gendisk *setup_major(xen_disk_info_t *xdi, int base, int major)
    1.19 +static void setup_major(struct gendisk **pgd, 
    1.20 +                        xen_disk_info_t *xdi, int base, int major)
    1.21  {
    1.22 -    int i, minors, disk, units = 2;
    1.23 +    int i, minors, disk, units = XLIDE_DEVS_PER_MAJOR;
    1.24      unsigned short minor; 
    1.25      unsigned char buf[64];
    1.26      struct gendisk *gd;
    1.27 @@ -78,6 +81,7 @@ static struct gendisk *setup_major(xen_d
    1.28      memset(gd->de_arr, 0, sizeof(*gd->de_arr) * units);
    1.29      memset(gd->flags, 0, sizeof(*gd->flags) * units);
    1.30      memset(gd->real_devices, 0, sizeof(xl_disk_t) * units);
    1.31 +    *pgd = gd;
    1.32      add_gendisk(gd);
    1.33      
    1.34      /* Now register each disk in turn. */
    1.35 @@ -134,7 +138,7 @@ int xlide_init(xen_disk_info_t *xdi)
    1.36      for ( i = 0; i < xdi->count; i++ )
    1.37          if ( IS_IDE_XENDEV(xdi->disks[i].device) &&
    1.38               ((xdi->disks[i].device & XENDEV_IDX_MASK) <
    1.39 -              (2*XLIDE_DEVS_PER_MAJOR)) ) 
    1.40 +              (XLIDE_NR_MAJORS*XLIDE_DEVS_PER_MAJOR)) ) 
    1.41              units++;
    1.42      if ( units == 0 ) return 0;
    1.43  
    1.44 @@ -156,8 +160,8 @@ int xlide_init(xen_disk_info_t *xdi)
    1.45          xlide_max_sectors[i]   = 128;
    1.46      }
    1.47  
    1.48 -    xlide_gendisk[0] = setup_major(xdi, 0, XLIDE_MAJOR_0);
    1.49 -    xlide_gendisk[1] = setup_major(xdi, 2, XLIDE_MAJOR_1);
    1.50 +    setup_major(&xlide_gendisk[0], xdi, 0*XLIDE_DEVS_PER_MAJOR, XLIDE_MAJOR_0);
    1.51 +    setup_major(&xlide_gendisk[1], xdi, 1*XLIDE_DEVS_PER_MAJOR, XLIDE_MAJOR_1);
    1.52  
    1.53      return 0;
    1.54  }