[Tux3] [PATCH] "Fix" fuse filename/path issue, which caused lots of brokenness, including

Shapor Naghibzadeh shapor at gmail.com
Sun Sep 7 04:58:12 PDT 2008


# HG changeset patch
# User shapor at yzf.shapor.com
# Date 1220788676 25200
# Node ID 4566f59b83af11e9368f9e42ddce7221287f8188
# Parent  aaa73d917e20df245a5d245eef2939379407e350
"Fix" fuse filename/path issue, which caused lots of brokenness, including
?'s in ls -l output due to /'s ending up at the beginning of filenames.
This fuse implementation is still very broken, but I'm on it.

diff -r aaa73d917e20 -r 4566f59b83af user/test/tux3fs.c
--- a/user/test/tux3fs.c	Sat Sep 06 23:45:57 2008 -0700
+++ b/user/test/tux3fs.c	Sun Sep 07 04:57:56 2008 -0700
@@ -66,7 +66,7 @@ static int tux3_read(const char *path, c
 	size_t size, off_t offset, struct fuse_file_info *fi)
 {
 	printf("---- read file ----\n");
-	const char *filename = path;
+	const char *filename = path + 1;
 	struct inode *inode = tuxopen(sb->rootdir, filename, strlen(filename));
 	struct file *file = &(struct file){ .f_inode = inode };
 	printf("userspace tries to seek to %Li\n", (L)offset);
@@ -93,7 +93,7 @@ eek:
 
 static int tux3_create(const char *path, mode_t mode, struct fuse_file_info *fi)
 {
-	const char *filename = path;
+	const char *filename = path + 1;
 	struct inode *inode = tuxopen(sb->rootdir, filename, strlen(filename));
 	if (!inode) {
 		printf("---- create file ----\n");
@@ -108,7 +108,7 @@ static int tux3_write(const char *path, 
 	off_t offset, struct fuse_file_info *fi)
 {
 	warn("---- write file ----");
-	const char *filename = path;
+	const char *filename = path + 1;
 	struct inode *inode = tuxopen(sb->rootdir, filename, strlen(filename));
 	if (!inode) {
 		printf("---- create file ----\n");
@@ -140,9 +140,10 @@ eek:
 
 static int tux3_getattr(const char *path, struct stat *stat)
 {
+	const char *filename = path + 1;
 	printf("---- get attr for '%s' ----\n", path);
 	struct inode *inode = !strcmp(path, "/") ? sb->rootdir :
-		tuxopen(sb->rootdir, path, strlen(path));
+		tuxopen(sb->rootdir, filename, strlen(filename));
 	if (!inode)
 		return -ENOENT;
 	*stat = (struct stat){
@@ -197,7 +198,7 @@ static int tux3_unlink(const char *path)
 {
 	printf("---- delete file ----\n");
 	struct buffer *buffer;
-	const char *filename = path;
+	const char *filename = path + 1;
 	ext2_dirent *entry = ext2_find_entry(sb->rootdir, filename, strlen(filename), &buffer);
 	if (!entry)
 		goto noent;

_______________________________________________
Tux3 mailing list
Tux3 at tux3.org
http://tux3.org/cgi-bin/mailman/listinfo/tux3



More information about the Tux3 mailing list