Lines Matching refs:seqbuf
15 struct seqbuf { struct
21 static void seqbuf_init(struct seqbuf *seqbuf, void *buf, size_t size) in seqbuf_init() argument
23 seqbuf->buf = buf; in seqbuf_init()
24 seqbuf->size = size; in seqbuf_init()
25 seqbuf->pos = 0; in seqbuf_init()
28 static size_t seqbuf_avail(struct seqbuf *seqbuf) in seqbuf_avail() argument
30 return seqbuf->pos < seqbuf->size ? seqbuf->size - seqbuf->pos : 0; in seqbuf_avail()
33 static size_t seqbuf_status(struct seqbuf *seqbuf) in seqbuf_status() argument
35 return seqbuf->pos <= seqbuf->size ? 0 : -EOVERFLOW; in seqbuf_status()
38 static int seqbuf_eof(struct seqbuf *seqbuf) in seqbuf_eof() argument
40 return seqbuf->pos >= seqbuf->size; in seqbuf_eof()
43 static int seqbuf_read(struct seqbuf *seqbuf, void *buf, size_t nbyte) in seqbuf_read() argument
45 nbyte = min(nbyte, seqbuf_avail(seqbuf)); in seqbuf_read()
46 memcpy(buf, seqbuf->buf + seqbuf->pos, nbyte); in seqbuf_read()
47 seqbuf->pos += nbyte; in seqbuf_read()
48 return seqbuf_status(seqbuf); in seqbuf_read()
51 static int seqbuf_read_u32(struct seqbuf *seqbuf, uint32_t *v) in seqbuf_read_u32() argument
55 err = seqbuf_read(seqbuf, v, 4); in seqbuf_read_u32()
60 static int seqbuf_read_str(struct seqbuf *seqbuf, const char **str) in seqbuf_read_str() argument
62 *str = seqbuf->buf + seqbuf->pos; in seqbuf_read_str()
63 seqbuf->pos += strnlen(*str, seqbuf_avail(seqbuf)); in seqbuf_read_str()
64 seqbuf->pos++; in seqbuf_read_str()
65 return seqbuf_status(seqbuf); in seqbuf_read_str()
68 static void seqbuf_seek(struct seqbuf *seqbuf, ssize_t offset) in seqbuf_seek() argument
70 seqbuf->pos += offset; in seqbuf_seek()
382 struct seqbuf seqbuf; in bpmp_populate_debugfs_inband() local
404 seqbuf_init(&seqbuf, buf, dsize); in bpmp_populate_debugfs_inband()
406 while (!seqbuf_eof(&seqbuf)) { in bpmp_populate_debugfs_inband()
407 err = seqbuf_read_u32(&seqbuf, &attrs); in bpmp_populate_debugfs_inband()
411 err = seqbuf_read_str(&seqbuf, &name); in bpmp_populate_debugfs_inband()
661 static int bpmp_populate_dir(struct tegra_bpmp *bpmp, struct seqbuf *seqbuf, in bpmp_populate_dir() argument
669 while (!seqbuf_eof(seqbuf)) { in bpmp_populate_dir()
670 err = seqbuf_read_u32(seqbuf, &d); in bpmp_populate_dir()
675 seqbuf_seek(seqbuf, -4); in bpmp_populate_dir()
683 err = seqbuf_read_u32(seqbuf, &t); in bpmp_populate_dir()
686 err = seqbuf_read_str(seqbuf, &name); in bpmp_populate_dir()
694 err = bpmp_populate_dir(bpmp, seqbuf, dentry, depth+1); in bpmp_populate_dir()
715 struct seqbuf seqbuf; in bpmp_populate_debugfs_shmem() local
735 seqbuf_init(&seqbuf, virt, nbytes); in bpmp_populate_debugfs_shmem()
736 err = bpmp_populate_dir(bpmp, &seqbuf, bpmp->debugfs_mirror, 0); in bpmp_populate_debugfs_shmem()