Lines Matching refs:buf
32 * @buf: The buffer to initialize.
39 static inline void sshp_buf_init(struct sshp_buf *buf, u8 *ptr, size_t cap)
41 buf->ptr = ptr;
42 buf->len = 0;
43 buf->cap = cap;
48 * @buf: The buffer to initialize/allocate to.
57 static inline int sshp_buf_alloc(struct sshp_buf *buf, size_t cap, gfp_t flags)
65 sshp_buf_init(buf, ptr, cap);
71 * @buf: The buffer to free.
77 static inline void sshp_buf_free(struct sshp_buf *buf)
79 kfree(buf->ptr);
80 buf->ptr = NULL;
81 buf->len = 0;
82 buf->cap = 0;
87 * @buf: The buffer to drop data from.
93 static inline void sshp_buf_drop(struct sshp_buf *buf, size_t n)
95 memmove(buf->ptr, buf->ptr + n, buf->len - n);
96 buf->len -= n;
101 * @buf: The buffer to write the data into.
111 static inline size_t sshp_buf_read_from_fifo(struct sshp_buf *buf,
116 n = kfifo_out(fifo, buf->ptr + buf->len, buf->cap - buf->len);
117 buf->len += n;
124 * @buf: The buffer to create the span from.
137 static inline void sshp_buf_span_from(struct sshp_buf *buf, size_t offset,
140 span->ptr = buf->ptr + offset;
141 span->len = buf->len - offset;