summaryrefslogtreecommitdiff
path: root/quotasys.c
diff options
context:
space:
mode:
Diffstat (limited to 'quotasys.c')
-rw-r--r--quotasys.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/quotasys.c b/quotasys.c
index afe5f6d..abbdfec 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -764,6 +764,24 @@ static int hasvfsmetaquota(const char *dev, struct mntent *mnt, int type, int fl
return QF_ERROR;
}
+static int hasbcachefsquota(char *dev, struct mntent *mnt, int type, int flags)
+{
+ /* For multi device filesytems, figure out which is the right device: */
+ char *devs = strdup(dev), *p = devs, *d;
+ uint32_t fmt;
+
+ while ((d = strsep(&p, ":"))) {
+ if (!quotactl(QCMD(Q_XFS_GETQSTAT, type), d, 0, (void *)&fmt)) {
+ strcpy(dev, d);
+ free(devs);
+ return QF_META;
+ }
+ }
+
+ free(devs);
+ return QF_ERROR;
+}
+
/* Return pointer to given mount option in mount option string */
char *str_hasmntopt(const char *optstring, const char *opt)
{
@@ -819,7 +837,7 @@ static void copy_mntoptarg(char *buf, const char *optarg, int buflen)
/*
* Check to see if a particular quota is to be enabled (filesystem mounted with proper option)
*/
-static int hasquota(const char *dev, struct mntent *mnt, int type, int flags)
+static int hasquota(char *dev, struct mntent *mnt, int type, int flags)
{
if (!strcmp(mnt->mnt_type, MNTTYPE_GFS2) ||
!strcmp(mnt->mnt_type, MNTTYPE_XFS) ||
@@ -832,6 +850,9 @@ static int hasquota(const char *dev, struct mntent *mnt, int type, int flags)
/* tmpfs has no device, pass null here so quotactl_fd() is called */
if (!strcmp(mnt->mnt_type, MNTTYPE_TMPFS))
return hasvfsmetaquota(NULL, mnt, type, flags);
+
+ if (!strcmp(mnt->mnt_type, MNTTYPE_BCACHEFS))
+ return hasbcachefsquota(dev, mnt, type, flags) != QF_ERROR ? QF_META : QF_ERROR;
/*
* For ext4 we check whether it has quota in system files and if not,
* we fall back on checking standard quotas. Furthermore we cannot use
@@ -1317,7 +1338,7 @@ alloc:
autofsdircnt = 0;
autofsdir_allocated = ALLOC_ENTRIES_NUM;
while ((mnt = getmntent(mntf))) {
- const char *devname;
+ char *devname;
char *opt;
int qfmt[MAXQUOTAS];