OSDN Git Service

Pass struct exfat to exfat_put_node() function.
authorrelan <relan@users.noreply.github.com>
Sat, 14 Nov 2009 18:56:40 +0000 (18:56 +0000)
committerrelan <relan@users.noreply.github.com>
Mon, 24 Aug 2015 05:26:10 +0000 (08:26 +0300)
It will be used in future.

fsck/main.c
fuse/main.c
libexfat/exfat.h
libexfat/lookup.c
libexfat/mount.c
libexfat/node.c

index fa26631..2bb6978 100644 (file)
@@ -99,7 +99,7 @@ static void dirck(struct exfat* ef, const char* path)
        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;
        }
@@ -120,10 +120,10 @@ static void dirck(struct exfat* ef, const char* path)
                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)
index b223be0..a34c761 100644 (file)
@@ -45,7 +45,7 @@ static int fuse_exfat_getattr(const char *path, struct stat *stbuf)
                return rc;
 
        exfat_stat(node, stbuf);
-       exfat_put_node(node);
+       exfat_put_node(&ef, node);
        return 0;
 }
 
@@ -61,7 +61,7 @@ static int fuse_exfat_truncate(const char *path, off_t size)
                return rc;
 
        exfat_truncate(&ef, node, size);
-       exfat_put_node(node);
+       exfat_put_node(&ef, node);
        return 0;
 }
 
@@ -81,7 +81,7 @@ static int fuse_exfat_readdir(const char *path, void *buffer,
                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;
        }
@@ -92,7 +92,7 @@ static int fuse_exfat_readdir(const char *path, void *buffer,
        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;
        }
@@ -103,10 +103,10 @@ static int fuse_exfat_readdir(const char *path, void *buffer,
                                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;
 }
 
@@ -126,7 +126,7 @@ static int fuse_exfat_open(const char *path, struct fuse_file_info *fi)
 
 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;
 }
 
index edcd585..36925fb 100644 (file)
@@ -89,7 +89,7 @@ ssize_t exfat_write(struct exfat* ef, struct exfat_node* node,
 
 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);
@@ -117,10 +117,10 @@ int utf8_to_utf16(le16_t* output, const char* input, size_t outsize,
                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);
index 5f810d9..8d27e10 100644 (file)
@@ -22,13 +22,13 @@ int exfat_opendir(struct exfat* ef, struct exfat_node* dir,
        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;
 }
@@ -85,12 +85,12 @@ static int lookup_name(struct exfat* ef, struct exfat_node* parent,
        {
                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;
 }
 
@@ -121,10 +121,10 @@ int exfat_lookup(struct exfat* ef, struct exfat_node** node,
                        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;
index 3c1d00f..c29f612 100644 (file)
@@ -96,7 +96,7 @@ int exfat_mount(struct exfat* ef, const char* spec)
 
 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);
index 15ce597..bfaa49d 100644 (file)
@@ -29,7 +29,7 @@ struct exfat_node* exfat_get_node(struct exfat_node* node)
        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)
        {
@@ -340,14 +340,14 @@ int exfat_cache_directory(struct exfat* ef, struct exfat_node* dir)
        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);
        }
@@ -364,10 +364,10 @@ static void reset_cache(struct exfat_node* node)
 
 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;