summaryrefslogtreecommitdiff
path: root/src/tools/myriadfs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/myriadfs.cpp')
-rw-r--r--src/tools/myriadfs.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/tools/myriadfs.cpp b/src/tools/myriadfs.cpp
index b54390d..c4004b7 100644
--- a/src/tools/myriadfs.cpp
+++ b/src/tools/myriadfs.cpp
@@ -54,13 +54,11 @@ extern "C" {
54 static int myriadfs_readdir( const char *sPath, void *buf, 54 static int myriadfs_readdir( const char *sPath, void *buf,
55 fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi ) 55 fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi )
56 { 56 {
57 fprintf( stderr, "Reading dir...\n");
58 Bu::MyriadFs::Dir lDir = pFs->readDir( sPath ); 57 Bu::MyriadFs::Dir lDir = pFs->readDir( sPath );
59 filler( buf, ".", NULL, 0 ); 58 filler( buf, ".", NULL, 0 );
60 filler( buf, "..", NULL, 0 ); 59 filler( buf, "..", NULL, 0 );
61 for( Bu::MyriadFs::Dir::iterator i = lDir.begin(); i; i++ ) 60 for( Bu::MyriadFs::Dir::iterator i = lDir.begin(); i; i++ )
62 { 61 {
63 fprintf( stderr, "Adding file: '%s'\n", (*i).sName.getStr() );
64 filler( buf, (*i).sName.getStr(), NULL, 0 ); 62 filler( buf, (*i).sName.getStr(), NULL, 0 );
65 } 63 }
66 64
@@ -80,6 +78,7 @@ extern "C" {
80 Bu::MyriadStream ms = pFs->open( sPath, 0 ); 78 Bu::MyriadStream ms = pFs->open( sPath, 0 );
81 fi->fh = iNextFileId; 79 fi->fh = iNextFileId;
82 hOpenFiles.insert( iNextFileId++, ms ); 80 hOpenFiles.insert( iNextFileId++, ms );
81 printf("File opened, %d files open now.\n", hOpenFiles.getSize() );
83 return 0; 82 return 0;
84 } 83 }
85 catch(...) 84 catch(...)
@@ -112,6 +111,7 @@ extern "C" {
112 Bu::MyriadStream ms = pFs->open( sPath, 0 ); 111 Bu::MyriadStream ms = pFs->open( sPath, 0 );
113 fi->fh = iNextFileId; 112 fi->fh = iNextFileId;
114 hOpenFiles.insert( iNextFileId++, ms ); 113 hOpenFiles.insert( iNextFileId++, ms );
114 printf("File created, %d files open now.\n", hOpenFiles.getSize() );
115 return 0; 115 return 0;
116 } 116 }
117 catch(...) 117 catch(...)
@@ -136,6 +136,7 @@ extern "C" {
136 static int myriadfs_release( const char *sPath, struct fuse_file_info *fi ) 136 static int myriadfs_release( const char *sPath, struct fuse_file_info *fi )
137 { 137 {
138 hOpenFiles.erase( fi->fh ); 138 hOpenFiles.erase( fi->fh );
139 printf("File released, %d files open now.\n", hOpenFiles.getSize() );
139 140
140 return 0; 141 return 0;
141 } 142 }
@@ -143,7 +144,14 @@ extern "C" {
143 static int myriadfs_utimens( const char *sPath, 144 static int myriadfs_utimens( const char *sPath,
144 const struct timespec tv[2] ) 145 const struct timespec tv[2] )
145 { 146 {
146 pFs->setTimes( sPath, tv[0].tv_sec, tv[1].tv_sec ); 147 try
148 {
149 pFs->setTimes( sPath, tv[0].tv_sec, tv[1].tv_sec );
150 }
151 catch(...)
152 {
153 return -EACCES;
154 }
147 return 0; 155 return 0;
148 } 156 }
149 157