commit: 8ed1bd1734016c6818c975b8630acf43d7fff4ea
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 13 12:47:20 2025 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Dec 13 12:47:20 2025 +0000
URL: https://gitweb.gentoo.org/proj/steve.git/commit/?id=8ed1bd17
Support overriding the device name
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
steve.cxx | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/steve.cxx b/steve.cxx
index 883acd2..b2ef505 100644
--- a/steve.cxx
+++ b/steve.cxx
@@ -88,6 +88,7 @@ struct steve_process {
};
struct steve_state {
+ const char *dev_name{"steve"};
bool verbose;
uint64_t jobs;
uint64_t min_jobs{1};
@@ -336,7 +337,7 @@ static void steve_init(void *userdata, struct
fuse_conn_info *)
state->tokens = state->jobs;
- std::print(stderr, "steve running on /dev/steve for {} jobs\n",
state->jobs);
+ std::print(stderr, "steve running on /dev/{} for {} jobs\n",
state->dev_name, state->jobs);
if (state->max_load_avg > 0) {
std::print(stderr, " tokens will be served with load average <
{:.3}\n", state->max_load_avg);
std::print(stderr, " with a recheck timeout of {} s {} us\n",
@@ -760,6 +761,7 @@ static constexpr char steve_usage[] =
"options:\n"
" --help, -h print this help message\n"
" --version, -V print version\n"
+"\n"
" --jobs=JOBS, -j JOBS jobs to use (default: nproc)\n"
" --load-average=LOAD_AVG, -l LOAD_AVG\n"
" do not serve tokens unless load is below
LOAD_AVG\n"
@@ -771,11 +773,17 @@ static constexpr char steve_usage[] =
" (default: 1)\n"
" --per-process-limit=LIMIT, -p LIMIT\n"
" max. jobs to serve to a single process\n"
+"\n"
+" --dev-name=DEV_NAME override the device name to use (default: steve)\n"
" --user=USER, -u USER drop superuser privileges and switch to USER\n"
" (and its primary group)\n"
" --verbose, -v enable verbose logging\n"
" --debug, -d enable FUSE debug output\n";
+struct steve_long_option {
+ static constexpr int dev_name = 256;
+};
+
static const struct option steve_long_opts[] = {
{ "help", no_argument, 0, 'h' },
{ "version", no_argument, 0, 'V' },
@@ -784,6 +792,7 @@ static const struct option steve_long_opts[] = {
{ "load-recheck-timeout", required_argument, 0, 'r' },
{ "min-jobs", required_argument, 0, 'm' },
{ "per-process-limit", required_argument, 0, 'p' },
+ { "dev-name", required_argument, 0, steve_long_option::dev_name },
{ "user", required_argument, 0, 'u' },
{ "verbose", no_argument, 0, 'v' },
{ "debug", no_argument, 0, 'd' },
@@ -850,6 +859,9 @@ int main(int argc, char **argv)
case 'd':
debug = true;
break;
+ case steve_long_option::dev_name:
+ state.dev_name = optarg;
+ break;
default:
std::print(stderr, steve_usage, argv[0]);
return 1;
@@ -896,8 +908,9 @@ int main(int argc, char **argv)
if (user && !steve_drop_privileges(user))
return 1;
- const char *dev_name = "DEVNAME=steve";
- const char *dev_info_argv[] = { dev_name };
+ std::string dev_name_arg{"DEVNAME="};
+ dev_name_arg += state.dev_name;
+ const char *dev_info_argv[] = { dev_name_arg.c_str() };
struct cuse_info ci{};
ci.dev_info_argc = 1;
ci.dev_info_argv = dev_info_argv;