Conversation
|
|
||
| if (err != NULL) { | ||
| read_len = 0; | ||
| fprintf(stderr, "Read fail.\n"); |
There was a problem hiding this comment.
Seems like you might want a more verbose error message here.
| lcl_mode = hash_read_value->mode; | ||
| *owner = hash_read_value->owner; | ||
| *group = hash_read_value->group; | ||
| } else { |
There was a problem hiding this comment.
Is it possible that the meta file is deleted in this branch with the call to unlink but the process dies before a call that writes it to the hash?
There was a problem hiding this comment.
that is true, should do a put here
| @@ -341,11 +394,11 @@ int read_meta_file(char path[PATH_MAX], mode_t *mode, uid_t *owner, gid_t *group | |||
| int write_meta_file(char path[PATH_MAX], mode_t mode, uid_t owner, gid_t group, | |||
There was a problem hiding this comment.
I think you should rename this function.
|
|
||
| if ((status == 0) && (addr > 0)) { | ||
| ht_value = malloc(sizeof(diskhash_struct_t)); | ||
| ht_value->mode = dtoo(mode); |
There was a problem hiding this comment.
If we aren't saving the mode in a human-readable file anymore, maybe we should just abandon the otod and dtoo conversions?
There was a problem hiding this comment.
not going to do this just yet, need to convince myself that everyone expects it one way. i know we we check permissions we want it in the octal format. everywhere else maybe decimal format
|
|
||
| options = leveldb_options_create(); | ||
| leveldb_options_set_create_if_missing(options, 1); | ||
| db = leveldb_open(options, "/tmp/testExtract/testdb", &err); |
There was a problem hiding this comment.
I think test terminology should be changed.
| ht_value->group = group; | ||
| leveldb_put(db, woptions, (char *)&addr, sizeof(ino_t), (char *)ht_value, sizeof(diskhash_struct_t), &err); | ||
| if (err != NULL) { | ||
| fprintf(stderr, "Write fail.\n"); |
There was a problem hiding this comment.
Think you may end up wanting a more verbose error message here as well.
src/extension/fake_id0/mk.c
Outdated
| if(status == 1) | ||
| return 0; | ||
|
|
||
| /* If the file already existed get iyt*/ |
There was a problem hiding this comment.
Typo in this comment could be misread as 'it' instead of 'out'.
| *group = config->egid; | ||
| *mode = otod(755); | ||
| return 0; | ||
| int status; |
There was a problem hiding this comment.
I think you might have an easier time removing metafile functionality during a later refactor if you extracted the leveldb read into its own routine, and did metafile reading fallback if that routine fails. At the very least, I think it would be useful to have clearer semantics concerning what read_meta_file does. It's called in a lot of places, but "reading a meta file" isn't really the intent of this function anymore.
src/extension/fake_id0/open.c
Outdated
| return 0; | ||
| } | ||
|
|
||
| /** Handles open, openat, and creat syscalls. Creates meta files to match the |
There was a problem hiding this comment.
This comment seems a little disingenuous, and it comes down again to the naming convention of writing/reading "meta files". It seems like that's not really what we're trying to accomplish anymore.
src/extension/fake_id0/fake_id0.c
Outdated
| Config *config; | ||
| int uid, gid; | ||
|
|
||
| #ifdef USERLAND |
There was a problem hiding this comment.
Do we use this definition everywhere we make calls to read_ and write_ meta files now? Otherwise, what happens when access to the hash is attempted?
| return status; | ||
|
|
||
| perms = get_permissions(meta_path, config, 0); | ||
| perms = get_permissions(path, config, 0); |
There was a problem hiding this comment.
This should be shorten_path not path. $^%&!
…ll open_exit_end routine
…ing or writing meta info
|
Wouldn't it be easier to store the metadata in extended attributes? Otherwise, the file system and the database must kept in sync, when files or whole folders are renamed. |
|
@Unrud that is a really great idea! I stopped looking at this because I found that there was still too much of a performance impact of keeping track of the emulated file ownership and such. There is a reasonable impact to intercepting system calls that happen often like open (which sets the initial ownership and permissions of a new file). This idea though, might make it worthwhile to revisit this. |
|
Really brilliant idea if it works though. |
Going to do much more testing now, but wanted to get this out, so we could get a code review going