Messages in this thread | | | Subject | Re: [PATCH] s390: Hypervisor File System | From | Michael Holzheu <> | Date | Fri, 28 Apr 2006 13:53:50 +0200 |
| |
Hi Jörn,
Jörn Engel <joern@wohnheim.fh-wedel.de> 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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |