quotactl

package
v0.0.0-...-5fb8a3f Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package quotactl implements a low-level wrapper around the modern portion of Linux's quotactl() syscall. See the fsquota package for a nicer interface to the most common part of this API.

Index

Constants

View Source
const (
	Q_SYNC uint = (0x800001 + iota) << 8
	Q_QUOTAON
	Q_QUOTAOFF
	Q_GETFMT
	Q_GETINFO
	Q_SETINFO
	Q_GETQUOTA
	Q_SETQUOTA
	Q_GETNEXTQUOTA
)
View Source
const (
	FlagBLimitsValid = 1 << iota
	FlagSpaceValid
	FlagILimitsValid
	FlagInodesValid
	FlagBTimeValid
	FlagITimeValid
)

Variables

This section is empty.

Functions

func QuotaOff

func QuotaOff(fd *os.File, qtype QuotaType) error

QuotaOff turns quotas off

func QuotaOn

func QuotaOn(fd *os.File, qtype QuotaType, quotaFormat QuotaFormat, quotaFilePath string) error

QuotaOn turns quota accounting and enforcement on

func SetInfo

func SetInfo(fd *os.File, qtype QuotaType, info *DQInfo) error

SetInfo sets information about quota files

func SetQuota

func SetQuota(fd *os.File, qtype QuotaType, id uint32, quota *Quota) error

SetQuota sets the given quota

func Sync

func Sync(fd *os.File) error

Sync syncs disk copy of filesystems quotas. If device is empty it syncs all filesystems.

Types

type DQInfo

type DQInfo struct {
	Bgrace uint64
	Igrace uint64
	Flags  uint32
	Valid  uint32
}

func GetInfo

func GetInfo(fd *os.File, qtype QuotaType) (*DQInfo, error)

GetInfo gets information about quota files

type NextDQBlk

type NextDQBlk struct {
	HardLimitBytes  uint64
	SoftLimitBytes  uint64
	CurrentBytes    uint64
	HardLimitInodes uint64
	SoftLimitInodes uint64
	CurrentInodes   uint64
	BTime           uint64
	ITime           uint64
	Valid           uint32
	ID              uint32
}

func GetNextQuota

func GetNextQuota(fd *os.File, qtype QuotaType, id uint32) (*NextDQBlk, error)

GetNextQuota gets disk limits and usage > ID

type Quota

type Quota struct {
	BHardLimit uint64 // Both Byte limits are prescaled by 1024 (so are in KiB), but CurSpace is in B
	BSoftLimit uint64
	CurSpace   uint64
	IHardLimit uint64
	ISoftLimit uint64
	CurInodes  uint64
	BTime      uint64
	ITime      uint64
	Valid      uint32
}

func GetQuota

func GetQuota(fd *os.File, qtype QuotaType, id uint32) (*Quota, error)

GetQuota gets user quota structure

type QuotaFormat

type QuotaFormat uint32
const (
	// QuotaFormatNone is a special case where all quota information is
	// stored inside filesystem metadata and thus requires no quotaFilePath.
	QuotaFormatNone   QuotaFormat = 0
	QuotaFormatVFSOld QuotaFormat = 1
	QuotaFormatVFSV0  QuotaFormat = 2
	QuotaFormatOCFS2  QuotaFormat = 3
	QuotaFormatVFSV1  QuotaFormat = 4
)

Collected from quota_format_type structs

func GetFmt

func GetFmt(fd *os.File, qtype QuotaType) (QuotaFormat, error)

GetFmt gets the quota format used on given filesystem

type QuotaType

type QuotaType uint
const (
	QuotaTypeUser QuotaType = iota
	QuotaTypeGroup
	QuotaTypeProject
)

Jump to

Keyboard shortcuts

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