0001
0002
0003
0004
0005
0006
0007
0008 #ifndef _LINUX_KFIFO_H
0009 #define _LINUX_KFIFO_H
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 #include <linux/kernel.h>
0040 #include <linux/spinlock.h>
0041 #include <linux/stddef.h>
0042 #include <linux/scatterlist.h>
0043
0044 struct __kfifo {
0045 unsigned int in;
0046 unsigned int out;
0047 unsigned int mask;
0048 unsigned int esize;
0049 void *data;
0050 };
0051
0052 #define __STRUCT_KFIFO_COMMON(datatype, recsize, ptrtype) \
0053 union { \
0054 struct __kfifo kfifo; \
0055 datatype *type; \
0056 const datatype *const_type; \
0057 char (*rectype)[recsize]; \
0058 ptrtype *ptr; \
0059 ptrtype const *ptr_const; \
0060 }
0061
0062 #define __STRUCT_KFIFO(type, size, recsize, ptrtype) \
0063 { \
0064 __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \
0065 type buf[((size < 2) || (size & (size - 1))) ? -1 : size]; \
0066 }
0067
0068 #define STRUCT_KFIFO(type, size) \
0069 struct __STRUCT_KFIFO(type, size, 0, type)
0070
0071 #define __STRUCT_KFIFO_PTR(type, recsize, ptrtype) \
0072 { \
0073 __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \
0074 type buf[0]; \
0075 }
0076
0077 #define STRUCT_KFIFO_PTR(type) \
0078 struct __STRUCT_KFIFO_PTR(type, 0, type)
0079
0080
0081
0082
0083 struct kfifo __STRUCT_KFIFO_PTR(unsigned char, 0, void);
0084
0085 #define STRUCT_KFIFO_REC_1(size) \
0086 struct __STRUCT_KFIFO(unsigned char, size, 1, void)
0087
0088 #define STRUCT_KFIFO_REC_2(size) \
0089 struct __STRUCT_KFIFO(unsigned char, size, 2, void)
0090
0091
0092
0093
0094 struct kfifo_rec_ptr_1 __STRUCT_KFIFO_PTR(unsigned char, 1, void);
0095 struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PTR(unsigned char, 2, void);
0096
0097
0098
0099
0100
0101
0102 #define __is_kfifo_ptr(fifo) \
0103 (sizeof(*fifo) == sizeof(STRUCT_KFIFO_PTR(typeof(*(fifo)->type))))
0104
0105
0106
0107
0108
0109
0110 #define DECLARE_KFIFO_PTR(fifo, type) STRUCT_KFIFO_PTR(type) fifo
0111
0112
0113
0114
0115
0116
0117
0118 #define DECLARE_KFIFO(fifo, type, size) STRUCT_KFIFO(type, size) fifo
0119
0120
0121
0122
0123
0124 #define INIT_KFIFO(fifo) \
0125 (void)({ \
0126 typeof(&(fifo)) __tmp = &(fifo); \
0127 struct __kfifo *__kfifo = &__tmp->kfifo; \
0128 __kfifo->in = 0; \
0129 __kfifo->out = 0; \
0130 __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : ARRAY_SIZE(__tmp->buf) - 1;\
0131 __kfifo->esize = sizeof(*__tmp->buf); \
0132 __kfifo->data = __is_kfifo_ptr(__tmp) ? NULL : __tmp->buf; \
0133 })
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143 #define DEFINE_KFIFO(fifo, type, size) \
0144 DECLARE_KFIFO(fifo, type, size) = \
0145 (typeof(fifo)) { \
0146 { \
0147 { \
0148 .in = 0, \
0149 .out = 0, \
0150 .mask = __is_kfifo_ptr(&(fifo)) ? \
0151 0 : \
0152 ARRAY_SIZE((fifo).buf) - 1, \
0153 .esize = sizeof(*(fifo).buf), \
0154 .data = __is_kfifo_ptr(&(fifo)) ? \
0155 NULL : \
0156 (fifo).buf, \
0157 } \
0158 } \
0159 }
0160
0161
0162 static inline unsigned int __must_check
0163 __kfifo_uint_must_check_helper(unsigned int val)
0164 {
0165 return val;
0166 }
0167
0168 static inline int __must_check
0169 __kfifo_int_must_check_helper(int val)
0170 {
0171 return val;
0172 }
0173
0174
0175
0176
0177
0178
0179
0180
0181 #define kfifo_initialized(fifo) ((fifo)->kfifo.mask)
0182
0183
0184
0185
0186
0187 #define kfifo_esize(fifo) ((fifo)->kfifo.esize)
0188
0189
0190
0191
0192
0193 #define kfifo_recsize(fifo) (sizeof(*(fifo)->rectype))
0194
0195
0196
0197
0198
0199 #define kfifo_size(fifo) ((fifo)->kfifo.mask + 1)
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209 #define kfifo_reset(fifo) \
0210 (void)({ \
0211 typeof((fifo) + 1) __tmp = (fifo); \
0212 __tmp->kfifo.in = __tmp->kfifo.out = 0; \
0213 })
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223 #define kfifo_reset_out(fifo) \
0224 (void)({ \
0225 typeof((fifo) + 1) __tmp = (fifo); \
0226 __tmp->kfifo.out = __tmp->kfifo.in; \
0227 })
0228
0229
0230
0231
0232
0233 #define kfifo_len(fifo) \
0234 ({ \
0235 typeof((fifo) + 1) __tmpl = (fifo); \
0236 __tmpl->kfifo.in - __tmpl->kfifo.out; \
0237 })
0238
0239
0240
0241
0242
0243 #define kfifo_is_empty(fifo) \
0244 ({ \
0245 typeof((fifo) + 1) __tmpq = (fifo); \
0246 __tmpq->kfifo.in == __tmpq->kfifo.out; \
0247 })
0248
0249
0250
0251
0252
0253
0254
0255 #define kfifo_is_empty_spinlocked(fifo, lock) \
0256 ({ \
0257 unsigned long __flags; \
0258 bool __ret; \
0259 spin_lock_irqsave(lock, __flags); \
0260 __ret = kfifo_is_empty(fifo); \
0261 spin_unlock_irqrestore(lock, __flags); \
0262 __ret; \
0263 })
0264
0265
0266
0267
0268
0269
0270
0271 #define kfifo_is_empty_spinlocked_noirqsave(fifo, lock) \
0272 ({ \
0273 bool __ret; \
0274 spin_lock(lock); \
0275 __ret = kfifo_is_empty(fifo); \
0276 spin_unlock(lock); \
0277 __ret; \
0278 })
0279
0280
0281
0282
0283
0284 #define kfifo_is_full(fifo) \
0285 ({ \
0286 typeof((fifo) + 1) __tmpq = (fifo); \
0287 kfifo_len(__tmpq) > __tmpq->kfifo.mask; \
0288 })
0289
0290
0291
0292
0293
0294 #define kfifo_avail(fifo) \
0295 __kfifo_uint_must_check_helper( \
0296 ({ \
0297 typeof((fifo) + 1) __tmpq = (fifo); \
0298 const size_t __recsize = sizeof(*__tmpq->rectype); \
0299 unsigned int __avail = kfifo_size(__tmpq) - kfifo_len(__tmpq); \
0300 (__recsize) ? ((__avail <= __recsize) ? 0 : \
0301 __kfifo_max_r(__avail - __recsize, __recsize)) : \
0302 __avail; \
0303 }) \
0304 )
0305
0306
0307
0308
0309
0310 #define kfifo_skip(fifo) \
0311 (void)({ \
0312 typeof((fifo) + 1) __tmp = (fifo); \
0313 const size_t __recsize = sizeof(*__tmp->rectype); \
0314 struct __kfifo *__kfifo = &__tmp->kfifo; \
0315 if (__recsize) \
0316 __kfifo_skip_r(__kfifo, __recsize); \
0317 else \
0318 __kfifo->out++; \
0319 })
0320
0321
0322
0323
0324
0325
0326
0327 #define kfifo_peek_len(fifo) \
0328 __kfifo_uint_must_check_helper( \
0329 ({ \
0330 typeof((fifo) + 1) __tmp = (fifo); \
0331 const size_t __recsize = sizeof(*__tmp->rectype); \
0332 struct __kfifo *__kfifo = &__tmp->kfifo; \
0333 (!__recsize) ? kfifo_len(__tmp) * sizeof(*__tmp->type) : \
0334 __kfifo_len_r(__kfifo, __recsize); \
0335 }) \
0336 )
0337
0338
0339
0340
0341
0342
0343
0344
0345
0346
0347
0348
0349
0350 #define kfifo_alloc(fifo, size, gfp_mask) \
0351 __kfifo_int_must_check_helper( \
0352 ({ \
0353 typeof((fifo) + 1) __tmp = (fifo); \
0354 struct __kfifo *__kfifo = &__tmp->kfifo; \
0355 __is_kfifo_ptr(__tmp) ? \
0356 __kfifo_alloc(__kfifo, size, sizeof(*__tmp->type), gfp_mask) : \
0357 -EINVAL; \
0358 }) \
0359 )
0360
0361
0362
0363
0364
0365 #define kfifo_free(fifo) \
0366 ({ \
0367 typeof((fifo) + 1) __tmp = (fifo); \
0368 struct __kfifo *__kfifo = &__tmp->kfifo; \
0369 if (__is_kfifo_ptr(__tmp)) \
0370 __kfifo_free(__kfifo); \
0371 })
0372
0373
0374
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384 #define kfifo_init(fifo, buffer, size) \
0385 ({ \
0386 typeof((fifo) + 1) __tmp = (fifo); \
0387 struct __kfifo *__kfifo = &__tmp->kfifo; \
0388 __is_kfifo_ptr(__tmp) ? \
0389 __kfifo_init(__kfifo, buffer, size, sizeof(*__tmp->type)) : \
0390 -EINVAL; \
0391 })
0392
0393
0394
0395
0396
0397
0398
0399
0400
0401
0402
0403
0404
0405 #define kfifo_put(fifo, val) \
0406 ({ \
0407 typeof((fifo) + 1) __tmp = (fifo); \
0408 typeof(*__tmp->const_type) __val = (val); \
0409 unsigned int __ret; \
0410 size_t __recsize = sizeof(*__tmp->rectype); \
0411 struct __kfifo *__kfifo = &__tmp->kfifo; \
0412 if (__recsize) \
0413 __ret = __kfifo_in_r(__kfifo, &__val, sizeof(__val), \
0414 __recsize); \
0415 else { \
0416 __ret = !kfifo_is_full(__tmp); \
0417 if (__ret) { \
0418 (__is_kfifo_ptr(__tmp) ? \
0419 ((typeof(__tmp->type))__kfifo->data) : \
0420 (__tmp->buf) \
0421 )[__kfifo->in & __tmp->kfifo.mask] = \
0422 *(typeof(__tmp->type))&__val; \
0423 smp_wmb(); \
0424 __kfifo->in++; \
0425 } \
0426 } \
0427 __ret; \
0428 })
0429
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
0440
0441
0442 #define kfifo_get(fifo, val) \
0443 __kfifo_uint_must_check_helper( \
0444 ({ \
0445 typeof((fifo) + 1) __tmp = (fifo); \
0446 typeof(__tmp->ptr) __val = (val); \
0447 unsigned int __ret; \
0448 const size_t __recsize = sizeof(*__tmp->rectype); \
0449 struct __kfifo *__kfifo = &__tmp->kfifo; \
0450 if (__recsize) \
0451 __ret = __kfifo_out_r(__kfifo, __val, sizeof(*__val), \
0452 __recsize); \
0453 else { \
0454 __ret = !kfifo_is_empty(__tmp); \
0455 if (__ret) { \
0456 *(typeof(__tmp->type))__val = \
0457 (__is_kfifo_ptr(__tmp) ? \
0458 ((typeof(__tmp->type))__kfifo->data) : \
0459 (__tmp->buf) \
0460 )[__kfifo->out & __tmp->kfifo.mask]; \
0461 smp_wmb(); \
0462 __kfifo->out++; \
0463 } \
0464 } \
0465 __ret; \
0466 }) \
0467 )
0468
0469
0470
0471
0472
0473
0474
0475
0476
0477
0478
0479
0480
0481 #define kfifo_peek(fifo, val) \
0482 __kfifo_uint_must_check_helper( \
0483 ({ \
0484 typeof((fifo) + 1) __tmp = (fifo); \
0485 typeof(__tmp->ptr) __val = (val); \
0486 unsigned int __ret; \
0487 const size_t __recsize = sizeof(*__tmp->rectype); \
0488 struct __kfifo *__kfifo = &__tmp->kfifo; \
0489 if (__recsize) \
0490 __ret = __kfifo_out_peek_r(__kfifo, __val, sizeof(*__val), \
0491 __recsize); \
0492 else { \
0493 __ret = !kfifo_is_empty(__tmp); \
0494 if (__ret) { \
0495 *(typeof(__tmp->type))__val = \
0496 (__is_kfifo_ptr(__tmp) ? \
0497 ((typeof(__tmp->type))__kfifo->data) : \
0498 (__tmp->buf) \
0499 )[__kfifo->out & __tmp->kfifo.mask]; \
0500 smp_wmb(); \
0501 } \
0502 } \
0503 __ret; \
0504 }) \
0505 )
0506
0507
0508
0509
0510
0511
0512
0513
0514
0515
0516
0517
0518
0519 #define kfifo_in(fifo, buf, n) \
0520 ({ \
0521 typeof((fifo) + 1) __tmp = (fifo); \
0522 typeof(__tmp->ptr_const) __buf = (buf); \
0523 unsigned long __n = (n); \
0524 const size_t __recsize = sizeof(*__tmp->rectype); \
0525 struct __kfifo *__kfifo = &__tmp->kfifo; \
0526 (__recsize) ?\
0527 __kfifo_in_r(__kfifo, __buf, __n, __recsize) : \
0528 __kfifo_in(__kfifo, __buf, __n); \
0529 })
0530
0531
0532
0533
0534
0535
0536
0537
0538
0539
0540
0541 #define kfifo_in_spinlocked(fifo, buf, n, lock) \
0542 ({ \
0543 unsigned long __flags; \
0544 unsigned int __ret; \
0545 spin_lock_irqsave(lock, __flags); \
0546 __ret = kfifo_in(fifo, buf, n); \
0547 spin_unlock_irqrestore(lock, __flags); \
0548 __ret; \
0549 })
0550
0551
0552
0553
0554
0555
0556
0557
0558
0559
0560
0561
0562 #define kfifo_in_spinlocked_noirqsave(fifo, buf, n, lock) \
0563 ({ \
0564 unsigned int __ret; \
0565 spin_lock(lock); \
0566 __ret = kfifo_in(fifo, buf, n); \
0567 spin_unlock(lock); \
0568 __ret; \
0569 })
0570
0571
0572 #define kfifo_in_locked(fifo, buf, n, lock) \
0573 kfifo_in_spinlocked(fifo, buf, n, lock)
0574
0575
0576
0577
0578
0579
0580
0581
0582
0583
0584
0585
0586
0587 #define kfifo_out(fifo, buf, n) \
0588 __kfifo_uint_must_check_helper( \
0589 ({ \
0590 typeof((fifo) + 1) __tmp = (fifo); \
0591 typeof(__tmp->ptr) __buf = (buf); \
0592 unsigned long __n = (n); \
0593 const size_t __recsize = sizeof(*__tmp->rectype); \
0594 struct __kfifo *__kfifo = &__tmp->kfifo; \
0595 (__recsize) ?\
0596 __kfifo_out_r(__kfifo, __buf, __n, __recsize) : \
0597 __kfifo_out(__kfifo, __buf, __n); \
0598 }) \
0599 )
0600
0601
0602
0603
0604
0605
0606
0607
0608
0609
0610
0611 #define kfifo_out_spinlocked(fifo, buf, n, lock) \
0612 __kfifo_uint_must_check_helper( \
0613 ({ \
0614 unsigned long __flags; \
0615 unsigned int __ret; \
0616 spin_lock_irqsave(lock, __flags); \
0617 __ret = kfifo_out(fifo, buf, n); \
0618 spin_unlock_irqrestore(lock, __flags); \
0619 __ret; \
0620 }) \
0621 )
0622
0623
0624
0625
0626
0627
0628
0629
0630
0631
0632
0633
0634 #define kfifo_out_spinlocked_noirqsave(fifo, buf, n, lock) \
0635 __kfifo_uint_must_check_helper( \
0636 ({ \
0637 unsigned int __ret; \
0638 spin_lock(lock); \
0639 __ret = kfifo_out(fifo, buf, n); \
0640 spin_unlock(lock); \
0641 __ret; \
0642 }) \
0643 )
0644
0645
0646 #define kfifo_out_locked(fifo, buf, n, lock) \
0647 kfifo_out_spinlocked(fifo, buf, n, lock)
0648
0649
0650
0651
0652
0653
0654
0655
0656
0657
0658
0659
0660
0661
0662 #define kfifo_from_user(fifo, from, len, copied) \
0663 __kfifo_uint_must_check_helper( \
0664 ({ \
0665 typeof((fifo) + 1) __tmp = (fifo); \
0666 const void __user *__from = (from); \
0667 unsigned int __len = (len); \
0668 unsigned int *__copied = (copied); \
0669 const size_t __recsize = sizeof(*__tmp->rectype); \
0670 struct __kfifo *__kfifo = &__tmp->kfifo; \
0671 (__recsize) ? \
0672 __kfifo_from_user_r(__kfifo, __from, __len, __copied, __recsize) : \
0673 __kfifo_from_user(__kfifo, __from, __len, __copied); \
0674 }) \
0675 )
0676
0677
0678
0679
0680
0681
0682
0683
0684
0685
0686
0687
0688
0689
0690 #define kfifo_to_user(fifo, to, len, copied) \
0691 __kfifo_int_must_check_helper( \
0692 ({ \
0693 typeof((fifo) + 1) __tmp = (fifo); \
0694 void __user *__to = (to); \
0695 unsigned int __len = (len); \
0696 unsigned int *__copied = (copied); \
0697 const size_t __recsize = sizeof(*__tmp->rectype); \
0698 struct __kfifo *__kfifo = &__tmp->kfifo; \
0699 (__recsize) ? \
0700 __kfifo_to_user_r(__kfifo, __to, __len, __copied, __recsize) : \
0701 __kfifo_to_user(__kfifo, __to, __len, __copied); \
0702 }) \
0703 )
0704
0705
0706
0707
0708
0709
0710
0711
0712
0713
0714
0715
0716
0717
0718 #define kfifo_dma_in_prepare(fifo, sgl, nents, len) \
0719 ({ \
0720 typeof((fifo) + 1) __tmp = (fifo); \
0721 struct scatterlist *__sgl = (sgl); \
0722 int __nents = (nents); \
0723 unsigned int __len = (len); \
0724 const size_t __recsize = sizeof(*__tmp->rectype); \
0725 struct __kfifo *__kfifo = &__tmp->kfifo; \
0726 (__recsize) ? \
0727 __kfifo_dma_in_prepare_r(__kfifo, __sgl, __nents, __len, __recsize) : \
0728 __kfifo_dma_in_prepare(__kfifo, __sgl, __nents, __len); \
0729 })
0730
0731
0732
0733
0734
0735
0736
0737
0738
0739
0740
0741
0742 #define kfifo_dma_in_finish(fifo, len) \
0743 (void)({ \
0744 typeof((fifo) + 1) __tmp = (fifo); \
0745 unsigned int __len = (len); \
0746 const size_t __recsize = sizeof(*__tmp->rectype); \
0747 struct __kfifo *__kfifo = &__tmp->kfifo; \
0748 if (__recsize) \
0749 __kfifo_dma_in_finish_r(__kfifo, __len, __recsize); \
0750 else \
0751 __kfifo->in += __len / sizeof(*__tmp->type); \
0752 })
0753
0754
0755
0756
0757
0758
0759
0760
0761
0762
0763
0764
0765
0766
0767
0768
0769 #define kfifo_dma_out_prepare(fifo, sgl, nents, len) \
0770 ({ \
0771 typeof((fifo) + 1) __tmp = (fifo); \
0772 struct scatterlist *__sgl = (sgl); \
0773 int __nents = (nents); \
0774 unsigned int __len = (len); \
0775 const size_t __recsize = sizeof(*__tmp->rectype); \
0776 struct __kfifo *__kfifo = &__tmp->kfifo; \
0777 (__recsize) ? \
0778 __kfifo_dma_out_prepare_r(__kfifo, __sgl, __nents, __len, __recsize) : \
0779 __kfifo_dma_out_prepare(__kfifo, __sgl, __nents, __len); \
0780 })
0781
0782
0783
0784
0785
0786
0787
0788
0789
0790
0791
0792
0793 #define kfifo_dma_out_finish(fifo, len) \
0794 (void)({ \
0795 typeof((fifo) + 1) __tmp = (fifo); \
0796 unsigned int __len = (len); \
0797 const size_t __recsize = sizeof(*__tmp->rectype); \
0798 struct __kfifo *__kfifo = &__tmp->kfifo; \
0799 if (__recsize) \
0800 __kfifo_dma_out_finish_r(__kfifo, __recsize); \
0801 else \
0802 __kfifo->out += __len / sizeof(*__tmp->type); \
0803 })
0804
0805
0806
0807
0808
0809
0810
0811
0812
0813
0814
0815
0816
0817 #define kfifo_out_peek(fifo, buf, n) \
0818 __kfifo_uint_must_check_helper( \
0819 ({ \
0820 typeof((fifo) + 1) __tmp = (fifo); \
0821 typeof(__tmp->ptr) __buf = (buf); \
0822 unsigned long __n = (n); \
0823 const size_t __recsize = sizeof(*__tmp->rectype); \
0824 struct __kfifo *__kfifo = &__tmp->kfifo; \
0825 (__recsize) ? \
0826 __kfifo_out_peek_r(__kfifo, __buf, __n, __recsize) : \
0827 __kfifo_out_peek(__kfifo, __buf, __n); \
0828 }) \
0829 )
0830
0831 extern int __kfifo_alloc(struct __kfifo *fifo, unsigned int size,
0832 size_t esize, gfp_t gfp_mask);
0833
0834 extern void __kfifo_free(struct __kfifo *fifo);
0835
0836 extern int __kfifo_init(struct __kfifo *fifo, void *buffer,
0837 unsigned int size, size_t esize);
0838
0839 extern unsigned int __kfifo_in(struct __kfifo *fifo,
0840 const void *buf, unsigned int len);
0841
0842 extern unsigned int __kfifo_out(struct __kfifo *fifo,
0843 void *buf, unsigned int len);
0844
0845 extern int __kfifo_from_user(struct __kfifo *fifo,
0846 const void __user *from, unsigned long len, unsigned int *copied);
0847
0848 extern int __kfifo_to_user(struct __kfifo *fifo,
0849 void __user *to, unsigned long len, unsigned int *copied);
0850
0851 extern unsigned int __kfifo_dma_in_prepare(struct __kfifo *fifo,
0852 struct scatterlist *sgl, int nents, unsigned int len);
0853
0854 extern unsigned int __kfifo_dma_out_prepare(struct __kfifo *fifo,
0855 struct scatterlist *sgl, int nents, unsigned int len);
0856
0857 extern unsigned int __kfifo_out_peek(struct __kfifo *fifo,
0858 void *buf, unsigned int len);
0859
0860 extern unsigned int __kfifo_in_r(struct __kfifo *fifo,
0861 const void *buf, unsigned int len, size_t recsize);
0862
0863 extern unsigned int __kfifo_out_r(struct __kfifo *fifo,
0864 void *buf, unsigned int len, size_t recsize);
0865
0866 extern int __kfifo_from_user_r(struct __kfifo *fifo,
0867 const void __user *from, unsigned long len, unsigned int *copied,
0868 size_t recsize);
0869
0870 extern int __kfifo_to_user_r(struct __kfifo *fifo, void __user *to,
0871 unsigned long len, unsigned int *copied, size_t recsize);
0872
0873 extern unsigned int __kfifo_dma_in_prepare_r(struct __kfifo *fifo,
0874 struct scatterlist *sgl, int nents, unsigned int len, size_t recsize);
0875
0876 extern void __kfifo_dma_in_finish_r(struct __kfifo *fifo,
0877 unsigned int len, size_t recsize);
0878
0879 extern unsigned int __kfifo_dma_out_prepare_r(struct __kfifo *fifo,
0880 struct scatterlist *sgl, int nents, unsigned int len, size_t recsize);
0881
0882 extern void __kfifo_dma_out_finish_r(struct __kfifo *fifo, size_t recsize);
0883
0884 extern unsigned int __kfifo_len_r(struct __kfifo *fifo, size_t recsize);
0885
0886 extern void __kfifo_skip_r(struct __kfifo *fifo, size_t recsize);
0887
0888 extern unsigned int __kfifo_out_peek_r(struct __kfifo *fifo,
0889 void *buf, unsigned int len, size_t recsize);
0890
0891 extern unsigned int __kfifo_max_r(unsigned int len, size_t recsize);
0892
0893 #endif