Re: [PATCH 3/9] x86/virt/tdx: Support global metadata read for all element sizes

From: Huang, Kai
Date: Tue Jun 18 2024 - 19:29:00 EST


On Tue, 2024-06-18 at 14:42 +0300, Nikolay Borisov wrote:
> <snip>
>
> >
> > -static int read_sys_metadata_field16(u64 field_id,
> > - int offset,
> > - void *stbuf)
> > +/*
> > + * Read one global metadata field and store the data to a location of a
> > + * given buffer specified by the offset and size (in bytes).
> > + */
> > +static int stbuf_read_sysmd_field(u64 field_id, void *stbuf, int offset,
>
> read_system_metadat_field or read_sys_metadata_field or simply
> read_metadata_field

read_sys_metadata_field() is already taken.

What's wrong of stbuf_read_sysmd_field()? It indicates the function reads
one system metadata field to a structure member.

>
> > + int bytes)
> s/bytes/size
> > {
> > - u16 *st_member = stbuf + offset;
> > + void *st_member = stbuf + offset;
>
> Again, this could be renamed to just 'member', what value does the 'st'
> prefix bring?

Will do.

[...]


> >
> > -#define MD_FIELD_ID_ELE_SIZE_16BIT 1
> > +#define MD_FIELD_BYTES(_field_id) \
>
> Just name it MD_FIELD_SIZE, even the MD_FIELD_ID member is called
> ELEMENT_SIZE_CODE, rather than ELEMENT_BYTES_CODE or some such.

Will do.

I will also change the 'bytes' argument to 'size' in
stbuf_read_sysmd_field() (or whatever name we finally have).