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()
114 int seq_buf_bprintf(struct seq_buf *s, const char *fmt, const u32 *binary) in seq_buf_bprintf() argument
116 unsigned int len = seq_buf_buffer_left(s); in seq_buf_bprintf()
119 WARN_ON(s->size == 0); in seq_buf_bprintf()
121 if (s->len < s->size) { in seq_buf_bprintf()
122 ret = bstr_printf(s->buffer + s->len, len, fmt, binary); in seq_buf_bprintf()
123 if (s->len + ret < s->size) { in seq_buf_bprintf()
124 s->len += ret; in seq_buf_bprintf()
128 seq_buf_set_overflow(s); in seq_buf_bprintf()
142 int seq_buf_puts(struct seq_buf *s, const char *str) in seq_buf_puts() argument
146 WARN_ON(s->size == 0); in seq_buf_puts()
151 if (seq_buf_can_fit(s, len)) { in seq_buf_puts()
152 memcpy(s->buffer + s->len, str, len); in seq_buf_puts()
154 s->len += len - 1; in seq_buf_puts()
157 seq_buf_set_overflow(s); in seq_buf_puts()
170 int seq_buf_putc(struct seq_buf *s, unsigned char c) in seq_buf_putc() argument
172 WARN_ON(s->size == 0); in seq_buf_putc()
174 if (seq_buf_can_fit(s, 1)) { in seq_buf_putc()
175 s->buffer[s->len++] = c; in seq_buf_putc()
178 seq_buf_set_overflow(s); in seq_buf_putc()
194 int seq_buf_putmem(struct seq_buf *s, const void *mem, unsigned int len) in seq_buf_putmem() argument
196 WARN_ON(s->size == 0); in seq_buf_putmem()
198 if (seq_buf_can_fit(s, len)) { in seq_buf_putmem()
199 memcpy(s->buffer + s->len, mem, len); in seq_buf_putmem()
200 s->len += len; in seq_buf_putmem()
203 seq_buf_set_overflow(s); in seq_buf_putmem()
222 int seq_buf_putmem_hex(struct seq_buf *s, const void *mem, argument
230 WARN_ON(s->size == 0);
250 seq_buf_putmem(s, hex, j);
251 if (seq_buf_has_overflowed(s))
270 int seq_buf_path(struct seq_buf *s, const struct path *path, const char *esc) argument
273 size_t size = seq_buf_get_buf(s, &buf);
276 WARN_ON(s->size == 0);
286 seq_buf_commit(s, res);
311 int seq_buf_to_user(struct seq_buf *s, char __user *ubuf, int cnt) argument
319 len = seq_buf_used(s);
321 if (len <= s->readpos)
324 len -= s->readpos;
327 ret = copy_to_user(ubuf, s->buffer + s->readpos, cnt);
333 s->readpos += cnt;
361 int seq_buf_hex_dump(struct seq_buf *s, const char *prefix_str, int prefix_type, argument
382 ret = seq_buf_printf(s, "%s%p: %s\n",
386 ret = seq_buf_printf(s, "%s%.8x: %s\n",
390 ret = seq_buf_printf(s, "%s%s\n", prefix_str, linebuf);