linux/fs/quota/quota.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Quota code necessary even when VFS quota support is not compiled
 * into the kernel.  The interesting stuff is over in dquot.c, here
 * we have symbols for initial quotactl(2) handling, the sysctl(2)
 * variables, etc - things needed even when quota support disabled.
 */

#include <linux/fs.h>
#include <linux/namei.h>
#include <linux/slab.h>
#include <asm/current.h>
#include <linux/blkdev.h>
#include <linux/uaccess.h>
#include <linux/kernel.h>
#include <linux/security.h>
#include <linux/syscalls.h>
#include <linux/capability.h>
#include <linux/quotaops.h>
#include <linux/types.h>
#include <linux/mount.h>
#include <linux/writeback.h>
#include <linux/nospec.h>
#include "compat.h"
#include "../internal.h"

static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
				     qid_t id)
{}

static void quota_sync_one(struct super_block *sb, void *arg)
{}

static int quota_sync_all(int type)
{}

unsigned int qtype_enforce_flag(int type)
{}

static int quota_quotaon(struct super_block *sb, int type, qid_t id,
		         const struct path *path)
{}

static int quota_quotaoff(struct super_block *sb, int type)
{}

static int quota_getfmt(struct super_block *sb, int type, void __user *addr)
{}

static int quota_getinfo(struct super_block *sb, int type, void __user *addr)
{}

static int quota_setinfo(struct super_block *sb, int type, void __user *addr)
{}

static inline qsize_t qbtos(qsize_t blocks)
{}

static inline qsize_t stoqb(qsize_t space)
{}

static void copy_to_if_dqblk(struct if_dqblk *dst, struct qc_dqblk *src)
{}

static int quota_getquota(struct super_block *sb, int type, qid_t id,
			  void __user *addr)
{}

/*
 * Return quota for next active quota >= this id, if any exists,
 * otherwise return -ENOENT via ->get_nextdqblk
 */
static int quota_getnextquota(struct super_block *sb, int type, qid_t id,
			  void __user *addr)
{}

static void copy_from_if_dqblk(struct qc_dqblk *dst, struct if_dqblk *src)
{}

static int quota_setquota(struct super_block *sb, int type, qid_t id,
			  void __user *addr)
{}

static int quota_enable(struct super_block *sb, void __user *addr)
{}

static int quota_disable(struct super_block *sb, void __user *addr)
{}

static int quota_state_to_flags(struct qc_state *state)
{}

static int quota_getstate(struct super_block *sb, int type,
			  struct fs_quota_stat *fqs)
{}

static int compat_copy_fs_qfilestat(struct compat_fs_qfilestat __user *to,
		struct fs_qfilestat *from)
{}

static int compat_copy_fs_quota_stat(struct compat_fs_quota_stat __user *to,
		struct fs_quota_stat *from)
{}

static int quota_getxstate(struct super_block *sb, int type, void __user *addr)
{}

static int quota_getstatev(struct super_block *sb, int type,
			   struct fs_quota_statv *fqs)
{}

static int quota_getxstatev(struct super_block *sb, int type, void __user *addr)
{}

/*
 * XFS defines BBTOB and BTOBB macros inside fs/xfs/ and we cannot move them
 * out of there as xfsprogs rely on definitions being in that header file. So
 * just define same functions here for quota purposes.
 */
#define XFS_BB_SHIFT

static inline u64 quota_bbtob(u64 blocks)
{}

static inline u64 quota_btobb(u64 bytes)
{}

static inline s64 copy_from_xfs_dqblk_ts(const struct fs_disk_quota *d,
		__s32 timer, __s8 timer_hi)
{}

static void copy_from_xfs_dqblk(struct qc_dqblk *dst, struct fs_disk_quota *src)
{}

static void copy_qcinfo_from_xfs_dqblk(struct qc_info *dst,
				       struct fs_disk_quota *src)
{}

static int quota_setxquota(struct super_block *sb, int type, qid_t id,
			   void __user *addr)
{}

static inline void copy_to_xfs_dqblk_ts(const struct fs_disk_quota *d,
		__s32 *timer_lo, __s8 *timer_hi, s64 timer)
{}

static inline bool want_bigtime(s64 timer)
{}

static void copy_to_xfs_dqblk(struct fs_disk_quota *dst, struct qc_dqblk *src,
			      int type, qid_t id)
{}

static int quota_getxquota(struct super_block *sb, int type, qid_t id,
			   void __user *addr)
{}

/*
 * Return quota for next active quota >= this id, if any exists,
 * otherwise return -ENOENT via ->get_nextdqblk.
 */
static int quota_getnextxquota(struct super_block *sb, int type, qid_t id,
			    void __user *addr)
{}

static int quota_rmxquota(struct super_block *sb, void __user *addr)
{}

/* Copy parameters and call proper function */
static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
		       void __user *addr, const struct path *path)
{}

/* Return 1 if 'cmd' will block on frozen filesystem */
static int quotactl_cmd_write(int cmd)
{}

/* Return true if quotactl command is manipulating quota on/off state */
static bool quotactl_cmd_onoff(int cmd)
{}

/*
 * look up a superblock on which quota ops will be performed
 * - use the name of a block device to find the superblock thereon
 */
static struct super_block *quotactl_block(const char __user *special, int cmd)
{}

/*
 * This is the system call interface. This communicates with
 * the user-level programs. Currently this only supports diskquota
 * calls. Maybe we need to add the process quotas etc. in the future,
 * but we probably should use rlimits for that.
 */
SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special,
		qid_t, id, void __user *, addr)
{}

SYSCALL_DEFINE4(quotactl_fd, unsigned int, fd, unsigned int, cmd,
		qid_t, id, void __user *, addr)
{}