qemu/util
Daniel P. Berrangé c490af57cb util: introduce qemu_open and qemu_create with error reporting
qemu_open_old() works like open(): set errno and return -1 on failure.
It has even more failure modes, though.  Reporting the error clearly
to users is basically impossible for many of them.

Our standard cure for "errno is too coarse" is the Error object.
Introduce two new helper methods:

  int qemu_open(const char *name, int flags, Error **errp);
  int qemu_create(const char *name, int flags, mode_t mode, Error **errp);

Note that with this design we no longer require or even accept the
O_CREAT flag. Avoiding overloading the two distinct operations
means we can avoid variable arguments which would prevent 'errp' from
being the last argument. It also gives us a guarantee that the 'mode' is
given when creating files, avoiding a latent security bug.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-09-16 10:33:48 +01:00
..
aio-posix.c aio-posix: keep aio_notify_me disabled during polling 2020-08-13 13:34:14 +01:00
aio-posix.h
aio-wait.c
aio-win32.c
aiocb.c
async.c async: always set ctx->notified in aio_notify() 2020-08-13 13:32:59 +01:00
atomic64.c
base64.c
bitmap.c
bitops.c
buffer.c
bufferiszero.c
cacheinfo.c
compatfd.c util/compatfd.c: Only include <sys/syscall.h> if CONFIG_SIGNALFD 2020-07-13 14:36:10 +01:00
coroutine-sigaltstack.c coroutine: add check for SafeStack in sigaltstack 2020-06-23 15:46:05 +01:00
coroutine-ucontext.c Remove the CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE switch 2020-07-13 11:40:52 +02:00
coroutine-win32.c
crc32c.c
cutils.c
dbus.c
drm.c util/drm: make portable by avoiding struct dirent d_type 2020-07-13 14:36:10 +01:00
envlist.c
error.c
event_notifier-posix.c
event_notifier-win32.c
fdmon-epoll.c
fdmon-io_uring.c
fdmon-poll.c
fifo8.c
filemonitor-inotify.c
filemonitor-stub.c
getauxval.c util/getauxval: Porting to FreeBSD getauxval feature 2020-06-26 06:45:29 -04:00
guest-random.c
hbitmap.c
hexdump.c util/hexdump: Reorder qemu_hexdump() arguments 2020-09-11 21:25:59 +02:00
host-utils.c
id.c
iov.c util/hexdump: Reorder qemu_hexdump() arguments 2020-09-11 21:25:59 +02:00
iova-tree.c
keyval.c
lockcnt.c
log.c
main-loop.c stubs: Move qemu_fd_register stub to util/main-loop.c 2020-09-07 12:34:17 +02:00
memfd.c
meson.build util/meson.build: fix fdmon-io_uring build 2020-08-21 11:57:13 -04:00
mmap-alloc.c
module.c virtio-gpu: build modular 2020-09-15 14:11:49 +02:00
notify.c
nvdimm-utils.c
osdep.c util: introduce qemu_open and qemu_create with error reporting 2020-09-16 10:33:48 +01:00
oslib-posix.c util: rename qemu_open() to qemu_open_old() 2020-09-16 10:33:48 +01:00
oslib-win32.c util/oslib-win32: add qemu_get_host_physmem implementation 2020-07-27 09:40:16 +01:00
pagesize.c
path.c
qdist.c
qemu-co-shared-resource.c
qemu-config.c error: Eliminate error_propagate() with Coccinelle, part 1 2020-07-10 15:18:08 +02:00
qemu-coroutine-io.c
qemu-coroutine-lock.c
qemu-coroutine-sleep.c
qemu-coroutine.c
qemu-error.c util/qemu-error: prepend guest name to error message to identify affected VM owner 2020-07-10 18:02:15 -04:00
qemu-openpty.c util/qemu-openpty.c: Don't assume pty.h is glibc-only 2020-07-13 14:36:09 +01:00
qemu-option.c error: Eliminate error_propagate() with Coccinelle, part 1 2020-07-10 15:18:08 +02:00
qemu-print.c
qemu-progress.c
qemu-sockets.c
qemu-thread-common.h
qemu-thread-posix.c util: Added tsan annotate for thread name. 2020-06-16 14:49:05 +01:00
qemu-thread-win32.c
qemu-timer-common.c
qemu-timer.c util/qemu-timer: Fix typo in description 2020-09-01 11:08:57 +02:00
qht.c
qsp.c
range.c
rcu.c
readline.c
selfmap.c
stats64.c
sys_membarrier.c
systemd.c
thread-pool.c
throttle.c
timed-average.c
trace-events trace-events: Fix attribution of trace points to source 2020-09-09 17:17:58 +01:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
unicode.c
uri.c
uuid.c
vfio-helpers.c util/vfio-helpers: Fix typo in description 2020-09-01 11:08:57 +02:00