qemu/include
Jeff Cody a0f1913637 util - add automated ID generation utility
Multiple sub-systems in QEMU may find it useful to generate IDs
for objects that a user may reference via QMP or HMP.  This patch
presents a standardized way to do it, so that automatic ID generation
follows the same rules.

This patch enforces the following rules when generating an ID:

1.) Guarantee no collisions with a user-specified ID
2.) Identify the sub-system the ID belongs to
3.) Guarantee of uniqueness
4.) Spoiling predictability, to avoid creating an assumption
    of object ordering and parsing (i.e., we don't want users to think
    they can guess the next ID based on prior behavior).

The scheme for this is as follows (no spaces):

                # subsys D RR
Reserved char --|    |   | |
Subsystem String ----|   | |
Unique number (64-bit) --| |
Two-digit random number ---|

For example, a generated node-name for the block sub-system may look
like this:

    #block076

The caller of id_generate() is responsible for freeing the generated
node name string with g_free().

Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-10-16 15:34:30 +02:00
..
block block: Remove bdrv_swap() 2015-10-16 15:34:30 +02:00
crypto crypto: introduce new module for handling TLS sessions 2015-09-15 15:07:43 +01:00
disas disas: Add print_insn to disassemble info 2015-07-09 15:20:40 +02:00
exec VFIO updates 2015-10-07 2015-10-08 16:50:34 +01:00
fpu softfloat: expand out STATUS macro 2015-02-06 16:11:38 +00:00
hw Pull request 2015-10-12 15:52:54 +01:00
libdecnumber
migration migration: qemu-file more size_t'ifying 2015-09-29 11:33:02 +05:30
monitor hmp: added io apic dump state 2015-09-25 12:04:42 +02:00
net net/queue: export qemu_net_queue_append_iov 2015-10-12 13:31:18 +08:00
qapi qapi: Introduce a first class 'any' type 2015-09-21 09:56:49 +02:00
qemu block: Remove bdrv_swap() 2015-10-16 15:34:30 +02:00
qom target-*: Introduce and use cpu_breakpoint_test 2015-10-07 20:36:28 +11:00
standard-headers Fix device introspection regressions 2015-10-12 11:07:38 +01:00
sysemu oslib-win32: only provide localtime_r/gmtime_r if missing 2015-09-24 21:13:49 +02:00
ui gtk/opengl: add opengl context and scanout support (GtkGLArea) 2015-10-08 10:34:53 +02:00
config.h
elf.h elf: Update EM_MOXIE definition 2015-09-25 12:04:43 +02:00
glib-compat.h glib: remove stale compat functions 2015-05-22 15:58:06 -04:00
qemu-common.h util - add automated ID generation utility 2015-10-16 15:34:30 +02:00
qemu-io.h qemu-io: Use BlockBackend 2015-02-16 15:07:19 +00:00
qjson.h QJSON: Add JSON writer 2015-02-05 17:16:14 +01:00
trace-tcg.h
trace.h