diff options
Diffstat (limited to 'src/ifuse.c')
| -rw-r--r-- | src/ifuse.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/ifuse.c b/src/ifuse.c index a56289d..3d921fd 100644 --- a/src/ifuse.c +++ b/src/ifuse.c | |||
| @@ -112,10 +112,25 @@ static int ifuse_read(const char *path, char *buf, size_t size, off_t offset, | |||
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | bytes = afc_read_file(afc, file, buf, size); | 114 | bytes = afc_read_file(afc, file, buf, size); |
| 115 | |||
| 116 | return bytes; | 115 | return bytes; |
| 117 | } | 116 | } |
| 118 | 117 | ||
| 118 | static int ifuse_release(const char *path, struct fuse_file_info *fi){ | ||
| 119 | AFCFile *file; | ||
| 120 | AFClient *afc = fuse_get_context()->private_data; | ||
| 121 | |||
| 122 | file = g_hash_table_lookup(file_handles, &(fi->fh)); | ||
| 123 | if (!file){ | ||
| 124 | return -ENOENT; | ||
| 125 | } | ||
| 126 | afc_close_file(afc, file); | ||
| 127 | |||
| 128 | free(file); | ||
| 129 | g_hash_table_remove(file_handles, &(fi->fh)); | ||
| 130 | |||
| 131 | return 0; | ||
| 132 | } | ||
| 133 | |||
| 119 | void *ifuse_init(struct fuse_conn_info *conn) { | 134 | void *ifuse_init(struct fuse_conn_info *conn) { |
| 120 | char *response = (char*)malloc(sizeof(char) * 2048); | 135 | char *response = (char*)malloc(sizeof(char) * 2048); |
| 121 | int bytes = 0, port = 0, i = 0; | 136 | int bytes = 0, port = 0, i = 0; |
| @@ -171,6 +186,7 @@ static struct fuse_operations ifuse_oper = { | |||
| 171 | .readdir = ifuse_readdir, | 186 | .readdir = ifuse_readdir, |
| 172 | .open = ifuse_open, | 187 | .open = ifuse_open, |
| 173 | .read = ifuse_read, | 188 | .read = ifuse_read, |
| 189 | .release = ifuse_release, | ||
| 174 | .init = ifuse_init, | 190 | .init = ifuse_init, |
| 175 | .destroy = ifuse_cleanup | 191 | .destroy = ifuse_cleanup |
| 176 | }; | 192 | }; |
