Documentation ¶
Index ¶
- Constants
- Variables
- func CheckMountpoint(devID uint64) (string, bool, string)
- func GetDefaultQuota(quotas map[string]string) string
- func GetDevID(dir string) (uint64, error)
- func GetFileAttr(dir string) uint32
- func GetNextQuatoID() (uint32, error)
- func SetDiskQuota(dir string, size string, quotaID uint32) error
- func SetFileAttr(dir string, id uint32) error
- func SetFileAttrNoOutput(dir string, id uint32)
- func SetQuotaDriver(name string)
- func SetSubtree(dir string, qid uint32) (uint32, error)
- func StartQuotaDriver(dir string) (string, error)
- type BaseQuota
- type GrpQuota
- func (quota *GrpQuota) CheckMountpoint(devID uint64) (string, bool, string)
- func (quota *GrpQuota) GetFileAttr(dir string) uint32
- func (quota *GrpQuota) GetNextQuatoID() (uint32, error)
- func (quota *GrpQuota) SetDiskQuota(dir string, size string, quotaID uint32) error
- func (quota *GrpQuota) SetFileAttr(dir string, id uint32) error
- func (quota *GrpQuota) SetFileAttrNoOutput(dir string, id uint32)
- func (quota *GrpQuota) SetSubtree(dir string, qid uint32) (uint32, error)
- func (quota *GrpQuota) StartQuotaDriver(dir string) (string, error)
- type OverlayMount
- type PrjQuota
- func (quota *PrjQuota) CheckMountpoint(devID uint64) (string, bool, string)
- func (quota *PrjQuota) GetFileAttr(dir string) uint32
- func (quota *PrjQuota) GetNextQuatoID() (uint32, error)
- func (quota *PrjQuota) SetDiskQuota(dir string, size string, quotaID uint32) error
- func (quota *PrjQuota) SetFileAttr(dir string, id uint32) error
- func (quota *PrjQuota) SetFileAttrNoOutput(dir string, id uint32)
- func (quota *PrjQuota) SetSubtree(dir string, qid uint32) (uint32, error)
- func (quota *PrjQuota) StartQuotaDriver(dir string) (string, error)
- type RegExp
Constants ¶
const ( // QuotaMinID represents the minimize quota id. QuotaMinID = uint32(16777216) )
Variables ¶
var ( // UseQuota represents use quota or not. UseQuota = true // Gquota represents global quota. Gquota = NewQuota("") )
Functions ¶
func CheckMountpoint ¶
CheckMountpoint is used to check mount point.
func GetDefaultQuota ¶
GetDefaultQuota returns the default quota size.
func GetFileAttr ¶
GetFileAttr returns the directory attributes.
func GetNextQuatoID ¶
GetNextQuatoID returns the next available quota id.
func SetDiskQuota ¶
SetDiskQuota is used to set quota for directory.
func SetFileAttr ¶
SetFileAttr is used to set file attributes.
func SetFileAttrNoOutput ¶
SetFileAttrNoOutput is used to set file attributes without error.
func SetQuotaDriver ¶
func SetQuotaDriver(name string)
SetQuotaDriver is used to set global quota driver.
func SetSubtree ¶
SetSubtree is used to set quota id for directory.
func StartQuotaDriver ¶
StartQuotaDriver is used to start quota driver.
Types ¶
type BaseQuota ¶
type BaseQuota interface { StartQuotaDriver(dir string) (string, error) SetSubtree(dir string, qid uint32) (uint32, error) SetDiskQuota(dir string, size string, quotaID uint32) error CheckMountpoint(devID uint64) (string, bool, string) GetFileAttr(dir string) uint32 SetFileAttr(dir string, id uint32) error SetFileAttrNoOutput(dir string, id uint32) GetNextQuatoID() (uint32, error) }
BaseQuota defines the quota operation interface.
type GrpQuota ¶
type GrpQuota struct {
// contains filtered or unexported fields
}
GrpQuota represents group quota.
func (*GrpQuota) CheckMountpoint ¶
CheckMountpoint is used to check mount point. cat /proc/mounts as follows: /dev/sda3 / ext4 rw,relatime,data=ordered 0 0 /dev/sda2 /boot/grub2 ext4 rw,relatime,stripe=4,data=ordered 0 0 /dev/sda5 /home ext4 rw,relatime,data=ordered 0 0 /dev/sdb1 /home/pouch ext4 rw,relatime,grpquota,data=ordered 0 0 tmpfs /run tmpfs rw,nosuid,nodev,mode=755 0 0 tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0 cgroup /sys/fs/cgroup/cpuset,cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpuacct,cpu,cpuset 0 0 cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0 cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0 cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
func (*GrpQuota) GetFileAttr ¶
GetFileAttr returns the directory attributes getfattr -n system.subtree --only-values --absolute-names /
func (*GrpQuota) GetNextQuatoID ¶
GetNextQuatoID returns the next available quota id.
func (*GrpQuota) SetDiskQuota ¶
SetDiskQuota is used to set quota for directory.
func (*GrpQuota) SetFileAttr ¶
SetFileAttr is used to set file attributes.
func (*GrpQuota) SetFileAttrNoOutput ¶
SetFileAttrNoOutput is used to set file attributes without error.
func (*GrpQuota) SetSubtree ¶
SetSubtree is used to set quota id for directory, setfattr -n system.subtree -v $QUOTAID
type OverlayMount ¶
OverlayMount represents the parameters of overlay mount.
type PrjQuota ¶
type PrjQuota struct {
// contains filtered or unexported fields
}
PrjQuota represents project quota.
func (*PrjQuota) CheckMountpoint ¶
CheckMountpoint is used to check mount point. cat /proc/mounts as follows: /dev/sda3 / ext4 rw,relatime,data=ordered 0 0 /dev/sda2 /boot/grub2 ext4 rw,relatime,stripe=4,data=ordered 0 0 /dev/sda5 /home ext4 rw,relatime,data=ordered 0 0 /dev/sdb1 /home/pouch ext4 rw,relatime,prjquota,data=ordered 0 0 tmpfs /run tmpfs rw,nosuid,nodev,mode=755 0 0 tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0 cgroup /sys/fs/cgroup/cpuset,cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpuacct,cpu,cpuset 0 0 cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0 cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0 cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
func (*PrjQuota) GetFileAttr ¶
GetFileAttr returns the directory attributes lsattr -p $dir
func (*PrjQuota) GetNextQuatoID ¶
GetNextQuatoID returns the next available quota id.
func (*PrjQuota) SetDiskQuota ¶
SetDiskQuota is used to set quota for directory.
func (*PrjQuota) SetFileAttr ¶
SetFileAttr is used to set file attributes.
func (*PrjQuota) SetFileAttrNoOutput ¶
SetFileAttrNoOutput is used to set file attributes without error.
func (*PrjQuota) SetSubtree ¶
SetSubtree is used to set quota id for directory, chattr -p qid +P $QUOTAID