Esempio n. 1
0
static int quota_setxquota(struct super_block *sb, int type, qid_t id,
                           void __user *addr)
{
    struct fs_disk_quota fdq;
    struct qc_dqblk qdq;
    struct kqid qid;

    if (copy_from_user(&fdq, addr, sizeof(fdq)))
        return -EFAULT;
    if (!sb->s_qcop->set_dqblk)
        return -ENOSYS;
    qid = make_kqid(current_user_ns(), type, id);
    if (!qid_valid(qid))
        return -EINVAL;
    /* Are we actually setting timer / warning limits for all users? */
    if (from_kqid(&init_user_ns, qid) == 0 &&
            fdq.d_fieldmask & (FS_DQ_WARNS_MASK | FS_DQ_TIMER_MASK)) {
        struct qc_info qinfo;
        int ret;

        if (!sb->s_qcop->set_info)
            return -EINVAL;
        copy_qcinfo_from_xfs_dqblk(&qinfo, &fdq);
        ret = sb->s_qcop->set_info(sb, type, &qinfo);
        if (ret)
            return ret;
        /* These are already done */
        fdq.d_fieldmask &= ~(FS_DQ_WARNS_MASK | FS_DQ_TIMER_MASK);
    }
    copy_from_xfs_dqblk(&qdq, &fdq);
    return sb->s_qcop->set_dqblk(sb, qid, &qdq);
}
Esempio n. 2
0
static int v2r1_is_id(void *dp, struct dquot *dquot)
{
	struct v2r1_disk_dqblk *d = dp;
	struct qtree_mem_dqinfo *info =
			sb_dqinfo(dquot->dq_sb, dquot->dq_id.type)->dqi_priv;

	if (qtree_entry_unused(info, dp))
		return 0;
	return qid_eq(make_kqid(&init_user_ns, dquot->dq_id.type,
				le32_to_cpu(d->dqb_id)),
		      dquot->dq_id);
}
Esempio n. 3
0
File: quota.c Progetto: 3null/linux
static int quota_setxquota(struct super_block *sb, int type, qid_t id,
			   void __user *addr)
{
	struct fs_disk_quota fdq;
	struct kqid qid;

	if (copy_from_user(&fdq, addr, sizeof(fdq)))
		return -EFAULT;
	if (!sb->s_qcop->set_dqblk)
		return -ENOSYS;
	qid = make_kqid(current_user_ns(), type, id);
	if (!qid_valid(qid))
		return -EINVAL;
	return sb->s_qcop->set_dqblk(sb, qid, &fdq);
}
Esempio n. 4
0
STATIC void
xfs_quota_warn(
	struct xfs_mount	*mp,
	struct xfs_dquot	*dqp,
	int			type)
{
	/* no warnings for project quotas - we just return ENOSPC later */
	if (dqp->dq_flags & XFS_DQ_PROJ)
		return;
	quota_send_warning(make_kqid(&init_user_ns,
				     (dqp->dq_flags & XFS_DQ_USER) ?
				     USRQUOTA : GRPQUOTA,
				     be32_to_cpu(dqp->q_core.d_id)),
			   mp->m_super->s_dev, type);
}
Esempio n. 5
0
STATIC void
xfs_quota_warn(
    struct xfs_mount	*mp,
    struct xfs_dquot	*dqp,
    int			type)
{
    enum quota_type qtype;

    if (dqp->dq_flags & XFS_DQ_PROJ)
        qtype = PRJQUOTA;
    else if (dqp->dq_flags & XFS_DQ_USER)
        qtype = USRQUOTA;
    else
        qtype = GRPQUOTA;

    quota_send_warning(make_kqid(&init_user_ns, qtype,
                                 be32_to_cpu(dqp->q_core.d_id)),
                       mp->m_super->s_dev, type);
}
Esempio n. 6
0
File: quota.c Progetto: 3null/linux
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;
}
Esempio n. 7
0
/*
 * 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)
{
    struct fs_disk_quota fdq;
    struct qc_dqblk qdq;
    struct kqid qid;
    qid_t id_out;
    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, &qdq);
    if (ret)
        return ret;
    id_out = from_kqid(current_user_ns(), qid);
    copy_to_xfs_dqblk(&fdq, &qdq, type, id_out);
    if (copy_to_user(addr, &fdq, sizeof(fdq)))
        return -EFAULT;
    return ret;
}
Esempio n. 8
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;
}