Hi Jörn,
Jörn Engel <[email protected]> wrote on 04/28/2006 11:43:20 AM:
> On Fri, 28 April 2006 11:22:25 +0200, Michael Holzheu wrote:
> > +
> > +static inline int info_blk_hdr__size(enum diag204_format type)
> > +{
> > + if (type == INFO_SIMPLE)
> > + return sizeof(struct info_blk_hdr);
> > + else /* INFO_EXT */
> > + return sizeof(struct x_info_blk_hdr);
> > +}
> > +
> > +static inline __u8 info_blk_hdr__npar(enum diag204_format type, void
*hdr)
> > +{
> > + if (type == INFO_SIMPLE)
> > + return ((struct info_blk_hdr *)hdr)->npar;
> > + else /* INFO_EXT */
> > + return ((struct x_info_blk_hdr *)hdr)->npar;
> > +}
> > +
> > +static inline __u8 info_blk_hdr__flags(enum diag204_format type, void
*hdr)
> > +{
> > + if (type == INFO_SIMPLE)
> > + return ((struct info_blk_hdr *)hdr)->flags;
> > + else /* INFO_EXT */
> > + return ((struct x_info_blk_hdr *)hdr)->flags;
> > +}
> > +
> > +static inline __u16 info_blk_hdr__pcpus(enum diag204_format type,void
*hdr)
> > +{
> > + if (type == INFO_SIMPLE)
> > + return ((struct info_blk_hdr *)hdr)->phys_cpus;
> > + else /* INFO_EXT */
> > + return ((struct x_info_blk_hdr *)hdr)->phys_cpus;
> > +}
>
> Hmm. Another possible approach would be to create a small struct with
> a couple of functions, have one function each for type==INFO_SIMPLE
> and type==INFO_EXT and fill the struct either with one set of
> functions or the other.
>
> Whether that would make more sense than your current approach, I
> cannot judge. Iirc, function calls are still fairly expensive on
> s390, so maybe not.
>
We discussed that! If we would have more than two data formats
we would have taken your approach. But for only two, I think
it is ok to do it my way!
Michael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]