[Haiku-commits] r29720 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/fuse
bonefish at BerliOS
bonefish at mail.berlios.de
Thu Mar 26 01:50:44 CET 2009
Author: bonefish
Date: 2009-03-26 01:50:44 +0100 (Thu, 26 Mar 2009)
New Revision: 29720
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29720&view=rev
Modified:
haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/fuse/fuse_fs.cpp
Log:
* Our error codes are already negative, so return ENOSYS instead of -ENOSYS.
* fuse_fs_utimens(): Fall back to the utime() hook, if utimens() is not
available.
Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/fuse/fuse_fs.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/fuse/fuse_fs.cpp 2009-03-26 00:16:34 UTC (rev 29719)
+++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/fuse/fuse_fs.cpp 2009-03-26 00:50:44 UTC (rev 29720)
@@ -16,7 +16,7 @@
fuse_fs_getattr(struct fuse_fs* fs, const char* path, struct stat* buf)
{
if (fs->ops.getattr == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.getattr(path, buf);
}
@@ -26,7 +26,7 @@
struct fuse_file_info* fi)
{
if (fs->ops.fgetattr == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.fgetattr(path, buf, fi);
}
@@ -35,7 +35,7 @@
fuse_fs_rename(struct fuse_fs* fs, const char* oldpath, const char* newpath)
{
if (fs->ops.rename == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.rename(oldpath, newpath);
}
@@ -44,7 +44,7 @@
fuse_fs_unlink(struct fuse_fs* fs, const char* path)
{
if (fs->ops.unlink == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.unlink(path);
}
@@ -53,7 +53,7 @@
fuse_fs_rmdir(struct fuse_fs* fs, const char* path)
{
if (fs->ops.rmdir == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.rmdir(path);
}
@@ -62,7 +62,7 @@
fuse_fs_symlink(struct fuse_fs* fs, const char* linkname, const char* path)
{
if (fs->ops.symlink == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.symlink(linkname, path);
}
@@ -71,7 +71,7 @@
fuse_fs_link(struct fuse_fs* fs, const char* oldpath, const char* newpath)
{
if (fs->ops.link == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.link(oldpath, newpath);
}
@@ -100,7 +100,7 @@
off_t off, struct fuse_file_info* fi)
{
if (fs->ops.read == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.read(path, buf, size, off, fi);
}
@@ -110,7 +110,7 @@
size_t size, off_t off, struct fuse_file_info* fi)
{
if (fs->ops.write == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.write(path, buf, size, off, fi);
}
@@ -120,7 +120,7 @@
struct fuse_file_info* fi)
{
if (fs->ops.fsync == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.fsync(path, datasync, fi);
}
@@ -129,7 +129,7 @@
fuse_fs_flush(struct fuse_fs* fs, const char* path, struct fuse_file_info* fi)
{
if (fs->ops.flush == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.flush(path, fi);
}
@@ -157,7 +157,7 @@
fuse_fill_dir_t filler, off_t off, struct fuse_file_info* fi)
{
if (fs->ops.readdir == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.readdir(path, buf, filler, off, fi);
}
@@ -167,7 +167,7 @@
struct fuse_file_info* fi)
{
if (fs->ops.fsyncdir == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.fsyncdir(path, datasync, fi);
}
@@ -187,7 +187,7 @@
struct fuse_file_info* fi)
{
if (fs->ops.create == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.create(path, mode, fi);
}
@@ -197,7 +197,7 @@
int cmd, struct flock* lock)
{
if (fs->ops.lock == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.lock(path, fi, cmd, lock);
}
@@ -206,7 +206,7 @@
fuse_fs_chmod(struct fuse_fs* fs, const char* path, mode_t mode)
{
if (fs->ops.chmod == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.chmod(path, mode);
}
@@ -215,7 +215,7 @@
fuse_fs_chown(struct fuse_fs* fs, const char* path, uid_t uid, gid_t gid)
{
if (fs->ops.chown == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.chown(path, uid, gid);
}
@@ -224,7 +224,7 @@
fuse_fs_truncate(struct fuse_fs* fs, const char* path, off_t size)
{
if (fs->ops.truncate == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.truncate(path, size);
}
@@ -234,7 +234,7 @@
struct fuse_file_info* fi)
{
if (fs->ops.ftruncate == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.ftruncate(path, size, fi);
}
@@ -243,9 +243,18 @@
fuse_fs_utimens(struct fuse_fs* fs, const char* path,
const struct timespec tv[2])
{
- if (fs->ops.utimens == NULL)
- return -ENOSYS;
- return fs->ops.utimens(path, tv);
+ if (fs->ops.utimens != NULL)
+ return fs->ops.utimens(path, tv);
+
+ if (fs->ops.utime != NULL) {
+ utimbuf timeBuffer = {
+ tv[0].tv_sec, // access time
+ tv[1].tv_sec // modification time
+ };
+ return fs->ops.utime(path, &timeBuffer);
+ }
+
+ return ENOSYS;
}
@@ -253,7 +262,7 @@
fuse_fs_access(struct fuse_fs* fs, const char* path, int mask)
{
if (fs->ops.access == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.access(path, mask);
}
@@ -262,7 +271,7 @@
fuse_fs_readlink(struct fuse_fs* fs, const char* path, char* buf, size_t len)
{
if (fs->ops.readlink == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.readlink(path, buf, len);
}
@@ -271,7 +280,7 @@
fuse_fs_mknod(struct fuse_fs* fs, const char* path, mode_t mode, dev_t rdev)
{
if (fs->ops.mknod == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.mknod(path, mode, rdev);
}
@@ -280,7 +289,7 @@
fuse_fs_mkdir(struct fuse_fs* fs, const char* path, mode_t mode)
{
if (fs->ops.mkdir == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.mkdir(path, mode);
}
@@ -290,7 +299,7 @@
const char* value, size_t size, int flags)
{
if (fs->ops.setxattr == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.setxattr(path, name, value, size, flags);
}
@@ -300,7 +309,7 @@
char* value, size_t size)
{
if (fs->ops.getxattr == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.getxattr(path, name, value, size);
}
@@ -309,7 +318,7 @@
fuse_fs_listxattr(struct fuse_fs* fs, const char* path, char* list, size_t size)
{
if (fs->ops.listxattr == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.listxattr(path, list, size);
}
@@ -318,7 +327,7 @@
fuse_fs_removexattr(struct fuse_fs* fs, const char* path, const char* name)
{
if (fs->ops.removexattr == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.removexattr(path, name);
}
@@ -328,7 +337,7 @@
uint64_t* idx)
{
if (fs->ops.bmap == NULL)
- return -ENOSYS;
+ return ENOSYS;
return fs->ops.bmap(path, blocksize, idx);
}
More information about the Haiku-commits
mailing list