mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 02:48:59 -04:00
Misc cleanup
This commit is contained in:
parent
a5a6c892b9
commit
a0cff637e1
19 changed files with 272 additions and 446 deletions
|
|
@ -33,4 +33,3 @@ void msgbuf_clear();
|
|||
void msgbuf_gc();
|
||||
|
||||
u64 msgbuf_alloc_count();
|
||||
u64 msgbuf_avail_count();
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include <time.h>
|
||||
|
||||
#define PARAM(inarg) (((char *)(inarg)) + sizeof(*(inarg)))
|
||||
#define STRERR_BUF_SIZE 128
|
||||
|
||||
static
|
||||
void
|
||||
|
|
@ -230,59 +231,7 @@ _open_flag_to_str(const uint64_t offset_)
|
|||
static
|
||||
const
|
||||
char*
|
||||
_fuse_flag_to_str(const uint64_t offset_)
|
||||
{
|
||||
switch(1ULL << offset_)
|
||||
{
|
||||
FUSE_INIT_FLAG_CASE(ASYNC_READ);
|
||||
FUSE_INIT_FLAG_CASE(POSIX_LOCKS);
|
||||
FUSE_INIT_FLAG_CASE(FILE_OPS);
|
||||
FUSE_INIT_FLAG_CASE(ATOMIC_O_TRUNC);
|
||||
FUSE_INIT_FLAG_CASE(EXPORT_SUPPORT);
|
||||
FUSE_INIT_FLAG_CASE(BIG_WRITES);
|
||||
FUSE_INIT_FLAG_CASE(DONT_MASK);
|
||||
FUSE_INIT_FLAG_CASE(SPLICE_WRITE);
|
||||
FUSE_INIT_FLAG_CASE(SPLICE_MOVE);
|
||||
FUSE_INIT_FLAG_CASE(SPLICE_READ);
|
||||
FUSE_INIT_FLAG_CASE(FLOCK_LOCKS);
|
||||
FUSE_INIT_FLAG_CASE(HAS_IOCTL_DIR);
|
||||
FUSE_INIT_FLAG_CASE(AUTO_INVAL_DATA);
|
||||
FUSE_INIT_FLAG_CASE(DO_READDIRPLUS);
|
||||
FUSE_INIT_FLAG_CASE(READDIRPLUS_AUTO);
|
||||
FUSE_INIT_FLAG_CASE(ASYNC_DIO);
|
||||
FUSE_INIT_FLAG_CASE(WRITEBACK_CACHE);
|
||||
FUSE_INIT_FLAG_CASE(NO_OPEN_SUPPORT);
|
||||
FUSE_INIT_FLAG_CASE(PARALLEL_DIROPS);
|
||||
FUSE_INIT_FLAG_CASE(HANDLE_KILLPRIV);
|
||||
FUSE_INIT_FLAG_CASE(POSIX_ACL);
|
||||
FUSE_INIT_FLAG_CASE(ABORT_ERROR);
|
||||
FUSE_INIT_FLAG_CASE(MAX_PAGES);
|
||||
FUSE_INIT_FLAG_CASE(CACHE_SYMLINKS);
|
||||
FUSE_INIT_FLAG_CASE(NO_OPENDIR_SUPPORT);
|
||||
FUSE_INIT_FLAG_CASE(EXPLICIT_INVAL_DATA);
|
||||
FUSE_INIT_FLAG_CASE(MAP_ALIGNMENT);
|
||||
FUSE_INIT_FLAG_CASE(SUBMOUNTS);
|
||||
FUSE_INIT_FLAG_CASE(HANDLE_KILLPRIV_V2);
|
||||
FUSE_INIT_FLAG_CASE(SETXATTR_EXT);
|
||||
FUSE_INIT_FLAG_CASE(INIT_EXT);
|
||||
FUSE_INIT_FLAG_CASE(INIT_RESERVED);
|
||||
FUSE_INIT_FLAG_CASE(SECURITY_CTX);
|
||||
FUSE_INIT_FLAG_CASE(HAS_INODE_DAX);
|
||||
FUSE_INIT_FLAG_CASE(CREATE_SUPP_GROUP);
|
||||
FUSE_INIT_FLAG_CASE(HAS_EXPIRE_ONLY);
|
||||
FUSE_INIT_FLAG_CASE(DIRECT_IO_ALLOW_MMAP);
|
||||
FUSE_INIT_FLAG_CASE(PASSTHROUGH);
|
||||
FUSE_INIT_FLAG_CASE(NO_EXPORT_SUPPORT);
|
||||
FUSE_INIT_FLAG_CASE(HAS_RESEND);
|
||||
FUSE_INIT_FLAG_CASE(ALLOW_IDMAP);
|
||||
FUSE_INIT_FLAG_CASE(OVER_IO_URING);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::string
|
||||
fuse_debug_init_flag_name(const uint64_t flag_)
|
||||
_fuse_init_flag_name(const uint64_t flag_)
|
||||
{
|
||||
switch(flag_)
|
||||
{
|
||||
|
|
@ -330,11 +279,26 @@ fuse_debug_init_flag_name(const uint64_t flag_)
|
|||
FUSE_INIT_FLAG_CASE(OVER_IO_URING);
|
||||
}
|
||||
|
||||
return "unknown";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#undef FUSE_INIT_FLAG_CASE
|
||||
|
||||
static
|
||||
const
|
||||
char*
|
||||
_fuse_flag_to_str(const uint64_t offset_)
|
||||
{
|
||||
return ::_fuse_init_flag_name(1ULL << offset_);
|
||||
}
|
||||
|
||||
std::string
|
||||
fuse_debug_init_flag_name(const uint64_t flag_)
|
||||
{
|
||||
const char *s = ::_fuse_init_flag_name(flag_);
|
||||
return s ? s : "unknown";
|
||||
}
|
||||
|
||||
static
|
||||
std::string
|
||||
_open_flags_str(const uint32_t flags_)
|
||||
|
|
@ -524,7 +488,7 @@ _debug_fuse_lookup(const void *arg_)
|
|||
|
||||
fmt::print(output.get(),
|
||||
"name={}\n",
|
||||
:: _quoted(name));
|
||||
::_quoted(name));
|
||||
}
|
||||
|
||||
static
|
||||
|
|
@ -644,7 +608,7 @@ _debug_fuse_unlink(const void *arg_)
|
|||
fmt::print(output.get(),
|
||||
"name={}"
|
||||
"\n",
|
||||
:: _quoted(name));
|
||||
::_quoted(name));
|
||||
}
|
||||
|
||||
static
|
||||
|
|
@ -658,7 +622,7 @@ _debug_fuse_rmdir(const void *arg_)
|
|||
fmt::print(output.get(),
|
||||
"name={}"
|
||||
"\n",
|
||||
:: _quoted(name));
|
||||
::_quoted(name));
|
||||
}
|
||||
|
||||
static
|
||||
|
|
@ -720,7 +684,7 @@ _debug_fuse_link_in(const void *arg_)
|
|||
" name={}"
|
||||
"\n",
|
||||
arg->oldnodeid,
|
||||
:: _quoted(name));
|
||||
::_quoted(name));
|
||||
}
|
||||
|
||||
static
|
||||
|
|
@ -913,7 +877,7 @@ _debug_fuse_getxattr_in(const void *arg_)
|
|||
" name={}"
|
||||
"\n",
|
||||
arg->size,
|
||||
:: _quoted(name));
|
||||
::_quoted(name));
|
||||
}
|
||||
|
||||
static
|
||||
|
|
@ -941,7 +905,7 @@ _debug_fuse_removexattr(const void *arg_)
|
|||
fmt::print(output.get(),
|
||||
"name={}"
|
||||
"\n",
|
||||
:: _quoted(name));
|
||||
::_quoted(name));
|
||||
}
|
||||
|
||||
static
|
||||
|
|
@ -1176,31 +1140,6 @@ _debug_fuse_statx_in(const void *arg_)
|
|||
arg->sx_mask);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
_debug_fuse_tmpfile_in(const void *arg_)
|
||||
{
|
||||
auto output = fuse_cfg.log_file();
|
||||
|
||||
const char *name;
|
||||
const struct fuse_create_in *arg = (const fuse_create_in*)arg_;
|
||||
|
||||
name = PARAM(arg);
|
||||
|
||||
fmt::print(output.get(),
|
||||
"mode={:o}"
|
||||
" umask={:o}"
|
||||
" name={}"
|
||||
" flags=0x{:08X}"
|
||||
" flags_str=\"{}\""
|
||||
"\n",
|
||||
arg->mode,
|
||||
arg->umask,
|
||||
_quoted(name),
|
||||
arg->flags,
|
||||
_open_flags_str(arg->flags));
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
_debug_init_in(const struct fuse_init_in *arg_)
|
||||
|
|
@ -1309,9 +1248,8 @@ fuse_debug_init_out(const uint64_t unique_,
|
|||
auto output = fuse_cfg.log_file();
|
||||
|
||||
uint64_t flags;
|
||||
const struct fuse_init_out *arg = arg_;
|
||||
|
||||
flags = (((uint64_t)arg->flags) | ((uint64_t)arg->flags2) << 32);
|
||||
flags = (((uint64_t)arg_->flags) | ((uint64_t)arg_->flags2) << 32);
|
||||
fmt::print(output.get(),
|
||||
"ts={}"
|
||||
" dir=OUT"
|
||||
|
|
@ -1333,17 +1271,17 @@ fuse_debug_init_out(const uint64_t unique_,
|
|||
_timestamp_ns(),
|
||||
unique_,
|
||||
sizeof(struct fuse_out_header) + argsize_,
|
||||
arg->major,
|
||||
arg->minor,
|
||||
arg->max_readahead,
|
||||
arg_->major,
|
||||
arg_->minor,
|
||||
arg_->max_readahead,
|
||||
flags,
|
||||
_fuse_init_flags_str(flags),
|
||||
arg->max_background,
|
||||
arg->congestion_threshold,
|
||||
arg->max_write,
|
||||
arg->time_gran,
|
||||
arg->max_pages,
|
||||
arg->map_alignment);
|
||||
arg_->max_background,
|
||||
arg_->congestion_threshold,
|
||||
arg_->max_write,
|
||||
arg_->time_gran,
|
||||
arg_->max_pages,
|
||||
arg_->map_alignment);
|
||||
}
|
||||
|
||||
static
|
||||
|
|
@ -1718,7 +1656,7 @@ fuse_debug_in_header(const struct fuse_in_header *hdr_)
|
|||
_debug_fuse_copy_file_range_in(arg);
|
||||
break;
|
||||
case FUSE_TMPFILE:
|
||||
_debug_fuse_tmpfile_in(arg);
|
||||
_debug_fuse_create_in(arg);
|
||||
break;
|
||||
case FUSE_STATX:
|
||||
_debug_fuse_statx_in(arg);
|
||||
|
|
@ -1742,7 +1680,7 @@ fuse_debug_out_header(const struct fuse_out_header *hdr_)
|
|||
{
|
||||
auto output = fuse_cfg.log_file();
|
||||
|
||||
char strerror_buf[128];
|
||||
char strerror_buf[STRERR_BUF_SIZE];
|
||||
|
||||
fmt::print(output.get(),
|
||||
"ts={}"
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
#include <vector>
|
||||
|
||||
#include <assert.h>
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <inttypes.h>
|
||||
|
|
@ -50,7 +49,6 @@
|
|||
#include <string.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/uio.h>
|
||||
|
|
@ -64,14 +62,15 @@
|
|||
#define FUSE_UNKNOWN_INO UINT64_MAX
|
||||
#define OFFSET_MAX 0x7fffffffffffffffLL
|
||||
|
||||
#define PATH_BUFSIZE_HALF_MAX 0x80000000u
|
||||
#define PATH_BUFSIZE_MAX 0xffffffffu
|
||||
|
||||
#define INFO_FILE_MAX_SIZE (1024 * 1024)
|
||||
|
||||
#define NODE_TABLE_MIN_SIZE 8192
|
||||
|
||||
#define PARAM(inarg) ((void*)(((char*)(inarg)) + sizeof(*(inarg))))
|
||||
|
||||
struct fuse_config
|
||||
{
|
||||
};
|
||||
|
||||
struct lock_queue_element
|
||||
{
|
||||
struct lock_queue_element *next;
|
||||
|
|
@ -124,7 +123,6 @@ struct fuse
|
|||
nodeid_gen_t nodeid_gen;
|
||||
unsigned int hidectr;
|
||||
mutex_t lock;
|
||||
struct fuse_config conf;
|
||||
fuse_operations ops;
|
||||
struct lock_queue_element *lockq;
|
||||
|
||||
|
|
@ -689,8 +687,8 @@ add_name(char **buf,
|
|||
|
||||
while(newbufsize < pathlen + len + 1)
|
||||
{
|
||||
if(newbufsize >= 0x80000000)
|
||||
newbufsize = 0xffffffff;
|
||||
if(newbufsize >= PATH_BUFSIZE_HALF_MAX)
|
||||
newbufsize = PATH_BUFSIZE_MAX;
|
||||
else
|
||||
newbufsize *= 2;
|
||||
}
|
||||
|
|
@ -1646,17 +1644,6 @@ fuse_lib_setattr(fuse_req_t *req_,
|
|||
f.ops.utimens(&req_->ctx,&fusepath[1],tv) :
|
||||
f.ops.futimens(&req_->ctx,fh,tv));
|
||||
}
|
||||
else if(!err && ((arg->valid & (FATTR_ATIME|FATTR_MTIME)) == (FATTR_ATIME|FATTR_MTIME)))
|
||||
{
|
||||
struct timespec tv[2];
|
||||
tv[0].tv_sec = arg->atime;
|
||||
tv[0].tv_nsec = arg->atimensec;
|
||||
tv[1].tv_sec = arg->mtime;
|
||||
tv[1].tv_nsec = arg->mtimensec;
|
||||
err = ((fusepath != NULL) ?
|
||||
f.ops.utimens(&req_->ctx,&fusepath[1],tv) :
|
||||
f.ops.futimens(&req_->ctx,fh,tv));
|
||||
}
|
||||
|
||||
if(!err)
|
||||
err = ((fusepath != NULL) ?
|
||||
|
|
@ -2245,8 +2232,6 @@ fuse_lib_write(fuse_req_t *req_,
|
|||
data,
|
||||
arg->size,
|
||||
arg->offset);
|
||||
free_path(hdr_->nodeid,NULL);
|
||||
|
||||
if(res >= 0)
|
||||
fuse_reply_write(req_,res);
|
||||
else
|
||||
|
|
@ -3535,28 +3520,6 @@ fuse_exit()
|
|||
f.se->exited = 1;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
KEY_HELP,
|
||||
};
|
||||
|
||||
#define FUSE_LIB_OPT(t,p,v) { t,offsetof(struct fuse_config,p),v }
|
||||
|
||||
static const struct fuse_opt fuse_lib_opts[] =
|
||||
{
|
||||
FUSE_OPT_END
|
||||
};
|
||||
|
||||
static
|
||||
int
|
||||
fuse_lib_opt_proc(void *data,
|
||||
const char *arg,
|
||||
int key,
|
||||
struct fuse_args *outargs)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
node_table_init(struct node_table *t)
|
||||
|
|
@ -3601,7 +3564,6 @@ metrics_log_nodes_info(FILE *file_)
|
|||
"node name_table total allocated memory: %" PRIu64 "\n"
|
||||
"msgbuf bufsize: %" PRIu64 "\n"
|
||||
"msgbuf allocation count: %" PRIu64 "\n"
|
||||
"msgbuf available count: %" PRIu64 "\n"
|
||||
"msgbuf total allocated memory: %" PRIu64 "\n"
|
||||
"\n"
|
||||
,
|
||||
|
|
@ -3615,7 +3577,6 @@ metrics_log_nodes_info(FILE *file_)
|
|||
(uint64_t)(f.name_table.size * sizeof(node_t*)),
|
||||
msgbuf_get_bufsize(),
|
||||
msgbuf_alloc_count(),
|
||||
msgbuf_avail_count(),
|
||||
msgbuf_alloc_count() * msgbuf_get_bufsize()
|
||||
);
|
||||
|
||||
|
|
@ -3631,12 +3592,11 @@ metrics_log_nodes_info_to_tmp_dir(struct fuse *f_)
|
|||
char filepath[256];
|
||||
struct stat st;
|
||||
char const *mode = "a";
|
||||
off_t const max_size = (1024 * 1024);
|
||||
|
||||
sprintf(filepath,"/tmp/mergerfs.%d.info",getpid());
|
||||
|
||||
rv = lstat(filepath,&st);
|
||||
if((rv == 0) && (st.st_size > max_size))
|
||||
if((rv == 0) && (st.st_size > INFO_FILE_MAX_SIZE))
|
||||
mode = "w";
|
||||
|
||||
file = fopen(filepath,mode);
|
||||
|
|
@ -3752,9 +3712,6 @@ fuse_new(int fd_,
|
|||
llop.setlk = NULL;
|
||||
}
|
||||
|
||||
if(fuse_opt_parse(args,&f.conf,fuse_lib_opts,fuse_lib_opt_proc) == -1)
|
||||
goto out_free_fs;
|
||||
|
||||
f.se = fuse_lowlevel_new_common(args,&llop,sizeof(llop),&f);
|
||||
if(f.se == NULL)
|
||||
goto out_free_fs;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@
|
|||
/* 32KB - same as glibc getdents buffer size */
|
||||
#define DENTS_BUF_EXPAND_SIZE (1024 * 32)
|
||||
|
||||
/* Initial pre-allocated capacity for directory-entry offset vector */
|
||||
#define DENTS_OFFS_INITIAL_CAPACITY 64
|
||||
|
||||
static
|
||||
uint64_t
|
||||
_round_up(const uint64_t number_,
|
||||
|
|
@ -146,7 +149,7 @@ fuse_dirents_init(fuse_dirents_t *d_)
|
|||
return -ENOMEM;
|
||||
|
||||
kv_init(d_->offs);
|
||||
kv_resize(uint32_t,d_->offs,64);
|
||||
kv_resize(uint32_t,d_->offs,DENTS_OFFS_INITIAL_CAPACITY);
|
||||
kv_push(uint32_t,d_->offs,0);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@
|
|||
|
||||
#include "extern_c.h"
|
||||
|
||||
struct fuse_ll;
|
||||
|
||||
/* Simplified fuse_session - fields inlined from former fuse_chan
|
||||
* Since mergerfs only supports one mount, we collapse the hierarchy:
|
||||
* fuse_session -> fuse_chan -> fd
|
||||
|
|
@ -54,13 +52,6 @@ struct fuse_notify_req
|
|||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
struct fuse *fuse_new_common(int fd,
|
||||
size_t bufsize,
|
||||
struct fuse_args *args,
|
||||
const struct fuse_operations *op);
|
||||
|
||||
|
||||
|
||||
struct fuse_session *fuse_lowlevel_new_common(struct fuse_args *args,
|
||||
const struct fuse_lowlevel_ops *op,
|
||||
size_t op_size, void *userdata);
|
||||
|
|
@ -70,12 +61,6 @@ struct fuse_session *fuse_lowlevel_new_common(struct fuse_args *args,
|
|||
void fuse_kern_unmount(const char *mountpoint, int fd);
|
||||
int fuse_kern_mount(const char *mountpoint, struct fuse_args *args);
|
||||
|
||||
struct fuse *fuse_setup_common(int argc,
|
||||
char *argv[],
|
||||
const struct fuse_operations *op,
|
||||
char **mountpoint,
|
||||
int *fd);
|
||||
|
||||
int fuse_start_thread(pthread_t *thread_id, void *(*func)(void *), void *arg);
|
||||
|
||||
EXTERN_C_END
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "fuse_msgbuf_t.h"
|
||||
|
||||
int fuse_receive_buf(struct fuse_session *se,
|
||||
fuse_msgbuf_t *msgbuf);
|
||||
void fuse_process_buf(void *data,
|
||||
const fuse_msgbuf_t *msgbuf,
|
||||
struct fuse_chan *ch);
|
||||
|
|
@ -205,7 +205,7 @@ _calculate_thread_count(const int raw_thread_count_)
|
|||
else if(raw_thread_count_ < 0)
|
||||
{
|
||||
thread_count = (std::thread::hardware_concurrency() / -raw_thread_count_);
|
||||
thread_count = std::min(1,thread_count);
|
||||
thread_count = std::max(1,thread_count);
|
||||
}
|
||||
else if(raw_thread_count_ > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1713,15 +1713,6 @@ fuse_send_enomem(struct fuse_session *se_,
|
|||
fuse_send_errno(se_,ENOMEM,unique_id_);
|
||||
}
|
||||
|
||||
// static
|
||||
// void
|
||||
// fuse_send_einval(struct fuse_ll *f_,
|
||||
// struct fuse_chan *ch_,
|
||||
// const uint64_t unique_id_)
|
||||
// {
|
||||
// fuse_send_errno(f_,ch_,EINVAL,unique_id_);
|
||||
// }
|
||||
|
||||
static
|
||||
int
|
||||
fuse_ll_buf_receive_read(struct fuse_session *se_,
|
||||
|
|
@ -1831,23 +1822,6 @@ fuse_ll_buf_process_read_init(struct fuse_session *se_,
|
|||
return;
|
||||
}
|
||||
|
||||
static const struct fuse_opt fuse_ll_opts[] =
|
||||
{
|
||||
FUSE_OPT_END
|
||||
};
|
||||
|
||||
static
|
||||
int
|
||||
fuse_ll_opt_proc(void *data_,
|
||||
const char *arg_,
|
||||
int key_,
|
||||
struct fuse_args *outargs_)
|
||||
{
|
||||
fmt::print(stderr, "fuse: ERROR - unknown option - '{}'\n", arg_);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* always call fuse_lowlevel_new_common() internally, to work around a
|
||||
* misfeature in the FreeBSD runtime linker, which links the old
|
||||
|
|
@ -1871,9 +1845,6 @@ fuse_lowlevel_new_common(struct fuse_args *args,
|
|||
f.notify_ctr = 1;
|
||||
mutex_init(f.lock);
|
||||
|
||||
if(fuse_opt_parse(args,NULL,fuse_ll_opts,fuse_ll_opt_proc) == -1)
|
||||
goto out_free;
|
||||
|
||||
memcpy(&f.op,op,op_size);
|
||||
f.owner = getuid();
|
||||
f.userdata = userdata;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@
|
|||
static u32 g_pagesize = 0;
|
||||
static u64 g_bufsize = 0;
|
||||
|
||||
/* Extra pages: 1 for page-alignment headroom, 1 for fuse_in_header+fuse_write_in alignment */
|
||||
#define MSGBUF_OVERHEAD_PAGES 2
|
||||
|
||||
static
|
||||
__attribute__((constructor))
|
||||
void
|
||||
|
|
@ -145,7 +148,7 @@ msgbuf_get_pagesize()
|
|||
void
|
||||
msgbuf_set_bufsize(const u64 size_in_pages_)
|
||||
{
|
||||
g_bufsize = ((size_in_pages_ + 2) * g_pagesize);
|
||||
g_bufsize = ((size_in_pages_ + MSGBUF_OVERHEAD_PAGES) * g_pagesize);
|
||||
}
|
||||
|
||||
u64
|
||||
|
|
@ -154,12 +157,6 @@ msgbuf_alloc_count()
|
|||
return g_msgbuf_pool.size();
|
||||
}
|
||||
|
||||
u64
|
||||
msgbuf_avail_count()
|
||||
{
|
||||
return g_msgbuf_pool.size();
|
||||
}
|
||||
|
||||
void
|
||||
msgbuf_gc()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,17 +29,19 @@ struct fuse_opt_context
|
|||
void
|
||||
fuse_opt_free_args(struct fuse_args *args)
|
||||
{
|
||||
if (args) {
|
||||
if (args->argv && args->allocated) {
|
||||
int i;
|
||||
for (i = 0; i < args->argc; i++)
|
||||
free(args->argv[i]);
|
||||
free(args->argv);
|
||||
if (args)
|
||||
{
|
||||
if (args->argv && args->allocated)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < args->argc; i++)
|
||||
free(args->argv[i]);
|
||||
free(args->argv);
|
||||
}
|
||||
args->argc = 0;
|
||||
args->argv = NULL;
|
||||
args->allocated = 0;
|
||||
}
|
||||
args->argc = 0;
|
||||
args->argv = NULL;
|
||||
args->allocated = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
|
|
@ -63,10 +65,11 @@ fuse_opt_add_arg(struct fuse_args *args, const char *arg)
|
|||
return alloc_failed();
|
||||
|
||||
newargv = realloc(args->argv, (args->argc + 2) * sizeof(char *));
|
||||
if (!newargv) {
|
||||
free(newarg);
|
||||
return alloc_failed();
|
||||
}
|
||||
if (!newargv)
|
||||
{
|
||||
free(newarg);
|
||||
return alloc_failed();
|
||||
}
|
||||
|
||||
args->argv = newargv;
|
||||
args->allocated = 1;
|
||||
|
|
@ -82,12 +85,14 @@ static int fuse_opt_insert_arg_common(struct fuse_args *args, int pos,
|
|||
if (fuse_opt_add_arg(args, arg) == -1)
|
||||
return -1;
|
||||
|
||||
if (pos != args->argc - 1) {
|
||||
char *newarg = args->argv[args->argc - 1];
|
||||
memmove(&args->argv[pos + 1], &args->argv[pos],
|
||||
sizeof(char *) * (args->argc - pos - 1));
|
||||
args->argv[pos] = newarg;
|
||||
}
|
||||
if (pos != args->argc - 1)
|
||||
|
||||
{
|
||||
char *newarg = args->argv[args->argc - 1];
|
||||
memmove(&args->argv[pos + 1], &args->argv[pos],
|
||||
sizeof(char *) * (args->argc - pos - 1));
|
||||
args->argv[pos] = newarg;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -98,10 +103,11 @@ int fuse_opt_insert_arg(struct fuse_args *args, int pos, const char *arg)
|
|||
|
||||
static int next_arg(struct fuse_opt_context *ctx, const char *opt)
|
||||
{
|
||||
if (ctx->argctr + 1 >= ctx->argc) {
|
||||
fprintf(stderr, "fuse: missing argument after `%s'\n", opt);
|
||||
return -1;
|
||||
}
|
||||
if (ctx->argctr + 1 >= ctx->argc)
|
||||
{
|
||||
fprintf(stderr, "fuse: missing argument after `%s'\n", opt);
|
||||
return -1;
|
||||
}
|
||||
ctx->argctr++;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -120,16 +126,19 @@ static int add_opt_common(char **opts, const char *opt, int esc)
|
|||
return alloc_failed();
|
||||
|
||||
*opts = d;
|
||||
if (oldlen) {
|
||||
d += oldlen;
|
||||
*d++ = ',';
|
||||
}
|
||||
if (oldlen)
|
||||
{
|
||||
d += oldlen;
|
||||
*d++ = ',';
|
||||
}
|
||||
|
||||
for (; *opt; opt++) {
|
||||
if (esc && (*opt == ',' || *opt == '\\'))
|
||||
*d++ = '\\';
|
||||
*d++ = *opt;
|
||||
}
|
||||
for (; *opt; opt++)
|
||||
|
||||
{
|
||||
if (esc && (*opt == ',' || *opt == '\\'))
|
||||
*d++ = '\\';
|
||||
*d++ = *opt;
|
||||
}
|
||||
*d = '\0';
|
||||
|
||||
return 0;
|
||||
|
|
@ -156,11 +165,13 @@ static int call_proc(struct fuse_opt_context *ctx, const char *arg, int key,
|
|||
if (key == FUSE_OPT_KEY_DISCARD)
|
||||
return 0;
|
||||
|
||||
if (key != FUSE_OPT_KEY_KEEP && ctx->proc) {
|
||||
int res = ctx->proc(ctx->data, arg, key, &ctx->outargs);
|
||||
if (res == -1 || !res)
|
||||
return res;
|
||||
}
|
||||
if (key != FUSE_OPT_KEY_KEEP && ctx->proc)
|
||||
|
||||
{
|
||||
int res = ctx->proc(ctx->data, arg, key, &ctx->outargs);
|
||||
if (res == -1 || !res)
|
||||
return res;
|
||||
}
|
||||
if (iso)
|
||||
return add_opt(ctx, arg);
|
||||
else
|
||||
|
|
@ -207,13 +218,14 @@ static int process_opt_param(void *var, const char *format, const char *param,
|
|||
const char *arg)
|
||||
{
|
||||
assert(format[0] == '%');
|
||||
if (format[1] == 's') {
|
||||
char *copy = strdup(param);
|
||||
if (!copy)
|
||||
return alloc_failed();
|
||||
if (format[1] == 's')
|
||||
{
|
||||
char *copy = strdup(param);
|
||||
if (!copy)
|
||||
return alloc_failed();
|
||||
|
||||
*(char **) var = copy;
|
||||
} else {
|
||||
*(char **) var = copy;
|
||||
} else {
|
||||
if (sscanf(param, format, var) != 1) {
|
||||
fprintf(stderr, "fuse: invalid parameter in option `%s'\n", arg);
|
||||
return -1;
|
||||
|
|
@ -226,19 +238,21 @@ static int process_opt(struct fuse_opt_context *ctx,
|
|||
const struct fuse_opt *opt, unsigned sep,
|
||||
const char *arg, int iso)
|
||||
{
|
||||
if (opt->offset == -1U) {
|
||||
if (call_proc(ctx, arg, opt->value, iso) == -1)
|
||||
return -1;
|
||||
} else {
|
||||
void *var = ctx->data + opt->offset;
|
||||
if (sep && opt->templ[sep + 1]) {
|
||||
const char *param = arg + sep;
|
||||
if (opt->templ[sep] == '=')
|
||||
param ++;
|
||||
if (process_opt_param(var, opt->templ + sep + 1,
|
||||
param, arg) == -1)
|
||||
if (opt->offset == -1U)
|
||||
{
|
||||
if (call_proc(ctx, arg, opt->value, iso) == -1)
|
||||
return -1;
|
||||
} else
|
||||
} else {
|
||||
void *var = ctx->data + opt->offset;
|
||||
if (sep && opt->templ[sep + 1])
|
||||
{
|
||||
const char *param = arg + sep;
|
||||
if (opt->templ[sep] == '=')
|
||||
param ++;
|
||||
if (process_opt_param(var, opt->templ + sep + 1,
|
||||
param, arg) == -1)
|
||||
return -1;
|
||||
} else
|
||||
*(int *)var = opt->value;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -272,19 +286,20 @@ static int process_gopt(struct fuse_opt_context *ctx, const char *arg, int iso)
|
|||
{
|
||||
unsigned sep;
|
||||
const struct fuse_opt *opt = find_opt(ctx->opt, arg, &sep);
|
||||
if (opt) {
|
||||
for (; opt; opt = find_opt(opt + 1, arg, &sep)) {
|
||||
int res;
|
||||
if (sep && opt->templ[sep] == ' ' && !arg[sep])
|
||||
res = process_opt_sep_arg(ctx, opt, sep, arg,
|
||||
iso);
|
||||
else
|
||||
res = process_opt(ctx, opt, sep, arg, iso);
|
||||
if (res == -1)
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
} else
|
||||
if (opt)
|
||||
{
|
||||
for (; opt; opt = find_opt(opt + 1, arg, &sep)) {
|
||||
int res;
|
||||
if (sep && opt->templ[sep] == ' ' && !arg[sep])
|
||||
res = process_opt_sep_arg(ctx, opt, sep, arg,
|
||||
iso);
|
||||
else
|
||||
res = process_opt(ctx, opt, sep, arg, iso);
|
||||
if (res == -1)
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
} else
|
||||
return call_proc(ctx, arg, FUSE_OPT_KEY_OPT, iso);
|
||||
}
|
||||
|
||||
|
|
@ -294,36 +309,41 @@ static int process_real_option_group(struct fuse_opt_context *ctx, char *opts)
|
|||
char *d = s;
|
||||
int end = 0;
|
||||
|
||||
while (!end) {
|
||||
if (*s == '\0')
|
||||
end = 1;
|
||||
if (*s == ',' || end) {
|
||||
int res;
|
||||
while (!end)
|
||||
|
||||
*d = '\0';
|
||||
res = process_gopt(ctx, opts, 1);
|
||||
if (res == -1)
|
||||
return -1;
|
||||
d = opts;
|
||||
} else {
|
||||
if (s[0] == '\\' && s[1] != '\0') {
|
||||
s++;
|
||||
if (s[0] >= '0' && s[0] <= '3' &&
|
||||
s[1] >= '0' && s[1] <= '7' &&
|
||||
s[2] >= '0' && s[2] <= '7') {
|
||||
*d++ = (s[0] - '0') * 0100 +
|
||||
(s[1] - '0') * 0010 +
|
||||
(s[2] - '0');
|
||||
s += 2;
|
||||
{
|
||||
if (*s == '\0')
|
||||
end = 1;
|
||||
if (*s == ',' || end)
|
||||
{
|
||||
int res;
|
||||
|
||||
*d = '\0';
|
||||
res = process_gopt(ctx, opts, 1);
|
||||
if (res == -1)
|
||||
return -1;
|
||||
d = opts;
|
||||
} else {
|
||||
if (s[0] == '\\' && s[1] != '\0')
|
||||
{
|
||||
s++;
|
||||
if (s[0] >= '0' && s[0] <= '3' &&
|
||||
s[1] >= '0' && s[1] <= '7' &&
|
||||
s[2] >= '0' && s[2] <= '7')
|
||||
{
|
||||
*d++ = (s[0] - '0') * 0100 +
|
||||
(s[1] - '0') * 0010 +
|
||||
(s[2] - '0');
|
||||
s += 2;
|
||||
} else {
|
||||
*d++ = *s;
|
||||
}
|
||||
} else {
|
||||
*d++ = *s;
|
||||
}
|
||||
} else {
|
||||
*d++ = *s;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -333,10 +353,12 @@ static int process_option_group(struct fuse_opt_context *ctx, const char *opts)
|
|||
int res;
|
||||
char *copy = strdup(opts);
|
||||
|
||||
if (!copy) {
|
||||
fprintf(stderr, "fuse: memory allocation failed\n");
|
||||
return -1;
|
||||
}
|
||||
if (!copy)
|
||||
|
||||
{
|
||||
fprintf(stderr, "fuse: memory allocation failed\n");
|
||||
return -1;
|
||||
}
|
||||
res = process_real_option_group(ctx, copy);
|
||||
free(copy);
|
||||
return res;
|
||||
|
|
@ -346,17 +368,19 @@ static int process_one(struct fuse_opt_context *ctx, const char *arg)
|
|||
{
|
||||
if (ctx->nonopt || arg[0] != '-')
|
||||
return call_proc(ctx, arg, FUSE_OPT_KEY_NONOPT, 0);
|
||||
else if (arg[1] == 'o') {
|
||||
if (arg[2])
|
||||
return process_option_group(ctx, arg + 2);
|
||||
else {
|
||||
if (next_arg(ctx, arg) == -1)
|
||||
return -1;
|
||||
else if (arg[1] == 'o')
|
||||
{
|
||||
if (arg[2])
|
||||
return process_option_group(ctx, arg + 2);
|
||||
else
|
||||
{
|
||||
if (next_arg(ctx, arg) == -1)
|
||||
return -1;
|
||||
|
||||
return process_option_group(ctx,
|
||||
ctx->argv[ctx->argctr]);
|
||||
}
|
||||
} else if (arg[1] == '-' && !arg[2]) {
|
||||
return process_option_group(ctx,
|
||||
ctx->argv[ctx->argctr]);
|
||||
}
|
||||
} else if (arg[1] == '-' && !arg[2]) {
|
||||
if (add_arg(ctx, arg) == -1)
|
||||
return -1;
|
||||
ctx->nonopt = ctx->outargs.argc;
|
||||
|
|
@ -367,20 +391,23 @@ static int process_one(struct fuse_opt_context *ctx, const char *arg)
|
|||
|
||||
static int opt_parse(struct fuse_opt_context *ctx)
|
||||
{
|
||||
if (ctx->argc) {
|
||||
if (add_arg(ctx, ctx->argv[0]) == -1)
|
||||
return -1;
|
||||
}
|
||||
if (ctx->argc)
|
||||
{
|
||||
if (add_arg(ctx, ctx->argv[0]) == -1)
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (ctx->argctr = 1; ctx->argctr < ctx->argc; ctx->argctr++)
|
||||
if (process_one(ctx, ctx->argv[ctx->argctr]) == -1)
|
||||
return -1;
|
||||
|
||||
if (ctx->opts) {
|
||||
if (fuse_opt_insert_arg(&ctx->outargs, 1, "-o") == -1 ||
|
||||
fuse_opt_insert_arg(&ctx->outargs, 2, ctx->opts) == -1)
|
||||
return -1;
|
||||
}
|
||||
if (ctx->opts)
|
||||
|
||||
{
|
||||
if (fuse_opt_insert_arg(&ctx->outargs, 1, "-o") == -1 ||
|
||||
fuse_opt_insert_arg(&ctx->outargs, 2, ctx->opts) == -1)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* If option separator ("--") is the last argument, remove it */
|
||||
if (ctx->nonopt && ctx->nonopt == ctx->outargs.argc &&
|
||||
|
|
@ -409,11 +436,12 @@ int fuse_opt_parse(struct fuse_args *args, void *data,
|
|||
ctx.argv = args->argv;
|
||||
|
||||
res = opt_parse(&ctx);
|
||||
if (res != -1) {
|
||||
struct fuse_args tmp = *args;
|
||||
*args = ctx.outargs;
|
||||
ctx.outargs = tmp;
|
||||
}
|
||||
if (res != -1)
|
||||
{
|
||||
struct fuse_args tmp = *args;
|
||||
*args = ctx.outargs;
|
||||
ctx.outargs = tmp;
|
||||
}
|
||||
free(ctx.opts);
|
||||
fuse_opt_free_args(&ctx.outargs);
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ fuse_session_new(void *data,
|
|||
se->process_buf = process_buf;
|
||||
se->destroy = destroy;
|
||||
se->fd = -1; /* Not yet mounted */
|
||||
se->bufsize = 0;
|
||||
//se->bufsize = 0;
|
||||
|
||||
return se;
|
||||
}
|
||||
|
|
@ -82,19 +82,6 @@ fuse_session_data(struct fuse_session *se)
|
|||
return se->f;
|
||||
}
|
||||
|
||||
/* Direct accessors for inlined channel fields */
|
||||
int
|
||||
fuse_session_fd(struct fuse_session *se)
|
||||
{
|
||||
return se->fd;
|
||||
}
|
||||
|
||||
size_t
|
||||
fuse_session_bufsize(struct fuse_session *se)
|
||||
{
|
||||
return se->bufsize;
|
||||
}
|
||||
|
||||
int
|
||||
fuse_session_clearfd(struct fuse_session *se)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -91,12 +91,13 @@ static int add_default_subtype(const char *progname, struct fuse_args *args)
|
|||
else if (basename[1] != '\0')
|
||||
basename++;
|
||||
|
||||
subtype_opt = (char *) malloc(strlen(basename) + 64);
|
||||
size_t optlen = strlen(basename) + 64;
|
||||
subtype_opt = (char *) malloc(optlen);
|
||||
if (subtype_opt == NULL) {
|
||||
fprintf(stderr, "fuse: memory allocation failed\n");
|
||||
return -1;
|
||||
}
|
||||
sprintf(subtype_opt, "-osubtype=%s", basename);
|
||||
snprintf(subtype_opt, optlen, "-osubtype=%s", basename);
|
||||
res = fuse_opt_add_arg(args, subtype_opt);
|
||||
free(subtype_opt);
|
||||
return res;
|
||||
|
|
@ -246,6 +247,7 @@ void fuse_unmount(const char *mountpoint, int fd)
|
|||
fuse_unmount_common(mountpoint, fd);
|
||||
}
|
||||
|
||||
static
|
||||
struct fuse*
|
||||
fuse_setup_common(int argc,
|
||||
char *argv[],
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -10,10 +10,9 @@
|
|||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
pthread_t g_thread;
|
||||
std::vector<std::function<void(int)>> g_funcs;
|
||||
mutex_t g_mutex;
|
||||
static pthread_t g_thread;
|
||||
static std::vector<std::function<void(int)>> g_funcs;
|
||||
static mutex_t g_mutex;
|
||||
|
||||
static
|
||||
void*
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
namespace std
|
||||
{
|
||||
template<class T> struct _Unique_if
|
||||
{
|
||||
typedef unique_ptr<T> _Single_object;
|
||||
};
|
||||
|
||||
template<class T> struct _Unique_if<T[]>
|
||||
{
|
||||
typedef unique_ptr<T[]> _Unknown_bound;
|
||||
};
|
||||
|
||||
template<class T, size_t N> struct _Unique_if<T[N]>
|
||||
{
|
||||
typedef void _Known_bound;
|
||||
};
|
||||
|
||||
template<class T, class... Args>
|
||||
typename _Unique_if<T>::_Single_object
|
||||
make_unique(Args&&... args)
|
||||
{
|
||||
return unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
typename _Unique_if<T>::_Unknown_bound
|
||||
make_unique(size_t n)
|
||||
{
|
||||
typedef typename remove_extent<T>::type U;
|
||||
return unique_ptr<T>(new U[n]());
|
||||
}
|
||||
|
||||
template<class T, class... Args>
|
||||
typename _Unique_if<T>::_Known_bound
|
||||
make_unique(Args&&...) = delete;
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ int fuse_mnt_umount(const char *progname, const char *abs_mnt,
|
|||
int res;
|
||||
|
||||
if (!mtab_needs_update(abs_mnt)) {
|
||||
res = umount2(rel_mnt, lazy ? 2 : 0);
|
||||
res = umount2(rel_mnt, lazy ? MNT_DETACH : 0);
|
||||
if (res == -1)
|
||||
fprintf(stderr, "%s: failed to unmount %s: %s\n",
|
||||
progname, abs_mnt, strerror(errno));
|
||||
|
|
@ -297,13 +297,14 @@ char *fuse_mnt_resolve_path(const char *progname, const char *orig)
|
|||
if (lastcomp == NULL)
|
||||
dst = strdup(buf);
|
||||
else {
|
||||
dst = (char *) malloc(strlen(buf) + 1 + strlen(lastcomp) + 1);
|
||||
unsigned buflen = strlen(buf);
|
||||
size_t dstlen = buflen + 1 + strlen(lastcomp) + 1;
|
||||
dst = (char *) malloc(dstlen);
|
||||
if (dst) {
|
||||
unsigned buflen = strlen(buf);
|
||||
if (buflen && buf[buflen-1] == '/')
|
||||
sprintf(dst, "%s%s", buf, lastcomp);
|
||||
snprintf(dst, dstlen, "%s%s", buf, lastcomp);
|
||||
else
|
||||
sprintf(dst, "%s/%s", buf, lastcomp);
|
||||
snprintf(dst, dstlen, "%s/%s", buf, lastcomp);
|
||||
}
|
||||
}
|
||||
free(copy);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "syslog.hpp"
|
||||
|
||||
void
|
||||
PinThreads::R1L(const CPU::ThreadIdVec threads_)
|
||||
PinThreads::R1L(const CPU::ThreadIdVec &threads_)
|
||||
{
|
||||
CPU::CPUVec cpus;
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ PinThreads::R1L(const CPU::ThreadIdVec threads_)
|
|||
}
|
||||
|
||||
void
|
||||
PinThreads::R1P(const CPU::ThreadIdVec threads_)
|
||||
PinThreads::R1P(const CPU::ThreadIdVec &threads_)
|
||||
{
|
||||
CPU::Core2CPUsMap core2cpus;
|
||||
|
||||
|
|
@ -28,9 +28,22 @@ PinThreads::R1P(const CPU::ThreadIdVec threads_)
|
|||
CPU::setaffinity(thread_id,core2cpus.begin()->second);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static
|
||||
void
|
||||
PinThreads::RP1L(const CPU::ThreadIdVec read_threads_,
|
||||
const CPU::ThreadIdVec process_threads_)
|
||||
_RP1(const CPU::ThreadIdVec &read_threads_,
|
||||
const CPU::ThreadIdVec &process_threads_,
|
||||
const T &cpus_)
|
||||
{
|
||||
for(auto const thread_id : read_threads_)
|
||||
CPU::setaffinity(thread_id,*cpus_.begin());
|
||||
for(auto const thread_id : process_threads_)
|
||||
CPU::setaffinity(thread_id,*cpus_.begin());
|
||||
}
|
||||
|
||||
void
|
||||
PinThreads::RP1L(const CPU::ThreadIdVec &read_threads_,
|
||||
const CPU::ThreadIdVec &process_threads_)
|
||||
{
|
||||
CPU::CPUVec cpus;
|
||||
|
||||
|
|
@ -38,15 +51,12 @@ PinThreads::RP1L(const CPU::ThreadIdVec read_threads_,
|
|||
if(cpus.empty())
|
||||
return;
|
||||
|
||||
for(auto const thread_id : read_threads_)
|
||||
CPU::setaffinity(thread_id,cpus.front());
|
||||
for(auto const thread_id : process_threads_)
|
||||
CPU::setaffinity(thread_id,cpus.front());
|
||||
_RP1(read_threads_,process_threads_,cpus);
|
||||
}
|
||||
|
||||
void
|
||||
PinThreads::RP1P(const CPU::ThreadIdVec read_threads_,
|
||||
const CPU::ThreadIdVec process_threads_)
|
||||
PinThreads::RP1P(const CPU::ThreadIdVec &read_threads_,
|
||||
const CPU::ThreadIdVec &process_threads_)
|
||||
{
|
||||
CPU::Core2CPUsMap core2cpus;
|
||||
|
||||
|
|
@ -54,16 +64,13 @@ PinThreads::RP1P(const CPU::ThreadIdVec read_threads_,
|
|||
if(core2cpus.empty())
|
||||
return;
|
||||
|
||||
for(auto const thread_id : read_threads_)
|
||||
CPU::setaffinity(thread_id,core2cpus.begin()->second);
|
||||
for(auto const thread_id : process_threads_)
|
||||
CPU::setaffinity(thread_id,core2cpus.begin()->second);
|
||||
_RP1(read_threads_,process_threads_,core2cpus.begin()->second);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PinThreads::R1LP1L(const CPU::ThreadIdVec read_threads_,
|
||||
const CPU::ThreadIdVec process_threads_)
|
||||
PinThreads::R1LP1L(const CPU::ThreadIdVec &read_threads_,
|
||||
const CPU::ThreadIdVec &process_threads_)
|
||||
{
|
||||
CPU::CPUVec cpus;
|
||||
|
||||
|
|
@ -80,8 +87,8 @@ PinThreads::R1LP1L(const CPU::ThreadIdVec read_threads_,
|
|||
|
||||
|
||||
void
|
||||
PinThreads::R1PP1P(const CPU::ThreadIdVec read_threads_,
|
||||
const CPU::ThreadIdVec process_threads_)
|
||||
PinThreads::R1PP1P(const CPU::ThreadIdVec &read_threads_,
|
||||
const CPU::ThreadIdVec &process_threads_)
|
||||
{
|
||||
CPU::Core2CPUsMap core2cpus;
|
||||
|
||||
|
|
@ -101,8 +108,8 @@ PinThreads::R1PP1P(const CPU::ThreadIdVec read_threads_,
|
|||
|
||||
|
||||
void
|
||||
PinThreads::RPSL(const CPU::ThreadIdVec read_threads_,
|
||||
const CPU::ThreadIdVec process_threads_)
|
||||
PinThreads::RPSL(const CPU::ThreadIdVec &read_threads_,
|
||||
const CPU::ThreadIdVec &process_threads_)
|
||||
{
|
||||
CPU::CPUVec cpus;
|
||||
|
||||
|
|
@ -129,8 +136,8 @@ PinThreads::RPSL(const CPU::ThreadIdVec read_threads_,
|
|||
|
||||
|
||||
void
|
||||
PinThreads::RPSP(const CPU::ThreadIdVec read_threads_,
|
||||
const CPU::ThreadIdVec process_threads_)
|
||||
PinThreads::RPSP(const CPU::ThreadIdVec &read_threads_,
|
||||
const CPU::ThreadIdVec &process_threads_)
|
||||
{
|
||||
CPU::Core2CPUsMap core2cpus;
|
||||
|
||||
|
|
@ -157,8 +164,8 @@ PinThreads::RPSP(const CPU::ThreadIdVec read_threads_,
|
|||
|
||||
|
||||
void
|
||||
PinThreads::R1PPSP(const CPU::ThreadIdVec read_threads_,
|
||||
const CPU::ThreadIdVec process_threads_)
|
||||
PinThreads::R1PPSP(const CPU::ThreadIdVec &read_threads_,
|
||||
const CPU::ThreadIdVec &process_threads_)
|
||||
{
|
||||
CPU::Core2CPUsMap core2cpus;
|
||||
CPU::Core2CPUsMap leftover;
|
||||
|
|
@ -186,9 +193,9 @@ PinThreads::R1PPSP(const CPU::ThreadIdVec read_threads_,
|
|||
|
||||
|
||||
void
|
||||
PinThreads::pin(const CPU::ThreadIdVec read_threads_,
|
||||
const CPU::ThreadIdVec process_threads_,
|
||||
const std::string type_)
|
||||
PinThreads::pin(const CPU::ThreadIdVec &read_threads_,
|
||||
const CPU::ThreadIdVec &process_threads_,
|
||||
const std::string &type_)
|
||||
{
|
||||
if(type_.empty() || (type_ == "false"))
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -6,23 +6,23 @@
|
|||
|
||||
namespace PinThreads
|
||||
{
|
||||
void R1L(const CPU::ThreadIdVec threads);
|
||||
void R1P(const CPU::ThreadIdVec threads);
|
||||
void RP1L(const CPU::ThreadIdVec read_threads,
|
||||
const CPU::ThreadIdVec process_threads);
|
||||
void RP1P(const CPU::ThreadIdVec read_threads,
|
||||
const CPU::ThreadIdVec process_threads);
|
||||
void R1LP1L(const CPU::ThreadIdVec read_threads,
|
||||
const CPU::ThreadIdVec process_threads);
|
||||
void R1PP1P(const CPU::ThreadIdVec read_threads,
|
||||
const CPU::ThreadIdVec process_threads);
|
||||
void RPSL(const CPU::ThreadIdVec read_threads,
|
||||
const CPU::ThreadIdVec process_threads);
|
||||
void RPSP(const CPU::ThreadIdVec read_threads,
|
||||
const CPU::ThreadIdVec process_threads);
|
||||
void R1PPSP(const CPU::ThreadIdVec read_threads,
|
||||
const CPU::ThreadIdVec process_threads);
|
||||
void pin(const CPU::ThreadIdVec read_threads,
|
||||
const CPU::ThreadIdVec process_threads,
|
||||
const std::string type);
|
||||
void R1L(const CPU::ThreadIdVec &threads);
|
||||
void R1P(const CPU::ThreadIdVec &threads);
|
||||
void RP1L(const CPU::ThreadIdVec &read_threads,
|
||||
const CPU::ThreadIdVec &process_threads);
|
||||
void RP1P(const CPU::ThreadIdVec &read_threads,
|
||||
const CPU::ThreadIdVec &process_threads);
|
||||
void R1LP1L(const CPU::ThreadIdVec &read_threads,
|
||||
const CPU::ThreadIdVec &process_threads);
|
||||
void R1PP1P(const CPU::ThreadIdVec &read_threads,
|
||||
const CPU::ThreadIdVec &process_threads);
|
||||
void RPSL(const CPU::ThreadIdVec &read_threads,
|
||||
const CPU::ThreadIdVec &process_threads);
|
||||
void RPSP(const CPU::ThreadIdVec &read_threads,
|
||||
const CPU::ThreadIdVec &process_threads);
|
||||
void R1PPSP(const CPU::ThreadIdVec &read_threads,
|
||||
const CPU::ThreadIdVec &process_threads);
|
||||
void pin(const CPU::ThreadIdVec &read_threads,
|
||||
const CPU::ThreadIdVec &process_threads,
|
||||
const std::string &type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ _get_fuse_operations(struct fuse_operations &ops_,
|
|||
ops_.mknod = FUSE::mknod;
|
||||
ops_.open = FUSE::open;
|
||||
ops_.opendir = FUSE::opendir;
|
||||
ops_.poll = FUSE::poll;;
|
||||
ops_.poll = FUSE::poll;
|
||||
ops_.read = (nullrw_ ? FUSE::read_null : FUSE::read);
|
||||
ops_.readdir = FUSE::readdir;
|
||||
ops_.readdir_plus = FUSE::readdir_plus;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue