char.c (2ecfc0657afa5d29a373271b342f704a1a3c6737) | char.c (54aa3de72ea2aaa2e903e7e879a4f3dda515a00e) |
---|---|
1/* 2 * QEMU System Emulator 3 * 4 * Copyright (c) 2003-2008 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 762 unchanged lines hidden (view full) --- 771{ 772 return qemu_chr_new_permit_mux_mon(label, filename, true, context); 773} 774 775static int qmp_query_chardev_foreach(Object *obj, void *data) 776{ 777 Chardev *chr = CHARDEV(obj); 778 ChardevInfoList **list = data; | 1/* 2 * QEMU System Emulator 3 * 4 * Copyright (c) 2003-2008 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 762 unchanged lines hidden (view full) --- 771{ 772 return qemu_chr_new_permit_mux_mon(label, filename, true, context); 773} 774 775static int qmp_query_chardev_foreach(Object *obj, void *data) 776{ 777 Chardev *chr = CHARDEV(obj); 778 ChardevInfoList **list = data; |
779 ChardevInfoList *info = g_malloc0(sizeof(*info)); | 779 ChardevInfo *value = g_malloc0(sizeof(*value)); |
780 | 780 |
781 info->value = g_malloc0(sizeof(*info->value)); 782 info->value->label = g_strdup(chr->label); 783 info->value->filename = g_strdup(chr->filename); 784 info->value->frontend_open = chr->be && chr->be->fe_open; | 781 value->label = g_strdup(chr->label); 782 value->filename = g_strdup(chr->filename); 783 value->frontend_open = chr->be && chr->be->fe_open; |
785 | 784 |
786 info->next = *list; 787 *list = info; | 785 QAPI_LIST_PREPEND(*list, value); |
788 789 return 0; 790} 791 792ChardevInfoList *qmp_query_chardev(Error **errp) 793{ 794 ChardevInfoList *chr_list = NULL; 795 796 object_child_foreach(get_chardevs_root(), 797 qmp_query_chardev_foreach, &chr_list); 798 799 return chr_list; 800} 801 802static void 803qmp_prepend_backend(const char *name, void *opaque) 804{ 805 ChardevBackendInfoList **list = opaque; | 786 787 return 0; 788} 789 790ChardevInfoList *qmp_query_chardev(Error **errp) 791{ 792 ChardevInfoList *chr_list = NULL; 793 794 object_child_foreach(get_chardevs_root(), 795 qmp_query_chardev_foreach, &chr_list); 796 797 return chr_list; 798} 799 800static void 801qmp_prepend_backend(const char *name, void *opaque) 802{ 803 ChardevBackendInfoList **list = opaque; |
806 ChardevBackendInfoList *info = g_malloc0(sizeof(*info)); | 804 ChardevBackendInfo *value = g_new0(ChardevBackendInfo, 1); |
807 | 805 |
808 info->value = g_malloc0(sizeof(*info->value)); 809 info->value->name = g_strdup(name); 810 info->next = *list; 811 *list = info; | 806 value->name = g_strdup(name); 807 QAPI_LIST_PREPEND(*list, value); |
812} 813 814ChardevBackendInfoList *qmp_query_chardev_backends(Error **errp) 815{ 816 ChardevBackendInfoList *backend_list = NULL; 817 818 chardev_name_foreach(qmp_prepend_backend, &backend_list); 819 --- 372 unchanged lines hidden --- | 808} 809 810ChardevBackendInfoList *qmp_query_chardev_backends(Error **errp) 811{ 812 ChardevBackendInfoList *backend_list = NULL; 813 814 chardev_name_foreach(qmp_prepend_backend, &backend_list); 815 --- 372 unchanged lines hidden --- |