fixed inode number callback
This commit is contained in:
parent
f240180a66
commit
f816ea919c
@ -41,4 +41,5 @@ class FilesOperation {
|
||||
int fischl_write(const char *, const char *, size_t, off_t, struct fuse_file_info *);
|
||||
int fischl_read(const char *, char *, size_t, off_t, struct fuse_file_info *);
|
||||
int fischl_utimens(const char *path, const struct timespec tv[2], struct fuse_file_info *fi);
|
||||
int fischl_statfs(const char* path, struct statvfs* stbuf);
|
||||
};
|
@ -495,6 +495,7 @@ int FilesOperation::fischl_chown(const char *path, uid_t uid, gid_t gid, struct
|
||||
|
||||
|
||||
int FilesOperation::fischl_unlink(const char* path) {
|
||||
|
||||
char *pathdup = strdup(path);
|
||||
char *lastSlash = strrchr(pathdup, '/');
|
||||
*lastSlash = '\0';
|
||||
@ -964,4 +965,14 @@ int FilesOperation::fischl_utimens(const char *path, const struct timespec tv[2]
|
||||
inode.metadata.modification_time = (u_int64_t)tv[1].tv_sec * 1000000000ULL + tv[1].tv_nsec;
|
||||
fs->inode_manager->save_inode(&inode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int FilesOperation::fischl_statfs(const char* path, struct statvfs* stbuf) {
|
||||
stbuf->f_bsize = 4096;
|
||||
stbuf->f_blocks = 0;
|
||||
stbuf->f_bfree = 0;
|
||||
stbuf->f_files = 0;
|
||||
stbuf->f_ffree = 0;
|
||||
stbuf->f_namemax = 256;
|
||||
return 0;
|
||||
}
|
@ -33,6 +33,7 @@ static const struct fuse_opt option_spec[] = {
|
||||
};
|
||||
|
||||
void* fischl_init(struct fuse_conn_info *conn, struct fuse_config *cfg) {
|
||||
cfg->use_ino = 1;
|
||||
options.fsop->initialize_rootinode();
|
||||
}
|
||||
|
||||
@ -126,7 +127,7 @@ static int fischl_write(const char *path, const char *buf, size_t size, off_t of
|
||||
}
|
||||
|
||||
static int fischl_statfs(const char* path, struct statvfs* stbuf) {
|
||||
return -1;
|
||||
return options.fsop->fischl_statfs(path, stbuf);
|
||||
}
|
||||
|
||||
static int fischl_release(const char* path, struct fuse_file_info *fi) {
|
||||
@ -156,7 +157,7 @@ static const struct fuse_operations fischl_oper = {
|
||||
.open = fischl_open,
|
||||
.read = fischl_read,
|
||||
.write = fischl_write,
|
||||
//.statfs = fischl_statfs,
|
||||
.statfs = fischl_statfs,
|
||||
.release = fischl_release,
|
||||
/*
|
||||
#ifdef HAVE_SETXATTR
|
||||
|
Loading…
x
Reference in New Issue
Block a user