Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / include / linux / ceph / buffer.h
blob5e58bb29b1a36b55e86bf8951cd04eaf149853e5
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __FS_CEPH_BUFFER_H
3 #define __FS_CEPH_BUFFER_H
5 #include <linux/kref.h>
6 #include <linux/mm.h>
7 #include <linux/vmalloc.h>
8 #include <linux/types.h>
9 #include <linux/uio.h>
12 * a simple reference counted buffer.
14 * use kmalloc for smaller sizes, vmalloc for larger sizes.
16 struct ceph_buffer {
17 struct kref kref;
18 struct kvec vec;
19 size_t alloc_len;
22 extern struct ceph_buffer *ceph_buffer_new(size_t len, gfp_t gfp);
23 extern void ceph_buffer_release(struct kref *kref);
25 static inline struct ceph_buffer *ceph_buffer_get(struct ceph_buffer *b)
27 kref_get(&b->kref);
28 return b;
31 static inline void ceph_buffer_put(struct ceph_buffer *b)
33 kref_put(&b->kref, ceph_buffer_release);
36 extern int ceph_decode_buffer(struct ceph_buffer **b, void **p, void *end);
38 #endif