static int dump_full(const char* spec, bool used_sectors) { struct exfat ef; uint32_t free_clusters; uint64_t free_sectors; if (exfat_mount(&ef, spec, "ro") != 0) return 1; free_clusters = exfat_count_free_clusters(&ef); free_sectors = (uint64_t) free_clusters << ef.sb->spc_bits; printf("Volume label %15s\n", exfat_get_label(&ef)); print_generic_info(ef.sb); print_sector_info(ef.sb); printf("Free sectors %10"PRIu64"\n", free_sectors); print_cluster_info(ef.sb); printf("Free clusters %10u\n", free_clusters); print_other_info(ef.sb); if (used_sectors) dump_sectors(&ef); exfat_unmount(&ef); return 0; }
static int dump_sb(const char* spec) { struct exfat_dev* dev; struct exfat_super_block sb; dev = exfat_open(spec, EXFAT_MODE_RO); if (dev == NULL) return 1; if (exfat_read(dev, &sb, sizeof(struct exfat_super_block)) < 0) { exfat_close(dev); exfat_error("failed to read from '%s'", spec); return 1; } if (memcmp(sb.oem_name, "EXFAT ", sizeof(sb.oem_name)) != 0) { exfat_close(dev); exfat_error("exFAT file system is not found on '%s'", spec); return 1; } print_generic_info(&sb); print_sector_info(&sb); print_cluster_info(&sb); print_other_info(&sb); exfat_close(dev); return 0; }
static void print_info_basic(const pci_info *info, bool verbose) { int domain; uint8 bus; __pci_resolve_virtual_bus(info->bus, &domain, &bus); TRACE(("PCI: [dom %d, bus %2d] bus %3d, device %2d, function %2d: vendor %04x, device %04x, revision %02x\n", domain, bus, info->bus /* virtual bus*/, info->device, info->function, info->vendor_id, info->device_id, info->revision)); TRACE(("PCI: class_base %02x, class_function %02x, class_api %02x\n", info->class_base, info->class_sub, info->class_api)); if (verbose) { #if USE_PCI_HEADER const char *venShort; const char *venFull; get_vendor_info(info->vendor_id, &venShort, &venFull); if (!venShort && !venFull) { TRACE(("PCI: vendor %04x: Unknown\n", info->vendor_id)); } else if (venShort && venFull) { TRACE(("PCI: vendor %04x: %s - %s\n", info->vendor_id, venShort, venFull)); } else { TRACE(("PCI: vendor %04x: %s\n", info->vendor_id, venShort ? venShort : venFull)); } const char *devShort; const char *devFull; get_device_info(info->vendor_id, info->device_id, info->u.h0.subsystem_vendor_id, info->u.h0.subsystem_id, &devShort, &devFull); if (!devShort && !devFull) { TRACE(("PCI: device %04x: Unknown\n", info->device_id)); } else if (devShort && devFull) { TRACE(("PCI: device %04x: %s (%s)\n", info->device_id, devShort, devFull)); } else { TRACE(("PCI: device %04x: %s\n", info->device_id, devShort ? devShort : devFull)); } char classInfo[64]; get_class_info(info->class_base, info->class_sub, info->class_api, classInfo, sizeof(classInfo)); TRACE(("PCI: info: %s\n", classInfo)); #endif } TRACE(("PCI: line_size %02x, latency %02x, header_type %02x, BIST %02x\n", info->line_size, info->latency, info->header_type, info->bist)); switch (info->header_type & PCI_header_type_mask) { case PCI_header_type_generic: print_generic_info(info, verbose); break; case PCI_header_type_PCI_to_PCI_bridge: print_pci2pci_bridge_info(info, verbose); break; case PCI_header_type_cardbus: print_pci2cardbus_bridge_info(info, verbose); break; default: TRACE(("PCI: unknown header type\n")); } print_capabilities(info); }