kubernetesk8s.io/kubernetes/pkg/volume/util/fsquota/common Index | Files

package common

import "k8s.io/kubernetes/pkg/volume/util/fsquota/common"

Index

Variables

var MountParseRegexp = regexp.MustCompilePOSIX("^([^ ]*)[ \t]*([^ ]*)[ \t]*([^ ]*)") // Ignore options etc.

MountParseRegexp parses out /proc/sys/self/mounts

var MountsFile = "/proc/self/mounts"

MountsFile is the location of the system mount data

Functions

func SupportsQuotas

func SupportsQuotas(mountpoint string, qType QuotaType) (bool, error)

SupportsQuotas determines whether the filesystem supports quotas.

Types

type LinuxVolumeQuotaApplier

type LinuxVolumeQuotaApplier interface {
	// GetQuotaOnDir gets the quota ID (if any) that applies to
	// this directory
	GetQuotaOnDir(path string) (QuotaID, error)

	// SetQuotaOnDir applies the specified quota ID to a directory.
	// Negative value for bytes means that a non-enforcing quota
	// should be applied (perhaps by setting a quota too large to
	// be hit)
	SetQuotaOnDir(path string, id QuotaID, bytes int64) error

	// QuotaIDIsInUse determines whether the quota ID is in use.
	// Implementations should not check /etc/project or /etc/projid,
	// only whether their underlying mechanism already has the ID in
	// use.
	// Return value of false with no error means that the ID is not
	// in use; true means that it is already in use.  An error
	// return means that any quota ID will fail.
	QuotaIDIsInUse(id QuotaID) (bool, error)

	// GetConsumption returns the consumption (in bytes) of the
	// directory, determined by the implementation's quota-based
	// mechanism.  If it is unable to do so using that mechanism,
	// it should return an error and allow higher layers to
	// enumerate the directory.
	GetConsumption(path string, id QuotaID) (int64, error)

	// GetInodes returns the number of inodes used by the
	// directory, determined by the implementation's quota-based
	// mechanism.  If it is unable to do so using that mechanism,
	// it should return an error and allow higher layers to
	// enumerate the directory.
	GetInodes(path string, id QuotaID) (int64, error)
}

LinuxVolumeQuotaApplier is a generic interface to any quota mechanism supported by Linux

type LinuxVolumeQuotaProvider

type LinuxVolumeQuotaProvider interface {
	// GetQuotaApplier retrieves an object that can apply
	// quotas (or nil if this provider cannot support quotas
	// on the device)
	GetQuotaApplier(mountpoint string, backingDev string) LinuxVolumeQuotaApplier
}

LinuxVolumeQuotaProvider returns an appropriate quota applier object if we can support quotas on this device

type QuotaID

type QuotaID int32

QuotaID is generic quota identifier. Data type based on quotactl(2).

const (
	// UnknownQuotaID -- cannot determine whether a quota is in force
	UnknownQuotaID QuotaID = -1
	// BadQuotaID -- Invalid quota
	BadQuotaID QuotaID = 0
)
var FirstQuota QuotaID = 1048577

FirstQuota is the quota ID we start with. XXXXXXX Need a better way of doing this...

type QuotaType

type QuotaType int

QuotaType -- type of quota to be applied

const (
	// FSQuotaAccounting for quotas for accounting only
	FSQuotaAccounting QuotaType = 1 << iota
	// FSQuotaEnforcing for quotas for enforcement
	FSQuotaEnforcing QuotaType = 1 << iota
)

type VolumeProvider

type VolumeProvider struct {
}

VolumeProvider supplies a quota applier to the generic code.

func (*VolumeProvider) GetQuotaApplier

func (*VolumeProvider) GetQuotaApplier(mountpoint string, backingDev string) LinuxVolumeQuotaApplier

GetQuotaApplier -- does this backing device support quotas that can be applied to directories?

Source Files

quota_common.go quota_common_linux.go quota_common_linux_impl.go

Version
v1.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
10 packages
Last checked
3 hours ago

Tools for package owners.