Пример #1
0
static int quota_getquota(struct super_block *sb, int type, qid_t id,
			  void __user *addr)
{
	struct fs_disk_quota fdq;
	struct if_dqblk idq;
	int ret;

	if (!sb->s_qcop->get_dqblk)
		return -ENOSYS;
	ret = sb->s_qcop->get_dqblk(sb, type, id, &fdq);
	if (ret)
		return ret;
	copy_to_if_dqblk(&idq, &fdq);
	if (copy_to_user(addr, &idq, sizeof(idq)))
		return -EFAULT;
	return 0;
}
Пример #2
0
static int quota_getquota(struct super_block *sb, int type, qid_t id,
			  void __user *addr)
{
	struct kqid qid;
	struct fs_disk_quota fdq;
	struct if_dqblk idq;
	int ret;

	if (!sb->s_qcop->get_dqblk)
		return -ENOSYS;
	qid = make_kqid(current_user_ns(), type, id);
	if (!qid_valid(qid))
		return -EINVAL;
	ret = sb->s_qcop->get_dqblk(sb, qid, &fdq);
	if (ret)
		return ret;
	copy_to_if_dqblk(&idq, &fdq);
	if (copy_to_user(addr, &idq, sizeof(idq)))
		return -EFAULT;
	return 0;
}
Пример #3
0
/*
 * 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)
{
    struct kqid qid;
    struct qc_dqblk fdq;
    struct if_nextdqblk idq;
    int ret;

    if (!sb->s_qcop->get_nextdqblk)
        return -ENOSYS;
    qid = make_kqid(current_user_ns(), type, id);
    if (!qid_valid(qid))
        return -EINVAL;
    ret = sb->s_qcop->get_nextdqblk(sb, &qid, &fdq);
    if (ret)
        return ret;
    /* struct if_nextdqblk is a superset of struct if_dqblk */
    copy_to_if_dqblk((struct if_dqblk *)&idq, &fdq);
    idq.dqb_id = from_kqid(current_user_ns(), qid);
    if (copy_to_user(addr, &idq, sizeof(idq)))
        return -EFAULT;
    return 0;
}