Commit df51a005 authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/elmarco/tags/option-pull-request' into staging



CLI help improvements

PULLv2:
 - fix uninitialized "seentype" variable in qom-test

# gpg: Signature made Fri 05 Oct 2018 13:28:21 BST
# gpg:                using RSA key DAE8E10975969CE5
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>"
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>"
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* remotes/elmarco/tags/option-pull-request:
  vl: list user creatable properties when 'help' is argument
  hostmem: add some properties description
  vl: handle -object help
  tests/qom-proplist: check class properties iterator
  tests/qom-proplist: check properties are not listed multiple times
  tests/qom-proplist: check duplicate "bv" property registration failed
  qom/object: register 'type' property as class property
  qom/object: fix iterating properties over a class
  qemu-option: improve qemu_opts_print_help() output
  qemu-option: add help fallback to print the list of options
  cutils: add qemu_pstrcmp0()
  qdev-monitor: print help to stdout

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents e2e3436a 1195fa2b
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -145,16 +145,25 @@ memfd_backend_class_init(ObjectClass *oc, void *data)
                                       memfd_backend_get_hugetlb,
                                       memfd_backend_set_hugetlb,
                                       &error_abort);
        object_class_property_set_description(oc, "hugetlb",
                                              "Use huge pages",
                                              &error_abort);
        object_class_property_add(oc, "hugetlbsize", "int",
                                  memfd_backend_get_hugetlbsize,
                                  memfd_backend_set_hugetlbsize,
                                  NULL, NULL, &error_abort);
        object_class_property_set_description(oc, "hugetlbsize",
                                              "Huge pages size (ex: 2M, 1G)",
                                              &error_abort);
    }
    if (qemu_memfd_check(MFD_ALLOW_SEALING)) {
        object_class_property_add_bool(oc, "seal",
                                       memfd_backend_get_seal,
                                       memfd_backend_set_seal,
                                       &error_abort);
        object_class_property_set_description(oc, "seal",
                                              "Seal growing & shrinking",
                                              &error_abort);
    }
}

+14 −0
Original line number Diff line number Diff line
@@ -397,27 +397,41 @@ host_memory_backend_class_init(ObjectClass *oc, void *data)
    object_class_property_add_bool(oc, "merge",
        host_memory_backend_get_merge,
        host_memory_backend_set_merge, &error_abort);
    object_class_property_set_description(oc, "merge",
        "Mark memory as mergeable", &error_abort);
    object_class_property_add_bool(oc, "dump",
        host_memory_backend_get_dump,
        host_memory_backend_set_dump, &error_abort);
    object_class_property_set_description(oc, "dump",
        "Set to 'off' to exclude from core dump", &error_abort);
    object_class_property_add_bool(oc, "prealloc",
        host_memory_backend_get_prealloc,
        host_memory_backend_set_prealloc, &error_abort);
    object_class_property_set_description(oc, "prealloc",
        "Preallocate memory", &error_abort);
    object_class_property_add(oc, "size", "int",
        host_memory_backend_get_size,
        host_memory_backend_set_size,
        NULL, NULL, &error_abort);
    object_class_property_set_description(oc, "size",
        "Size of the memory region (ex: 500M)", &error_abort);
    object_class_property_add(oc, "host-nodes", "int",
        host_memory_backend_get_host_nodes,
        host_memory_backend_set_host_nodes,
        NULL, NULL, &error_abort);
    object_class_property_set_description(oc, "host-nodes",
        "Binds memory to the list of NUMA host nodes", &error_abort);
    object_class_property_add_enum(oc, "policy", "HostMemPolicy",
        &HostMemPolicy_lookup,
        host_memory_backend_get_policy,
        host_memory_backend_set_policy, &error_abort);
    object_class_property_set_description(oc, "policy",
        "Set the NUMA policy", &error_abort);
    object_class_property_add_bool(oc, "share",
        host_memory_backend_get_share, host_memory_backend_set_share,
        &error_abort);
    object_class_property_set_description(oc, "share",
        "Mark the memory as private to QEMU or shared", &error_abort);
}

static const TypeInfo host_memory_backend_info = {
+3 −0
Original line number Diff line number Diff line
@@ -47,4 +47,7 @@ int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd);
void monitor_fdset_dup_fd_remove(int dup_fd);
int monitor_fdset_dup_fd_find(int dup_fd);

void monitor_vfprintf(FILE *stream,
                      const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0);

#endif /* MONITOR_H */
+12 −0
Original line number Diff line number Diff line
@@ -169,4 +169,16 @@ bool test_buffer_is_zero_next_accel(void);
int uleb128_encode_small(uint8_t *out, uint32_t n);
int uleb128_decode_small(const uint8_t *in, uint32_t *n);

/**
 * qemu_pstrcmp0:
 * @str1: a non-NULL pointer to a C string (*str1 can be NULL)
 * @str2: a non-NULL pointer to a C string (*str2 can be NULL)
 *
 * Compares *str1 and *str2 with g_strcmp0().
 *
 * Returns: an integer less than, equal to, or greater than zero, if
 * *str1 is <, == or > than *str2.
 */
int qemu_pstrcmp0(const char **str1, const char **str2);

#endif
+13 −3
Original line number Diff line number Diff line
@@ -4493,19 +4493,29 @@ static void monitor_readline_flush(void *opaque)
}

/*
 * Print to current monitor if we have one, else to stderr.
 * Print to current monitor if we have one, else to stream.
 * TODO should return int, so callers can calculate width, but that
 * requires surgery to monitor_vprintf().  Left for another day.
 */
void error_vprintf(const char *fmt, va_list ap)
void monitor_vfprintf(FILE *stream, const char *fmt, va_list ap)
{
    if (cur_mon && !monitor_cur_is_qmp()) {
        monitor_vprintf(cur_mon, fmt, ap);
    } else {
        vfprintf(stderr, fmt, ap);
        vfprintf(stream, fmt, ap);
    }
}

/*
 * Print to current monitor if we have one, else to stderr.
 * TODO should return int, so callers can calculate width, but that
 * requires surgery to monitor_vprintf().  Left for another day.
 */
void error_vprintf(const char *fmt, va_list ap)
{
    monitor_vfprintf(stderr, fmt, ap);
}

void error_vprintf_unless_qmp(const char *fmt, va_list ap)
{
    if (cur_mon && !monitor_cur_is_qmp()) {
Loading