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.
Jörn
--
Courage is not the absence of fear, but rather the judgement that
something else is more important than fear.
-- Ambrose Redmoon
-
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]