From 52409fae3e4b8d16b68b61902fc09075cd97b75d Mon Sep 17 00:00:00 2001 From: Dominik Sliwa Date: Sun, 2 Jul 2017 16:41:37 +0200 Subject: Backports generated from 4.11 kernel Initial commit. Signed-off-by: Dominik Sliwa --- backport-include/linux/seq_file.h | 51 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 backport-include/linux/seq_file.h (limited to 'backport-include/linux/seq_file.h') diff --git a/backport-include/linux/seq_file.h b/backport-include/linux/seq_file.h new file mode 100644 index 0000000..ad1bded --- /dev/null +++ b/backport-include/linux/seq_file.h @@ -0,0 +1,51 @@ +#ifndef __BACKPORT_SEQ_FILE_H +#define __BACKPORT_SEQ_FILE_H +#include_next +#include + +#if LINUX_VERSION_IS_LESS(3,7,0) +#include +#include +#include +#ifdef CONFIG_USER_NS +static inline struct user_namespace *seq_user_ns(struct seq_file *seq) +{ + struct file *f = container_of((void *) seq, struct file, private_data); + + return f->f_cred->user_ns; +} +#else +static inline struct user_namespace *seq_user_ns(struct seq_file *seq) +{ + extern struct user_namespace init_user_ns; + return &init_user_ns; +} +#endif /* CONFIG_USER_NS */ +#endif /* < 3.7 */ + +#if LINUX_VERSION_IS_LESS(3,19,0) +#define seq_has_overflowed LINUX_BACKPORT(seq_has_overflowed) +/** + * seq_has_overflowed - check if the buffer has overflowed + * @m: the seq_file handle + * + * seq_files have a buffer which may overflow. When this happens a larger + * buffer is reallocated and all the data will be printed again. + * The overflow state is true when m->count == m->size. + * + * Returns true if the buffer received more than it can hold. + */ +static inline bool seq_has_overflowed(struct seq_file *m) +{ + return m->count == m->size; +} +#endif + +#if LINUX_VERSION_IS_LESS(4,3,0) +#define seq_hex_dump LINUX_BACKPORT(seq_hex_dump) +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); +#endif + +#endif /* __BACKPORT_SEQ_FILE_H */ -- cgit v1.2.3