acl

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package acl implements just enough POSIX.1e ACL handling for default-ACL INHERITANCE on file creation. Enforcement of explicit ACLs is the kernel's job (the mount advertises CAP_POSIX_ACL and reads/writes the system.posix_acl_access / system.posix_acl_default xattrs through mlfs's generic xattr store). But under raw FUSE the kernel delegates default-ACL inheritance to the filesystem, so on create we must compute the child's access ACL + mode from the parent directory's default ACL. This is a POSIX ACL creation and inheritance rules (fs/posix_acl.c), operating on the on-disk xattr binary format.

Index

Constants

View Source
const (
	TagUserObj  uint16 = 0x01
	TagUser     uint16 = 0x02
	TagGroupObj uint16 = 0x04
	TagGroup    uint16 = 0x08
	TagMask     uint16 = 0x10
	TagOther    uint16 = 0x20
)

Entry tags (uapi/linux/posix_acl.h).

Variables

This section is empty.

Functions

This section is empty.

Types

type ACL

type ACL []Entry

ACL is an ordered list of entries (as stored in the xattr).

func Create

func Create(def ACL, mode uint16) (access ACL, newMode uint16)

Create computes a child's inherited state from a parent directory's default ACL and the requested mode:

  • newMode is the child's effective mode after masking by the default ACL.
  • access is the child's system.posix_acl_access ACL, or nil when the ACL is equivalent to the plain mode bits (then mode alone suffices).

The caller additionally copies the parent default ACL onto a child DIRECTORY's system.posix_acl_default (handled outside this function).

func Unmarshal

func Unmarshal(b []byte) (ACL, bool)

Unmarshal parses the system.posix_acl_* binary format. A zero-length blob (or header-only) yields an empty ACL.

func (ACL) Marshal

func (a ACL) Marshal() []byte

Marshal renders the ACL back to the xattr binary format.

type Entry

type Entry struct {
	Tag  uint16
	Perm uint16
	ID   uint32
}

Entry is one ACL entry. Perm is the low 3 bits (rwx).

Jump to

Keyboard shortcuts

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