From: Peter Maydell <peter.maydell@linaro.org>
To: Kamil Rytarowski <n54@gmx.com>
Cc: "Gerd Hoffmann" <kraxel@redhat.com>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: Re: [Qemu-devel] [PATCH v2] usb-mtp: Add fallback definition of NAME_MAX
Date: Mon, 4 Sep 2017 18:50:21 +0100 [thread overview]
Message-ID: <CAFEAcA8ojJteWAuwxhQPVTVvFh5b-S4zWoyCssM0ZxWt5tt4GQ@mail.gmail.com> (raw)
In-Reply-To: <20170904172500.26513-1-n54@gmx.com>
On 4 September 2017 at 18:25, Kamil Rytarowski <n54@gmx.com> wrote:
> This fixes build on SmartOS (Joyent).
>
> Patch cherry-picked from pkgsrc by jperkin (Joyent).
>
> Signed-off-by: Kamil Rytarowski <n54@gmx.com>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> 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
next prev parent reply other threads:[~2017-09-04 17:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-03 16:34 [Qemu-devel] [PATCH] usb-mtp: Add fallback definition of NAME_MAX Kamil Rytarowski
2017-09-04 0:35 ` Philippe Mathieu-Daudé
2017-09-04 17:25 ` [Qemu-devel] [PATCH v2] " Kamil Rytarowski
2017-09-04 17:50 ` Peter Maydell [this message]
2017-09-04 23:22 ` Kamil Rytarowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFEAcA8ojJteWAuwxhQPVTVvFh5b-S4zWoyCssM0ZxWt5tt4GQ@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=f4bug@amsat.org \
--cc=kraxel@redhat.com \
--cc=n54@gmx.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).