diskquota

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// QuotaMinID represents the minimum quota id.
	// The value is unit32(2^24).
	QuotaMinID = uint32(16777216)

	// QuotaMaxID represents the maximum quota id.
	QuotaMaxID = uint32(200000000)
)

Variables

This section is empty.

Functions

func CheckRegularFile

func CheckRegularFile(file string) (bool, error)

CheckRegularFile is used to check the file is regular file or directory.

func ExecSync

func ExecSync(bin string, args ...string) (std, serr string, err error)

func SetDiskQuotaBytes

func SetDiskQuotaBytes(dir string, limit int64, quotaID uint32) error

SetDiskQuotaBytes set dir project quota to the quotaId

Types

type PrjQuotaDriver

type PrjQuotaDriver struct {

	// quotaIDs saves all of quota ids.
	// key: quota ID which means this ID is used in the global scope.
	// value: stuct{}
	QuotaIDs map[uint32]struct{}

	// lastID is used to mark last used quota ID.
	// quota ID is allocated increasingly by sequence one by one.
	LastID uint32
	// contains filtered or unexported fields
}

PrjQuotaDriver represents project quota driver.

func (*PrjQuotaDriver) CheckMountpoint

func (quota *PrjQuotaDriver) CheckMountpoint(dir string) (string, bool, error)

func (*PrjQuotaDriver) GetNextQuotaID

func (quota *PrjQuotaDriver) GetNextQuotaID() (quotaID uint32, err error)

GetNextQuotaID returns the next available quota id.

func (*PrjQuotaDriver) GetQuotaIDInFileAttr

func (quota *PrjQuotaDriver) GetQuotaIDInFileAttr(dir string) uint32

GetQuotaIDInFileAttr gets attributes of the file which is in the inode. The returned result is quota ID. return 0 if failure happens, since quota ID must be positive. execution command: `lsattr -p $dir`

func (*PrjQuotaDriver) SetDiskQuota

func (quota *PrjQuotaDriver) SetDiskQuota(dir string, size string, quotaID uint32) error

SetDiskQuota uses the following two parameters to set disk quota for a directory. * quota size: a byte size of requested quota. * quota ID: an ID represent quota attr which is used in the global scope.

func (*PrjQuotaDriver) SetFileAttr

func (quota *PrjQuotaDriver) SetFileAttr(dir string, quotaID uint32) error

SetFileAttr set the file attr. ext4: chattr -p quotaid +P $DIR

Jump to

Keyboard shortcuts

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