mirror of https://github.com/xqemu/xqemu.git
fprintf to error_report conversion in hw/9pfs and fsdev
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEABECAAYFAlaiO1MACgkQAvw66wEB28IxAgCfTQuCnPaE1W1U2gPkluAaDvKo e8sAoIdPrfSTcP3AM4wdpBphObE1ewi4 =YI2Q -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/gkurz/tags/for-upstream' into staging fprintf to error_report conversion in hw/9pfs and fsdev # gpg: Signature made Fri 22 Jan 2016 14:23:15 GMT using DSA key ID 0101DBC2 # gpg: Good signature from "Greg Kurz <gkurz@fr.ibm.com>" # gpg: aka "Greg Kurz <groug@free.fr>" # gpg: aka "Greg Kurz <gkurz@linux.vnet.ibm.com>" # gpg: aka "Gregory Kurz (Groug) <groug@free.fr>" # gpg: aka "Gregory Kurz (Cimai Technology) <gkurz@cimai.com>" # gpg: aka "Gregory Kurz (Meiosys Technology) <gkurz@meiosys.com>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 2BD4 3B44 535E C0A7 9894 DBA2 02FC 3AEB 0101 DBC2 * remotes/gkurz/tags/for-upstream: fsdev: use error_report() instead of fprintf(stderr) 9pfs: use error_report() instead of fprintf(stderr) Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
3c2c85ec4b
|
@ -17,6 +17,7 @@
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "qemu/config-file.h"
|
#include "qemu/config-file.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
|
|
||||||
static QTAILQ_HEAD(FsDriverEntry_head, FsDriverListEntry) fsdriver_entries =
|
static QTAILQ_HEAD(FsDriverEntry_head, FsDriverListEntry) fsdriver_entries =
|
||||||
QTAILQ_HEAD_INITIALIZER(fsdriver_entries);
|
QTAILQ_HEAD_INITIALIZER(fsdriver_entries);
|
||||||
|
@ -40,7 +41,7 @@ int qemu_fsdev_add(QemuOpts *opts)
|
||||||
bool ro = qemu_opt_get_bool(opts, "readonly", 0);
|
bool ro = qemu_opt_get_bool(opts, "readonly", 0);
|
||||||
|
|
||||||
if (!fsdev_id) {
|
if (!fsdev_id) {
|
||||||
fprintf(stderr, "fsdev: No id specified\n");
|
error_report("fsdev: No id specified");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,11 +53,11 @@ int qemu_fsdev_add(QemuOpts *opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == ARRAY_SIZE(FsDrivers)) {
|
if (i == ARRAY_SIZE(FsDrivers)) {
|
||||||
fprintf(stderr, "fsdev: fsdriver %s not found\n", fsdriver);
|
error_report("fsdev: fsdriver %s not found", fsdriver);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "fsdev: No fsdriver specified\n");
|
error_report("fsdev: No fsdriver specified");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#include "qemu/xattr.h"
|
#include "qemu/xattr.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
#ifdef CONFIG_LINUX_MAGIC_H
|
#ifdef CONFIG_LINUX_MAGIC_H
|
||||||
|
@ -655,12 +656,12 @@ static int handle_parse_opts(QemuOpts *opts, struct FsDriverEntry *fse)
|
||||||
const char *path = qemu_opt_get(opts, "path");
|
const char *path = qemu_opt_get(opts, "path");
|
||||||
|
|
||||||
if (sec_model) {
|
if (sec_model) {
|
||||||
fprintf(stderr, "Invalid argument security_model specified with handle fsdriver\n");
|
error_report("Invalid argument security_model specified with handle fsdriver");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!path) {
|
if (!path) {
|
||||||
fprintf(stderr, "fsdev: No path specified.\n");
|
error_report("fsdev: No path specified");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
fse->path = g_strdup(path);
|
fse->path = g_strdup(path);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#include "qemu/xattr.h"
|
#include "qemu/xattr.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
#ifdef CONFIG_LINUX_MAGIC_H
|
#ifdef CONFIG_LINUX_MAGIC_H
|
||||||
|
@ -1209,9 +1210,9 @@ static int local_parse_opts(QemuOpts *opts, struct FsDriverEntry *fse)
|
||||||
const char *path = qemu_opt_get(opts, "path");
|
const char *path = qemu_opt_get(opts, "path");
|
||||||
|
|
||||||
if (!sec_model) {
|
if (!sec_model) {
|
||||||
fprintf(stderr, "security model not specified, "
|
error_report("Security model not specified, local fs needs security model");
|
||||||
"local fs needs security model\nvalid options are:"
|
error_printf("valid options are:"
|
||||||
"\tsecurity_model=[passthrough|mapped|none]\n");
|
"\tsecurity_model=[passthrough|mapped-xattr|mapped-file|none]\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1225,14 +1226,14 @@ static int local_parse_opts(QemuOpts *opts, struct FsDriverEntry *fse)
|
||||||
} else if (!strcmp(sec_model, "mapped-file")) {
|
} else if (!strcmp(sec_model, "mapped-file")) {
|
||||||
fse->export_flags |= V9FS_SM_MAPPED_FILE;
|
fse->export_flags |= V9FS_SM_MAPPED_FILE;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Invalid security model %s specified, valid options are"
|
error_report("Invalid security model %s specified", sec_model);
|
||||||
"\n\t [passthrough|mapped-xattr|mapped-file|none]\n",
|
error_printf("valid options are:"
|
||||||
sec_model);
|
"\t[passthrough|mapped-xattr|mapped-file|none]\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!path) {
|
if (!path) {
|
||||||
fprintf(stderr, "fsdev: No path specified.\n");
|
error_report("fsdev: No path specified");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
fse->path = g_strdup(path);
|
fse->path = g_strdup(path);
|
||||||
|
|
|
@ -1100,19 +1100,19 @@ static int connect_namedsocket(const char *path)
|
||||||
struct sockaddr_un helper;
|
struct sockaddr_un helper;
|
||||||
|
|
||||||
if (strlen(path) >= sizeof(helper.sun_path)) {
|
if (strlen(path) >= sizeof(helper.sun_path)) {
|
||||||
fprintf(stderr, "Socket name too large\n");
|
error_report("Socket name too long");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
|
sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||||
if (sockfd < 0) {
|
if (sockfd < 0) {
|
||||||
fprintf(stderr, "failed to create socket: %s\n", strerror(errno));
|
error_report("Failed to create socket: %s", strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
strcpy(helper.sun_path, path);
|
strcpy(helper.sun_path, path);
|
||||||
helper.sun_family = AF_UNIX;
|
helper.sun_family = AF_UNIX;
|
||||||
size = strlen(helper.sun_path) + sizeof(helper.sun_family);
|
size = strlen(helper.sun_path) + sizeof(helper.sun_family);
|
||||||
if (connect(sockfd, (struct sockaddr *)&helper, size) < 0) {
|
if (connect(sockfd, (struct sockaddr *)&helper, size) < 0) {
|
||||||
fprintf(stderr, "failed to connect to %s: %s\n", path, strerror(errno));
|
error_report("Failed to connect to %s: %s", path, strerror(errno));
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1128,11 +1128,11 @@ static int proxy_parse_opts(QemuOpts *opts, struct FsDriverEntry *fs)
|
||||||
const char *sock_fd = qemu_opt_get(opts, "sock_fd");
|
const char *sock_fd = qemu_opt_get(opts, "sock_fd");
|
||||||
|
|
||||||
if (!socket && !sock_fd) {
|
if (!socket && !sock_fd) {
|
||||||
fprintf(stderr, "socket and sock_fd none of the option specified\n");
|
error_report("Must specify either socket or sock_fd");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (socket && sock_fd) {
|
if (socket && sock_fd) {
|
||||||
fprintf(stderr, "Both socket and sock_fd options specified\n");
|
error_report("Both socket and sock_fd options specified");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (socket) {
|
if (socket) {
|
||||||
|
@ -1155,7 +1155,7 @@ static int proxy_init(FsContext *ctx)
|
||||||
} else {
|
} else {
|
||||||
sock_id = atoi(ctx->fs_root);
|
sock_id = atoi(ctx->fs_root);
|
||||||
if (sock_id < 0) {
|
if (sock_id < 0) {
|
||||||
fprintf(stderr, "socket descriptor not initialized\n");
|
error_report("Socket descriptor not initialized");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sock_id < 0) {
|
if (sock_id < 0) {
|
||||||
|
|
|
@ -3370,7 +3370,7 @@ static void __attribute__((__constructor__)) v9fs_set_fd_limit(void)
|
||||||
{
|
{
|
||||||
struct rlimit rlim;
|
struct rlimit rlim;
|
||||||
if (getrlimit(RLIMIT_NOFILE, &rlim) < 0) {
|
if (getrlimit(RLIMIT_NOFILE, &rlim) < 0) {
|
||||||
fprintf(stderr, "Failed to get the resource limit\n");
|
error_report("Failed to get the resource limit");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
open_fd_hw = rlim.rlim_cur - MIN(400, rlim.rlim_cur/3);
|
open_fd_hw = rlim.rlim_cur - MIN(400, rlim.rlim_cur/3);
|
||||||
|
|
Loading…
Reference in New Issue