ia64/xen-unstable

changeset 896:352a82eb57ad

bitkeeper revision 1.564 (3fa9134cYyjxglAlh2gjmCiQ901Z8g)

misc vbd tweaks tidies and fixes
author smh22@labyrinth.cl.cam.ac.uk
date Wed Nov 05 15:12:12 2003 +0000 (2003-11-05)
parents e50a38309067
children 38ad3cea577f
files tools/internal/dom0_defs.h tools/internal/xi_phys_grant.c xen/drivers/block/xen_vbd.c xen/drivers/ide/ide-xeno.c xen/drivers/scsi/sd.c xen/include/hypervisor-ifs/block.h xen/include/hypervisor-ifs/vbd.h xen/include/xeno/vbd.h xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_block.c xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_vbd.c
line diff
     1.1 --- a/tools/internal/dom0_defs.h	Wed Nov 05 13:50:28 2003 +0000
     1.2 +++ b/tools/internal/dom0_defs.h	Wed Nov 05 15:12:12 2003 +0000
     1.3 @@ -58,11 +58,6 @@ static inline int do_privcmd(unsigned in
     1.4      return ret;
     1.5  }
     1.6  
     1.7 -static inline int do_xen_blkmsg(privcmd_blkmsg_t *blkmsg)
     1.8 -{
     1.9 -    return do_privcmd(IOCTL_PRIVCMD_BLKMSG, (unsigned long)blkmsg);
    1.10 -}
    1.11 -
    1.12  static inline int do_xen_hypercall(privcmd_hypercall_t *hypercall)
    1.13  {
    1.14      return do_privcmd(IOCTL_PRIVCMD_HYPERCALL, (unsigned long)hypercall);
     2.1 --- a/tools/internal/xi_phys_grant.c	Wed Nov 05 13:50:28 2003 +0000
     2.2 +++ b/tools/internal/xi_phys_grant.c	Wed Nov 05 15:12:12 2003 +0000
     2.3 @@ -26,12 +26,17 @@ int main(int argc, char *argv[])
     2.4      */
     2.5      domain  = atoi(argv[2]); 
     2.6      device  = atoi(argv[3]); 
     2.7 -	/* XXX SMH: hack -- generate device name by addition ptn number */
     2.8 +    /* XXX SMH: hack -- generate device name by addition ptn number */
     2.9      vdevice = device + atoi(argv[6]);
    2.10      
    2.11      op.cmd = BLOCK_IO_OP_VBD_CREATE; 
    2.12      op.u.create_info.domain  = domain; 
    2.13      op.u.create_info.vdevice = vdevice; 
    2.14 +    op.u.create_info.mode    = 0; 
    2.15 +    if ( strchr(argv[1], 'r') )
    2.16 +	op.u.create_info.mode |= VBD_MODE_R;
    2.17 +    if ( strchr(argv[1], 'w') )
    2.18 +        op.u.create_info.mode |= VBD_MODE_W;
    2.19  
    2.20      ret = do_block_io_op(&op);
    2.21  
    2.22 @@ -49,13 +54,7 @@ int main(int argc, char *argv[])
    2.23      op.u.add_info.extent.device       = device; 
    2.24      op.u.add_info.extent.start_sector = atol(argv[4]);
    2.25      op.u.add_info.extent.nr_sectors   = atol(argv[5]);
    2.26 -    op.u.add_info.extent.mode         = 0; 
    2.27 -    if ( strchr(argv[1], 'r') )
    2.28 -	op.u.add_info.extent.mode |= PHYSDISK_MODE_R;
    2.29 -    if ( strchr(argv[1], 'w') )
    2.30 -        op.u.add_info.extent.mode |= PHYSDISK_MODE_W;
    2.31  
    2.32 -    
    2.33      ret = do_block_io_op(&op);
    2.34  
    2.35      if(ret < 0) { 
     3.1 --- a/xen/drivers/block/xen_vbd.c	Wed Nov 05 13:50:28 2003 +0000
     3.2 +++ b/xen/drivers/block/xen_vbd.c	Wed Nov 05 15:12:12 2003 +0000
     3.3 @@ -45,6 +45,7 @@ long vbd_create(vbd_create_t *create_inf
     3.4  
     3.5      new_vbd = kmalloc(sizeof(vbd_t), GFP_KERNEL); 
     3.6      new_vbd->vdevice = create_info->vdevice; 
     3.7 +    new_vbd->mode    = create_info->mode; 
     3.8      new_vbd->extents = (xen_extent_le_t *)NULL; 
     3.9      new_vbd->next    = (vbd_t *)NULL; 
    3.10  
    3.11 @@ -94,7 +95,6 @@ long vbd_add(vbd_add_t *add_info)
    3.12      xele->extent.device       = add_info->extent.device; 
    3.13      xele->extent.start_sector = add_info->extent.start_sector; 
    3.14      xele->extent.nr_sectors   = add_info->extent.nr_sectors; 
    3.15 -    xele->extent.mode         = add_info->extent.mode; 
    3.16      xele->next                = (xen_extent_le_t *)NULL; 
    3.17  
    3.18      if(!v->extents) {
    3.19 @@ -141,6 +141,13 @@ int vbd_translate(phys_seg_t * pseg, int
    3.20  	return -ENODEV; 
    3.21      }
    3.22  
    3.23 +    if(operation == READ && !VBD_CAN_READ(v)) 
    3.24 +	return -EACCES; 
    3.25 +    
    3.26 +    if(operation == WRITE && !VBD_CAN_WRITE(v))
    3.27 +	return -EACCES; 
    3.28 +    
    3.29 +
    3.30      /* Now iterate through the list of xen_extents, working out which 
    3.31         should be used to perform the translation. */
    3.32      sec = pseg->sector_number; 
    3.33 @@ -151,12 +158,6 @@ int vbd_translate(phys_seg_t * pseg, int
    3.34  	    /* we've got a match! XXX SMH: should deal with 
    3.35  	       situation where we span multiple xe's */
    3.36  
    3.37 -	    if(operation == READ && !(x->extent.mode & PHYSDISK_MODE_R))
    3.38 -		return -EACCES; 
    3.39 -
    3.40 -	    if(operation == WRITE && !(x->extent.mode & PHYSDISK_MODE_W))
    3.41 -		return -EACCES; 
    3.42 -
    3.43  	    pseg->dev = x->extent.device; 
    3.44  	    pseg->sector_number += x->extent.start_sector; 
    3.45  
    3.46 @@ -189,7 +190,10 @@ void vbd_probe_devices(xen_disk_info_t *
    3.47      for(i = 0; i < VBD_HTAB_SZ; i++) { 
    3.48  	for(v = p->vbdtab[i]; v; v = v->next) { 
    3.49  	    xdi->disks[xdi->count].device   = v->vdevice; 
    3.50 -	    xdi->disks[xdi->count].type     = XD_TYPE_DISK; // always :-) 
    3.51 +	    xdi->disks[xdi->count].info     = XD_FLAG_VIRT | XD_TYPE_DISK; 
    3.52 +
    3.53 +	    /* XXX SMH: and now set XD_FLAG_RO if necessary */
    3.54 +
    3.55  	    xdi->disks[xdi->count].capacity = 0; 
    3.56  	    for(x = v->extents; x; x = x->next) 
    3.57  		xdi->disks[xdi->count].capacity += x->extent.nr_sectors; 
     4.1 --- a/xen/drivers/ide/ide-xeno.c	Wed Nov 05 13:50:28 2003 +0000
     4.2 +++ b/xen/drivers/ide/ide-xeno.c	Wed Nov 05 15:12:12 2003 +0000
     4.3 @@ -55,7 +55,7 @@ void ide_probe_devices(xen_disk_info_t* 
     4.4              capacity = current_capacity(drive);
     4.5  
     4.6              xdi->disks[xdi->count].device   = device; 
     4.7 -            xdi->disks[xdi->count].type     = type; 
     4.8 +            xdi->disks[xdi->count].info     = type; 
     4.9              xdi->disks[xdi->count].capacity = capacity;
    4.10              xdi->count++;
    4.11  
     5.1 --- a/xen/drivers/scsi/sd.c	Wed Nov 05 13:50:28 2003 +0000
     5.2 +++ b/xen/drivers/scsi/sd.c	Wed Nov 05 15:12:12 2003 +0000
     5.3 @@ -1353,7 +1353,7 @@ void scsi_probe_devices(xen_disk_info_t 
     5.4  
     5.5  	/* XXX SMH: if make generic, need to properly determine 'type' */
     5.6          xdi->disks[xdi->count].device   = device;
     5.7 -	xdi->disks[xdi->count].type     = XD_TYPE_DISK; 
     5.8 +	xdi->disks[xdi->count].info     = XD_TYPE_DISK; 
     5.9          xdi->disks[xdi->count].capacity = capacity; 
    5.10          xdi->count++; 
    5.11                  
     6.1 --- a/xen/include/hypervisor-ifs/block.h	Wed Nov 05 13:50:28 2003 +0000
     6.2 +++ b/xen/include/hypervisor-ifs/block.h	Wed Nov 05 15:12:12 2003 +0000
     6.3 @@ -22,12 +22,6 @@
     6.4  #define XEN_BLOCK_SPECIAL      4
     6.5  #define XEN_BLOCK_PROBE        5   /* get config from hypervisor */
     6.6  #define XEN_BLOCK_DEBUG        6   /* debug */
     6.7 -#define XEN_BLOCK_VBD_CREATE   7   /* create vbd */
     6.8 -#define XEN_BLOCK_VBD_DELETE   8   /* delete vbd */
     6.9 -                                   /* XXX SMH: was 'probe vbd' */
    6.10 -#define XEN_BLOCK_PHYSDEV_GRANT 10 /* grant access to range of disk blocks */
    6.11 -#define XEN_BLOCK_PHYSDEV_PROBE 11 /* probe for a domain's physdev accesses */
    6.12 -                                   /* XXX SMH: was 'probe vbd all' */
    6.13  
    6.14  /* NB. Ring size must be small enough for sizeof(blk_ring_t) <= PAGE_SIZE. */
    6.15  #define BLK_RING_SIZE        64
    6.16 @@ -68,12 +62,10 @@ typedef struct blk_ring_st
    6.17  } blk_ring_t;
    6.18  
    6.19  /*
    6.20 - *
    6.21 - * physical disk (xhd) info, used by XEN_BLOCK_PROBE
    6.22 - *
    6.23 - */
    6.24 -
    6.25 -#define XEN_MAX_DISK_COUNT 100
    6.26 + * Information about the real and virtual disks we have; used during 
    6.27 + * guest device probing. 
    6.28 + */ 
    6.29 +#define XEN_MAX_DISK_COUNT 64
    6.30  
    6.31  /* XXX SMH: below types chosen to align with ide_xxx types in ide.h */
    6.32  #define XD_TYPE_FLOPPY  0x00
    6.33 @@ -82,10 +74,19 @@ typedef struct blk_ring_st
    6.34  #define XD_TYPE_OPTICAL 0x07
    6.35  #define XD_TYPE_DISK    0x20 
    6.36  
    6.37 +#define XD_TYPE_MASK    0x3F
    6.38 +#define XD_TYPE(_x)     ((_x) & XD_TYPE_MASK) 
    6.39 +
    6.40 +/* The top two bits of the type field encode various flags */
    6.41 +#define XD_FLAG_RO      0x40
    6.42 +#define XD_FLAG_VIRT    0x80
    6.43 +#define XD_READONLY(_x) ((_x) & XD_FLAG_RO)
    6.44 +#define XD_VIRTUAL(_x)  ((_x) & XF_FLAG_VIRT) 
    6.45 +
    6.46  typedef struct xen_disk
    6.47  {
    6.48 -    unsigned short device;       /* device number (see top of file)    */
    6.49 -    unsigned short type;         /* device type, i.e. disk, cdrom, etc */
    6.50 +    unsigned short device;       /* device number (opaque 16 bit val)  */
    6.51 +    unsigned short info;         /* device type and flags              */
    6.52      unsigned long  capacity;     /* size in terms of #512 byte sectors */
    6.53  } xen_disk_t;
    6.54  
     7.1 --- a/xen/include/hypervisor-ifs/vbd.h	Wed Nov 05 13:50:28 2003 +0000
     7.2 +++ b/xen/include/hypervisor-ifs/vbd.h	Wed Nov 05 15:12:12 2003 +0000
     7.3 @@ -2,43 +2,13 @@
     7.4  #define __HYP_IFS_VBD_H__
     7.5  
     7.6  
     7.7 -#define PHYSDISK_MODE_R 1
     7.8 -#define PHYSDISK_MODE_W 2
     7.9 -
    7.10 -#if 0
    7.11 -typedef struct xp_disk
    7.12 -{
    7.13 -  int mode; /* 0 -> revoke existing access, otherwise bitmask of
    7.14 -	       PHYSDISK_MODE_? constants */
    7.15 -  int domain;
    7.16 -  unsigned short device; /* XENDEV_??? + idx */
    7.17 -  unsigned short partition; /* partition number */
    7.18 -  unsigned long start_sect;
    7.19 -  unsigned long n_sectors;
    7.20 -} xp_disk_t;
    7.21 -
    7.22 -#define PHYSDISK_MAX_ACES_PER_REQUEST 254 /* Make it fit in one page */
    7.23 -typedef struct {
    7.24 -  int n_aces;
    7.25 -  int domain;
    7.26 -  int start_ind;
    7.27 -  struct {
    7.28 -    unsigned short device; /* XENDEV_??? + idx */
    7.29 -    unsigned short partition; /* partition number */
    7.30 -    unsigned long start_sect;
    7.31 -    unsigned long n_sectors;
    7.32 -    unsigned mode;
    7.33 -  } entries[PHYSDISK_MAX_ACES_PER_REQUEST];
    7.34 -} physdisk_probebuf_t;
    7.35 -#endif
    7.36 -
    7.37 -
    7.38 -/* Block I/O trap operations and associated structures.
    7.39 +/* 
    7.40 + * Block I/O trap operations and associated structures.
    7.41   */
    7.42  
    7.43  #define BLOCK_IO_OP_SIGNAL       0    /* let xen know we have work to do */ 
    7.44  #define BLOCK_IO_OP_RESET        1    /* reset ring indexes on quiescent i/f */
    7.45 -#define BLOCK_IO_OP_RING_ADDRESS 2 /* returns machine address of I/O ring */
    7.46 +#define BLOCK_IO_OP_RING_ADDRESS 2    /* returns machine address of I/O ring */
    7.47  #define BLOCK_IO_OP_VBD_CREATE   3    /* create a new VBD for a given domain */
    7.48  #define BLOCK_IO_OP_VBD_ADD      4    /* add an extent to a given VBD */
    7.49  #define BLOCK_IO_OP_VBD_REMOVE   5    /* remove an extent from a given VBD */
    7.50 @@ -47,18 +17,26 @@ typedef struct {
    7.51  
    7.52  typedef struct _xen_extent { 
    7.53      u16       device; 
    7.54 +    u16       unused;                 // pad 
    7.55      ulong     start_sector; 
    7.56      ulong     nr_sectors;
    7.57 -    u16       mode; 
    7.58  } xen_extent_t; 
    7.59  
    7.60 +
    7.61 +
    7.62 +#define VBD_MODE_R         0x1
    7.63 +#define VBD_MODE_W         0x2
    7.64 +
    7.65 +#define VBD_CAN_READ(_v)  ((_v)->mode & VBD_MODE_R)
    7.66 +#define VBD_CAN_WRITE(_v) ((_v)->mode & VBD_MODE_R)
    7.67 +
    7.68    
    7.69  typedef struct _vbd_create { 
    7.70      unsigned  domain; 
    7.71      u16       vdevice; 
    7.72 +    u16       mode; 
    7.73  } vbd_create_t; 
    7.74  
    7.75 -
    7.76  typedef struct _vbd_add { 
    7.77      unsigned     domain; 
    7.78      u16          vdevice; 
     8.1 --- a/xen/include/xeno/vbd.h	Wed Nov 05 13:50:28 2003 +0000
     8.2 +++ b/xen/include/xeno/vbd.h	Wed Nov 05 15:12:12 2003 +0000
     8.3 @@ -23,20 +23,20 @@ typedef struct _xen_extent_le {
     8.4  */
     8.5  typedef struct _vbd { 
     8.6      unsigned short    vdevice;   // what the domain refers to this vbd as 
     8.7 +    unsigned short    mode;      // VBD_MODE_{READONLY,READWRITE}
     8.8      xen_extent_le_t  *extents;   // list of xen_extents making up this vbd
     8.9      struct _vbd      *next;      // for chaining in the hash table
    8.10  } vbd_t; 
    8.11  
    8.12  #define VBD_HTAB_SZ  16       // no. of entries in the vbd hash table. 
    8.13  
    8.14 -void xen_vbd_initialize(void);
    8.15 -void xen_refresh_vbd_list (struct task_struct *p);
    8.16  long vbd_create(vbd_create_t *create_info); 
    8.17  long vbd_add(vbd_add_t *add_info); 
    8.18  long vbd_remove(vbd_remove_t *remove_info);
    8.19  long vbd_delete(vbd_delete_t *delete_info); 
    8.20  
    8.21 -/* Describes a physical disk extent (part of a block io request) */
    8.22 +
    8.23 +/* Describes a [partial] disk extent (part of a block io request) */
    8.24  typedef struct {
    8.25      unsigned short dev;
    8.26      unsigned short nr_sects;
    8.27 @@ -49,15 +49,4 @@ int vbd_translate(phys_seg_t * pseg, int
    8.28  		  struct task_struct *p, int operation); 
    8.29  
    8.30  
    8.31 -#if 0
    8.32 -void destroy_physdisk_aces(struct task_struct *p);
    8.33 -
    8.34 -int xen_physdisk_grant(xp_disk_t *);
    8.35 -int xen_physdisk_probe(struct task_struct *requesting_task,
    8.36 -		       physdisk_probebuf_t *);
    8.37 -int xen_physdisk_access_okay(phys_seg_t *pseg, struct task_struct *p,
    8.38 -			     int operation);
    8.39 -#endif
    8.40 -
    8.41 -
    8.42 -#endif /* PHYSDISK_ACES__ */
    8.43 +#endif /* __VBD_H__ */
     9.1 --- a/xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_block.c	Wed Nov 05 13:50:28 2003 +0000
     9.2 +++ b/xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_block.c	Wed Nov 05 15:12:12 2003 +0000
     9.3 @@ -160,6 +160,7 @@ int xenolinux_block_ioctl(struct inode *
     9.4      return 0;
     9.5  }
     9.6  
     9.7 +/* check media change: should probably do something here in some cases :-) */
     9.8  int xenolinux_block_check(kdev_t dev)
     9.9  {
    9.10      DPRINTK("xenolinux_block_check\n");
    9.11 @@ -246,8 +247,6 @@ static int hypervisor_request(unsigned l
    9.12  
    9.13      switch ( operation )
    9.14      {
    9.15 -//    case XEN_BLOCK_PHYSDEV_GRANT:
    9.16 -//    case XEN_BLOCK_PHYSDEV_PROBE:
    9.17      case XEN_BLOCK_PROBE:
    9.18          if ( RING_PLUGGED ) return 1;
    9.19  	sector_number = 0;
    9.20 @@ -431,12 +430,6 @@ static void xlblk_response_int(int irq, 
    9.21              }
    9.22  	    break;
    9.23  	    
    9.24 -        case XEN_BLOCK_VBD_CREATE:
    9.25 -        case XEN_BLOCK_VBD_DELETE:
    9.26 -	case XEN_BLOCK_PHYSDEV_GRANT:
    9.27 -	case XEN_BLOCK_PHYSDEV_PROBE:
    9.28 -	    printk(KERN_ALERT "response for bogus operation %d\n", 
    9.29 -		   bret->operation); 
    9.30          case XEN_BLOCK_PROBE:
    9.31              xlblk_control_msg_pending = bret->status;
    9.32              break;
    10.1 --- a/xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_vbd.c	Wed Nov 05 13:50:28 2003 +0000
    10.2 +++ b/xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_vbd.c	Wed Nov 05 15:12:12 2003 +0000
    10.3 @@ -77,7 +77,7 @@ typedef unsigned char bool;
    10.4  int __init xlvbd_init(xen_disk_info_t *xdi)
    10.5  {
    10.6      int i, result, nminors; 
    10.7 -    struct gendisk *gd;
    10.8 +    struct gendisk *gd = NULL;
    10.9      kdev_t device; 
   10.10      unsigned short major, minor, real_minor; 
   10.11      bool is_ide, is_scsi; 
   10.12 @@ -237,6 +237,9 @@ int __init xlvbd_init(xen_disk_info_t *x
   10.13  	    majors[major] = 1; 
   10.14  	}
   10.15  
   10.16 +	if(XD_READONLY(xdi->disks[i].info)) 
   10.17 +	    set_device_ro(device, 1); 
   10.18 +
   10.19  	if(real_minor) { 
   10.20  
   10.21  	    /* Need to skankily setup 'partition' information */
   10.22 @@ -247,29 +250,28 @@ int __init xlvbd_init(xen_disk_info_t *x
   10.23  	} else { 
   10.24  	
   10.25  	    /* Some final fix-ups depending on the device type */
   10.26 -	    switch (xdi->disks[i].type) 
   10.27 +	    switch (XD_TYPE(xdi->disks[i].info)) 
   10.28  	    { 
   10.29 +
   10.30  	    case XD_TYPE_CDROM:
   10.31 -		set_device_ro(device, 1); 
   10.32 -		
   10.33  	    case XD_TYPE_FLOPPY: 
   10.34  	    case XD_TYPE_TAPE:
   10.35  		gd->flags[0] = GENHD_FL_REMOVABLE; 
   10.36  		printk(KERN_ALERT 
   10.37  		       "Skipping partition check on %s /dev/%s\n", 
   10.38 -		       xdi->disks[i].type==XD_TYPE_CDROM ? "cdrom" : 
   10.39 -		       (xdi->disks[i].type==XD_TYPE_TAPE ? "tape" : 
   10.40 +		       XD_TYPE(xdi->disks[i].info)==XD_TYPE_CDROM ? "cdrom" : 
   10.41 +		       (XD_TYPE(xdi->disks[i].info)==XD_TYPE_TAPE ? "tape" : 
   10.42  			"floppy"), disk_name(gd, MINOR(device), buf)); 
   10.43  		break; 
   10.44 -	    
   10.45 +		
   10.46  	    case XD_TYPE_DISK: 
   10.47  		register_disk(gd, device, gd->nr_real, &xlvbd_block_fops, 
   10.48  			      xdi->disks[i].capacity);
   10.49  		break; 
   10.50  		
   10.51  	    default: 
   10.52 -		printk(KERN_ALERT "XenoLinux: unknown ide device type %d\n", 
   10.53 -		       xdi->disks[i].type); 
   10.54 +		printk(KERN_ALERT "XenoLinux: unknown device type %d\n", 
   10.55 +		       XD_TYPE(xdi->disks[i].info)); 
   10.56  		break; 
   10.57  	    }
   10.58  
   10.59 @@ -304,41 +306,36 @@ struct gendisk *xldev_to_gendisk(kdev_t 
   10.60  
   10.61  void xlvbd_cleanup(void)
   10.62  {
   10.63 -#if 0
   10.64 -    if ( xlvbd_gendisk == NULL ) return;
   10.65 -    
   10.66 -    blk_cleanup_queue(BLK_DEFAULT_QUEUE(XLVIRT_MAJOR));
   10.67 +    bool is_ide, is_scsi; 
   10.68 +    struct gendisk *gd; 
   10.69 +    char *major_name; 
   10.70 +    int major; 
   10.71  
   10.72 -    xlvbd_gendisk = NULL;
   10.73 -
   10.74 -    read_ahead[XLVIRT_MAJOR] = 0;
   10.75 +    for(major = 0; major < XLVBD_MAX_MAJORS; major++) { 
   10.76  
   10.77 -    if ( blksize_size[XLVIRT_MAJOR] != NULL )
   10.78 -    { 
   10.79 -	kfree(blksize_size[XLVIRT_MAJOR]);
   10.80 -        blksize_size[XLVIRT_MAJOR] = NULL;
   10.81 +	if(!(gd = xlvbd_gendisk[major]))
   10.82 +	    continue; 
   10.83 +
   10.84 +	is_ide = IDE_DISK_MAJOR(major);  /* is this an ide device? */
   10.85 +	is_scsi= SCSI_BLK_MAJOR(major);  /* is this a scsi device? */
   10.86 +
   10.87 +	blk_cleanup_queue(BLK_DEFAULT_QUEUE(major)); 
   10.88 +	
   10.89 +	if(is_ide) { 
   10.90 +	    major_name = XLIDE_MAJOR_NAME; 
   10.91 +	} else if(is_scsi) { 
   10.92 +	    major_name = XLSCSI_MAJOR_NAME;
   10.93 +	} else { 
   10.94 +	    major_name = XLVBD_MAJOR_NAME;
   10.95 +	}
   10.96 +
   10.97 +	if (unregister_blkdev(major, major_name) != 0) 
   10.98 +	    printk(KERN_ALERT "XenoLinux Virtual Block Device Driver:"
   10.99 +		   "major device %04x uninstalled w/ errors\n", major); 
  10.100 +
  10.101      }
  10.102  
  10.103 -    if ( hardsect_size[XLVIRT_MAJOR] != NULL )
  10.104 -    { 
  10.105 -	kfree(hardsect_size[XLVIRT_MAJOR]);
  10.106 -        hardsect_size[XLVIRT_MAJOR] = NULL;
  10.107 -    }
  10.108 -    
  10.109 -    if ( max_sectors[XLVIRT_MAJOR] != NULL )
  10.110 -    { 
  10.111 -	kfree(max_sectors[XLVIRT_MAJOR]);
  10.112 -        max_sectors[XLVIRT_MAJOR] = NULL;
  10.113 -    }
  10.114 -    
  10.115 -    if ( unregister_blkdev(XLVIRT_MAJOR, XLVIRT_MAJOR_NAME) != 0 )
  10.116 -    {
  10.117 -	printk(KERN_ALERT
  10.118 -	       "XenoLinux Virtual Block Device Driver"
  10.119 -               " uninstalled w/ errs\n");
  10.120 -    }
  10.121 -#endif
  10.122 -    printk(KERN_ALERT "xlvbd_cleanup: not implemented XXX FIXME SMH\n"); 
  10.123 +    return; 
  10.124  }
  10.125  
  10.126