Lines Matching refs:s

28 static bool seq_buf_can_fit(struct seq_buf *s, size_t len)  in seq_buf_can_fit()  argument
30 return s->len + len <= s->size; in seq_buf_can_fit()
40 int seq_buf_print_seq(struct seq_file *m, struct seq_buf *s) in seq_buf_print_seq() argument
42 unsigned int len = seq_buf_used(s); in seq_buf_print_seq()
44 return seq_write(m, s->buffer, len); in seq_buf_print_seq()
57 int seq_buf_vprintf(struct seq_buf *s, const char *fmt, va_list args) in seq_buf_vprintf() argument
61 WARN_ON(s->size == 0); in seq_buf_vprintf()
63 if (s->len < s->size) { in seq_buf_vprintf()
64 len = vsnprintf(s->buffer + s->len, s->size - s->len, fmt, args); in seq_buf_vprintf()
65 if (s->len + len < s->size) { in seq_buf_vprintf()
66 s->len += len; in seq_buf_vprintf()
70 seq_buf_set_overflow(s); in seq_buf_vprintf()
83 int seq_buf_printf(struct seq_buf *s, const char *fmt, ...) in seq_buf_printf() argument
89 ret = seq_buf_vprintf(s, fmt, ap); in seq_buf_printf()
105 void seq_buf_do_printk(struct seq_buf *s, const char *lvl) in seq_buf_do_printk() argument
109 if (s->size == 0 || s->len == 0) in seq_buf_do_printk()
112 seq_buf_terminate(s); in seq_buf_do_printk()
114 start = s->buffer; in seq_buf_do_printk()
123 if (start < s->buffer + s->len) in seq_buf_do_printk()
146 int seq_buf_bprintf(struct seq_buf *s, const char *fmt, const u32 *binary) in seq_buf_bprintf() argument
148 unsigned int len = seq_buf_buffer_left(s); in seq_buf_bprintf()
151 WARN_ON(s->size == 0); in seq_buf_bprintf()
153 if (s->len < s->size) { in seq_buf_bprintf()
154 ret = bstr_printf(s->buffer + s->len, len, fmt, binary); in seq_buf_bprintf()
155 if (s->len + ret < s->size) { in seq_buf_bprintf()
156 s->len += ret; in seq_buf_bprintf()
160 seq_buf_set_overflow(s); in seq_buf_bprintf()
174 int seq_buf_puts(struct seq_buf *s, const char *str) in seq_buf_puts() argument
178 WARN_ON(s->size == 0); in seq_buf_puts()
183 if (seq_buf_can_fit(s, len)) { in seq_buf_puts()
184 memcpy(s->buffer + s->len, str, len); in seq_buf_puts()
186 s->len += len - 1; in seq_buf_puts()
189 seq_buf_set_overflow(s); in seq_buf_puts()
202 int seq_buf_putc(struct seq_buf *s, unsigned char c) in seq_buf_putc() argument
204 WARN_ON(s->size == 0); in seq_buf_putc()
206 if (seq_buf_can_fit(s, 1)) { in seq_buf_putc()
207 s->buffer[s->len++] = c; in seq_buf_putc()
210 seq_buf_set_overflow(s); in seq_buf_putc()
226 int seq_buf_putmem(struct seq_buf *s, const void *mem, unsigned int len) in seq_buf_putmem() argument
228 WARN_ON(s->size == 0); in seq_buf_putmem()
230 if (seq_buf_can_fit(s, len)) { in seq_buf_putmem()
231 memcpy(s->buffer + s->len, mem, len); in seq_buf_putmem()
232 s->len += len; in seq_buf_putmem()
235 seq_buf_set_overflow(s); in seq_buf_putmem()
254 int seq_buf_putmem_hex(struct seq_buf *s, const void *mem, argument
262 WARN_ON(s->size == 0);
282 seq_buf_putmem(s, hex, j);
283 if (seq_buf_has_overflowed(s))
302 int seq_buf_path(struct seq_buf *s, const struct path *path, const char *esc) argument
305 size_t size = seq_buf_get_buf(s, &buf);
308 WARN_ON(s->size == 0);
318 seq_buf_commit(s, res);
343 int seq_buf_to_user(struct seq_buf *s, char __user *ubuf, int cnt) argument
351 len = seq_buf_used(s);
353 if (len <= s->readpos)
356 len -= s->readpos;
359 ret = copy_to_user(ubuf, s->buffer + s->readpos, cnt);
365 s->readpos += cnt;
393 int seq_buf_hex_dump(struct seq_buf *s, const char *prefix_str, int prefix_type, argument
414 ret = seq_buf_printf(s, "%s%p: %s\n",
418 ret = seq_buf_printf(s, "%s%.8x: %s\n",
422 ret = seq_buf_printf(s, "%s%s\n", prefix_str, linebuf);