aboutsummaryrefslogtreecommitdiff
path: root/hw/usb
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-04-02 14:52:17 +0100
committerPeter Maydell <peter.maydell@linaro.org>2019-04-02 14:52:17 +0100
commit436960c95946007aca713330e7a488a6f2e0696f (patch)
tree2ee2842fa097887052aa09c4f409af7a6367e193 /hw/usb
parent9a363f0bcc65f5805396241d16973d0c62615162 (diff)
parentb4682a63f86ed81abcaa543ea6135e17f9e99d01 (diff)
downloadqemu-436960c95946007aca713330e7a488a6f2e0696f.zip
qemu-436960c95946007aca713330e7a488a6f2e0696f.tar.gz
qemu-436960c95946007aca713330e7a488a6f2e0696f.tar.bz2
Merge remote-tracking branch 'remotes/berrange/tags/filemon-next-pull-request' into staging
filemon: various fixes / improvements to file monitor for USB MTP Ensure watch IDs unique within a monitor and avoid integer wraparound issues when many watches are set & unset over time. # gpg: Signature made Tue 02 Apr 2019 13:53:40 BST # gpg: using RSA key BE86EBB415104FDF # gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" [full] # gpg: aka "Daniel P. Berrange <berrange@redhat.com>" [full] # Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E 8E3F BE86 EBB4 1510 4FDF * remotes/berrange/tags/filemon-next-pull-request: filemon: fix watch IDs to avoid potential wraparound issues filemon: ensure watch IDs are unique to QFileMonitor scope tests: refactor file monitor test to make it more understandable Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/usb')
-rw-r--r--hw/usb/dev-mtp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index 4dc1317..ebf210f 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -170,7 +170,7 @@ struct MTPObject {
char *path;
struct stat stat;
/* file monitor watch id */
- int watchid;
+ int64_t watchid;
MTPObject *parent;
uint32_t nchildren;
QLIST_HEAD(, MTPObject) children;
@@ -498,7 +498,7 @@ static MTPObject *usb_mtp_object_lookup_name(MTPObject *parent,
return NULL;
}
-static MTPObject *usb_mtp_object_lookup_id(MTPState *s, int id)
+static MTPObject *usb_mtp_object_lookup_id(MTPState *s, int64_t id)
{
MTPObject *iter;
@@ -511,7 +511,7 @@ static MTPObject *usb_mtp_object_lookup_id(MTPState *s, int id)
return NULL;
}
-static void file_monitor_event(int id,
+static void file_monitor_event(int64_t id,
QFileMonitorEvent ev,
const char *name,
void *opaque)
@@ -625,8 +625,8 @@ static void usb_mtp_object_readdir(MTPState *s, MTPObject *o)
}
if (s->file_monitor) {
- int id = qemu_file_monitor_add_watch(s->file_monitor, o->path, NULL,
- file_monitor_event, s, &err);
+ int64_t id = qemu_file_monitor_add_watch(s->file_monitor, o->path, NULL,
+ file_monitor_event, s, &err);
if (id == -1) {
error_report("usb-mtp: failed to add watch for %s: %s", o->path,
error_get_pretty(err));