1f08c3bdfSopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 2f08c3bdfSopenharmony_ci/* 3f08c3bdfSopenharmony_ci * Copyright (c) 2017-2021 FUJITSU LIMITED. All rights reserved 4f08c3bdfSopenharmony_ci * Author: Xiao Yang <yangx.jy@cn.fujitsu.com> 5f08c3bdfSopenharmony_ci * Author: Yang Xu <xuyang2018.jy@fujitsu.com> 6f08c3bdfSopenharmony_ci */ 7f08c3bdfSopenharmony_ci 8f08c3bdfSopenharmony_ci#ifndef LAPI_QUOTACTL_H__ 9f08c3bdfSopenharmony_ci#define LAPI_QUOTACTL_H__ 10f08c3bdfSopenharmony_ci 11f08c3bdfSopenharmony_ci#include "config.h" 12f08c3bdfSopenharmony_ci#include <sys/quota.h> 13f08c3bdfSopenharmony_ci#include "lapi/syscalls.h" 14f08c3bdfSopenharmony_ci 15f08c3bdfSopenharmony_ci#ifndef HAVE_QUOTACTL_FD 16f08c3bdfSopenharmony_cistatic inline int quotactl_fd(int fd, int cmd, int id, caddr_t addr) 17f08c3bdfSopenharmony_ci{ 18f08c3bdfSopenharmony_ci return tst_syscall(__NR_quotactl_fd, fd, cmd, id, addr); 19f08c3bdfSopenharmony_ci} 20f08c3bdfSopenharmony_ci#endif 21f08c3bdfSopenharmony_ci 22f08c3bdfSopenharmony_ci#ifdef HAVE_STRUCT_IF_NEXTDQBLK 23f08c3bdfSopenharmony_ci# include <linux/quota.h> 24f08c3bdfSopenharmony_ci#else 25f08c3bdfSopenharmony_ci# include <stdint.h> 26f08c3bdfSopenharmony_cistruct if_nextdqblk { 27f08c3bdfSopenharmony_ci uint64_t dqb_bhardlimit; 28f08c3bdfSopenharmony_ci uint64_t dqb_bsoftlimit; 29f08c3bdfSopenharmony_ci uint64_t dqb_curspace; 30f08c3bdfSopenharmony_ci uint64_t dqb_ihardlimit; 31f08c3bdfSopenharmony_ci uint64_t dqb_isoftlimit; 32f08c3bdfSopenharmony_ci uint64_t dqb_curinodes; 33f08c3bdfSopenharmony_ci uint64_t dqb_btime; 34f08c3bdfSopenharmony_ci uint64_t dqb_itime; 35f08c3bdfSopenharmony_ci uint32_t dqb_valid; 36f08c3bdfSopenharmony_ci uint32_t dqb_id; 37f08c3bdfSopenharmony_ci}; 38f08c3bdfSopenharmony_ci#endif /* HAVE_STRUCT_IF_NEXTDQBLK */ 39f08c3bdfSopenharmony_ci 40f08c3bdfSopenharmony_ci#ifndef HAVE_STRUCT_FS_QUOTA_STATV 41f08c3bdfSopenharmony_ci# include <stdint.h> 42f08c3bdfSopenharmony_cistruct fs_qfilestatv { 43f08c3bdfSopenharmony_ci uint64_t qfs_ino; 44f08c3bdfSopenharmony_ci uint64_t qfs_nblks; 45f08c3bdfSopenharmony_ci uint32_t qfs_nextents; 46f08c3bdfSopenharmony_ci uint32_t qfs_pad; 47f08c3bdfSopenharmony_ci}; 48f08c3bdfSopenharmony_ci 49f08c3bdfSopenharmony_cistruct fs_quota_statv { 50f08c3bdfSopenharmony_ci int8_t qs_version; 51f08c3bdfSopenharmony_ci uint8_t qs_pad1; 52f08c3bdfSopenharmony_ci uint16_t qs_flags; 53f08c3bdfSopenharmony_ci uint32_t qs_incoredqs; 54f08c3bdfSopenharmony_ci struct fs_qfilestatv qs_uquota; 55f08c3bdfSopenharmony_ci struct fs_qfilestatv qs_gquota; 56f08c3bdfSopenharmony_ci struct fs_qfilestatv qs_pquota; 57f08c3bdfSopenharmony_ci int32_t qs_btimelimit; 58f08c3bdfSopenharmony_ci int32_t qs_itimelimit; 59f08c3bdfSopenharmony_ci int32_t qs_rtbtimelimit; 60f08c3bdfSopenharmony_ci uint16_t qs_bwarnlimit; 61f08c3bdfSopenharmony_ci uint16_t qs_iwarnlimit; 62f08c3bdfSopenharmony_ci uint64_t qs_pad2[8]; 63f08c3bdfSopenharmony_ci}; 64f08c3bdfSopenharmony_ci# define FS_QSTATV_VERSION1 1 65f08c3bdfSopenharmony_ci#endif /* HAVE_STRUCT_FS_QUOTA_STATV */ 66f08c3bdfSopenharmony_ci 67f08c3bdfSopenharmony_ci#ifndef PRJQUOTA 68f08c3bdfSopenharmony_ci# define PRJQUOTA 2 69f08c3bdfSopenharmony_ci#endif 70f08c3bdfSopenharmony_ci 71f08c3bdfSopenharmony_ci#ifndef Q_XQUOTARM 72f08c3bdfSopenharmony_ci# define Q_XQUOTARM XQM_CMD(6) 73f08c3bdfSopenharmony_ci#endif 74f08c3bdfSopenharmony_ci 75f08c3bdfSopenharmony_ci#ifndef Q_XGETQSTATV 76f08c3bdfSopenharmony_ci# define Q_XGETQSTATV XQM_CMD(8) 77f08c3bdfSopenharmony_ci#endif 78f08c3bdfSopenharmony_ci 79f08c3bdfSopenharmony_ci#ifndef Q_XGETNEXTQUOTA 80f08c3bdfSopenharmony_ci# define Q_XGETNEXTQUOTA XQM_CMD(9) 81f08c3bdfSopenharmony_ci#endif 82f08c3bdfSopenharmony_ci 83f08c3bdfSopenharmony_ci#ifndef Q_GETNEXTQUOTA 84f08c3bdfSopenharmony_ci# define Q_GETNEXTQUOTA 0x800009 /* get disk limits and usage >= ID */ 85f08c3bdfSopenharmony_ci#endif 86f08c3bdfSopenharmony_ci 87f08c3bdfSopenharmony_ci#ifndef QFMT_VFS_V0 88f08c3bdfSopenharmony_ci# define QFMT_VFS_V0 2 89f08c3bdfSopenharmony_ci#endif 90f08c3bdfSopenharmony_ci 91f08c3bdfSopenharmony_ci#ifndef QFMT_VFS_V1 92f08c3bdfSopenharmony_ci# define QFMT_VFS_V1 4 93f08c3bdfSopenharmony_ci#endif 94f08c3bdfSopenharmony_ci 95f08c3bdfSopenharmony_ci#endif /* LAPI_QUOTACTL_H__ */ 96