[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 05/29] tools/xenlogd: add 9pfs response generation support



On Fri, Nov 10, 2023 at 1:41 PM Juergen Gross <jgross@xxxxxxxx> wrote:
> +static void fill_buffer(struct ring *ring, uint8_t cmd, uint16_t tag,
> +                        const char *fmt, ...)
> +{
> +    struct p9_header *hdr = ring->buffer;
> +    void *data = hdr + 1;
> +    const char *f;
> +    const void *par;
> +    const char *str_val;
> +    const struct p9_qid *qid;
> +    unsigned int len;
> +    va_list ap;
> +    unsigned int array_sz = 0;
> +    unsigned int elem_sz = 0;
> +
> +    hdr->cmd = cmd;
> +    hdr->tag = tag;
> +
> +    va_start(ap, fmt);
> +
> +    for ( f = fmt; *f; f++ )
> +    {
> +        if ( !array_sz )
> +            par = va_arg(ap, const void *);
> +        else
> +        {
> +            par += elem_sz;
> +            array_sz--;
> +        }
> +
> +        switch ( *f )
> +        {
> +        case 'a':
> +            f++;
> +            if ( !*f || array_sz )
> +                fmt_err(fmt);
> +            array_sz = *(const unsigned int *)par;
> +            if ( array_sz > 0xffff )
> +            {
> +                syslog(LOG_CRIT, "array size %u in fill_buffer()", array_sz);
> +                exit(1);
> +            }
> +            *(__packed uint16_t *)data = array_sz;

Compiling on Fedora 39, gcc 13.2.1:

io.c: In function ‘fill_buffer’:
io.c:233:13: error: ‘packed’ attribute ignored for type ‘uint16_t *’
{aka ‘short unsigned int *’} [-Werror=attributes]
  233 |             *(__packed uint16_t *)data = array_sz;
      |             ^

For all these uses of __packed.

Regards,
Jason



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.