Re: [PATCH] s390: Hypervisor File System

From: Jörn Engel
Date: Fri Apr 28 2006 - 05:43:15 EST


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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/