Messages in this thread | | | Date | Fri, 25 Feb 2011 15:38:35 +0000 | From | Stefano Stabellini <> | Subject | Re: [PATCH 3/7] xen-blkfront: handle Xen major numbers other than XENVBD |
| |
On Tue, 22 Feb 2011, Konrad Rzeszutek Wilk wrote: > > @@ -120,6 +120,10 @@ static DEFINE_SPINLOCK(minor_lock); > > #define EXTENDED (1<<EXT_SHIFT) > > #define VDEV_IS_EXTENDED(dev) ((dev)&(EXTENDED)) > > #define BLKIF_MINOR_EXT(dev) ((dev)&(~EXTENDED)) > > +#define EMULATED_HD_DISK_MINOR_OFFSET (0) > > +#define EMULATED_HD_DISK_NAME_OFFSET (EMULATED_HD_DISK_MINOR_OFFSET / 256) > > 0 / 256 ? Why not just 0?
Because if we set EMULATED_HD_DISK_MINOR_OFFSET to something different from 0, then the divison by 256 would matter. If you look at the code below you'll see that:
offset = minor / nr_parts;
where nr_parts is 256 and offset is the the device name offset. EMULATED_HD_DISK_MINOR_OFFSET is the offset of the variable "minor" and EMULATED_HD_DISK_NAME_OFFSET is the offset of the variable "offset".
| |