cmd/sharefs: allocate sharefs_private early
All checks were successful
Test / Create distribution (push) Successful in 43s
Test / Sandbox (push) Successful in 2m21s
Test / ShareFS (push) Successful in 3m26s
Test / Hpkg (push) Successful in 4m14s
Test / Sandbox (race detector) (push) Successful in 4m31s
Test / Hakurei (race detector) (push) Successful in 5m31s
Test / Hakurei (push) Successful in 2m34s
Test / Flake checks (push) Successful in 1m39s

This also removes global state used by sharefs_init.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-12-26 08:08:41 +09:00
parent 54712e0426
commit 0e476c5e5b
2 changed files with 40 additions and 29 deletions

View File

@@ -13,7 +13,11 @@
/* sharefs_private is populated by sharefs_init and contains process-wide context */
struct sharefs_private {
int dirfd; /* source dirfd opened during sharefs_init */
int dirfd; /* source dirfd opened during sharefs_init */
bool init_failed; /* whether sharefs_init failed */
uintptr_t source_handle; /* cgo handle of pathname to open for dirfd, freed during sharefs_init */
uintptr_t setuid; /* uid to set by sharefs_init when running as root */
uintptr_t setgid; /* gid to set by sharefs_init when running as root */
};
int sharefs_getattr(const char *pathname, struct stat *statbuf, struct fuse_file_info *fi);