函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:lib\kfifo.c Create Date:2022-07-27 07:21:50
首页 Copyright©Brick

209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
int __kfifo_from_user(struct __kfifo *fifo, const void __user *from,
        unsigned long len, unsigned int *copied)
{
    unsigned int l;
    unsigned long ret;
    unsigned int esize = fifo->esize;
    int err;
 
    if (esize != 1)
        len /= esize;
 
    l = kfifo_unused(fifo);
    if (len > l)
        len = l;
 
    ret = kfifo_copy_from_user(fifo, from, len, fifo->in, copied);
    if (unlikely(ret)) {
        len -= ret;
        err = -EFAULT;
    } else
        err = 0;
    fifo->in += len;
    return err;
}