It will be used in future.
rc = exfat_opendir(ef, parent, &it);
if (rc != 0)
{
- exfat_put_node(parent);
+ exfat_put_node(ef, parent);
exfat_error("failed to open directory `%s'", path);
return;
}
else
files_count++;
nodeck(ef, node);
- exfat_put_node(node);
+ exfat_put_node(ef, node);
}
- exfat_closedir(&it);
- exfat_put_node(parent);
+ exfat_closedir(ef, &it);
+ exfat_put_node(ef, parent);
}
static void fsck(struct exfat* ef)
return rc;
exfat_stat(node, stbuf);
- exfat_put_node(node);
+ exfat_put_node(&ef, node);
return 0;
}
return rc;
exfat_truncate(&ef, node, size);
- exfat_put_node(node);
+ exfat_put_node(&ef, node);
return 0;
}
return rc;
if (!(parent->flags & EXFAT_ATTRIB_DIR))
{
- exfat_put_node(parent);
+ exfat_put_node(&ef, parent);
exfat_error("`%s' is not a directory (0x%x)", path, parent->flags);
return -ENOTDIR;
}
rc = exfat_opendir(&ef, parent, &it);
if (rc != 0)
{
- exfat_put_node(parent);
+ exfat_put_node(&ef, parent);
exfat_error("failed to open directory `%s'", path);
return rc;
}
name, IS_CONTIGUOUS(*node) ? "contiguous" : "fragmented",
node->size, node->start_cluster);
filler(buffer, name, NULL, 0);
- exfat_put_node(node);
+ exfat_put_node(&ef, node);
}
- exfat_closedir(&it);
- exfat_put_node(parent);
+ exfat_closedir(&ef, &it);
+ exfat_put_node(&ef, parent);
return 0;
}
static int fuse_exfat_release(const char *path, struct fuse_file_info *fi)
{
- exfat_put_node(get_node(fi));
+ exfat_put_node(&ef, get_node(fi));
return 0;
}
int exfat_opendir(struct exfat* ef, struct exfat_node* dir,
struct exfat_iterator* it);
-void exfat_closedir(struct exfat_iterator* it);
+void exfat_closedir(struct exfat* ef, struct exfat_iterator* it);
struct exfat_node* exfat_readdir(struct exfat* ef, struct exfat_iterator* it);
int exfat_lookup(struct exfat* ef, struct exfat_node** node,
const char* path);
size_t insize);
struct exfat_node* exfat_get_node(struct exfat_node* node);
-void exfat_put_node(struct exfat_node* node);
+void exfat_put_node(struct exfat* ef, struct exfat_node* node);
int exfat_cache_directory(struct exfat* ef, struct exfat_node* dir);
void exfat_reset_cache(struct exfat* ef);
-void exfat_flush_node(struct exfat* ef, const struct exfat_node* node);
+void exfat_flush_node(struct exfat* ef, struct exfat_node* node);
int exfat_mount(struct exfat* ef, const char* spec);
void exfat_unmount(struct exfat* ef);
it->current = NULL;
rc = exfat_cache_directory(ef, dir);
if (rc != 0)
- exfat_put_node(dir);
+ exfat_put_node(ef, dir);
return rc;
}
-void exfat_closedir(struct exfat_iterator* it)
+void exfat_closedir(struct exfat* ef, struct exfat_iterator* it)
{
- exfat_put_node(it->parent);
+ exfat_put_node(ef, it->parent);
it->parent = NULL;
it->current = NULL;
}
{
if (compare_name(ef, buffer, (*node)->name) == 0)
{
- exfat_closedir(&it);
+ exfat_closedir(ef, &it);
return 0;
}
- exfat_put_node(*node);
+ exfat_put_node(ef, *node);
}
- exfat_closedir(&it);
+ exfat_closedir(ef, &it);
return -ENOENT;
}
continue;
if (lookup_name(ef, parent, node, p, n) != 0)
{
- exfat_put_node(parent);
+ exfat_put_node(ef, parent);
return -ENOENT;
}
- exfat_put_node(parent);
+ exfat_put_node(ef, parent);
parent = *node;
}
return 0;
void exfat_unmount(struct exfat* ef)
{
- exfat_put_node(ef->root);
+ exfat_put_node(ef, ef->root);
exfat_reset_cache(ef);
ef->root = NULL;
free(ef->zero_block);
return node;
}
-void exfat_put_node(struct exfat_node* node)
+void exfat_put_node(struct exfat* ef, struct exfat_node* node)
{
if (--node->references < 0)
{
return 0;
}
-static void reset_cache(struct exfat_node* node)
+static void reset_cache(struct exfat* ef, struct exfat_node* node)
{
struct exfat_node* child;
struct exfat_node* next;
for (child = node->child; child; child = next)
{
- reset_cache(child);
+ reset_cache(ef, child);
next = child->next;
free(child);
}
void exfat_reset_cache(struct exfat* ef)
{
- reset_cache(ef->root);
+ reset_cache(ef, ef->root);
}
-void exfat_flush_node(struct exfat* ef, const struct exfat_node* node)
+void exfat_flush_node(struct exfat* ef, struct exfat_node* node)
{
struct exfat_file meta1;
struct exfat_file_info meta2;