hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/linux/seq_file.h
....@@ -21,7 +21,6 @@
2121 size_t pad_until;
2222 loff_t index;
2323 loff_t read_pos;
24
- u64 version;
2524 struct mutex lock;
2625 const struct seq_operations *op;
2726 int poll_event;
....@@ -108,6 +107,7 @@
108107 char *mangle_path(char *s, const char *p, const char *esc);
109108 int seq_open(struct file *, const struct seq_operations *);
110109 ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
110
+ssize_t seq_read_iter(struct kiocb *iocb, struct iov_iter *iter);
111111 loff_t seq_lseek(struct file *, loff_t, int);
112112 int seq_release(struct inode *, struct file *);
113113 int seq_write(struct seq_file *seq, const void *data, size_t len);
....@@ -127,6 +127,7 @@
127127 unsigned long long v, unsigned int width);
128128
129129 void seq_escape(struct seq_file *m, const char *s, const char *esc);
130
+void seq_escape_mem_ascii(struct seq_file *m, const char *src, size_t isz);
130131
131132 void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type,
132133 int rowsize, int groupsize, const void *buf, size_t len,
....@@ -145,6 +146,25 @@
145146 int seq_open_private(struct file *, const struct seq_operations *, int);
146147 int seq_release_private(struct inode *, struct file *);
147148
149
+#define DEFINE_SEQ_ATTRIBUTE(__name) \
150
+static int __name ## _open(struct inode *inode, struct file *file) \
151
+{ \
152
+ int ret = seq_open(file, &__name ## _sops); \
153
+ if (!ret && inode->i_private) { \
154
+ struct seq_file *seq_f = file->private_data; \
155
+ seq_f->private = inode->i_private; \
156
+ } \
157
+ return ret; \
158
+} \
159
+ \
160
+static const struct file_operations __name ## _fops = { \
161
+ .owner = THIS_MODULE, \
162
+ .open = __name ## _open, \
163
+ .read = seq_read, \
164
+ .llseek = seq_lseek, \
165
+ .release = seq_release, \
166
+}
167
+
148168 #define DEFINE_SHOW_ATTRIBUTE(__name) \
149169 static int __name ## _open(struct inode *inode, struct file *file) \
150170 { \
....@@ -159,6 +179,19 @@
159179 .release = single_release, \
160180 }
161181
182
+#define DEFINE_PROC_SHOW_ATTRIBUTE(__name) \
183
+static int __name ## _open(struct inode *inode, struct file *file) \
184
+{ \
185
+ return single_open(file, __name ## _show, PDE_DATA(inode)); \
186
+} \
187
+ \
188
+static const struct proc_ops __name ## _proc_ops = { \
189
+ .proc_open = __name ## _open, \
190
+ .proc_read = seq_read, \
191
+ .proc_lseek = seq_lseek, \
192
+ .proc_release = single_release, \
193
+}
194
+
162195 static inline struct user_namespace *seq_user_ns(struct seq_file *seq)
163196 {
164197 #ifdef CONFIG_USER_NS