Skip to content

Commit

Permalink
Merge pull request #51 from yhoogstrate/remove_syscall_err_strace
Browse files Browse the repository at this point in the history
Fixes an strace error
  • Loading branch information
yhoogstrate authored Feb 1, 2020
2 parents 52b9728 + 519b31e commit 87dc480
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ project(fastafs)
# Do this once in a while - find different bugs
#set(CMAKE_CXX_COMPILER "clang++")

set(PROJECT_VERSION "1.7.0")
set(PROJECT_VERSION "1.7.1")
set(PACKAGE_URL "https://github.com/yhoogstrate/fastafs")
set(PACKAGE_BUGREPORT "${PACKAGE_URL}/issues")

Expand Down
6 changes: 6 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2020-02-01 Youri Hoogstrate

* v1.7.1
* Fixed an errornous syscall (when `ls -l` requests a certain xattr
* Set chmods to 0555 and 0777

2020-01-27 Youri Hoogstrate

* v1.7.0
Expand Down
15 changes: 9 additions & 6 deletions src/fuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,33 +67,36 @@ static int do_getattr(const char *path, struct stat *st)
// st_size: This specifies the size of a regular file in bytes. For files that are really devices this field isn’t usually meaningful. For symbolic links this specifies the length of the file name the link refers to.
st->st_uid = getuid(); // The owner of the file/directory is the user who mounted the filesystem
st->st_gid = getgid(); // The group of the file/directory is the same as the group of the user who mounted the filesystem

st->st_atime = time(NULL); // The last "a"ccess of the file/directory is right now
st->st_mtime = time(NULL); // The last "m"odification of the file/directory is right now

st->st_nlink = 1;

printf("[%s]\n", path);
if(strcmp(path, "/") == 0) {
//st->st_mode = S_IFREG | 0644;
//st->st_mode = S_IFREG | 0444;
//st->st_nlink = 1;
//st->st_size = 1024;
//directory
st->st_mode = S_IFDIR | 0755;
st->st_mode = S_IFDIR | 0555;
st->st_nlink = 2; // Why "two" hardlinks instead of "one"? The answer is here: http://unix.stackexchange.com/a/101536
} else if(strlen(path) == 4 && strncmp(path, "/seq", 4) == 0) {
//directory
//printf("setting to DIR because /seq\n");
st->st_mode = S_IFDIR | 0755;
st->st_mode = S_IFDIR | 0555;
st->st_nlink = 1;
} else if(strlen(path) > 4 && strncmp(path, "/seq/", 5) == 0) {
// API: "/seq/chr1:123-456"
printf("setting to FILE [%s] because /seq/...\n", path);
// @ todo - run a check on wether the chr exists and return err otherwise
st->st_mode = S_IFREG | 0644;
st->st_mode = S_IFREG | 0444;
st->st_nlink = 1;

//@todo this needs to be defined with some api stuff:!!
st->st_size = (signed int) ffi->f->view_sequence_region_size(ffi->cache_p0, (strchr(path, '/') + 5));
} else {
st->st_mode = S_IFREG | 0644;
st->st_mode = S_IFREG | 0444;
st->st_nlink = 1;

if(ffi->from_fastafs) {
Expand Down Expand Up @@ -271,7 +274,7 @@ static int do_getxattr(const char* path, const char* name, char* value, size_t s
}
}

return -1; // returns -1 on other files
return ENODATA; // returns -1 on other files
}


Expand Down

0 comments on commit 87dc480

Please sign in to comment.