Rework config, centralize fuse config (#1547)
Some checks are pending
CodeQL / Analyze (push) Waiting to run
mkdocs / deploy (push) Waiting to run

This commit is contained in:
trapexit 2025-10-24 08:20:29 -05:00 • committed by GitHub
parent 00e5467e99
commit 727c522fb8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 1294 additions and 1316 deletions

View file

@ -0,0 +1,38 @@
#pragma once
#include "int_types.h"
#include <climits>
#include <string>
#define FUSE_CFG_INVALID_ID -1
#define FUSE_CFG_INVALID_UMASK -1
struct fuse_cfg_t
{
s64 uid = FUSE_CFG_INVALID_ID;
bool valid_uid() const;
s64 gid = FUSE_CFG_INVALID_ID;
bool valid_gid() const;
s64 umask = FUSE_CFG_INVALID_UMASK;
bool valid_umask() const;
s64 remember_nodes = 0;
bool debug = false;
int max_background = 0;
int congestion_threshold = 0;
u32 max_pages = 32;
int passthrough_max_stack_depth = 1;
int read_thread_count = 0;
int process_thread_count = -1;
int process_thread_queue_depth = 2;
std::string pin_threads = "false";
};
extern fuse_cfg_t fuse_cfg;

View file

@ -139,13 +139,8 @@ struct fuse_conn_info
{
unsigned proto_major;
unsigned proto_minor;
unsigned max_write;
unsigned max_readahead;
uint64_t capable;
uint64_t want;
unsigned max_background;
unsigned congestion_threshold;
uint16_t max_pages;
};
struct fuse_session;

View file

@ -1,31 +0,0 @@
/*
ISC License
Copyright (c) 2023, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include <string>
int fuse_config_get_read_thread_count();
int fuse_config_get_process_thread_count();
int fuse_config_get_process_thread_queue_depth();
std::string fuse_config_get_pin_threads();
void fuse_config_set_read_thread_count(int const);
void fuse_config_set_process_thread_count(int const);
void fuse_config_set_process_thread_queue_depth(int const);
void fuse_config_set_pin_threads(std::string const);

View file

@ -18,11 +18,10 @@
#pragma once
#include "int_types.h"
#include "fuse_msgbuf_t.h"
#include "extern_c.h"
EXTERN_C_BEGIN
u32 msgbuf_get_pagesize();
void msgbuf_set_bufsize(const uint32_t size);
uint64_t msgbuf_get_bufsize();
@ -35,8 +34,3 @@ void msgbuf_gc_10percent();
uint64_t msgbuf_alloc_count();
uint64_t msgbuf_avail_count();
void msgbuf_page_align(fuse_msgbuf_t *msgbuf);
void msgbuf_write_align(fuse_msgbuf_t *msgbuf);
EXTERN_C_END

View file

@ -0,0 +1,13 @@
#pragma once
#include <stdint.h>
typedef uint64_t u32;
typedef int64_t s32;
typedef uint64_t u64;
typedef int64_t s64;
typedef const uint64_t cu32;
typedef const int64_t cs32;
typedef const uint64_t cu64;
typedef const int64_t cs64;