flags

package
v3.3.310 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package flags provides utilities for working with FUSE file open flags.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FuseFlags

type FuseFlags int

func NewFuseFlags

func NewFuseFlags(flags int) FuseFlags

NewFuseFlags initializes a FuseFlags instance with the given integer flag value.

func (FuseFlags) AsOsFlags

func (f FuseFlags) AsOsFlags() int

AsOsFlags translates POSIX/FUSE-style open(2) flags carried in FuseFlags into the platform-appropriate flags defined by Go’s os package.

Why this is cross-platform:

  • Access mode: FUSE follows POSIX semantics where the lower two bits encode the access mode (O_RDONLY=0, O_WRONLY=1, O_RDWR=2). Masking with 0x3 and mapping to os.O_RDONLY / os.O_WRONLY / os.O_RDWR allows the os package to turn these into the correct native flags for Linux and Windows.
  • Behavior/creation bits: FUSE flags like O_CREAT, O_EXCL, O_TRUNC, and O_APPEND have direct counterparts in the os package (os.O_CREATE, os.O_EXCL, os.O_TRUNC, os.O_APPEND). OR-ing these through lets the os package handle the per-platform syscall details (including WinFsp on Windows for cgofuse).

How it works:

  1. Mask the lower two bits (0x3) to select exactly one of R/O, W/O, or R/W.
  2. OR in any creation/behavior bits that are present.
  3. Return the composite mask, suitable for passing to os.OpenFile.

Add additional mappings here if more FUSE flags need to flow through.

func (FuseFlags) IsAppend

func (f FuseFlags) IsAppend() bool

IsAppend checks if the flag is set to append.

func (FuseFlags) IsCreate

func (f FuseFlags) IsCreate() bool

IsCreate checks if the flag is set to create.

func (FuseFlags) IsCreateExclusive

func (f FuseFlags) IsCreateExclusive() bool

IsCreateExclusive checks if the flag is set to create and exclusive.

func (FuseFlags) IsExclusive

func (f FuseFlags) IsExclusive() bool

IsExclusive checks if the flag is set to exclusive.

func (FuseFlags) IsReadOnly

func (f FuseFlags) IsReadOnly() bool

IsReadOnly checks if the flag is set to read-only.

func (FuseFlags) IsReadWrite

func (f FuseFlags) IsReadWrite() bool

IsReadWrite checks if the flag is set to read-write.

func (FuseFlags) IsTruncate

func (f FuseFlags) IsTruncate() bool

IsTruncate checks if the flag is set to truncate.

func (FuseFlags) IsWriteOnly

func (f FuseFlags) IsWriteOnly() bool

IsWriteOnly checks if the flag is set to write-only.

func (FuseFlags) String

func (f FuseFlags) String() string

String returns a string representation of the FuseFlags.

func (FuseFlags) Without

func (f FuseFlags) Without(remove int) FuseFlags

Without returns a new FuseFlags instance with the specified flags removed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL