summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Zach C2008-10-23 20:07:26 -0700
committerGravatar Matt Colyer2008-10-23 20:07:26 -0700
commit2f63045e0f01cb6d7cd53802acdb785a8a723ba1 (patch)
tree2d2f56997200694962a6d16a3158deed76f9abb2 /src
parentfe90955ffb6aef6f10fd77d5e1606f6f83ac74b4 (diff)
downloadifuse-2f63045e0f01cb6d7cd53802acdb785a8a723ba1.tar.gz
ifuse-2f63045e0f01cb6d7cd53802acdb785a8a723ba1.tar.bz2
Uses AFC filehandle to handle multiple file transfers better.
Diffstat (limited to 'src')
-rw-r--r--src/ifuse.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/ifuse.c b/src/ifuse.c
index 52c6a63..a0e950e 100644
--- a/src/ifuse.c
+++ b/src/ifuse.c
@@ -28,6 +28,9 @@
#include <fcntl.h>
#include <glib.h>
#include <unistd.h>
+#include <stdint.h>
+
+typedef uint32_t uint32; // this annoys me too
#include <libiphone/libiphone.h>
@@ -76,18 +79,20 @@ static int ifuse_create(const char *path, mode_t mode, struct fuse_file_info *fi
{
// exactly the same as open but using a different mode
iphone_afc_file_t file = NULL;
+ uint32 *argh_filehandle = (uint32 *) malloc(sizeof(uint32));
iphone_afc_client_t afc = fuse_get_context()->private_data;
iphone_afc_open_file(afc, path, IPHONE_AFC_FILE_WRITE, &file);
- fh_index++;
- fi->fh = fh_index;
- g_hash_table_insert(file_handles, &fh_index, file);
+ *argh_filehandle = iphone_afc_get_file_handle(file);
+ fi->fh = *argh_filehandle;
+ g_hash_table_insert(file_handles, argh_filehandle, file);
return 0;
}
static int ifuse_open(const char *path, struct fuse_file_info *fi)
{
iphone_afc_file_t file = NULL;
+ uint32 *argh_filehandle = (uint32 *) malloc(sizeof(uint32));
iphone_afc_client_t afc = fuse_get_context()->private_data;
uint32_t mode = 0;
@@ -101,9 +106,9 @@ static int ifuse_open(const char *path, struct fuse_file_info *fi)
iphone_afc_open_file(afc, path, mode, &file);
- fh_index++;
- fi->fh = fh_index;
- g_hash_table_insert(file_handles, &fh_index, file);
+ *argh_filehandle = iphone_afc_get_file_handle(file);
+ fi->fh = *argh_filehandle;
+ g_hash_table_insert(file_handles, argh_filehandle, file);
return 0;
}