Re: [RFC PATCH v4 8/9] printk-rb: new functionality to support printk
From: Sergey Senozhatsky
Date: Tue Aug 20 2019 - 05:59:25 EST
On (08/08/19 00:32), John Ogness wrote:
[..]
> +void prb_init(struct printk_ringbuffer *rb, char *data, int data_size_bits,
> + struct prb_desc *descs, int desc_count_bits,
> + struct wait_queue_head *waitq)
> +{
> + struct dataring *dr = &rb->dr;
> + struct numlist *nl = &rb->nl;
> +
> + rb->desc_count_bits = desc_count_bits;
> + rb->descs = descs;
> + atomic_long_set(&descs[0].id, 0);
> + descs[0].desc.begin_lpos = 1;
> + descs[0].desc.next_lpos = 1;
dataring_desc_init(), perhaps?
> + atomic_set(&rb->desc_next_unused, 1);
> +
> + atomic_long_set(&nl->head_id, 0);
> + atomic_long_set(&nl->tail_id, 0);
> + nl->node = prb_desc_node;
> + nl->node_arg = rb;
> + nl->busy = prb_desc_busy;
> + nl->busy_arg = rb;
> +
> + dr->size_bits = data_size_bits;
> + dr->data = data;
> + atomic_long_set(&dr->head_lpos, -111 * sizeof(long));
> + atomic_long_set(&dr->tail_lpos, -111 * sizeof(long));
> + dr->getdesc = prb_getdesc;
> + dr->getdesc_arg = rb;
> +
> + atomic_long_set(&rb->fail, 0);
> +
> + rb->wq = waitq;
> +}
> +EXPORT_SYMBOL(prb_init);
-ss