1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __FS_CEPH_BUFFER_H
3 #define __FS_CEPH_BUFFER_H
5 #include <linux/kref.h>
7 #include <linux/vmalloc.h>
8 #include <linux/types.h>
12 * a simple reference counted buffer.
14 * use kmalloc for smaller sizes, vmalloc for larger sizes.
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
)
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
);