Fix: handle writes of length 0
[lttng-ust.git] / libringbuffer / ring_buffer_backend.c
CommitLineData
852c2936
MD
1/*
2 * ring_buffer_backend.c
3 *
e92f3e28 4 * Copyright (C) 2005-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
852c2936 5 *
e92f3e28
MD
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; only
9 * version 2.1 of the License.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
852c2936
MD
19 */
20
5ad63a16 21#define _GNU_SOURCE
14641deb 22#include <urcu/arch.h>
96e80018 23#include <limits.h>
14641deb 24
4318ae1b 25#include <lttng/ringbuffer-config.h>
2fed87ae 26#include "vatomic.h"
4931a13e
MD
27#include "backend.h"
28#include "frontend.h"
a6352fd4 29#include "smp.h"
431d5cf0 30#include "shm.h"
852c2936
MD
31
32/**
33 * lib_ring_buffer_backend_allocate - allocate a channel buffer
34 * @config: ring buffer instance configuration
35 * @buf: the buffer struct
36 * @size: total size of the buffer
37 * @num_subbuf: number of subbuffers
38 * @extra_reader_sb: need extra subbuffer for reader
39 */
40static
4cfec15c
MD
41int lib_ring_buffer_backend_allocate(const struct lttng_ust_lib_ring_buffer_config *config,
42 struct lttng_ust_lib_ring_buffer_backend *bufb,
852c2936 43 size_t size, size_t num_subbuf,
a6352fd4 44 int extra_reader_sb,
38fae1d3 45 struct lttng_ust_shm_handle *handle,
1d498196 46 struct shm_object *shmobj)
852c2936 47{
1d498196 48 struct channel_backend *chanb = &shmp(handle, bufb->chan)->backend;
852c2936
MD
49 unsigned long subbuf_size, mmap_offset = 0;
50 unsigned long num_subbuf_alloc;
852c2936
MD
51 unsigned long i;
52
852c2936
MD
53 subbuf_size = chanb->subbuf_size;
54 num_subbuf_alloc = num_subbuf;
55
a6352fd4 56 if (extra_reader_sb)
852c2936 57 num_subbuf_alloc++;
852c2936 58
4cfec15c 59 align_shm(shmobj, __alignof__(struct lttng_ust_lib_ring_buffer_backend_pages_shmp));
1d498196 60 set_shmp(bufb->array, zalloc_shm(shmobj,
4cfec15c 61 sizeof(struct lttng_ust_lib_ring_buffer_backend_pages_shmp) * num_subbuf_alloc));
b5a3dfa5 62 if (caa_unlikely(!shmp(handle, bufb->array)))
852c2936
MD
63 goto array_error;
64
431d5cf0
MD
65 /*
66 * This is the largest element (the buffer pages) which needs to
67 * be aligned on PAGE_SIZE.
68 */
1d498196
MD
69 align_shm(shmobj, PAGE_SIZE);
70 set_shmp(bufb->memory_map, zalloc_shm(shmobj,
a6352fd4 71 subbuf_size * num_subbuf_alloc));
b5a3dfa5 72 if (caa_unlikely(!shmp(handle, bufb->memory_map)))
a6352fd4 73 goto memory_map_error;
852c2936
MD
74
75 /* Allocate backend pages array elements */
76 for (i = 0; i < num_subbuf_alloc; i++) {
4cfec15c 77 align_shm(shmobj, __alignof__(struct lttng_ust_lib_ring_buffer_backend_pages));
aead2025 78 set_shmp(shmp_index(handle, bufb->array, i)->shmp,
1d498196 79 zalloc_shm(shmobj,
4cfec15c 80 sizeof(struct lttng_ust_lib_ring_buffer_backend_pages)));
4746ae29 81 if (!shmp(handle, shmp_index(handle, bufb->array, i)->shmp))
852c2936
MD
82 goto free_array;
83 }
84
85 /* Allocate write-side subbuffer table */
4cfec15c 86 align_shm(shmobj, __alignof__(struct lttng_ust_lib_ring_buffer_backend_subbuffer));
1d498196 87 set_shmp(bufb->buf_wsb, zalloc_shm(shmobj,
4cfec15c 88 sizeof(struct lttng_ust_lib_ring_buffer_backend_subbuffer)
1d498196 89 * num_subbuf));
b5a3dfa5 90 if (caa_unlikely(!shmp(handle, bufb->buf_wsb)))
852c2936
MD
91 goto free_array;
92
93 for (i = 0; i < num_subbuf; i++)
4746ae29 94 shmp_index(handle, bufb->buf_wsb, i)->id = subbuffer_id(config, 0, 1, i);
852c2936
MD
95
96 /* Assign read-side subbuffer table */
97 if (extra_reader_sb)
98 bufb->buf_rsb.id = subbuffer_id(config, 0, 1,
99 num_subbuf_alloc - 1);
100 else
101 bufb->buf_rsb.id = subbuffer_id(config, 0, 1, 0);
102
103 /* Assign pages to page index */
104 for (i = 0; i < num_subbuf_alloc; i++) {
1d498196
MD
105 struct shm_ref ref;
106
107 ref.index = bufb->memory_map._ref.index;
108 ref.offset = bufb->memory_map._ref.offset;
109 ref.offset += i * subbuf_size;
110
4746ae29 111 set_shmp(shmp(handle, shmp_index(handle, bufb->array, i)->shmp)->p,
1d498196 112 ref);
852c2936 113 if (config->output == RING_BUFFER_MMAP) {
4746ae29 114 shmp(handle, shmp_index(handle, bufb->array, i)->shmp)->mmap_offset = mmap_offset;
852c2936
MD
115 mmap_offset += subbuf_size;
116 }
117 }
118
852c2936
MD
119 return 0;
120
121free_array:
a6352fd4
MD
122 /* bufb->array[i] will be freed by shm teardown */
123memory_map_error:
124 /* bufb->array will be freed by shm teardown */
852c2936 125array_error:
852c2936
MD
126 return -ENOMEM;
127}
128
4cfec15c 129int lib_ring_buffer_backend_create(struct lttng_ust_lib_ring_buffer_backend *bufb,
a6352fd4 130 struct channel_backend *chanb, int cpu,
38fae1d3 131 struct lttng_ust_shm_handle *handle,
1d498196 132 struct shm_object *shmobj)
852c2936 133{
4cfec15c 134 const struct lttng_ust_lib_ring_buffer_config *config = &chanb->config;
852c2936 135
1d498196 136 set_shmp(bufb->chan, handle->chan._ref);
852c2936
MD
137 bufb->cpu = cpu;
138
139 return lib_ring_buffer_backend_allocate(config, bufb, chanb->buf_size,
140 chanb->num_subbuf,
a6352fd4 141 chanb->extra_reader_sb,
1d498196 142 handle, shmobj);
852c2936
MD
143}
144
4cfec15c 145void lib_ring_buffer_backend_reset(struct lttng_ust_lib_ring_buffer_backend *bufb,
38fae1d3 146 struct lttng_ust_shm_handle *handle)
852c2936 147{
1d498196 148 struct channel_backend *chanb = &shmp(handle, bufb->chan)->backend;
4cfec15c 149 const struct lttng_ust_lib_ring_buffer_config *config = &chanb->config;
852c2936
MD
150 unsigned long num_subbuf_alloc;
151 unsigned int i;
152
153 num_subbuf_alloc = chanb->num_subbuf;
154 if (chanb->extra_reader_sb)
155 num_subbuf_alloc++;
156
157 for (i = 0; i < chanb->num_subbuf; i++)
4746ae29 158 shmp_index(handle, bufb->buf_wsb, i)->id = subbuffer_id(config, 0, 1, i);
852c2936
MD
159 if (chanb->extra_reader_sb)
160 bufb->buf_rsb.id = subbuffer_id(config, 0, 1,
161 num_subbuf_alloc - 1);
162 else
163 bufb->buf_rsb.id = subbuffer_id(config, 0, 1, 0);
164
165 for (i = 0; i < num_subbuf_alloc; i++) {
166 /* Don't reset mmap_offset */
4746ae29
MD
167 v_set(config, &shmp(handle, shmp_index(handle, bufb->array, i)->shmp)->records_commit, 0);
168 v_set(config, &shmp(handle, shmp_index(handle, bufb->array, i)->shmp)->records_unread, 0);
169 shmp(handle, shmp_index(handle, bufb->array, i)->shmp)->data_size = 0;
852c2936
MD
170 /* Don't reset backend page and virt addresses */
171 }
172 /* Don't reset num_pages_per_subbuf, cpu, allocated */
173 v_set(config, &bufb->records_read, 0);
174}
175
176/*
177 * The frontend is responsible for also calling ring_buffer_backend_reset for
178 * each buffer when calling channel_backend_reset.
179 */
180void channel_backend_reset(struct channel_backend *chanb)
181{
14641deb 182 struct channel *chan = caa_container_of(chanb, struct channel, backend);
4cfec15c 183 const struct lttng_ust_lib_ring_buffer_config *config = &chanb->config;
852c2936
MD
184
185 /*
186 * Don't reset buf_size, subbuf_size, subbuf_size_order,
187 * num_subbuf_order, buf_size_order, extra_reader_sb, num_subbuf,
188 * priv, notifiers, config, cpumask and name.
189 */
190 chanb->start_tsc = config->cb.ring_buffer_clock_read(chan);
191}
192
852c2936
MD
193/**
194 * channel_backend_init - initialize a channel backend
195 * @chanb: channel backend
196 * @name: channel name
197 * @config: client ring buffer configuration
852c2936
MD
198 * @parent: dentry of parent directory, %NULL for root directory
199 * @subbuf_size: size of sub-buffers (> PAGE_SIZE, power of 2)
200 * @num_subbuf: number of sub-buffers (power of 2)
38fae1d3 201 * @lttng_ust_shm_handle: shared memory handle
852c2936
MD
202 *
203 * Returns channel pointer if successful, %NULL otherwise.
204 *
205 * Creates per-cpu channel buffers using the sizes and attributes
206 * specified. The created channel buffer files will be named
207 * name_0...name_N-1. File permissions will be %S_IRUSR.
208 *
209 * Called with CPU hotplug disabled.
210 */
211int channel_backend_init(struct channel_backend *chanb,
212 const char *name,
4cfec15c 213 const struct lttng_ust_lib_ring_buffer_config *config,
a3f61e7f 214 size_t subbuf_size, size_t num_subbuf,
38fae1d3 215 struct lttng_ust_shm_handle *handle)
852c2936 216{
14641deb 217 struct channel *chan = caa_container_of(chanb, struct channel, backend);
852c2936
MD
218 unsigned int i;
219 int ret;
6c1f7d8b 220 size_t shmsize = 0, num_subbuf_alloc;
852c2936
MD
221
222 if (!name)
223 return -EPERM;
224
852c2936
MD
225 /* Check that the subbuffer size is larger than a page. */
226 if (subbuf_size < PAGE_SIZE)
227 return -EINVAL;
228
229 /*
12bcbbdb
MD
230 * Make sure the number of subbuffers and subbuffer size are
231 * power of 2, and nonzero.
852c2936 232 */
12bcbbdb 233 if (!subbuf_size || (subbuf_size & (subbuf_size - 1)))
e52b0723 234 return -EINVAL;
12bcbbdb 235 if (!num_subbuf || (num_subbuf & (num_subbuf - 1)))
e52b0723 236 return -EINVAL;
852c2936
MD
237
238 ret = subbuffer_id_check_index(config, num_subbuf);
239 if (ret)
240 return ret;
241
852c2936
MD
242 chanb->buf_size = num_subbuf * subbuf_size;
243 chanb->subbuf_size = subbuf_size;
244 chanb->buf_size_order = get_count_order(chanb->buf_size);
245 chanb->subbuf_size_order = get_count_order(subbuf_size);
246 chanb->num_subbuf_order = get_count_order(num_subbuf);
247 chanb->extra_reader_sb =
248 (config->mode == RING_BUFFER_OVERWRITE) ? 1 : 0;
249 chanb->num_subbuf = num_subbuf;
a6352fd4
MD
250 strncpy(chanb->name, name, NAME_MAX);
251 chanb->name[NAME_MAX - 1] = '\0';
193183fb 252 memcpy(&chanb->config, config, sizeof(*config));
852c2936 253
1d498196 254 /* Per-cpu buffer size: control (prior to backend) */
4cfec15c
MD
255 shmsize = offset_align(shmsize, __alignof__(struct lttng_ust_lib_ring_buffer));
256 shmsize += sizeof(struct lttng_ust_lib_ring_buffer);
1d498196
MD
257
258 /* Per-cpu buffer size: backend */
259 /* num_subbuf + 1 is the worse case */
260 num_subbuf_alloc = num_subbuf + 1;
4cfec15c
MD
261 shmsize += offset_align(shmsize, __alignof__(struct lttng_ust_lib_ring_buffer_backend_pages_shmp));
262 shmsize += sizeof(struct lttng_ust_lib_ring_buffer_backend_pages_shmp) * num_subbuf_alloc;
6c1f7d8b 263 shmsize += offset_align(shmsize, PAGE_SIZE);
1d498196 264 shmsize += subbuf_size * num_subbuf_alloc;
4cfec15c
MD
265 shmsize += offset_align(shmsize, __alignof__(struct lttng_ust_lib_ring_buffer_backend_pages));
266 shmsize += sizeof(struct lttng_ust_lib_ring_buffer_backend_pages) * num_subbuf_alloc;
267 shmsize += offset_align(shmsize, __alignof__(struct lttng_ust_lib_ring_buffer_backend_subbuffer));
268 shmsize += sizeof(struct lttng_ust_lib_ring_buffer_backend_subbuffer) * num_subbuf;
1d498196
MD
269 /* Per-cpu buffer size: control (after backend) */
270 shmsize += offset_align(shmsize, __alignof__(struct commit_counters_hot));
271 shmsize += sizeof(struct commit_counters_hot) * num_subbuf;
272 shmsize += offset_align(shmsize, __alignof__(struct commit_counters_cold));
273 shmsize += sizeof(struct commit_counters_cold) * num_subbuf;
274
852c2936 275 if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) {
4cfec15c 276 struct lttng_ust_lib_ring_buffer *buf;
852c2936 277 /*
a6352fd4 278 * We need to allocate for all possible cpus.
852c2936 279 */
852c2936 280 for_each_possible_cpu(i) {
1d498196
MD
281 struct shm_object *shmobj;
282
74d81a6c
MD
283 shmobj = shm_object_table_alloc(handle->table, shmsize,
284 SHM_OBJECT_SHM);
afdf9825
MD
285 if (!shmobj)
286 goto end;
4cfec15c
MD
287 align_shm(shmobj, __alignof__(struct lttng_ust_lib_ring_buffer));
288 set_shmp(chanb->buf[i].shmp, zalloc_shm(shmobj, sizeof(struct lttng_ust_lib_ring_buffer)));
1d498196
MD
289 buf = shmp(handle, chanb->buf[i].shmp);
290 if (!buf)
291 goto end;
5d61a504 292 set_shmp(buf->self, chanb->buf[i].shmp._ref);
1d498196
MD
293 ret = lib_ring_buffer_create(buf, chanb, i,
294 handle, shmobj);
852c2936
MD
295 if (ret)
296 goto free_bufs; /* cpu hotplug locked */
297 }
852c2936 298 } else {
1d498196 299 struct shm_object *shmobj;
4cfec15c 300 struct lttng_ust_lib_ring_buffer *buf;
a6352fd4 301
74d81a6c
MD
302 shmobj = shm_object_table_alloc(handle->table, shmsize,
303 SHM_OBJECT_SHM);
afdf9825
MD
304 if (!shmobj)
305 goto end;
4cfec15c
MD
306 align_shm(shmobj, __alignof__(struct lttng_ust_lib_ring_buffer));
307 set_shmp(chanb->buf[0].shmp, zalloc_shm(shmobj, sizeof(struct lttng_ust_lib_ring_buffer)));
1d498196 308 buf = shmp(handle, chanb->buf[0].shmp);
a6352fd4
MD
309 if (!buf)
310 goto end;
cb14bae9 311 set_shmp(buf->self, chanb->buf[0].shmp._ref);
1d498196
MD
312 ret = lib_ring_buffer_create(buf, chanb, -1,
313 handle, shmobj);
852c2936
MD
314 if (ret)
315 goto free_bufs;
316 }
317 chanb->start_tsc = config->cb.ring_buffer_clock_read(chan);
318
319 return 0;
320
321free_bufs:
a6352fd4
MD
322 /* We only free the buffer data upon shm teardown */
323end:
852c2936
MD
324 return -ENOMEM;
325}
326
852c2936
MD
327/**
328 * channel_backend_free - destroy the channel
329 * @chan: the channel
330 *
331 * Destroy all channel buffers and frees the channel.
332 */
1d498196 333void channel_backend_free(struct channel_backend *chanb,
38fae1d3 334 struct lttng_ust_shm_handle *handle)
852c2936 335{
45e9e699 336 /* SHM teardown takes care of everything */
852c2936
MD
337}
338
852c2936
MD
339/**
340 * lib_ring_buffer_read - read data from ring_buffer_buffer.
341 * @bufb : buffer backend
342 * @offset : offset within the buffer
343 * @dest : destination address
344 * @len : length to copy to destination
345 *
346 * Should be protected by get_subbuf/put_subbuf.
347 * Returns the length copied.
348 */
4cfec15c 349size_t lib_ring_buffer_read(struct lttng_ust_lib_ring_buffer_backend *bufb, size_t offset,
38fae1d3 350 void *dest, size_t len, struct lttng_ust_shm_handle *handle)
852c2936 351{
1d498196 352 struct channel_backend *chanb = &shmp(handle, bufb->chan)->backend;
4cfec15c 353 const struct lttng_ust_lib_ring_buffer_config *config = &chanb->config;
a6352fd4 354 ssize_t orig_len;
4cfec15c 355 struct lttng_ust_lib_ring_buffer_backend_pages_shmp *rpages;
852c2936
MD
356 unsigned long sb_bindex, id;
357
358 orig_len = len;
359 offset &= chanb->buf_size - 1;
a6352fd4 360
b5a3dfa5 361 if (caa_unlikely(!len))
852c2936 362 return 0;
a6352fd4
MD
363 id = bufb->buf_rsb.id;
364 sb_bindex = subbuffer_id_get_index(config, id);
4746ae29 365 rpages = shmp_index(handle, bufb->array, sb_bindex);
a6352fd4
MD
366 /*
367 * Underlying layer should never ask for reads across
368 * subbuffers.
369 */
370 CHAN_WARN_ON(chanb, offset >= chanb->buf_size);
371 CHAN_WARN_ON(chanb, config->mode == RING_BUFFER_OVERWRITE
372 && subbuffer_id_is_noref(config, id));
aead2025 373 memcpy(dest, shmp_index(handle, shmp(handle, rpages->shmp)->p, offset & (chanb->subbuf_size - 1)), len);
852c2936
MD
374 return orig_len;
375}
852c2936 376
852c2936
MD
377/**
378 * lib_ring_buffer_read_cstr - read a C-style string from ring_buffer.
379 * @bufb : buffer backend
380 * @offset : offset within the buffer
381 * @dest : destination address
382 * @len : destination's length
383 *
d37f78cd 384 * Return string's length, or -EINVAL on error.
852c2936 385 * Should be protected by get_subbuf/put_subbuf.
d37f78cd 386 * Destination length should be at least 1 to hold '\0'.
852c2936 387 */
4cfec15c 388int lib_ring_buffer_read_cstr(struct lttng_ust_lib_ring_buffer_backend *bufb, size_t offset,
38fae1d3 389 void *dest, size_t len, struct lttng_ust_shm_handle *handle)
852c2936 390{
1d498196 391 struct channel_backend *chanb = &shmp(handle, bufb->chan)->backend;
4cfec15c 392 const struct lttng_ust_lib_ring_buffer_config *config = &chanb->config;
a6352fd4 393 ssize_t string_len, orig_offset;
852c2936 394 char *str;
4cfec15c 395 struct lttng_ust_lib_ring_buffer_backend_pages_shmp *rpages;
852c2936
MD
396 unsigned long sb_bindex, id;
397
d37f78cd
MD
398 if (caa_unlikely(!len))
399 return -EINVAL;
852c2936 400 offset &= chanb->buf_size - 1;
852c2936 401 orig_offset = offset;
852c2936
MD
402 id = bufb->buf_rsb.id;
403 sb_bindex = subbuffer_id_get_index(config, id);
4746ae29 404 rpages = shmp_index(handle, bufb->array, sb_bindex);
a6352fd4
MD
405 /*
406 * Underlying layer should never ask for reads across
407 * subbuffers.
408 */
409 CHAN_WARN_ON(chanb, offset >= chanb->buf_size);
852c2936
MD
410 CHAN_WARN_ON(chanb, config->mode == RING_BUFFER_OVERWRITE
411 && subbuffer_id_is_noref(config, id));
aead2025 412 str = shmp_index(handle, shmp(handle, rpages->shmp)->p, offset & (chanb->subbuf_size - 1));
a6352fd4
MD
413 string_len = strnlen(str, len);
414 if (dest && len) {
415 memcpy(dest, str, string_len);
416 ((char *)dest)[0] = 0;
417 }
418 return offset - orig_offset;
852c2936 419}
852c2936
MD
420
421/**
422 * lib_ring_buffer_read_offset_address - get address of a buffer location
423 * @bufb : buffer backend
424 * @offset : offset within the buffer.
425 *
426 * Return the address where a given offset is located (for read).
427 * Should be used to get the current subbuffer header pointer. Given we know
428 * it's never on a page boundary, it's safe to write directly to this address,
429 * as long as the write is never bigger than a page size.
430 */
4cfec15c 431void *lib_ring_buffer_read_offset_address(struct lttng_ust_lib_ring_buffer_backend *bufb,
1d498196 432 size_t offset,
38fae1d3 433 struct lttng_ust_shm_handle *handle)
852c2936 434{
4cfec15c 435 struct lttng_ust_lib_ring_buffer_backend_pages_shmp *rpages;
1d498196 436 struct channel_backend *chanb = &shmp(handle, bufb->chan)->backend;
4cfec15c 437 const struct lttng_ust_lib_ring_buffer_config *config = &chanb->config;
852c2936
MD
438 unsigned long sb_bindex, id;
439
440 offset &= chanb->buf_size - 1;
852c2936
MD
441 id = bufb->buf_rsb.id;
442 sb_bindex = subbuffer_id_get_index(config, id);
4746ae29 443 rpages = shmp_index(handle, bufb->array, sb_bindex);
852c2936
MD
444 CHAN_WARN_ON(chanb, config->mode == RING_BUFFER_OVERWRITE
445 && subbuffer_id_is_noref(config, id));
aead2025 446 return shmp_index(handle, shmp(handle, rpages->shmp)->p, offset & (chanb->subbuf_size - 1));
852c2936 447}
852c2936
MD
448
449/**
450 * lib_ring_buffer_offset_address - get address of a location within the buffer
451 * @bufb : buffer backend
452 * @offset : offset within the buffer.
453 *
454 * Return the address where a given offset is located.
455 * Should be used to get the current subbuffer header pointer. Given we know
456 * it's always at the beginning of a page, it's safe to write directly to this
457 * address, as long as the write is never bigger than a page size.
458 */
4cfec15c 459void *lib_ring_buffer_offset_address(struct lttng_ust_lib_ring_buffer_backend *bufb,
1d498196 460 size_t offset,
38fae1d3 461 struct lttng_ust_shm_handle *handle)
852c2936 462{
a6352fd4 463 size_t sbidx;
4cfec15c 464 struct lttng_ust_lib_ring_buffer_backend_pages_shmp *rpages;
1d498196 465 struct channel_backend *chanb = &shmp(handle, bufb->chan)->backend;
4cfec15c 466 const struct lttng_ust_lib_ring_buffer_config *config = &chanb->config;
852c2936
MD
467 unsigned long sb_bindex, id;
468
469 offset &= chanb->buf_size - 1;
470 sbidx = offset >> chanb->subbuf_size_order;
4746ae29 471 id = shmp_index(handle, bufb->buf_wsb, sbidx)->id;
852c2936 472 sb_bindex = subbuffer_id_get_index(config, id);
4746ae29 473 rpages = shmp_index(handle, bufb->array, sb_bindex);
852c2936
MD
474 CHAN_WARN_ON(chanb, config->mode == RING_BUFFER_OVERWRITE
475 && subbuffer_id_is_noref(config, id));
aead2025 476 return shmp_index(handle, shmp(handle, rpages->shmp)->p, offset & (chanb->subbuf_size - 1));
852c2936 477}
This page took 0.050913 seconds and 4 git commands to generate.