diff options
author | relan <relan@users.noreply.github.com> | 2009-10-05 17:35:56 +0000 |
---|---|---|
committer | relan <relan@users.noreply.github.com> | 2015-08-24 08:26:10 +0300 |
commit | 7d4f05ff7d833ece42d3e489dd4aa804c4c313c1 (patch) | |
tree | 773b12ffdfc82c2542f8b94ddfc15bf81f2c308b /fsck | |
parent | 3e4cfeefa0f27c2c79d125cb65b6b8cda3ccfe88 (diff) | |
download | android_external_exfat-7d4f05ff7d833ece42d3e489dd4aa804c4c313c1.tar.gz android_external_exfat-7d4f05ff7d833ece42d3e489dd4aa804c4c313c1.tar.bz2 android_external_exfat-7d4f05ff7d833ece42d3e489dd4aa804c4c313c1.zip |
Implement dynamic nodes allocation.
Diffstat (limited to 'fsck')
-rw-r--r-- | fsck/main.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/fsck/main.c b/fsck/main.c index ca7d7e0..bd40d77 100644 --- a/fsck/main.c +++ b/fsck/main.c @@ -59,34 +59,37 @@ static void sbck(const struct exfat* ef) static void dirck(struct exfat* ef, const char* path) { - struct exfat_node parent, node; + struct exfat_node* parent; + struct exfat_node* node; struct exfat_iterator it; char subpath[EXFAT_NAME_MAX + 1]; if (exfat_lookup(ef, &parent, path) != 0) exfat_bug("directory `%s' is not found", path); - if (!(parent.flags & EXFAT_ATTRIB_DIR)) - exfat_bug("`%s' is not a directory (0x%x)", path, parent.flags); + if (!(parent->flags & EXFAT_ATTRIB_DIR)) + exfat_bug("`%s' is not a directory (0x%x)", path, parent->flags); - exfat_opendir(&parent, &it); - while (exfat_readdir(ef, &node, &it) == 0) + exfat_opendir(parent, &it); + while (exfat_readdir(ef, parent, &node, &it) == 0) { - exfat_debug("%s/%s: %s, %llu bytes, cluster %u", path, node.name, - IS_CONTIGUOUS(node) ? "contiguous" : "fragmented", - node.size, node.start_cluster); - if (node.flags & EXFAT_ATTRIB_DIR) + exfat_debug("%s/%s: %s, %llu bytes, cluster %u", path, node->name, + IS_CONTIGUOUS(*node) ? "contiguous" : "fragmented", + node->size, node->start_cluster); + if (node->flags & EXFAT_ATTRIB_DIR) { directories_count++; strcpy(subpath, path); strcat(subpath, "/"); - exfat_get_name(&node, subpath + strlen(subpath), + exfat_get_name(node, subpath + strlen(subpath), EXFAT_NAME_MAX - strlen(subpath)); dirck(ef, subpath); } else files_count++; + exfat_put_node(node); } exfat_closedir(&it); + exfat_put_node(parent); } static void fsck(struct exfat* ef) |