[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] usb-mtp: Add fallback definition of NAME_MAX
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH v2] usb-mtp: Add fallback definition of NAME_MAX |
Date: |
Mon, 4 Sep 2017 18:50:21 +0100 |
On 4 September 2017 at 18:25, Kamil Rytarowski <address@hidden> wrote:
> This fixes build on SmartOS (Joyent).
>
> Patch cherry-picked from pkgsrc by jperkin (Joyent).
>
> Signed-off-by: Kamil Rytarowski <address@hidden>
> Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> include/qemu/osdep.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
> index 6855b94bbf..5d3860f80e 100644
> --- a/include/qemu/osdep.h
> +++ b/include/qemu/osdep.h
> @@ -306,6 +306,11 @@ void qemu_anon_ram_free(void *ptr, size_t size);
> #endif
> #endif
>
> +/* Required by SmartOS (SunOS) */
> +#ifndef NAME_MAX
> +#define NAME_MAX 255
> +#endif
So in hw/usb/dev-mtp.c we're using NAME_MAX in
char buf[sizeof(struct inotify_event) + NAME_MAX + 1];
because the Linux implementation of inotify documents in inotify(7)
that this is guaranteed to be sufficient to read at least one event:
http://man7.org/linux/man-pages/man7/inotify.7.html
Looking at the SmartOS manpage
https://smartos.org/man/5/inotify
there doesn't seem to be any equivalent language.
What is the SmartOS requirement on the buffer size to be
guaranteed to read at least one complete event ?
Defining NAME_MAX to 255 seems like it shuts up the compiler
error but does it give us the correct behaviour?
thanks
-- PMM