Lines Matching full:io
14 struct io { struct
29 static inline void io__init(struct io *io, int fd, in io__init() argument
32 io->fd = fd; in io__init()
33 io->buf_len = buf_len; in io__init()
34 io->buf = buf; in io__init()
35 io->end = buf; in io__init()
36 io->data = buf; in io__init()
37 io->eof = false; in io__init()
40 /* Reads one character from the "io" file with similar semantics to fgetc. */
41 static inline int io__get_char(struct io *io) in io__get_char() argument
43 char *ptr = io->data; in io__get_char()
45 if (io->eof) in io__get_char()
48 if (ptr == io->end) { in io__get_char()
49 ssize_t n = read(io->fd, io->buf, io->buf_len); in io__get_char()
52 io->eof = true; in io__get_char()
55 ptr = &io->buf[0]; in io__get_char()
56 io->end = &io->buf[n]; in io__get_char()
58 io->data = ptr + 1; in io__get_char()
63 * first character isn't hexadecimal returns -2, io->eof returns -1, otherwise
67 static inline int io__get_hex(struct io *io, __u64 *hex) in io__get_hex() argument
73 int ch = io__get_char(io); in io__get_hex()
92 * isn't a decimal returns -2, io->eof returns -1, otherwise returns the
96 static inline int io__get_dec(struct io *io, __u64 *dec) in io__get_dec() argument
102 int ch = io__get_char(io); in io__get_dec()