Browse Source

checkpoint

debug
Antonio SJ Musumeci 4 years ago
parent
commit
96095d1fce
  1. 27
      libfuse/lib/ansi.h
  2. 67
      libfuse/lib/fuse.c
  3. 549
      libfuse/lib/fuse_lowlevel.c

27
libfuse/lib/ansi.h

@ -0,0 +1,27 @@
#pragma once
#define ANSI_RESET "\033[00m"
#define ANSI_BOLD "\033[1m"
#define ANSI_DARK "\033[2m"
#define ANSI_UNDERLINE "\033[4m"
#define ANSI_BLINK "\033[5m"
#define ANSI_REVERSE "\033[7m"
#define ANSI_CONCEALED "\033[8m"
#define ANSI_GRAY "\033[30m"
#define ANSI_GREY "\033[30m"
#define ANSI_RED "\033[31m"
#define ANSI_GREEN "\033[32m"
#define ANSI_YELLOW "\033[33m"
#define ANSI_BLUE "\033[34m"
#define ANSI_MAGENTA "\033[35m"
#define ANSI_CYAN "\033[36m"
#define ANSI_WHITE "\033[37m"
#define ANSI_BG_GRAY "\033[40m"
#define ANSI_BG_GREY "\033[40m"
#define ANSI_BG_RED "\033[41m"
#define ANSI_BG_GREEN "\033[42m"
#define ANSI_BG_YELLOW "\033[43m"
#define ANSI_BG_BLUE "\033[44m"
#define ANSI_BG_MAGENTA "\033[45m"
#define ANSI_BG_CYAN "\033[46m"
#define ANSI_BG_WHITE "\033[47m"

67
libfuse/lib/fuse.c

@ -1549,20 +1549,17 @@ req_fuse(fuse_req_t req)
} }
int int
fuse_fs_getattr(struct fuse_fs *fs,
const char *path,
struct stat *buf,
fuse_timeouts_t *timeout)
fuse_fs_getattr(struct fuse_fs *fs_,
const char *path_,
struct stat *buf_,
fuse_timeouts_t *timeout_)
{ {
if(fs->op.getattr == NULL)
if(fs_->op.getattr == NULL)
return -ENOSYS; return -ENOSYS;
if(fs->debug)
fprintf(stderr,"getattr %s\n",path);
fuse_get_context()->private_data = fs->user_data;
fuse_get_context()->private_data = fs_->user_data;
return fs->op.getattr(path,buf,timeout);
return fs_->op.getattr(path_,buf_,timeout_);
} }
int int
@ -2872,11 +2869,10 @@ fuse_lib_forget_multi(fuse_req_t req,
static static
void void
fuse_lib_getattr(fuse_req_t req,
fuse_ino_t ino,
fuse_file_info_t *fi)
fuse_lib_getattr(fuse_req_t req_,
fuse_ino_t ino_,
fuse_file_info_t *fi_)
{ {
int err; int err;
char *path; char *path;
struct fuse *f; struct fuse *f;
@ -2885,15 +2881,15 @@ fuse_lib_getattr(fuse_req_t req,
fuse_timeouts_t timeout; fuse_timeouts_t timeout;
fuse_file_info_t ffi = {0}; fuse_file_info_t ffi = {0};
f = req_fuse_prepare(req);
if(fi == NULL)
f = req_fuse_prepare(req_);
if(fi_ == NULL)
{ {
pthread_mutex_lock(&f->lock); pthread_mutex_lock(&f->lock);
node = get_node(f,ino);
node = get_node(f,ino_);
if(node->is_hidden) if(node->is_hidden)
{ {
fi = &ffi;
fi->fh = node->hidden_fh;
fi_ = &ffi;
fi_->fh = node->hidden_fh;
} }
pthread_mutex_unlock(&f->lock); pthread_mutex_unlock(&f->lock);
} }
@ -2902,44 +2898,44 @@ fuse_lib_getattr(fuse_req_t req,
err = 0; err = 0;
path = NULL; path = NULL;
if((fi == NULL) || (f->fs->op.fgetattr == NULL))
err = get_path(f,ino,&path);
if((fi_ == NULL) || (f->fs->op.fgetattr == NULL))
err = get_path(f,ino_,&path);
if(!err) if(!err)
{ {
err = ((fi == NULL) ?
err = ((fi_ == NULL) ?
fuse_fs_getattr(f->fs,path,&buf,&timeout) : fuse_fs_getattr(f->fs,path,&buf,&timeout) :
fuse_fs_fgetattr(f->fs,&buf,fi,&timeout));
fuse_fs_fgetattr(f->fs,&buf,fi_,&timeout));
free_path(f,ino,path);
free_path(f,ino_,path);
} }
if(!err) if(!err)
{ {
pthread_mutex_lock(&f->lock); pthread_mutex_lock(&f->lock);
node = get_node(f,ino);
node = get_node(f,ino_);
update_stat(node,&buf); update_stat(node,&buf);
pthread_mutex_unlock(&f->lock); pthread_mutex_unlock(&f->lock);
set_stat(f,ino,&buf);
fuse_reply_attr(req,&buf,timeout.attr);
set_stat(f,ino_,&buf);
fuse_reply_attr(req_,&buf,timeout.attr);
} }
else else
{ {
reply_err(req,err);
reply_err(req_,err);
} }
} }
int int
fuse_fs_chmod(struct fuse_fs *fs,
const char *path,
mode_t mode)
fuse_fs_chmod(struct fuse_fs *fs_,
const char *path_,
mode_t mode_)
{ {
if(fs->op.chmod == NULL)
if(fs_->op.chmod == NULL)
return -ENOSYS; return -ENOSYS;
fuse_get_context()->private_data = fs->user_data;
fuse_get_context()->private_data = fs_->user_data;
return fs->op.chmod(path,mode);
return fs_->op.chmod(path_,mode_);
} }
int int
@ -2963,7 +2959,7 @@ fuse_lib_setattr(fuse_req_t req,
int valid, int valid,
fuse_file_info_t *fi) fuse_file_info_t *fi)
{ {
struct fuse *f = req_fuse_prepare(req);
struct fuse *f;
struct stat buf; struct stat buf;
char *path; char *path;
int err; int err;
@ -2971,6 +2967,7 @@ fuse_lib_setattr(fuse_req_t req,
fuse_timeouts_t timeout; fuse_timeouts_t timeout;
fuse_file_info_t ffi = {0}; fuse_file_info_t ffi = {0};
f = req_fuse_prepare(req);
if(fi == NULL) if(fi == NULL)
{ {
pthread_mutex_lock(&f->lock); pthread_mutex_lock(&f->lock);

549
libfuse/lib/fuse_lowlevel.c
File diff suppressed because it is too large
View File

Loading…
Cancel
Save