diff options
author | Erwan Velu <erwanaliasr1@gmail.com> | 2011-04-03 20:59:34 +0200 |
---|---|---|
committer | Erwan Velu <erwanaliasr1@gmail.com> | 2011-04-03 20:59:34 +0200 |
commit | b0ca086f7b98cdb92355c7adfddd3d976b7c94fc (patch) | |
tree | ed4f0b2387fe214eb53d3b52faae3d2d8981288e /com32/hdt/hdt-dump-pci.c | |
parent | 9ca3c9cc9eeb578b60c4d27746dc4e7447face0c (diff) | |
download | syslinux-b0ca086f7b98cdb92355c7adfddd3d976b7c94fc.tar.gz |
hdt: Making dumping code easier to use
A set of CREATE_NEW_OBJECT / FLUSH is enough for a simple dump.
Diffstat (limited to 'com32/hdt/hdt-dump-pci.c')
-rw-r--r-- | com32/hdt/hdt-dump-pci.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/com32/hdt/hdt-dump-pci.c b/com32/hdt/hdt-dump-pci.c index 9d89f3ad..b1f18fdf 100644 --- a/com32/hdt/hdt-dump-pci.c +++ b/com32/hdt/hdt-dump-pci.c @@ -54,10 +54,11 @@ void dump_pci(struct s_hardware *hardware, ZZJSON_CONFIG * config, nomodulesfile = nomodulespcimap && nomodulesalias; - *item = zzjson_create_object(config, NULL); /* empty object */ + CREATE_NEW_OBJECT; add_i("pci_device.count", hardware->nb_pci_devices); + FLUSH_OBJECT; /* For every detected pci device, compute its submenu */ for_each_pci_func(pci_device, hardware->pci_domain) { if (pci_device == NULL) @@ -69,9 +70,7 @@ void dump_pci(struct s_hardware *hardware, ZZJSON_CONFIG * config, char c[10] = { 0 }; char r[10] = { 0 }; - zzjson_print(config, *item); - zzjson_free(config, *item); - *item = zzjson_create_object(config, NULL); /* empty object */ + CREATE_NEW_OBJECT; bus = __pci_bus; slot = __pci_slot; func = __pci_func; @@ -112,8 +111,8 @@ void dump_pci(struct s_hardware *hardware, ZZJSON_CONFIG * config, add_s("pci_device.product_id", p); add_s("pci_device.sub_vendor_id", sv); add_s("pci_device.sub_product_id", sp); -// add_s("pci_device.class_id", c); -// add_s("pci_device.revision", r); + add_s("pci_device.class_id", c); + add_s("pci_device.revision", r); if ((pci_device->dev_info->irq > 0) && (pci_device->dev_info->irq < 255)) add_i("pci_device.irq", pci_device->dev_info->irq); @@ -131,6 +130,7 @@ void dump_pci(struct s_hardware *hardware, ZZJSON_CONFIG * config, } } i++; + FLUSH_OBJECT; } - flush("pci", config, item); + to_cpio("pci"); } |