tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: partitionSizeHi in raidframe component label



On Sun, Feb 13, 2011 at 03:34:01PM +0900, enami tsugutomo wrote:
> It looks like there is two place where partitionSizeHi is ignored in
> rf_netbsdkintf.c.  I guess we should define access macros for it (and
> also for numBlocks) to prevent further mistakes.

Please use functions, not macros.  It's easier to read and to modify
code like this than the macros:

static inline RF_SectorCount_t
rf_component_label_numblocks(const RF_ComponentLabel_t *cl)
{
        return (((RF_SectorCount_t)cl->numBlocksHi) << 32) |
            cl->numBlocks;
}

static inline void
rf_component_label_set_numblocks(RF_ComponentLabel_t *cl, RF_SectorCount_t siz)
{
        cl->numBlocksHi = siz >> 32;
        cl->numBlocks = siz;
}

static inline RF_SectorCount_t
rf_component_label_partitionsize(const RF_ComponentLabel_t *cl)
{
        return (((RF_SectorCount_t)cl->partitionSizeHi) << 32) |
            cl->partitionSize;
}

static inline void
rf_component_label_set_partitionsize(RF_ComponentLabel_t *cl,
    RF_SectorCount_t siz)
{
        cl->partitionSizeHi = siz >> 32;
        cl->partitionSize = siz;
}

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 344-0444 x24


Home | Main Index | Thread Index | Old Index