mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
Pull request trivial branch 2019-05-03
-----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJczCVqAAoJEPMMOL0/L748fJgP/2egGeZwC/CwnMOf/8U27mp6 oINuhwZ+xM4Tb7ZaOJnyJIrXL5oJNXXc3EqhVS/m+bRM5WgvszWnAMVKr4aTqj5G exuqrIp9SRjvWd4giWHB8rgedIWuY6B5B6T6obvpwWJV3SNiNOGUeXbcF+oyH0L9 msp9PS4mzp/pEauBiulJOHSlqa9r/9AtP/liGp52vJ7wb6St+y1fLDlAbfPSYh6i XQUXy/ymR4JrEFXSH0mLXDDqpY6UW1z1PRaqoNKrr99pfvYn7M+zrVXkXBEFDLTA wMLiTGiOTR8P/bDhkiKCreWVsH6X93qMPS4kiAQnrT8FnDYMgKzG8rscG3a/DMZR 1cXrSh2mckupXQTXNaT0judoUYRXEDXu7fD7PlyXmNiAT1FkRLaBHUQ243DHzZ07 E3UD0ngsXSl5m6W3EDpGag5RlnFlyexPDDVkN3ZNPjmzStp0lOKplj24DXIz4xYf 9CpTAiVM16MH7PUWdIkhRGXk92n5giw+pZWynA2W5F7ykWIlV1lTTPLwt55g1aev ExdGTOH0qQ9s96AvQtBuomUzd45DfWLdL4Ixqf13uP4Diuy5XTZS8DnRZ/HGxKRN hTZXFxI3sVvRcLNId/hrjH6D8+Ou6W89RA8rfL762pc7zGsaD7+n9rqZQA1sDixh 9N0IHgrPbbLiWGbZ56vf =fRKG -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-pull-request' into staging Pull request trivial branch 2019-05-03 # gpg: Signature made Fri 03 May 2019 12:26:34 BST # gpg: using RSA key F30C38BD3F2FBE3C # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full] # gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full] # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full] # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/trivial-branch-pull-request: sockets: avoid string truncation warnings when copying UNIX path hw/sparc/leon3: Allow load of uImage firmwares Makefile: Let the 'clean' rule remove qemu-ga.exe on Windows hosts net: Print output of "-net nic, model=help" to stdout instead of stderr Header cleanups Update configure configure: fix pam test warning qom: use object_new_with_type in object_new_with_propv doc: fix the configuration path CODING_STYLE: indent example code as all others CODING_STYLE: specify the indent rule for multiline code hw/net/pcnet: Use qemu_log_mask(GUEST_ERROR) instead of printf Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
68a7b9724f
10 changed files with 74 additions and 25 deletions
43
CODING_STYLE
43
CODING_STYLE
|
@ -29,6 +29,45 @@ Spaces of course are superior to tabs because:
|
||||||
|
|
||||||
Do not leave whitespace dangling off the ends of lines.
|
Do not leave whitespace dangling off the ends of lines.
|
||||||
|
|
||||||
|
1.1 Multiline Indent
|
||||||
|
|
||||||
|
There are several places where indent is necessary:
|
||||||
|
|
||||||
|
- if/else
|
||||||
|
- while/for
|
||||||
|
- function definition & call
|
||||||
|
|
||||||
|
When breaking up a long line to fit within line width, we need a proper indent
|
||||||
|
for the following lines.
|
||||||
|
|
||||||
|
In case of if/else, while/for, align the secondary lines just after the
|
||||||
|
opening parenthesis of the first.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
if (a == 1 &&
|
||||||
|
b == 2) {
|
||||||
|
|
||||||
|
while (a == 1 &&
|
||||||
|
b == 2) {
|
||||||
|
|
||||||
|
In case of function, there are several variants:
|
||||||
|
|
||||||
|
* 4 spaces indent from the beginning
|
||||||
|
* align the secondary lines just after the opening parenthesis of the
|
||||||
|
first
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
do_something(x, y,
|
||||||
|
z);
|
||||||
|
|
||||||
|
do_something(x, y,
|
||||||
|
z);
|
||||||
|
|
||||||
|
do_something(x, do_another(y,
|
||||||
|
z));
|
||||||
|
|
||||||
2. Line width
|
2. Line width
|
||||||
|
|
||||||
Lines should be 80 characters; try not to make them longer.
|
Lines should be 80 characters; try not to make them longer.
|
||||||
|
@ -108,10 +147,10 @@ block to a separate function altogether.
|
||||||
When comparing a variable for (in)equality with a constant, list the
|
When comparing a variable for (in)equality with a constant, list the
|
||||||
constant on the right, as in:
|
constant on the right, as in:
|
||||||
|
|
||||||
if (a == 1) {
|
if (a == 1) {
|
||||||
/* Reads like: "If a equals 1" */
|
/* Reads like: "If a equals 1" */
|
||||||
do_something();
|
do_something();
|
||||||
}
|
}
|
||||||
|
|
||||||
Rationale: Yoda conditions (as in 'if (1 == a)') are awkward to read.
|
Rationale: Yoda conditions (as in 'if (1 == a)') are awkward to read.
|
||||||
Besides, good compilers already warn users when '==' is mis-typed as '=',
|
Besides, good compilers already warn users when '==' is mis-typed as '=',
|
||||||
|
|
11
Makefile
11
Makefile
|
@ -639,7 +639,7 @@ clean:
|
||||||
! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll \
|
! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll \
|
||||||
-exec rm {} +
|
-exec rm {} +
|
||||||
rm -f $(edk2-decompressed)
|
rm -f $(edk2-decompressed)
|
||||||
rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
|
rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga$(EXESUF) TAGS cscope.* *.pod *~ */*~
|
||||||
rm -f fsdev/*.pod scsi/*.pod
|
rm -f fsdev/*.pod scsi/*.pod
|
||||||
rm -f qemu-img-cmds.h
|
rm -f qemu-img-cmds.h
|
||||||
rm -f ui/shader/*-vert.h ui/shader/*-frag.h
|
rm -f ui/shader/*-vert.h ui/shader/*-frag.h
|
||||||
|
@ -899,11 +899,14 @@ ui/shader.o: $(SRC_PATH)/ui/shader.c \
|
||||||
MAKEINFO=makeinfo
|
MAKEINFO=makeinfo
|
||||||
MAKEINFOINCLUDES= -I docs -I $(<D) -I $(@D)
|
MAKEINFOINCLUDES= -I docs -I $(<D) -I $(@D)
|
||||||
MAKEINFOFLAGS=--no-split --number-sections $(MAKEINFOINCLUDES)
|
MAKEINFOFLAGS=--no-split --number-sections $(MAKEINFOINCLUDES)
|
||||||
TEXI2PODFLAGS=$(MAKEINFOINCLUDES) "-DVERSION=$(VERSION)"
|
TEXI2PODFLAGS=$(MAKEINFOINCLUDES) -DVERSION="$(VERSION)" -DCONFDIR="$(qemu_confdir)"
|
||||||
TEXI2PDFFLAGS=$(if $(V),,--quiet) -I $(SRC_PATH) $(MAKEINFOINCLUDES)
|
TEXI2PDFFLAGS=$(if $(V),,--quiet) -I $(SRC_PATH) $(MAKEINFOINCLUDES)
|
||||||
|
|
||||||
docs/version.texi: $(SRC_PATH)/VERSION
|
docs/version.texi: $(SRC_PATH)/VERSION config-host.mak
|
||||||
$(call quiet-command,echo "@set VERSION $(VERSION)" > $@,"GEN","$@")
|
$(call quiet-command,(\
|
||||||
|
echo "@set VERSION $(VERSION)" && \
|
||||||
|
echo "@set CONFDIR $(qemu_confdir)" \
|
||||||
|
)> $@,"GEN","$@")
|
||||||
|
|
||||||
%.html: %.texi docs/version.texi
|
%.html: %.texi docs/version.texi
|
||||||
$(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
|
$(call quiet-command,LC_ALL=C $(MAKEINFO) $(MAKEINFOFLAGS) --no-headers \
|
||||||
|
|
5
configure
vendored
5
configure
vendored
|
@ -2937,9 +2937,9 @@ if test "$auth_pam" != "no"; then
|
||||||
int main(void) {
|
int main(void) {
|
||||||
const char *service_name = "qemu";
|
const char *service_name = "qemu";
|
||||||
const char *user = "frank";
|
const char *user = "frank";
|
||||||
const struct pam_conv *pam_conv = NULL;
|
const struct pam_conv pam_conv = { 0 };
|
||||||
pam_handle_t *pamh = NULL;
|
pam_handle_t *pamh = NULL;
|
||||||
pam_start(service_name, user, pam_conv, &pamh);
|
pam_start(service_name, user, &pam_conv, &pamh);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
@ -7882,7 +7882,6 @@ LINKS="$LINKS python"
|
||||||
for bios_file in \
|
for bios_file in \
|
||||||
$source_path/pc-bios/*.bin \
|
$source_path/pc-bios/*.bin \
|
||||||
$source_path/pc-bios/*.lid \
|
$source_path/pc-bios/*.lid \
|
||||||
$source_path/pc-bios/*.aml \
|
|
||||||
$source_path/pc-bios/*.rom \
|
$source_path/pc-bios/*.rom \
|
||||||
$source_path/pc-bios/*.dtb \
|
$source_path/pc-bios/*.dtb \
|
||||||
$source_path/pc-bios/*.img \
|
$source_path/pc-bios/*.img \
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
|
#include "qemu/log.h"
|
||||||
#include "hw/qdev.h"
|
#include "hw/qdev.h"
|
||||||
#include "net/net.h"
|
#include "net/net.h"
|
||||||
#include "net/eth.h"
|
#include "net/eth.h"
|
||||||
|
@ -1501,7 +1502,8 @@ static void pcnet_bcr_writew(PCNetState *s, uint32_t rap, uint32_t val)
|
||||||
val |= 0x0300;
|
val |= 0x0300;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Bad SWSTYLE=0x%02x\n", val & 0xff);
|
qemu_log_mask(LOG_GUEST_ERROR, "pcnet: Bad SWSTYLE=0x%02x\n",
|
||||||
|
val & 0xff);
|
||||||
val = 0x0200;
|
val = 0x0200;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,6 +193,10 @@ static void leon3_generic_hw_init(MachineState *machine)
|
||||||
kernel_size = load_elf(kernel_filename, NULL, NULL, NULL,
|
kernel_size = load_elf(kernel_filename, NULL, NULL, NULL,
|
||||||
&entry, NULL, NULL,
|
&entry, NULL, NULL,
|
||||||
1 /* big endian */, EM_SPARC, 0, 0);
|
1 /* big endian */, EM_SPARC, 0, 0);
|
||||||
|
if (kernel_size < 0) {
|
||||||
|
kernel_size = load_uimage(kernel_filename, NULL, &entry,
|
||||||
|
NULL, NULL, NULL);
|
||||||
|
}
|
||||||
if (kernel_size < 0) {
|
if (kernel_size < 0) {
|
||||||
error_report("could not load kernel '%s'", kernel_filename);
|
error_report("could not load kernel '%s'", kernel_filename);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -7,9 +7,6 @@
|
||||||
#include "exec/hwaddr.h"
|
#include "exec/hwaddr.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "qemu/bswap.h"
|
|
||||||
#include "qemu/queue.h"
|
|
||||||
|
|
||||||
/* The CPU list lock nests outside page_(un)lock or mmap_(un)lock */
|
/* The CPU list lock nests outside page_(un)lock or mmap_(un)lock */
|
||||||
void qemu_init_cpu_list(void);
|
void qemu_init_cpu_list(void);
|
||||||
void cpu_list_lock(void);
|
void cpu_list_lock(void);
|
||||||
|
|
|
@ -837,9 +837,10 @@ int qemu_show_nic_models(const char *arg, const char *const *models)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "qemu: Supported NIC models: ");
|
printf("Supported NIC models:\n");
|
||||||
for (i = 0 ; models[i]; i++)
|
for (i = 0 ; models[i]; i++) {
|
||||||
fprintf(stderr, "%s%c", models[i], models[i+1] ? ',' : '\n');
|
printf("%s\n", models[i]);
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ set user's password
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
qemu-ga will read a system configuration file on startup (located at
|
qemu-ga will read a system configuration file on startup (located at
|
||||||
@file{/etc/qemu/qemu-ga.conf} by default), then parse remaining
|
@file{@value{CONFDIR}/qemu-ga.conf} by default), then parse remaining
|
||||||
configuration options on the command line. For the same key, the last
|
configuration options on the command line. For the same key, the last
|
||||||
option wins, but the lists accumulate (see below for configuration
|
option wins, but the lists accumulate (see below for configuration
|
||||||
file format).
|
file format).
|
||||||
|
@ -58,7 +58,7 @@ file format).
|
||||||
Enable fsfreeze hook. Accepts an optional argument that specifies
|
Enable fsfreeze hook. Accepts an optional argument that specifies
|
||||||
script to run on freeze/thaw. Script will be called with
|
script to run on freeze/thaw. Script will be called with
|
||||||
'freeze'/'thaw' arguments accordingly (default is
|
'freeze'/'thaw' arguments accordingly (default is
|
||||||
@samp{/etc/qemu/fsfreeze-hook}). If using -F with an argument, do
|
@samp{@value{CONFDIR}/fsfreeze-hook}). If using -F with an argument, do
|
||||||
not follow -F with a space (for example:
|
not follow -F with a space (for example:
|
||||||
@samp{-F/var/run/fsfreezehook.sh}).
|
@samp{-F/var/run/fsfreezehook.sh}).
|
||||||
|
|
||||||
|
|
|
@ -679,7 +679,7 @@ Object *object_new_with_propv(const char *typename,
|
||||||
error_setg(errp, "object type '%s' is abstract", typename);
|
error_setg(errp, "object type '%s' is abstract", typename);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
obj = object_new(typename);
|
obj = object_new_with_type(klass->type);
|
||||||
|
|
||||||
if (object_set_propv(obj, &local_err, vargs) < 0) {
|
if (object_set_propv(obj, &local_err, vargs) < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
|
|
|
@ -830,6 +830,7 @@ static int unix_listen_saddr(UnixSocketAddress *saddr,
|
||||||
int sock, fd;
|
int sock, fd;
|
||||||
char *pathbuf = NULL;
|
char *pathbuf = NULL;
|
||||||
const char *path;
|
const char *path;
|
||||||
|
size_t pathlen;
|
||||||
|
|
||||||
sock = qemu_socket(PF_UNIX, SOCK_STREAM, 0);
|
sock = qemu_socket(PF_UNIX, SOCK_STREAM, 0);
|
||||||
if (sock < 0) {
|
if (sock < 0) {
|
||||||
|
@ -845,7 +846,8 @@ static int unix_listen_saddr(UnixSocketAddress *saddr,
|
||||||
path = pathbuf = g_strdup_printf("%s/qemu-socket-XXXXXX", tmpdir);
|
path = pathbuf = g_strdup_printf("%s/qemu-socket-XXXXXX", tmpdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(path) > sizeof(un.sun_path)) {
|
pathlen = strlen(path);
|
||||||
|
if (pathlen > sizeof(un.sun_path)) {
|
||||||
error_setg(errp, "UNIX socket path '%s' is too long", path);
|
error_setg(errp, "UNIX socket path '%s' is too long", path);
|
||||||
error_append_hint(errp, "Path must be less than %zu bytes\n",
|
error_append_hint(errp, "Path must be less than %zu bytes\n",
|
||||||
sizeof(un.sun_path));
|
sizeof(un.sun_path));
|
||||||
|
@ -877,7 +879,7 @@ static int unix_listen_saddr(UnixSocketAddress *saddr,
|
||||||
|
|
||||||
memset(&un, 0, sizeof(un));
|
memset(&un, 0, sizeof(un));
|
||||||
un.sun_family = AF_UNIX;
|
un.sun_family = AF_UNIX;
|
||||||
strncpy(un.sun_path, path, sizeof(un.sun_path));
|
memcpy(un.sun_path, path, pathlen);
|
||||||
|
|
||||||
if (bind(sock, (struct sockaddr*) &un, sizeof(un)) < 0) {
|
if (bind(sock, (struct sockaddr*) &un, sizeof(un)) < 0) {
|
||||||
error_setg_errno(errp, errno, "Failed to bind socket to %s", path);
|
error_setg_errno(errp, errno, "Failed to bind socket to %s", path);
|
||||||
|
@ -901,6 +903,7 @@ static int unix_connect_saddr(UnixSocketAddress *saddr, Error **errp)
|
||||||
{
|
{
|
||||||
struct sockaddr_un un;
|
struct sockaddr_un un;
|
||||||
int sock, rc;
|
int sock, rc;
|
||||||
|
size_t pathlen;
|
||||||
|
|
||||||
if (saddr->path == NULL) {
|
if (saddr->path == NULL) {
|
||||||
error_setg(errp, "unix connect: no path specified");
|
error_setg(errp, "unix connect: no path specified");
|
||||||
|
@ -913,7 +916,8 @@ static int unix_connect_saddr(UnixSocketAddress *saddr, Error **errp)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(saddr->path) > sizeof(un.sun_path)) {
|
pathlen = strlen(saddr->path);
|
||||||
|
if (pathlen > sizeof(un.sun_path)) {
|
||||||
error_setg(errp, "UNIX socket path '%s' is too long", saddr->path);
|
error_setg(errp, "UNIX socket path '%s' is too long", saddr->path);
|
||||||
error_append_hint(errp, "Path must be less than %zu bytes\n",
|
error_append_hint(errp, "Path must be less than %zu bytes\n",
|
||||||
sizeof(un.sun_path));
|
sizeof(un.sun_path));
|
||||||
|
@ -922,7 +926,7 @@ static int unix_connect_saddr(UnixSocketAddress *saddr, Error **errp)
|
||||||
|
|
||||||
memset(&un, 0, sizeof(un));
|
memset(&un, 0, sizeof(un));
|
||||||
un.sun_family = AF_UNIX;
|
un.sun_family = AF_UNIX;
|
||||||
strncpy(un.sun_path, saddr->path, sizeof(un.sun_path));
|
memcpy(un.sun_path, saddr->path, pathlen);
|
||||||
|
|
||||||
/* connect to peer */
|
/* connect to peer */
|
||||||
do {
|
do {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue