Re: [PATCH 3/7] xen-blkfront: handle Xen major numbers other thanXENVBD

From: Stefano Stabellini
Date: Fri Feb 25 2011 - 10:38:05 EST


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".
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/