diff options
| author | Mark Brown <[email protected]> | 2015-10-12 18:09:27 +0100 | 
|---|---|---|
| committer | Mark Brown <[email protected]> | 2015-10-12 18:09:27 +0100 | 
| commit | 79828b4fa835f73cdaf4bffa48696abdcbea9d02 (patch) | |
| tree | 5e0fa7156acb75ba603022bc807df8f2fedb97a8 /include/linux/seq_file.h | |
| parent | 721b51fcf91898299d96f4b72cb9434cda29dce6 (diff) | |
| parent | 8c1a9d6323abf0fb1e5dad96cf3f1c783505ea5a (diff) | |
Merge remote-tracking branch 'asoc/fix/rt5645' into asoc-fix-rt5645
Diffstat (limited to 'include/linux/seq_file.h')
| -rw-r--r-- | include/linux/seq_file.h | 58 | 
1 files changed, 49 insertions, 9 deletions
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 912a7c482649..dde00defbaa5 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h @@ -114,13 +114,22 @@ int seq_open(struct file *, const struct seq_operations *);  ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);  loff_t seq_lseek(struct file *, loff_t, int);  int seq_release(struct inode *, struct file *); -int seq_escape(struct seq_file *, const char *, const char *); -int seq_putc(struct seq_file *m, char c); -int seq_puts(struct seq_file *m, const char *s);  int seq_write(struct seq_file *seq, const void *data, size_t len); -__printf(2, 3) int seq_printf(struct seq_file *, const char *, ...); -__printf(2, 0) int seq_vprintf(struct seq_file *, const char *, va_list args); +__printf(2, 0) +void seq_vprintf(struct seq_file *m, const char *fmt, va_list args); +__printf(2, 3) +void seq_printf(struct seq_file *m, const char *fmt, ...); +void seq_putc(struct seq_file *m, char c); +void seq_puts(struct seq_file *m, const char *s); +void seq_put_decimal_ull(struct seq_file *m, char delimiter, +			 unsigned long long num); +void seq_put_decimal_ll(struct seq_file *m, char delimiter, long long num); +void seq_escape(struct seq_file *m, const char *s, const char *esc); + +void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type, +		  int rowsize, int groupsize, const void *buf, size_t len, +		  bool ascii);  int seq_path(struct seq_file *, const struct path *, const char *);  int seq_file_path(struct seq_file *, struct file *, const char *); @@ -134,10 +143,6 @@ int single_release(struct inode *, struct file *);  void *__seq_open_private(struct file *, const struct seq_operations *, int);  int seq_open_private(struct file *, const struct seq_operations *, int);  int seq_release_private(struct inode *, struct file *); -int seq_put_decimal_ull(struct seq_file *m, char delimiter, -			unsigned long long num); -int seq_put_decimal_ll(struct seq_file *m, char delimiter, -			long long num);  static inline struct user_namespace *seq_user_ns(struct seq_file *seq)  { @@ -149,6 +154,41 @@ static inline struct user_namespace *seq_user_ns(struct seq_file *seq)  #endif  } +/** + * seq_show_options - display mount options with appropriate escapes. + * @m: the seq_file handle + * @name: the mount option name + * @value: the mount option name's value, can be NULL + */ +static inline void seq_show_option(struct seq_file *m, const char *name, +				   const char *value) +{ +	seq_putc(m, ','); +	seq_escape(m, name, ",= \t\n\\"); +	if (value) { +		seq_putc(m, '='); +		seq_escape(m, value, ", \t\n\\"); +	} +} + +/** + * seq_show_option_n - display mount options with appropriate escapes + *		       where @value must be a specific length. + * @m: the seq_file handle + * @name: the mount option name + * @value: the mount option name's value, cannot be NULL + * @length: the length of @value to display + * + * This is a macro since this uses "length" to define the size of the + * stack buffer. + */ +#define seq_show_option_n(m, name, value, length) {	\ +	char val_buf[length + 1];			\ +	strncpy(val_buf, value, length);		\ +	val_buf[length] = '\0';				\ +	seq_show_option(m, name, val_buf);		\ +} +  #define SEQ_START_TOKEN ((void *)1)  /*   * Helpers for iteration over list_head-s in seq_files  |