函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:fs\quota\quota.c Create Date:2022-07-29 11:10:07
首页 Copyright©Brick

218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
/*
 * 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_has_mapping(sb->s_user_ns, 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;
}