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, u32 *v) in seqbuf_read_u32() argument
53 return seqbuf_read(seqbuf, v, 4); in seqbuf_read_u32()
56 static int seqbuf_read_str(struct seqbuf *seqbuf, const char **str) in seqbuf_read_str() argument
58 *str = seqbuf->buf + seqbuf->pos; in seqbuf_read_str()
59 seqbuf->pos += strnlen(*str, seqbuf_avail(seqbuf)); in seqbuf_read_str()
60 seqbuf->pos++; in seqbuf_read_str()
61 return seqbuf_status(seqbuf); in seqbuf_read_str()
64 static void seqbuf_seek(struct seqbuf *seqbuf, ssize_t offset) in seqbuf_seek() argument
66 seqbuf->pos += offset; in seqbuf_seek()
411 struct seqbuf seqbuf; in bpmp_populate_debugfs_inband() local
433 seqbuf_init(&seqbuf, buf, dsize); in bpmp_populate_debugfs_inband()
435 while (!seqbuf_eof(&seqbuf)) { in bpmp_populate_debugfs_inband()
436 err = seqbuf_read_u32(&seqbuf, &attrs); in bpmp_populate_debugfs_inband()
440 err = seqbuf_read_str(&seqbuf, &name); in bpmp_populate_debugfs_inband()
690 static int bpmp_populate_dir(struct tegra_bpmp *bpmp, struct seqbuf *seqbuf, in bpmp_populate_dir() argument
698 while (!seqbuf_eof(seqbuf)) { in bpmp_populate_dir()
699 err = seqbuf_read_u32(seqbuf, &d); in bpmp_populate_dir()
704 seqbuf_seek(seqbuf, -4); in bpmp_populate_dir()
712 err = seqbuf_read_u32(seqbuf, &t); in bpmp_populate_dir()
715 err = seqbuf_read_str(seqbuf, &name); in bpmp_populate_dir()
723 err = bpmp_populate_dir(bpmp, seqbuf, dentry, depth+1); in bpmp_populate_dir()
744 struct seqbuf seqbuf; in bpmp_populate_debugfs_shmem() local
764 seqbuf_init(&seqbuf, virt, nbytes); in bpmp_populate_debugfs_shmem()
765 err = bpmp_populate_dir(bpmp, &seqbuf, bpmp->debugfs_mirror, 0); in bpmp_populate_debugfs_shmem()