Skip to content

Commit

Permalink
troubleshoot ci
Browse files Browse the repository at this point in the history
  • Loading branch information
billziss-gh committed Jan 4, 2025
1 parent 5210177 commit 64d2980
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
17 changes: 14 additions & 3 deletions fuse/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ type FileSystemHost struct {
mntp string
sigc chan os.Signal

capCaseInsensitive, capReaddirPlus, capDeleteAccess bool
directIO, useIno bool
capCaseInsensitive bool
capReaddirPlus bool
capDeleteAccess bool
capOpenTrunc bool
directIO bool
useIno bool
}

var (
Expand Down Expand Up @@ -464,7 +468,8 @@ func hostInit(conn0 *c_struct_fuse_conn_info, conf0 *c_struct_fuse_config) (user
c_hostAsgnCconninfo(conn0,
c_bool(host.capCaseInsensitive),
c_bool(host.capReaddirPlus),
c_bool(host.capDeleteAccess))
c_bool(host.capDeleteAccess),
c_bool(host.capOpenTrunc))
c_hostAsgnCconfig(conf0,
c_bool(host.directIO),
c_bool(host.useIno))
Expand Down Expand Up @@ -687,6 +692,12 @@ func (host *FileSystemHost) SetCapDeleteAccess(value bool) {
host.capDeleteAccess = value
}

// SetCapOpenTrunc informs the host that the hosted file system can handle the O_TRUNC
// Open flag [Linux only].
func (host *FileSystemHost) SetCapOpenTrunc(value bool) {
host.capOpenTrunc = value
}

// SetDirectIO causes the file system to disable page caching [FUSE3 only]. Must be set
// before Mount is called.
func (host *FileSystemHost) SetDirectIO(value bool) {
Expand Down
17 changes: 13 additions & 4 deletions fuse/host_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,12 +415,20 @@ extern int go_hostChflags(char *path, uint32_t flags);
static inline void hostAsgnCconninfo(struct fuse_conn_info *conn,
bool capCaseInsensitive,
bool capReaddirPlus,
bool capDeleteAccess)
bool capDeleteAccess,
bool capOpenTrunc)
{
#if defined(__APPLE__)
if (capCaseInsensitive)
FUSE_ENABLE_CASE_INSENSITIVE(conn);
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__linux__)
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#elif defined(__linux__)
// FUSE_CAP_ATOMIC_O_TRUNC was disabled in FUSE2 and is enabled in FUSE3.
// So disable it here, unless the user explicitly enables it.
if (capOpenTrunc)
conn->want |= conn->capable & FUSE_CAP_ATOMIC_O_TRUNC;
else
conn->want &= ~FUSE_CAP_ATOMIC_O_TRUNC;
#elif defined(_WIN32)
#if defined(FSP_FUSE_CAP_STAT_EX)
conn->want |= conn->capable & FSP_FUSE_CAP_STAT_EX;
Expand Down Expand Up @@ -876,8 +884,9 @@ func c_fuse_opt_free_args(args *c_struct_fuse_args) {
func c_hostAsgnCconninfo(conn *c_struct_fuse_conn_info,
capCaseInsensitive c_bool,
capReaddirPlus c_bool,
capDeleteAccess c_bool) {
C.hostAsgnCconninfo(conn, capCaseInsensitive, capReaddirPlus, capDeleteAccess)
capDeleteAccess c_bool,
capOpenTrunc c_bool) {
C.hostAsgnCconninfo(conn, capCaseInsensitive, capReaddirPlus, capDeleteAccess, capOpenTrunc)
}
func c_hostAsgnCconfig(conf *c_struct_fuse_config,
directIO c_bool,
Expand Down
3 changes: 2 additions & 1 deletion fuse/host_nocgo_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ func c_fuse_opt_free_args(args *c_struct_fuse_args) {
func c_hostAsgnCconninfo(conn *c_struct_fuse_conn_info,
capCaseInsensitive c_bool,
capReaddirPlus c_bool,
capDeleteAccess c_bool) {
capDeleteAccess c_bool,
capOpenTrunc c_bool) {
conn.want |= conn.capable & FSP_FUSE_CAP_STAT_EX
cgofuse_stat_ex = 0 != conn.want&FSP_FUSE_CAP_STAT_EX // hack!
if capCaseInsensitive {
Expand Down

0 comments on commit 64d2980

Please sign in to comment.