Documentation ¶
Index ¶
- Constants
- func CheckRegularFile(file string) (bool, error)
- func ExecSync(bin string, args ...string) (std, serr string, err error)
- func SetDiskQuotaBytes(dir string, limit int64, quotaID uint32) error
- type PrjQuotaDriver
- func (quota *PrjQuotaDriver) CheckMountpoint(dir string) (string, bool, error)
- func (quota *PrjQuotaDriver) GetNextQuotaID() (quotaID uint32, err error)
- func (quota *PrjQuotaDriver) GetQuotaIDInFileAttr(dir string) uint32
- func (quota *PrjQuotaDriver) SetDiskQuota(dir string, size string, quotaID uint32) error
- func (quota *PrjQuotaDriver) SetFileAttr(dir string, quotaID uint32) error
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 ¶
CheckRegularFile is used to check the file is regular file or directory.
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
Click to show internal directories.
Click to hide internal directories.