]> git.proxmox.com Git - qemu.git/commitdiff
Merge remote-tracking branch 'kwolf/for-anthony' into staging
authorAnthony Liguori <aliguori@us.ibm.com>
Mon, 29 Oct 2012 15:34:05 +0000 (10:34 -0500)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 29 Oct 2012 15:34:05 +0000 (10:34 -0500)
* kwolf/for-anthony: (32 commits)
  osdep: Less restrictive F_SEFL in qemu_dup_flags()
  qemu-iotests: add testcases for mirroring on-source-error/on-target-error
  qmp: add pull_event function
  mirror: add support for on-source-error/on-target-error
  iostatus: forward block_job_iostatus_reset to block job
  qemu-iotests: add mirroring test case
  mirror: implement completion
  qmp: add drive-mirror command
  mirror: introduce mirror job
  block: introduce BLOCK_JOB_READY event
  block: add block-job-complete
  block: rename block_job_complete to block_job_completed
  block: export dirty bitmap information in query-block
  block: introduce new dirty bitmap functionality
  block: add bdrv_open_backing_file
  block: add bdrv_query_stats
  block: add bdrv_query_info
  qemu-config: Add new -add-fd command line option
  monitor: Prevent removing fd from set during init
  monitor: Enable adding an inherited fd to an fd set
  ...

Conflicts:
vl.c

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
1  2 
block.c
block.h
block_int.h
hmp.c
qapi-schema.json
qemu-config.c
qerror.h
qmp-commands.hx
vl.c

diff --cc block.c
Simple merge
diff --cc block.h
Simple merge
diff --cc block_int.h
Simple merge
diff --cc hmp.c
Simple merge
Simple merge
diff --cc qemu-config.c
Simple merge
diff --cc qerror.h
Simple merge
diff --cc qmp-commands.hx
Simple merge
diff --cc vl.c
index 6dd767cb309709df81b28dd4837ab237ad9c03a0,b870caf2c8fa4e45f9123fbd3c996be54bda9042..5a3d31698072c438fd63c0ac29310f117f9eda06
--- 1/vl.c
--- 2/vl.c
+++ b/vl.c
@@@ -789,17 -790,78 +789,89 @@@ static int parse_sandbox(QemuOpts *opts
      return 0;
  }
  
 +/*********QEMU USB setting******/
 +bool usb_enabled(bool default_usb)
 +{
 +    QemuOpts *mach_opts;
 +    mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
 +    if (mach_opts) {
 +        return qemu_opt_get_bool(mach_opts, "usb", default_usb);
 +    }
 +    return default_usb;
 +}
 +
+ #ifndef _WIN32
+ static int parse_add_fd(QemuOpts *opts, void *opaque)
+ {
+     int fd, dupfd, flags;
+     int64_t fdset_id;
+     const char *fd_opaque = NULL;
+     fd = qemu_opt_get_number(opts, "fd", -1);
+     fdset_id = qemu_opt_get_number(opts, "set", -1);
+     fd_opaque = qemu_opt_get(opts, "opaque");
+     if (fd < 0) {
+         qerror_report(ERROR_CLASS_GENERIC_ERROR,
+                       "fd option is required and must be non-negative");
+         return -1;
+     }
+     if (fd <= STDERR_FILENO) {
+         qerror_report(ERROR_CLASS_GENERIC_ERROR,
+                       "fd cannot be a standard I/O stream");
+         return -1;
+     }
+     /*
+      * All fds inherited across exec() necessarily have FD_CLOEXEC
+      * clear, while qemu sets FD_CLOEXEC on all other fds used internally.
+      */
+     flags = fcntl(fd, F_GETFD);
+     if (flags == -1 || (flags & FD_CLOEXEC)) {
+         qerror_report(ERROR_CLASS_GENERIC_ERROR,
+                       "fd is not valid or already in use");
+         return -1;
+     }
+     if (fdset_id < 0) {
+         qerror_report(ERROR_CLASS_GENERIC_ERROR,
+                       "set option is required and must be non-negative");
+         return -1;
+     }
+ #ifdef F_DUPFD_CLOEXEC
+     dupfd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
+ #else
+     dupfd = dup(fd);
+     if (dupfd != -1) {
+         qemu_set_cloexec(dupfd);
+     }
+ #endif
+     if (dupfd == -1) {
+         qerror_report(ERROR_CLASS_GENERIC_ERROR,
+                       "Error duplicating fd: %s", strerror(errno));
+         return -1;
+     }
+     /* add the duplicate fd, and optionally the opaque string, to the fd set */
+     monitor_fdset_add_fd(dupfd, true, fdset_id, fd_opaque ? true : false,
+                          fd_opaque, NULL);
+     return 0;
+ }
+ static int cleanup_add_fd(QemuOpts *opts, void *opaque)
+ {
+     int fd;
+     fd = qemu_opt_get_number(opts, "fd", -1);
+     close(fd);
+     return 0;
+ }
+ #endif
  /***********************************************************/
  /* QEMU Block devices */