From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Matthew Fortune <matthew.fortune@imgtec.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 5/6] hw/usb/dev-mtp: Guard inotify usage with CONFIG_INOTIFY1
Date: Mon, 21 Mar 2016 12:10:23 +0100 [thread overview]
Message-ID: <1458558624-6890-6-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1458558624-6890-1-git-send-email-kraxel@redhat.com>
From: Matthew Fortune <Matthew.Fortune@imgtec.com>
inotify_init1 usage was guarded by a check for linux but does not
exist on older distributions like CentOS 5 resulting in build
failures.
Signed-off-by: Matthew Fortune <matthew.fortune@imgtec.com>
Message-id: 6D39441BF12EF246A7ABCE6654B023536BB85D4A@hhmail02.hh.imgtec.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/dev-mtp.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index 01c5e51..ee2071f 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -14,7 +14,7 @@
#include <dirent.h>
#include <sys/statvfs.h>
-#ifdef __linux__
+#ifdef CONFIG_INOTIFY1
#include <sys/inotify.h>
#include "qemu/main-loop.h"
#endif
@@ -92,7 +92,7 @@ enum {
EP_EVENT,
};
-#ifdef __linux__
+#ifdef CONFIG_INOTIFY1
typedef struct MTPMonEntry MTPMonEntry;
struct MTPMonEntry {
@@ -127,7 +127,7 @@ struct MTPObject {
char *name;
char *path;
struct stat stat;
-#ifdef __linux__
+#ifdef CONFIG_INOTIFY1
/* inotify watch cookie */
int watchfd;
#endif
@@ -152,7 +152,7 @@ struct MTPState {
uint32_t next_handle;
QTAILQ_HEAD(, MTPObject) objects;
-#ifdef __linux__
+#ifdef CONFIG_INOTIFY1
/* inotify descriptor */
int inotifyfd;
QTAILQ_HEAD(events, MTPMonEntry) events;
@@ -400,7 +400,7 @@ static MTPObject *usb_mtp_add_child(MTPState *s, MTPObject *o,
return child;
}
-#ifdef __linux__
+#ifdef CONFIG_INOTIFY1
static MTPObject *usb_mtp_object_lookup_name(MTPObject *parent,
char *name, int len)
{
@@ -592,7 +592,7 @@ static void usb_mtp_object_readdir(MTPState *s, MTPObject *o)
if (!dir) {
return;
}
-#ifdef __linux__
+#ifdef CONFIG_INOTIFY1
int watchfd = usb_mtp_add_watch(s->inotifyfd, o->path);
if (watchfd == -1) {
fprintf(stderr, "usb-mtp: failed to add watch for %s\n", o->path);
@@ -996,7 +996,7 @@ static void usb_mtp_command(MTPState *s, MTPControl *c)
trace_usb_mtp_op_open_session(s->dev.addr);
s->session = c->argv[0];
usb_mtp_object_alloc(s, s->next_handle++, NULL, s->root);
-#ifdef __linux__
+#ifdef CONFIG_INOTIFY1
if (usb_mtp_inotify_init(s)) {
fprintf(stderr, "usb-mtp: file monitoring init failed\n");
}
@@ -1006,7 +1006,7 @@ static void usb_mtp_command(MTPState *s, MTPControl *c)
trace_usb_mtp_op_close_session(s->dev.addr);
s->session = 0;
s->next_handle = 0;
-#ifdef __linux__
+#ifdef CONFIG_INOTIFY1
usb_mtp_inotify_cleanup(s);
#endif
usb_mtp_object_free(s, QTAILQ_FIRST(&s->objects));
@@ -1134,7 +1134,7 @@ static void usb_mtp_handle_reset(USBDevice *dev)
trace_usb_mtp_reset(s->dev.addr);
-#ifdef __linux__
+#ifdef CONFIG_INOTIFY1
usb_mtp_inotify_cleanup(s);
#endif
usb_mtp_object_free(s, QTAILQ_FIRST(&s->objects));
@@ -1297,7 +1297,7 @@ static void usb_mtp_handle_data(USBDevice *dev, USBPacket *p)
}
break;
case EP_EVENT:
-#ifdef __linux__
+#ifdef CONFIG_INOTIFY1
if (!QTAILQ_EMPTY(&s->events)) {
struct MTPMonEntry *e = QTAILQ_LAST(&s->events, events);
uint32_t handle;
--
1.8.3.1
next prev parent reply other threads:[~2016-03-21 11:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-21 11:10 [Qemu-devel] [PULL 0/6] usb patch queue Gerd Hoffmann
2016-03-21 11:10 ` [Qemu-devel] [PULL 1/6] usb: Fix compilation for Windows Gerd Hoffmann
2016-03-21 11:10 ` [Qemu-devel] [PULL 2/6] usb: fix unbounded stack warning for xhci_dma_write_u32s Gerd Hoffmann
2016-03-21 11:10 ` [Qemu-devel] [PULL 3/6] usb: fix unbound stack usage for usb_mtp_add_str Gerd Hoffmann
2016-03-21 11:10 ` [Qemu-devel] [PULL 4/6] usb: fix unbound stack warning for inotify_watchfn Gerd Hoffmann
2016-03-21 11:10 ` Gerd Hoffmann [this message]
2016-03-21 11:10 ` [Qemu-devel] [PULL 6/6] usb: ehci: add capability mmio write function Gerd Hoffmann
2016-03-22 17:39 ` [Qemu-devel] [PULL 0/6] usb patch queue Peter Maydell
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=1458558624-6890-6-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=matthew.fortune@imgtec.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).