~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/seq_file.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /fs/seq_file.c (Version linux-6.12-rc7) and /fs/seq_file.c (Version linux-5.4.285)


  1 // SPDX-License-Identifier: GPL-2.0                 1 // SPDX-License-Identifier: GPL-2.0
  2 /*                                                  2 /*
  3  * linux/fs/seq_file.c                              3  * linux/fs/seq_file.c
  4  *                                                  4  *
  5  * helper functions for making synthetic files      5  * helper functions for making synthetic files from sequences of records.
  6  * initial implementation -- AV, Oct 2001.          6  * initial implementation -- AV, Oct 2001.
  7  */                                                 7  */
  8                                                     8 
  9 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt    << 
 10                                                << 
 11 #include <linux/cache.h>                            9 #include <linux/cache.h>
 12 #include <linux/fs.h>                              10 #include <linux/fs.h>
 13 #include <linux/export.h>                          11 #include <linux/export.h>
 14 #include <linux/seq_file.h>                        12 #include <linux/seq_file.h>
 15 #include <linux/vmalloc.h>                         13 #include <linux/vmalloc.h>
 16 #include <linux/slab.h>                            14 #include <linux/slab.h>
 17 #include <linux/cred.h>                            15 #include <linux/cred.h>
 18 #include <linux/mm.h>                              16 #include <linux/mm.h>
 19 #include <linux/printk.h>                          17 #include <linux/printk.h>
 20 #include <linux/string_helpers.h>                  18 #include <linux/string_helpers.h>
 21 #include <linux/uio.h>                         << 
 22                                                    19 
 23 #include <linux/uaccess.h>                         20 #include <linux/uaccess.h>
 24 #include <asm/page.h>                              21 #include <asm/page.h>
 25                                                    22 
 26 static struct kmem_cache *seq_file_cache __ro_     23 static struct kmem_cache *seq_file_cache __ro_after_init;
 27                                                    24 
 28 static void seq_set_overflow(struct seq_file *     25 static void seq_set_overflow(struct seq_file *m)
 29 {                                                  26 {
 30         m->count = m->size;                        27         m->count = m->size;
 31 }                                                  28 }
 32                                                    29 
 33 static void *seq_buf_alloc(unsigned long size)     30 static void *seq_buf_alloc(unsigned long size)
 34 {                                                  31 {
 35         if (unlikely(size > MAX_RW_COUNT))         32         if (unlikely(size > MAX_RW_COUNT))
 36                 return NULL;                       33                 return NULL;
 37                                                    34 
 38         return kvmalloc(size, GFP_KERNEL_ACCOU     35         return kvmalloc(size, GFP_KERNEL_ACCOUNT);
 39 }                                                  36 }
 40                                                    37 
 41 /**                                                38 /**
 42  *      seq_open -      initialize sequential      39  *      seq_open -      initialize sequential file
 43  *      @file: file we initialize                  40  *      @file: file we initialize
 44  *      @op: method table describing the seque     41  *      @op: method table describing the sequence
 45  *                                                 42  *
 46  *      seq_open() sets @file, associating it      43  *      seq_open() sets @file, associating it with a sequence described
 47  *      by @op.  @op->start() sets the iterato     44  *      by @op.  @op->start() sets the iterator up and returns the first
 48  *      element of sequence. @op->stop() shuts     45  *      element of sequence. @op->stop() shuts it down.  @op->next()
 49  *      returns the next element of sequence.      46  *      returns the next element of sequence.  @op->show() prints element
 50  *      into the buffer.  In case of error ->s     47  *      into the buffer.  In case of error ->start() and ->next() return
 51  *      ERR_PTR(error).  In the end of sequenc     48  *      ERR_PTR(error).  In the end of sequence they return %NULL. ->show()
 52  *      returns 0 in case of success and negat     49  *      returns 0 in case of success and negative number in case of error.
 53  *      Returning SEQ_SKIP means "discard this     50  *      Returning SEQ_SKIP means "discard this element and move on".
 54  *      Note: seq_open() will allocate a struc     51  *      Note: seq_open() will allocate a struct seq_file and store its
 55  *      pointer in @file->private_data. This p     52  *      pointer in @file->private_data. This pointer should not be modified.
 56  */                                                53  */
 57 int seq_open(struct file *file, const struct s     54 int seq_open(struct file *file, const struct seq_operations *op)
 58 {                                                  55 {
 59         struct seq_file *p;                        56         struct seq_file *p;
 60                                                    57 
 61         WARN_ON(file->private_data);               58         WARN_ON(file->private_data);
 62                                                    59 
 63         p = kmem_cache_zalloc(seq_file_cache,      60         p = kmem_cache_zalloc(seq_file_cache, GFP_KERNEL);
 64         if (!p)                                    61         if (!p)
 65                 return -ENOMEM;                    62                 return -ENOMEM;
 66                                                    63 
 67         file->private_data = p;                    64         file->private_data = p;
 68                                                    65 
 69         mutex_init(&p->lock);                      66         mutex_init(&p->lock);
 70         p->op = op;                                67         p->op = op;
 71                                                    68 
 72         // No refcounting: the lifetime of 'p'     69         // No refcounting: the lifetime of 'p' is constrained
 73         // to the lifetime of the file.            70         // to the lifetime of the file.
 74         p->file = file;                            71         p->file = file;
 75                                                    72 
 76         /*                                         73         /*
                                                   >>  74          * Wrappers around seq_open(e.g. swaps_open) need to be
                                                   >>  75          * aware of this. If they set f_version themselves, they
                                                   >>  76          * should call seq_open first and then set f_version.
                                                   >>  77          */
                                                   >>  78         file->f_version = 0;
                                                   >>  79 
                                                   >>  80         /*
 77          * seq_files support lseek() and pread     81          * seq_files support lseek() and pread().  They do not implement
 78          * write() at all, but we clear FMODE_     82          * write() at all, but we clear FMODE_PWRITE here for historical
 79          * reasons.                                83          * reasons.
 80          *                                         84          *
 81          * If a client of seq_files a) impleme     85          * If a client of seq_files a) implements file.write() and b) wishes to
 82          * support pwrite() then that client w     86          * support pwrite() then that client will need to implement its own
 83          * file.open() which calls seq_open()      87          * file.open() which calls seq_open() and then sets FMODE_PWRITE.
 84          */                                        88          */
 85         file->f_mode &= ~FMODE_PWRITE;             89         file->f_mode &= ~FMODE_PWRITE;
 86         return 0;                                  90         return 0;
 87 }                                                  91 }
 88 EXPORT_SYMBOL(seq_open);                           92 EXPORT_SYMBOL(seq_open);
 89                                                    93 
 90 static int traverse(struct seq_file *m, loff_t     94 static int traverse(struct seq_file *m, loff_t offset)
 91 {                                                  95 {
 92         loff_t pos = 0;                            96         loff_t pos = 0;
 93         int error = 0;                             97         int error = 0;
 94         void *p;                                   98         void *p;
 95                                                    99 
                                                   >> 100         m->version = 0;
 96         m->index = 0;                             101         m->index = 0;
 97         m->count = m->from = 0;                   102         m->count = m->from = 0;
 98         if (!offset)                              103         if (!offset)
 99                 return 0;                         104                 return 0;
100                                                   105 
101         if (!m->buf) {                            106         if (!m->buf) {
102                 m->buf = seq_buf_alloc(m->size    107                 m->buf = seq_buf_alloc(m->size = PAGE_SIZE);
103                 if (!m->buf)                      108                 if (!m->buf)
104                         return -ENOMEM;           109                         return -ENOMEM;
105         }                                         110         }
106         p = m->op->start(m, &m->index);           111         p = m->op->start(m, &m->index);
107         while (p) {                               112         while (p) {
108                 error = PTR_ERR(p);               113                 error = PTR_ERR(p);
109                 if (IS_ERR(p))                    114                 if (IS_ERR(p))
110                         break;                    115                         break;
111                 error = m->op->show(m, p);        116                 error = m->op->show(m, p);
112                 if (error < 0)                    117                 if (error < 0)
113                         break;                    118                         break;
114                 if (unlikely(error)) {            119                 if (unlikely(error)) {
115                         error = 0;                120                         error = 0;
116                         m->count = 0;             121                         m->count = 0;
117                 }                                 122                 }
118                 if (seq_has_overflowed(m))        123                 if (seq_has_overflowed(m))
119                         goto Eoverflow;           124                         goto Eoverflow;
120                 p = m->op->next(m, p, &m->inde    125                 p = m->op->next(m, p, &m->index);
121                 if (pos + m->count > offset) {    126                 if (pos + m->count > offset) {
122                         m->from = offset - pos    127                         m->from = offset - pos;
123                         m->count -= m->from;      128                         m->count -= m->from;
124                         break;                    129                         break;
125                 }                                 130                 }
126                 pos += m->count;                  131                 pos += m->count;
127                 m->count = 0;                     132                 m->count = 0;
128                 if (pos == offset)                133                 if (pos == offset)
129                         break;                    134                         break;
130         }                                         135         }
131         m->op->stop(m, p);                        136         m->op->stop(m, p);
132         return error;                             137         return error;
133                                                   138 
134 Eoverflow:                                        139 Eoverflow:
135         m->op->stop(m, p);                        140         m->op->stop(m, p);
136         kvfree(m->buf);                           141         kvfree(m->buf);
137         m->count = 0;                             142         m->count = 0;
138         m->buf = seq_buf_alloc(m->size <<= 1);    143         m->buf = seq_buf_alloc(m->size <<= 1);
139         return !m->buf ? -ENOMEM : -EAGAIN;       144         return !m->buf ? -ENOMEM : -EAGAIN;
140 }                                                 145 }
141                                                   146 
142 /**                                               147 /**
143  *      seq_read -      ->read() method for se    148  *      seq_read -      ->read() method for sequential files.
144  *      @file: the file to read from              149  *      @file: the file to read from
145  *      @buf: the buffer to read to               150  *      @buf: the buffer to read to
146  *      @size: the maximum number of bytes to     151  *      @size: the maximum number of bytes to read
147  *      @ppos: the current position in the fil    152  *      @ppos: the current position in the file
148  *                                                153  *
149  *      Ready-made ->f_op->read()                 154  *      Ready-made ->f_op->read()
150  */                                               155  */
151 ssize_t seq_read(struct file *file, char __use    156 ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
152 {                                                 157 {
153         struct iovec iov = { .iov_base = buf,  !! 158         struct seq_file *m = file->private_data;
154         struct kiocb kiocb;                    << 
155         struct iov_iter iter;                  << 
156         ssize_t ret;                           << 
157                                                << 
158         init_sync_kiocb(&kiocb, file);         << 
159         iov_iter_init(&iter, ITER_DEST, &iov,  << 
160                                                << 
161         kiocb.ki_pos = *ppos;                  << 
162         ret = seq_read_iter(&kiocb, &iter);    << 
163         *ppos = kiocb.ki_pos;                  << 
164         return ret;                            << 
165 }                                              << 
166 EXPORT_SYMBOL(seq_read);                       << 
167                                                << 
168 /*                                             << 
169  * Ready-made ->f_op->read_iter()              << 
170  */                                            << 
171 ssize_t seq_read_iter(struct kiocb *iocb, stru << 
172 {                                              << 
173         struct seq_file *m = iocb->ki_filp->pr << 
174         size_t copied = 0;                        159         size_t copied = 0;
175         size_t n;                                 160         size_t n;
176         void *p;                                  161         void *p;
177         int err = 0;                              162         int err = 0;
178                                                   163 
179         if (!iov_iter_count(iter))             << 
180                 return 0;                      << 
181                                                << 
182         mutex_lock(&m->lock);                     164         mutex_lock(&m->lock);
183                                                   165 
184         /*                                        166         /*
                                                   >> 167          * seq_file->op->..m_start/m_stop/m_next may do special actions
                                                   >> 168          * or optimisations based on the file->f_version, so we want to
                                                   >> 169          * pass the file->f_version to those methods.
                                                   >> 170          *
                                                   >> 171          * seq_file->version is just copy of f_version, and seq_file
                                                   >> 172          * methods can treat it simply as file version.
                                                   >> 173          * It is copied in first and copied out after all operations.
                                                   >> 174          * It is convenient to have it as  part of structure to avoid the
                                                   >> 175          * need of passing another argument to all the seq_file methods.
                                                   >> 176          */
                                                   >> 177         m->version = file->f_version;
                                                   >> 178 
                                                   >> 179         /*
185          * if request is to read from zero off    180          * if request is to read from zero offset, reset iterator to first
186          * record as it might have been alread    181          * record as it might have been already advanced by previous requests
187          */                                       182          */
188         if (iocb->ki_pos == 0) {               !! 183         if (*ppos == 0) {
189                 m->index = 0;                     184                 m->index = 0;
                                                   >> 185                 m->version = 0;
190                 m->count = 0;                     186                 m->count = 0;
191         }                                         187         }
192                                                   188 
193         /* Don't assume ki_pos is where we lef !! 189         /* Don't assume *ppos is where we left it */
194         if (unlikely(iocb->ki_pos != m->read_p !! 190         if (unlikely(*ppos != m->read_pos)) {
195                 while ((err = traverse(m, iocb !! 191                 while ((err = traverse(m, *ppos)) == -EAGAIN)
196                         ;                         192                         ;
197                 if (err) {                        193                 if (err) {
198                         /* With prejudice... *    194                         /* With prejudice... */
199                         m->read_pos = 0;          195                         m->read_pos = 0;
                                                   >> 196                         m->version = 0;
200                         m->index = 0;             197                         m->index = 0;
201                         m->count = 0;             198                         m->count = 0;
202                         goto Done;                199                         goto Done;
203                 } else {                          200                 } else {
204                         m->read_pos = iocb->ki !! 201                         m->read_pos = *ppos;
205                 }                                 202                 }
206         }                                         203         }
207                                                   204 
208         /* grab buffer if we didn't have one *    205         /* grab buffer if we didn't have one */
209         if (!m->buf) {                            206         if (!m->buf) {
210                 m->buf = seq_buf_alloc(m->size    207                 m->buf = seq_buf_alloc(m->size = PAGE_SIZE);
211                 if (!m->buf)                      208                 if (!m->buf)
212                         goto Enomem;              209                         goto Enomem;
213         }                                         210         }
214         // something left in the buffer - copy !! 211         /* if not empty - flush it first */
215         if (m->count) {                           212         if (m->count) {
216                 n = copy_to_iter(m->buf + m->f !! 213                 n = min(m->count, size);
                                                   >> 214                 err = copy_to_user(buf, m->buf + m->from, n);
                                                   >> 215                 if (err)
                                                   >> 216                         goto Efault;
217                 m->count -= n;                    217                 m->count -= n;
218                 m->from += n;                     218                 m->from += n;
                                                   >> 219                 size -= n;
                                                   >> 220                 buf += n;
219                 copied += n;                      221                 copied += n;
220                 if (m->count)   // hadn't mana !! 222                 if (!size)
221                         goto Done;                223                         goto Done;
222         }                                         224         }
223         // get a non-empty record in the buffe !! 225         /* we need at least one record in buffer */
224         m->from = 0;                              226         m->from = 0;
225         p = m->op->start(m, &m->index);           227         p = m->op->start(m, &m->index);
226         while (1) {                               228         while (1) {
227                 err = PTR_ERR(p);                 229                 err = PTR_ERR(p);
228                 if (!p || IS_ERR(p))    // EOF !! 230                 if (!p || IS_ERR(p))
229                         break;                    231                         break;
230                 err = m->op->show(m, p);          232                 err = m->op->show(m, p);
231                 if (err < 0)            // har !! 233                 if (err < 0)
232                         break;                    234                         break;
233                 if (unlikely(err))      // ->s !! 235                 if (unlikely(err))
234                         m->count = 0;             236                         m->count = 0;
235                 if (unlikely(!m->count)) { //  !! 237                 if (unlikely(!m->count)) {
236                         p = m->op->next(m, p,     238                         p = m->op->next(m, p, &m->index);
237                         continue;                 239                         continue;
238                 }                                 240                 }
239                 if (!seq_has_overflowed(m)) // !! 241                 if (m->count < m->size)
240                         goto Fill;                242                         goto Fill;
241                 // need a bigger buffer        << 
242                 m->op->stop(m, p);                243                 m->op->stop(m, p);
243                 kvfree(m->buf);                   244                 kvfree(m->buf);
244                 m->count = 0;                     245                 m->count = 0;
245                 m->buf = seq_buf_alloc(m->size    246                 m->buf = seq_buf_alloc(m->size <<= 1);
246                 if (!m->buf)                      247                 if (!m->buf)
247                         goto Enomem;              248                         goto Enomem;
                                                   >> 249                 m->version = 0;
248                 p = m->op->start(m, &m->index)    250                 p = m->op->start(m, &m->index);
249         }                                         251         }
250         // EOF or an error                     << 
251         m->op->stop(m, p);                        252         m->op->stop(m, p);
252         m->count = 0;                             253         m->count = 0;
253         goto Done;                                254         goto Done;
254 Fill:                                             255 Fill:
255         // one non-empty record is in the buff !! 256         /* they want more? let's try to get some more */
256         // try to fit more in, but in any case << 
257         // the iterator once for every record  << 
258         while (1) {                               257         while (1) {
259                 size_t offs = m->count;           258                 size_t offs = m->count;
260                 loff_t pos = m->index;            259                 loff_t pos = m->index;
261                                                   260 
262                 p = m->op->next(m, p, &m->inde    261                 p = m->op->next(m, p, &m->index);
263                 if (pos == m->index) {         !! 262                 if (pos == m->index)
264                         pr_info_ratelimited("b !! 263                         /* Buggy ->next function */
265                                             m- << 
266                         m->index++;               264                         m->index++;
267                 }                              !! 265                 if (!p || IS_ERR(p)) {
268                 if (!p || IS_ERR(p))    // no  !! 266                         err = PTR_ERR(p);
269                         break;                    267                         break;
270                 if (m->count >= iov_iter_count !! 268                 }
                                                   >> 269                 if (m->count >= size)
271                         break;                    270                         break;
272                 err = m->op->show(m, p);          271                 err = m->op->show(m, p);
273                 if (err > 0) {          // ->s !! 272                 if (seq_has_overflowed(m) || err) {
274                         m->count = offs;       << 
275                 } else if (err || seq_has_over << 
276                         m->count = offs;          273                         m->count = offs;
277                         break;                 !! 274                         if (likely(err <= 0))
                                                   >> 275                                 break;
278                 }                                 276                 }
279         }                                         277         }
280         m->op->stop(m, p);                        278         m->op->stop(m, p);
281         n = copy_to_iter(m->buf, m->count, ite !! 279         n = min(m->count, size);
                                                   >> 280         err = copy_to_user(buf, m->buf, n);
                                                   >> 281         if (err)
                                                   >> 282                 goto Efault;
282         copied += n;                              283         copied += n;
283         m->count -= n;                            284         m->count -= n;
284         m->from = n;                              285         m->from = n;
285 Done:                                             286 Done:
286         if (unlikely(!copied)) {               !! 287         if (!copied)
287                 copied = m->count ? -EFAULT :  !! 288                 copied = err;
288         } else {                               !! 289         else {
289                 iocb->ki_pos += copied;        !! 290                 *ppos += copied;
290                 m->read_pos += copied;            291                 m->read_pos += copied;
291         }                                         292         }
                                                   >> 293         file->f_version = m->version;
292         mutex_unlock(&m->lock);                   294         mutex_unlock(&m->lock);
293         return copied;                            295         return copied;
294 Enomem:                                           296 Enomem:
295         err = -ENOMEM;                            297         err = -ENOMEM;
296         goto Done;                                298         goto Done;
                                                   >> 299 Efault:
                                                   >> 300         err = -EFAULT;
                                                   >> 301         goto Done;
297 }                                                 302 }
298 EXPORT_SYMBOL(seq_read_iter);                  !! 303 EXPORT_SYMBOL(seq_read);
299                                                   304 
300 /**                                               305 /**
301  *      seq_lseek -     ->llseek() method for     306  *      seq_lseek -     ->llseek() method for sequential files.
302  *      @file: the file in question               307  *      @file: the file in question
303  *      @offset: new position                     308  *      @offset: new position
304  *      @whence: 0 for absolute, 1 for relativ    309  *      @whence: 0 for absolute, 1 for relative position
305  *                                                310  *
306  *      Ready-made ->f_op->llseek()               311  *      Ready-made ->f_op->llseek()
307  */                                               312  */
308 loff_t seq_lseek(struct file *file, loff_t off    313 loff_t seq_lseek(struct file *file, loff_t offset, int whence)
309 {                                                 314 {
310         struct seq_file *m = file->private_dat    315         struct seq_file *m = file->private_data;
311         loff_t retval = -EINVAL;                  316         loff_t retval = -EINVAL;
312                                                   317 
313         mutex_lock(&m->lock);                     318         mutex_lock(&m->lock);
                                                   >> 319         m->version = file->f_version;
314         switch (whence) {                         320         switch (whence) {
315         case SEEK_CUR:                            321         case SEEK_CUR:
316                 offset += file->f_pos;            322                 offset += file->f_pos;
317                 fallthrough;                   !! 323                 /* fall through */
318         case SEEK_SET:                            324         case SEEK_SET:
319                 if (offset < 0)                   325                 if (offset < 0)
320                         break;                    326                         break;
321                 retval = offset;                  327                 retval = offset;
322                 if (offset != m->read_pos) {      328                 if (offset != m->read_pos) {
323                         while ((retval = trave    329                         while ((retval = traverse(m, offset)) == -EAGAIN)
324                                 ;                 330                                 ;
325                         if (retval) {             331                         if (retval) {
326                                 /* with extrem    332                                 /* with extreme prejudice... */
327                                 file->f_pos =     333                                 file->f_pos = 0;
328                                 m->read_pos =     334                                 m->read_pos = 0;
                                                   >> 335                                 m->version = 0;
329                                 m->index = 0;     336                                 m->index = 0;
330                                 m->count = 0;     337                                 m->count = 0;
331                         } else {                  338                         } else {
332                                 m->read_pos =     339                                 m->read_pos = offset;
333                                 retval = file-    340                                 retval = file->f_pos = offset;
334                         }                         341                         }
335                 } else {                          342                 } else {
336                         file->f_pos = offset;     343                         file->f_pos = offset;
337                 }                                 344                 }
338         }                                         345         }
                                                   >> 346         file->f_version = m->version;
339         mutex_unlock(&m->lock);                   347         mutex_unlock(&m->lock);
340         return retval;                            348         return retval;
341 }                                                 349 }
342 EXPORT_SYMBOL(seq_lseek);                         350 EXPORT_SYMBOL(seq_lseek);
343                                                   351 
344 /**                                               352 /**
345  *      seq_release -   free the structures as    353  *      seq_release -   free the structures associated with sequential file.
346  *      @file: file in question                   354  *      @file: file in question
347  *      @inode: its inode                         355  *      @inode: its inode
348  *                                                356  *
349  *      Frees the structures associated with s    357  *      Frees the structures associated with sequential file; can be used
350  *      as ->f_op->release() if you don't have    358  *      as ->f_op->release() if you don't have private data to destroy.
351  */                                               359  */
352 int seq_release(struct inode *inode, struct fi    360 int seq_release(struct inode *inode, struct file *file)
353 {                                                 361 {
354         struct seq_file *m = file->private_dat    362         struct seq_file *m = file->private_data;
355         kvfree(m->buf);                           363         kvfree(m->buf);
356         kmem_cache_free(seq_file_cache, m);       364         kmem_cache_free(seq_file_cache, m);
357         return 0;                                 365         return 0;
358 }                                                 366 }
359 EXPORT_SYMBOL(seq_release);                       367 EXPORT_SYMBOL(seq_release);
360                                                   368 
361 /**                                               369 /**
362  * seq_escape_mem - print data into buffer, es !! 370  *      seq_escape -    print string into buffer, escaping some characters
363  * @m: target buffer                           !! 371  *      @m:     target buffer
364  * @src: source buffer                         !! 372  *      @s:     string
365  * @len: size of source buffer                 !! 373  *      @esc:   set of characters that need escaping
366  * @flags: flags to pass to string_escape_mem( !! 374  *
367  * @esc: set of characters that need escaping  !! 375  *      Puts string into buffer, replacing each occurrence of character from
368  *                                             !! 376  *      @esc with usual octal escape.
369  * Puts data into buffer, replacing each occur !! 377  *      Use seq_has_overflowed() to check for errors.
370  * given class (defined by @flags and @esc) wi << 
371  *                                             << 
372  * Use seq_has_overflowed() to check for error << 
373  */                                               378  */
374 void seq_escape_mem(struct seq_file *m, const  !! 379 void seq_escape(struct seq_file *m, const char *s, const char *esc)
375                     unsigned int flags, const  !! 380 {
                                                   >> 381         char *buf;
                                                   >> 382         size_t size = seq_get_buf(m, &buf);
                                                   >> 383         int ret;
                                                   >> 384 
                                                   >> 385         ret = string_escape_str(s, buf, size, ESCAPE_OCTAL, esc);
                                                   >> 386         seq_commit(m, ret < size ? ret : -1);
                                                   >> 387 }
                                                   >> 388 EXPORT_SYMBOL(seq_escape);
                                                   >> 389 
                                                   >> 390 void seq_escape_mem_ascii(struct seq_file *m, const char *src, size_t isz)
376 {                                                 391 {
377         char *buf;                                392         char *buf;
378         size_t size = seq_get_buf(m, &buf);       393         size_t size = seq_get_buf(m, &buf);
379         int ret;                                  394         int ret;
380                                                   395 
381         ret = string_escape_mem(src, len, buf, !! 396         ret = string_escape_mem_ascii(src, isz, buf, size);
382         seq_commit(m, ret < size ? ret : -1);     397         seq_commit(m, ret < size ? ret : -1);
383 }                                                 398 }
384 EXPORT_SYMBOL(seq_escape_mem);                 !! 399 EXPORT_SYMBOL(seq_escape_mem_ascii);
385                                                   400 
386 void seq_vprintf(struct seq_file *m, const cha    401 void seq_vprintf(struct seq_file *m, const char *f, va_list args)
387 {                                                 402 {
388         int len;                                  403         int len;
389                                                   404 
390         if (m->count < m->size) {                 405         if (m->count < m->size) {
391                 len = vsnprintf(m->buf + m->co    406                 len = vsnprintf(m->buf + m->count, m->size - m->count, f, args);
392                 if (m->count + len < m->size)     407                 if (m->count + len < m->size) {
393                         m->count += len;          408                         m->count += len;
394                         return;                   409                         return;
395                 }                                 410                 }
396         }                                         411         }
397         seq_set_overflow(m);                      412         seq_set_overflow(m);
398 }                                                 413 }
399 EXPORT_SYMBOL(seq_vprintf);                       414 EXPORT_SYMBOL(seq_vprintf);
400                                                   415 
401 void seq_printf(struct seq_file *m, const char    416 void seq_printf(struct seq_file *m, const char *f, ...)
402 {                                                 417 {
403         va_list args;                             418         va_list args;
404                                                   419 
405         va_start(args, f);                        420         va_start(args, f);
406         seq_vprintf(m, f, args);                  421         seq_vprintf(m, f, args);
407         va_end(args);                             422         va_end(args);
408 }                                                 423 }
409 EXPORT_SYMBOL(seq_printf);                        424 EXPORT_SYMBOL(seq_printf);
410                                                   425 
411 #ifdef CONFIG_BINARY_PRINTF                    << 
412 void seq_bprintf(struct seq_file *m, const cha << 
413 {                                              << 
414         int len;                               << 
415                                                << 
416         if (m->count < m->size) {              << 
417                 len = bstr_printf(m->buf + m-> << 
418                                   binary);     << 
419                 if (m->count + len < m->size)  << 
420                         m->count += len;       << 
421                         return;                << 
422                 }                              << 
423         }                                      << 
424         seq_set_overflow(m);                   << 
425 }                                              << 
426 EXPORT_SYMBOL(seq_bprintf);                    << 
427 #endif /* CONFIG_BINARY_PRINTF */              << 
428                                                << 
429 /**                                               426 /**
430  *      mangle_path -   mangle and copy path t    427  *      mangle_path -   mangle and copy path to buffer beginning
431  *      @s: buffer start                          428  *      @s: buffer start
432  *      @p: beginning of path in above buffer     429  *      @p: beginning of path in above buffer
433  *      @esc: set of characters that need esca    430  *      @esc: set of characters that need escaping
434  *                                                431  *
435  *      Copy the path from @p to @s, replacing    432  *      Copy the path from @p to @s, replacing each occurrence of character from
436  *      @esc with usual octal escape.             433  *      @esc with usual octal escape.
437  *      Returns pointer past last written char    434  *      Returns pointer past last written character in @s, or NULL in case of
438  *      failure.                                  435  *      failure.
439  */                                               436  */
440 char *mangle_path(char *s, const char *p, cons    437 char *mangle_path(char *s, const char *p, const char *esc)
441 {                                                 438 {
442         while (s <= p) {                          439         while (s <= p) {
443                 char c = *p++;                    440                 char c = *p++;
444                 if (!c) {                         441                 if (!c) {
445                         return s;                 442                         return s;
446                 } else if (!strchr(esc, c)) {     443                 } else if (!strchr(esc, c)) {
447                         *s++ = c;                 444                         *s++ = c;
448                 } else if (s + 4 > p) {           445                 } else if (s + 4 > p) {
449                         break;                    446                         break;
450                 } else {                          447                 } else {
451                         *s++ = '\\';              448                         *s++ = '\\';
452                         *s++ = '' + ((c & 0300    449                         *s++ = '' + ((c & 0300) >> 6);
453                         *s++ = '' + ((c & 070)    450                         *s++ = '' + ((c & 070) >> 3);
454                         *s++ = '' + (c & 07);     451                         *s++ = '' + (c & 07);
455                 }                                 452                 }
456         }                                         453         }
457         return NULL;                              454         return NULL;
458 }                                                 455 }
459 EXPORT_SYMBOL(mangle_path);                       456 EXPORT_SYMBOL(mangle_path);
460                                                   457 
461 /**                                               458 /**
462  * seq_path - seq_file interface to print a pa    459  * seq_path - seq_file interface to print a pathname
463  * @m: the seq_file handle                        460  * @m: the seq_file handle
464  * @path: the struct path to print                461  * @path: the struct path to print
465  * @esc: set of characters to escape in the ou    462  * @esc: set of characters to escape in the output
466  *                                                463  *
467  * return the absolute path of 'path', as repr    464  * return the absolute path of 'path', as represented by the
468  * dentry / mnt pair in the path parameter.       465  * dentry / mnt pair in the path parameter.
469  */                                               466  */
470 int seq_path(struct seq_file *m, const struct     467 int seq_path(struct seq_file *m, const struct path *path, const char *esc)
471 {                                                 468 {
472         char *buf;                                469         char *buf;
473         size_t size = seq_get_buf(m, &buf);       470         size_t size = seq_get_buf(m, &buf);
474         int res = -1;                             471         int res = -1;
475                                                   472 
476         if (size) {                               473         if (size) {
477                 char *p = d_path(path, buf, si    474                 char *p = d_path(path, buf, size);
478                 if (!IS_ERR(p)) {                 475                 if (!IS_ERR(p)) {
479                         char *end = mangle_pat    476                         char *end = mangle_path(buf, p, esc);
480                         if (end)                  477                         if (end)
481                                 res = end - bu    478                                 res = end - buf;
482                 }                                 479                 }
483         }                                         480         }
484         seq_commit(m, res);                       481         seq_commit(m, res);
485                                                   482 
486         return res;                               483         return res;
487 }                                                 484 }
488 EXPORT_SYMBOL(seq_path);                          485 EXPORT_SYMBOL(seq_path);
489                                                   486 
490 /**                                               487 /**
491  * seq_file_path - seq_file interface to print    488  * seq_file_path - seq_file interface to print a pathname of a file
492  * @m: the seq_file handle                        489  * @m: the seq_file handle
493  * @file: the struct file to print                490  * @file: the struct file to print
494  * @esc: set of characters to escape in the ou    491  * @esc: set of characters to escape in the output
495  *                                                492  *
496  * return the absolute path to the file.          493  * return the absolute path to the file.
497  */                                               494  */
498 int seq_file_path(struct seq_file *m, struct f    495 int seq_file_path(struct seq_file *m, struct file *file, const char *esc)
499 {                                                 496 {
500         return seq_path(m, &file->f_path, esc)    497         return seq_path(m, &file->f_path, esc);
501 }                                                 498 }
502 EXPORT_SYMBOL(seq_file_path);                     499 EXPORT_SYMBOL(seq_file_path);
503                                                   500 
504 /*                                                501 /*
505  * Same as seq_path, but relative to supplied     502  * Same as seq_path, but relative to supplied root.
506  */                                               503  */
507 int seq_path_root(struct seq_file *m, const st    504 int seq_path_root(struct seq_file *m, const struct path *path,
508                   const struct path *root, con    505                   const struct path *root, const char *esc)
509 {                                                 506 {
510         char *buf;                                507         char *buf;
511         size_t size = seq_get_buf(m, &buf);       508         size_t size = seq_get_buf(m, &buf);
512         int res = -ENAMETOOLONG;                  509         int res = -ENAMETOOLONG;
513                                                   510 
514         if (size) {                               511         if (size) {
515                 char *p;                          512                 char *p;
516                                                   513 
517                 p = __d_path(path, root, buf,     514                 p = __d_path(path, root, buf, size);
518                 if (!p)                           515                 if (!p)
519                         return SEQ_SKIP;          516                         return SEQ_SKIP;
520                 res = PTR_ERR(p);                 517                 res = PTR_ERR(p);
521                 if (!IS_ERR(p)) {                 518                 if (!IS_ERR(p)) {
522                         char *end = mangle_pat    519                         char *end = mangle_path(buf, p, esc);
523                         if (end)                  520                         if (end)
524                                 res = end - bu    521                                 res = end - buf;
525                         else                      522                         else
526                                 res = -ENAMETO    523                                 res = -ENAMETOOLONG;
527                 }                                 524                 }
528         }                                         525         }
529         seq_commit(m, res);                       526         seq_commit(m, res);
530                                                   527 
531         return res < 0 && res != -ENAMETOOLONG    528         return res < 0 && res != -ENAMETOOLONG ? res : 0;
532 }                                                 529 }
533                                                   530 
534 /*                                                531 /*
535  * returns the path of the 'dentry' from the r    532  * returns the path of the 'dentry' from the root of its filesystem.
536  */                                               533  */
537 int seq_dentry(struct seq_file *m, struct dent    534 int seq_dentry(struct seq_file *m, struct dentry *dentry, const char *esc)
538 {                                                 535 {
539         char *buf;                                536         char *buf;
540         size_t size = seq_get_buf(m, &buf);       537         size_t size = seq_get_buf(m, &buf);
541         int res = -1;                             538         int res = -1;
542                                                   539 
543         if (size) {                               540         if (size) {
544                 char *p = dentry_path(dentry,     541                 char *p = dentry_path(dentry, buf, size);
545                 if (!IS_ERR(p)) {                 542                 if (!IS_ERR(p)) {
546                         char *end = mangle_pat    543                         char *end = mangle_path(buf, p, esc);
547                         if (end)                  544                         if (end)
548                                 res = end - bu    545                                 res = end - buf;
549                 }                                 546                 }
550         }                                         547         }
551         seq_commit(m, res);                       548         seq_commit(m, res);
552                                                   549 
553         return res;                               550         return res;
554 }                                                 551 }
555 EXPORT_SYMBOL(seq_dentry);                        552 EXPORT_SYMBOL(seq_dentry);
556                                                   553 
557 void *single_start(struct seq_file *p, loff_t  !! 554 static void *single_start(struct seq_file *p, loff_t *pos)
558 {                                                 555 {
559         return *pos ? NULL : SEQ_START_TOKEN;  !! 556         return NULL + (*pos == 0);
560 }                                                 557 }
561                                                   558 
562 static void *single_next(struct seq_file *p, v    559 static void *single_next(struct seq_file *p, void *v, loff_t *pos)
563 {                                                 560 {
564         ++*pos;                                   561         ++*pos;
565         return NULL;                              562         return NULL;
566 }                                                 563 }
567                                                   564 
568 static void single_stop(struct seq_file *p, vo    565 static void single_stop(struct seq_file *p, void *v)
569 {                                                 566 {
570 }                                                 567 }
571                                                   568 
572 int single_open(struct file *file, int (*show)    569 int single_open(struct file *file, int (*show)(struct seq_file *, void *),
573                 void *data)                       570                 void *data)
574 {                                                 571 {
575         struct seq_operations *op = kmalloc(si    572         struct seq_operations *op = kmalloc(sizeof(*op), GFP_KERNEL_ACCOUNT);
576         int res = -ENOMEM;                        573         int res = -ENOMEM;
577                                                   574 
578         if (op) {                                 575         if (op) {
579                 op->start = single_start;         576                 op->start = single_start;
580                 op->next = single_next;           577                 op->next = single_next;
581                 op->stop = single_stop;           578                 op->stop = single_stop;
582                 op->show = show;                  579                 op->show = show;
583                 res = seq_open(file, op);         580                 res = seq_open(file, op);
584                 if (!res)                         581                 if (!res)
585                         ((struct seq_file *)fi    582                         ((struct seq_file *)file->private_data)->private = data;
586                 else                              583                 else
587                         kfree(op);                584                         kfree(op);
588         }                                         585         }
589         return res;                               586         return res;
590 }                                                 587 }
591 EXPORT_SYMBOL(single_open);                       588 EXPORT_SYMBOL(single_open);
592                                                   589 
593 int single_open_size(struct file *file, int (*    590 int single_open_size(struct file *file, int (*show)(struct seq_file *, void *),
594                 void *data, size_t size)          591                 void *data, size_t size)
595 {                                                 592 {
596         char *buf = seq_buf_alloc(size);          593         char *buf = seq_buf_alloc(size);
597         int ret;                                  594         int ret;
598         if (!buf)                                 595         if (!buf)
599                 return -ENOMEM;                   596                 return -ENOMEM;
600         ret = single_open(file, show, data);      597         ret = single_open(file, show, data);
601         if (ret) {                                598         if (ret) {
602                 kvfree(buf);                      599                 kvfree(buf);
603                 return ret;                       600                 return ret;
604         }                                         601         }
605         ((struct seq_file *)file->private_data    602         ((struct seq_file *)file->private_data)->buf = buf;
606         ((struct seq_file *)file->private_data    603         ((struct seq_file *)file->private_data)->size = size;
607         return 0;                                 604         return 0;
608 }                                                 605 }
609 EXPORT_SYMBOL(single_open_size);                  606 EXPORT_SYMBOL(single_open_size);
610                                                   607 
611 int single_release(struct inode *inode, struct    608 int single_release(struct inode *inode, struct file *file)
612 {                                                 609 {
613         const struct seq_operations *op = ((st    610         const struct seq_operations *op = ((struct seq_file *)file->private_data)->op;
614         int res = seq_release(inode, file);       611         int res = seq_release(inode, file);
615         kfree(op);                                612         kfree(op);
616         return res;                               613         return res;
617 }                                                 614 }
618 EXPORT_SYMBOL(single_release);                    615 EXPORT_SYMBOL(single_release);
619                                                   616 
620 int seq_release_private(struct inode *inode, s    617 int seq_release_private(struct inode *inode, struct file *file)
621 {                                                 618 {
622         struct seq_file *seq = file->private_d    619         struct seq_file *seq = file->private_data;
623                                                   620 
624         kfree(seq->private);                      621         kfree(seq->private);
625         seq->private = NULL;                      622         seq->private = NULL;
626         return seq_release(inode, file);          623         return seq_release(inode, file);
627 }                                                 624 }
628 EXPORT_SYMBOL(seq_release_private);               625 EXPORT_SYMBOL(seq_release_private);
629                                                   626 
630 void *__seq_open_private(struct file *f, const    627 void *__seq_open_private(struct file *f, const struct seq_operations *ops,
631                 int psize)                        628                 int psize)
632 {                                                 629 {
633         int rc;                                   630         int rc;
634         void *private;                            631         void *private;
635         struct seq_file *seq;                     632         struct seq_file *seq;
636                                                   633 
637         private = kzalloc(psize, GFP_KERNEL_AC    634         private = kzalloc(psize, GFP_KERNEL_ACCOUNT);
638         if (private == NULL)                      635         if (private == NULL)
639                 goto out;                         636                 goto out;
640                                                   637 
641         rc = seq_open(f, ops);                    638         rc = seq_open(f, ops);
642         if (rc < 0)                               639         if (rc < 0)
643                 goto out_free;                    640                 goto out_free;
644                                                   641 
645         seq = f->private_data;                    642         seq = f->private_data;
646         seq->private = private;                   643         seq->private = private;
647         return private;                           644         return private;
648                                                   645 
649 out_free:                                         646 out_free:
650         kfree(private);                           647         kfree(private);
651 out:                                              648 out:
652         return NULL;                              649         return NULL;
653 }                                                 650 }
654 EXPORT_SYMBOL(__seq_open_private);                651 EXPORT_SYMBOL(__seq_open_private);
655                                                   652 
656 int seq_open_private(struct file *filp, const     653 int seq_open_private(struct file *filp, const struct seq_operations *ops,
657                 int psize)                        654                 int psize)
658 {                                                 655 {
659         return __seq_open_private(filp, ops, p    656         return __seq_open_private(filp, ops, psize) ? 0 : -ENOMEM;
660 }                                                 657 }
661 EXPORT_SYMBOL(seq_open_private);                  658 EXPORT_SYMBOL(seq_open_private);
662                                                   659 
663 void seq_putc(struct seq_file *m, char c)         660 void seq_putc(struct seq_file *m, char c)
664 {                                                 661 {
665         if (m->count >= m->size)                  662         if (m->count >= m->size)
666                 return;                           663                 return;
667                                                   664 
668         m->buf[m->count++] = c;                   665         m->buf[m->count++] = c;
669 }                                                 666 }
670 EXPORT_SYMBOL(seq_putc);                          667 EXPORT_SYMBOL(seq_putc);
671                                                   668 
672 void __seq_puts(struct seq_file *m, const char !! 669 void seq_puts(struct seq_file *m, const char *s)
673 {                                                 670 {
674         seq_write(m, s, strlen(s));            !! 671         int len = strlen(s);
                                                   >> 672 
                                                   >> 673         if (m->count + len >= m->size) {
                                                   >> 674                 seq_set_overflow(m);
                                                   >> 675                 return;
                                                   >> 676         }
                                                   >> 677         memcpy(m->buf + m->count, s, len);
                                                   >> 678         m->count += len;
675 }                                                 679 }
676 EXPORT_SYMBOL(__seq_puts);                     !! 680 EXPORT_SYMBOL(seq_puts);
677                                                   681 
678 /**                                               682 /**
679  * seq_put_decimal_ull_width - A helper routin !! 683  * A helper routine for putting decimal numbers without rich format of printf().
680  *                             without rich fo << 
681  * only 'unsigned long long' is supported.        684  * only 'unsigned long long' is supported.
682  * @m: seq_file identifying the buffer to whic    685  * @m: seq_file identifying the buffer to which data should be written
683  * @delimiter: a string which is printed befor    686  * @delimiter: a string which is printed before the number
684  * @num: the number                               687  * @num: the number
685  * @width: a minimum field width                  688  * @width: a minimum field width
686  *                                                689  *
687  * This routine will put strlen(delimiter) + n    690  * This routine will put strlen(delimiter) + number into seq_filed.
688  * This routine is very quick when you show lo    691  * This routine is very quick when you show lots of numbers.
689  * In usual cases, it will be better to use se    692  * In usual cases, it will be better to use seq_printf(). It's easier to read.
690  */                                               693  */
691 void seq_put_decimal_ull_width(struct seq_file    694 void seq_put_decimal_ull_width(struct seq_file *m, const char *delimiter,
692                          unsigned long long nu    695                          unsigned long long num, unsigned int width)
693 {                                                 696 {
694         int len;                                  697         int len;
695                                                   698 
696         if (m->count + 2 >= m->size) /* we'll     699         if (m->count + 2 >= m->size) /* we'll write 2 bytes at least */
697                 goto overflow;                    700                 goto overflow;
698                                                   701 
699         if (delimiter && delimiter[0]) {          702         if (delimiter && delimiter[0]) {
700                 if (delimiter[1] == 0)            703                 if (delimiter[1] == 0)
701                         seq_putc(m, delimiter[    704                         seq_putc(m, delimiter[0]);
702                 else                              705                 else
703                         seq_puts(m, delimiter)    706                         seq_puts(m, delimiter);
704         }                                         707         }
705                                                   708 
706         if (!width)                               709         if (!width)
707                 width = 1;                        710                 width = 1;
708                                                   711 
709         if (m->count + width >= m->size)          712         if (m->count + width >= m->size)
710                 goto overflow;                    713                 goto overflow;
711                                                   714 
712         len = num_to_str(m->buf + m->count, m-    715         len = num_to_str(m->buf + m->count, m->size - m->count, num, width);
713         if (!len)                                 716         if (!len)
714                 goto overflow;                    717                 goto overflow;
715                                                   718 
716         m->count += len;                          719         m->count += len;
717         return;                                   720         return;
718                                                   721 
719 overflow:                                         722 overflow:
720         seq_set_overflow(m);                      723         seq_set_overflow(m);
721 }                                                 724 }
722                                                   725 
723 void seq_put_decimal_ull(struct seq_file *m, c    726 void seq_put_decimal_ull(struct seq_file *m, const char *delimiter,
724                          unsigned long long nu    727                          unsigned long long num)
725 {                                                 728 {
726         return seq_put_decimal_ull_width(m, de    729         return seq_put_decimal_ull_width(m, delimiter, num, 0);
727 }                                                 730 }
728 EXPORT_SYMBOL(seq_put_decimal_ull);               731 EXPORT_SYMBOL(seq_put_decimal_ull);
729                                                   732 
730 /**                                               733 /**
731  * seq_put_hex_ll - put a number in hexadecima    734  * seq_put_hex_ll - put a number in hexadecimal notation
732  * @m: seq_file identifying the buffer to whic    735  * @m: seq_file identifying the buffer to which data should be written
733  * @delimiter: a string which is printed befor    736  * @delimiter: a string which is printed before the number
734  * @v: the number                                 737  * @v: the number
735  * @width: a minimum field width                  738  * @width: a minimum field width
736  *                                                739  *
737  * seq_put_hex_ll(m, "", v, 8) is equal to seq    740  * seq_put_hex_ll(m, "", v, 8) is equal to seq_printf(m, "%08llx", v)
738  *                                                741  *
739  * This routine is very quick when you show lo    742  * This routine is very quick when you show lots of numbers.
740  * In usual cases, it will be better to use se    743  * In usual cases, it will be better to use seq_printf(). It's easier to read.
741  */                                               744  */
742 void seq_put_hex_ll(struct seq_file *m, const     745 void seq_put_hex_ll(struct seq_file *m, const char *delimiter,
743                                 unsigned long     746                                 unsigned long long v, unsigned int width)
744 {                                                 747 {
745         unsigned int len;                         748         unsigned int len;
746         int i;                                    749         int i;
747                                                   750 
748         if (delimiter && delimiter[0]) {          751         if (delimiter && delimiter[0]) {
749                 if (delimiter[1] == 0)            752                 if (delimiter[1] == 0)
750                         seq_putc(m, delimiter[    753                         seq_putc(m, delimiter[0]);
751                 else                              754                 else
752                         seq_puts(m, delimiter)    755                         seq_puts(m, delimiter);
753         }                                         756         }
754                                                   757 
755         /* If x is 0, the result of __builtin_    758         /* If x is 0, the result of __builtin_clzll is undefined */
756         if (v == 0)                               759         if (v == 0)
757                 len = 1;                          760                 len = 1;
758         else                                      761         else
759                 len = (sizeof(v) * 8 - __built    762                 len = (sizeof(v) * 8 - __builtin_clzll(v) + 3) / 4;
760                                                   763 
761         if (len < width)                          764         if (len < width)
762                 len = width;                      765                 len = width;
763                                                   766 
764         if (m->count + len > m->size) {           767         if (m->count + len > m->size) {
765                 seq_set_overflow(m);              768                 seq_set_overflow(m);
766                 return;                           769                 return;
767         }                                         770         }
768                                                   771 
769         for (i = len - 1; i >= 0; i--) {          772         for (i = len - 1; i >= 0; i--) {
770                 m->buf[m->count + i] = hex_asc    773                 m->buf[m->count + i] = hex_asc[0xf & v];
771                 v = v >> 4;                       774                 v = v >> 4;
772         }                                         775         }
773         m->count += len;                          776         m->count += len;
774 }                                                 777 }
775                                                   778 
776 void seq_put_decimal_ll(struct seq_file *m, co    779 void seq_put_decimal_ll(struct seq_file *m, const char *delimiter, long long num)
777 {                                                 780 {
778         int len;                                  781         int len;
779                                                   782 
780         if (m->count + 3 >= m->size) /* we'll     783         if (m->count + 3 >= m->size) /* we'll write 2 bytes at least */
781                 goto overflow;                    784                 goto overflow;
782                                                   785 
783         if (delimiter && delimiter[0]) {          786         if (delimiter && delimiter[0]) {
784                 if (delimiter[1] == 0)            787                 if (delimiter[1] == 0)
785                         seq_putc(m, delimiter[    788                         seq_putc(m, delimiter[0]);
786                 else                              789                 else
787                         seq_puts(m, delimiter)    790                         seq_puts(m, delimiter);
788         }                                         791         }
789                                                   792 
790         if (m->count + 2 >= m->size)              793         if (m->count + 2 >= m->size)
791                 goto overflow;                    794                 goto overflow;
792                                                   795 
793         if (num < 0) {                            796         if (num < 0) {
794                 m->buf[m->count++] = '-';         797                 m->buf[m->count++] = '-';
795                 num = -num;                       798                 num = -num;
796         }                                         799         }
797                                                   800 
798         if (num < 10) {                           801         if (num < 10) {
799                 m->buf[m->count++] = num + '';    802                 m->buf[m->count++] = num + '';
800                 return;                           803                 return;
801         }                                         804         }
802                                                   805 
803         len = num_to_str(m->buf + m->count, m-    806         len = num_to_str(m->buf + m->count, m->size - m->count, num, 0);
804         if (!len)                                 807         if (!len)
805                 goto overflow;                    808                 goto overflow;
806                                                   809 
807         m->count += len;                          810         m->count += len;
808         return;                                   811         return;
809                                                   812 
810 overflow:                                         813 overflow:
811         seq_set_overflow(m);                      814         seq_set_overflow(m);
812 }                                                 815 }
813 EXPORT_SYMBOL(seq_put_decimal_ll);                816 EXPORT_SYMBOL(seq_put_decimal_ll);
814                                                   817 
815 /**                                               818 /**
816  * seq_write - write arbitrary data to buffer     819  * seq_write - write arbitrary data to buffer
817  * @seq: seq_file identifying the buffer to wh    820  * @seq: seq_file identifying the buffer to which data should be written
818  * @data: data address                            821  * @data: data address
819  * @len: number of bytes                          822  * @len: number of bytes
820  *                                                823  *
821  * Return 0 on success, non-zero otherwise.       824  * Return 0 on success, non-zero otherwise.
822  */                                               825  */
823 int seq_write(struct seq_file *seq, const void    826 int seq_write(struct seq_file *seq, const void *data, size_t len)
824 {                                                 827 {
825         if (seq->count + len < seq->size) {       828         if (seq->count + len < seq->size) {
826                 memcpy(seq->buf + seq->count,     829                 memcpy(seq->buf + seq->count, data, len);
827                 seq->count += len;                830                 seq->count += len;
828                 return 0;                         831                 return 0;
829         }                                         832         }
830         seq_set_overflow(seq);                    833         seq_set_overflow(seq);
831         return -1;                                834         return -1;
832 }                                                 835 }
833 EXPORT_SYMBOL(seq_write);                         836 EXPORT_SYMBOL(seq_write);
834                                                   837 
835 /**                                               838 /**
836  * seq_pad - write padding spaces to buffer       839  * seq_pad - write padding spaces to buffer
837  * @m: seq_file identifying the buffer to whic    840  * @m: seq_file identifying the buffer to which data should be written
838  * @c: the byte to append after padding if non    841  * @c: the byte to append after padding if non-zero
839  */                                               842  */
840 void seq_pad(struct seq_file *m, char c)          843 void seq_pad(struct seq_file *m, char c)
841 {                                                 844 {
842         int size = m->pad_until - m->count;       845         int size = m->pad_until - m->count;
843         if (size > 0) {                           846         if (size > 0) {
844                 if (size + m->count > m->size)    847                 if (size + m->count > m->size) {
845                         seq_set_overflow(m);      848                         seq_set_overflow(m);
846                         return;                   849                         return;
847                 }                                 850                 }
848                 memset(m->buf + m->count, ' ',    851                 memset(m->buf + m->count, ' ', size);
849                 m->count += size;                 852                 m->count += size;
850         }                                         853         }
851         if (c)                                    854         if (c)
852                 seq_putc(m, c);                   855                 seq_putc(m, c);
853 }                                                 856 }
854 EXPORT_SYMBOL(seq_pad);                           857 EXPORT_SYMBOL(seq_pad);
855                                                   858 
856 /* A complete analogue of print_hex_dump() */     859 /* A complete analogue of print_hex_dump() */
857 void seq_hex_dump(struct seq_file *m, const ch    860 void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type,
858                   int rowsize, int groupsize,     861                   int rowsize, int groupsize, const void *buf, size_t len,
859                   bool ascii)                     862                   bool ascii)
860 {                                                 863 {
861         const u8 *ptr = buf;                      864         const u8 *ptr = buf;
862         int i, linelen, remaining = len;          865         int i, linelen, remaining = len;
863         char *buffer;                             866         char *buffer;
864         size_t size;                              867         size_t size;
865         int ret;                                  868         int ret;
866                                                   869 
867         if (rowsize != 16 && rowsize != 32)       870         if (rowsize != 16 && rowsize != 32)
868                 rowsize = 16;                     871                 rowsize = 16;
869                                                   872 
870         for (i = 0; i < len && !seq_has_overfl    873         for (i = 0; i < len && !seq_has_overflowed(m); i += rowsize) {
871                 linelen = min(remaining, rowsi    874                 linelen = min(remaining, rowsize);
872                 remaining -= rowsize;             875                 remaining -= rowsize;
873                                                   876 
874                 switch (prefix_type) {            877                 switch (prefix_type) {
875                 case DUMP_PREFIX_ADDRESS:         878                 case DUMP_PREFIX_ADDRESS:
876                         seq_printf(m, "%s%p: "    879                         seq_printf(m, "%s%p: ", prefix_str, ptr + i);
877                         break;                    880                         break;
878                 case DUMP_PREFIX_OFFSET:          881                 case DUMP_PREFIX_OFFSET:
879                         seq_printf(m, "%s%.8x:    882                         seq_printf(m, "%s%.8x: ", prefix_str, i);
880                         break;                    883                         break;
881                 default:                          884                 default:
882                         seq_printf(m, "%s", pr    885                         seq_printf(m, "%s", prefix_str);
883                         break;                    886                         break;
884                 }                                 887                 }
885                                                   888 
886                 size = seq_get_buf(m, &buffer)    889                 size = seq_get_buf(m, &buffer);
887                 ret = hex_dump_to_buffer(ptr +    890                 ret = hex_dump_to_buffer(ptr + i, linelen, rowsize, groupsize,
888                                          buffe    891                                          buffer, size, ascii);
889                 seq_commit(m, ret < size ? ret    892                 seq_commit(m, ret < size ? ret : -1);
890                                                   893 
891                 seq_putc(m, '\n');                894                 seq_putc(m, '\n');
892         }                                         895         }
893 }                                                 896 }
894 EXPORT_SYMBOL(seq_hex_dump);                      897 EXPORT_SYMBOL(seq_hex_dump);
895                                                   898 
896 struct list_head *seq_list_start(struct list_h    899 struct list_head *seq_list_start(struct list_head *head, loff_t pos)
897 {                                                 900 {
898         struct list_head *lh;                     901         struct list_head *lh;
899                                                   902 
900         list_for_each(lh, head)                   903         list_for_each(lh, head)
901                 if (pos-- == 0)                   904                 if (pos-- == 0)
902                         return lh;                905                         return lh;
903                                                   906 
904         return NULL;                              907         return NULL;
905 }                                                 908 }
906 EXPORT_SYMBOL(seq_list_start);                    909 EXPORT_SYMBOL(seq_list_start);
907                                                   910 
908 struct list_head *seq_list_start_head(struct l    911 struct list_head *seq_list_start_head(struct list_head *head, loff_t pos)
909 {                                                 912 {
910         if (!pos)                                 913         if (!pos)
911                 return head;                      914                 return head;
912                                                   915 
913         return seq_list_start(head, pos - 1);     916         return seq_list_start(head, pos - 1);
914 }                                                 917 }
915 EXPORT_SYMBOL(seq_list_start_head);               918 EXPORT_SYMBOL(seq_list_start_head);
916                                                   919 
917 struct list_head *seq_list_next(void *v, struc    920 struct list_head *seq_list_next(void *v, struct list_head *head, loff_t *ppos)
918 {                                                 921 {
919         struct list_head *lh;                     922         struct list_head *lh;
920                                                   923 
921         lh = ((struct list_head *)v)->next;       924         lh = ((struct list_head *)v)->next;
922         ++*ppos;                                  925         ++*ppos;
923         return lh == head ? NULL : lh;            926         return lh == head ? NULL : lh;
924 }                                                 927 }
925 EXPORT_SYMBOL(seq_list_next);                     928 EXPORT_SYMBOL(seq_list_next);
926                                                   929 
927 struct list_head *seq_list_start_rcu(struct li << 
928 {                                              << 
929         struct list_head *lh;                  << 
930                                                << 
931         list_for_each_rcu(lh, head)            << 
932                 if (pos-- == 0)                << 
933                         return lh;             << 
934                                                << 
935         return NULL;                           << 
936 }                                              << 
937 EXPORT_SYMBOL(seq_list_start_rcu);             << 
938                                                << 
939 struct list_head *seq_list_start_head_rcu(stru << 
940 {                                              << 
941         if (!pos)                              << 
942                 return head;                   << 
943                                                << 
944         return seq_list_start_rcu(head, pos -  << 
945 }                                              << 
946 EXPORT_SYMBOL(seq_list_start_head_rcu);        << 
947                                                << 
948 struct list_head *seq_list_next_rcu(void *v, s << 
949                                     loff_t *pp << 
950 {                                              << 
951         struct list_head *lh;                  << 
952                                                << 
953         lh = list_next_rcu((struct list_head * << 
954         ++*ppos;                               << 
955         return lh == head ? NULL : lh;         << 
956 }                                              << 
957 EXPORT_SYMBOL(seq_list_next_rcu);              << 
958                                                << 
959 /**                                               930 /**
960  * seq_hlist_start - start an iteration of a h    931  * seq_hlist_start - start an iteration of a hlist
961  * @head: the head of the hlist                   932  * @head: the head of the hlist
962  * @pos:  the start position of the sequence      933  * @pos:  the start position of the sequence
963  *                                                934  *
964  * Called at seq_file->op->start().               935  * Called at seq_file->op->start().
965  */                                               936  */
966 struct hlist_node *seq_hlist_start(struct hlis    937 struct hlist_node *seq_hlist_start(struct hlist_head *head, loff_t pos)
967 {                                                 938 {
968         struct hlist_node *node;                  939         struct hlist_node *node;
969                                                   940 
970         hlist_for_each(node, head)                941         hlist_for_each(node, head)
971                 if (pos-- == 0)                   942                 if (pos-- == 0)
972                         return node;              943                         return node;
973         return NULL;                              944         return NULL;
974 }                                                 945 }
975 EXPORT_SYMBOL(seq_hlist_start);                   946 EXPORT_SYMBOL(seq_hlist_start);
976                                                   947 
977 /**                                               948 /**
978  * seq_hlist_start_head - start an iteration o    949  * seq_hlist_start_head - start an iteration of a hlist
979  * @head: the head of the hlist                   950  * @head: the head of the hlist
980  * @pos:  the start position of the sequence      951  * @pos:  the start position of the sequence
981  *                                                952  *
982  * Called at seq_file->op->start(). Call this     953  * Called at seq_file->op->start(). Call this function if you want to
983  * print a header at the top of the output.       954  * print a header at the top of the output.
984  */                                               955  */
985 struct hlist_node *seq_hlist_start_head(struct    956 struct hlist_node *seq_hlist_start_head(struct hlist_head *head, loff_t pos)
986 {                                                 957 {
987         if (!pos)                                 958         if (!pos)
988                 return SEQ_START_TOKEN;           959                 return SEQ_START_TOKEN;
989                                                   960 
990         return seq_hlist_start(head, pos - 1);    961         return seq_hlist_start(head, pos - 1);
991 }                                                 962 }
992 EXPORT_SYMBOL(seq_hlist_start_head);              963 EXPORT_SYMBOL(seq_hlist_start_head);
993                                                   964 
994 /**                                               965 /**
995  * seq_hlist_next - move to the next position     966  * seq_hlist_next - move to the next position of the hlist
996  * @v:    the current iterator                    967  * @v:    the current iterator
997  * @head: the head of the hlist                   968  * @head: the head of the hlist
998  * @ppos: the current position                    969  * @ppos: the current position
999  *                                                970  *
1000  * Called at seq_file->op->next().               971  * Called at seq_file->op->next().
1001  */                                              972  */
1002 struct hlist_node *seq_hlist_next(void *v, st    973 struct hlist_node *seq_hlist_next(void *v, struct hlist_head *head,
1003                                   loff_t *ppo    974                                   loff_t *ppos)
1004 {                                                975 {
1005         struct hlist_node *node = v;             976         struct hlist_node *node = v;
1006                                                  977 
1007         ++*ppos;                                 978         ++*ppos;
1008         if (v == SEQ_START_TOKEN)                979         if (v == SEQ_START_TOKEN)
1009                 return head->first;              980                 return head->first;
1010         else                                     981         else
1011                 return node->next;               982                 return node->next;
1012 }                                                983 }
1013 EXPORT_SYMBOL(seq_hlist_next);                   984 EXPORT_SYMBOL(seq_hlist_next);
1014                                                  985 
1015 /**                                              986 /**
1016  * seq_hlist_start_rcu - start an iteration o    987  * seq_hlist_start_rcu - start an iteration of a hlist protected by RCU
1017  * @head: the head of the hlist                  988  * @head: the head of the hlist
1018  * @pos:  the start position of the sequence     989  * @pos:  the start position of the sequence
1019  *                                               990  *
1020  * Called at seq_file->op->start().              991  * Called at seq_file->op->start().
1021  *                                               992  *
1022  * This list-traversal primitive may safely r    993  * This list-traversal primitive may safely run concurrently with
1023  * the _rcu list-mutation primitives such as     994  * the _rcu list-mutation primitives such as hlist_add_head_rcu()
1024  * as long as the traversal is guarded by rcu    995  * as long as the traversal is guarded by rcu_read_lock().
1025  */                                              996  */
1026 struct hlist_node *seq_hlist_start_rcu(struct    997 struct hlist_node *seq_hlist_start_rcu(struct hlist_head *head,
1027                                        loff_t    998                                        loff_t pos)
1028 {                                                999 {
1029         struct hlist_node *node;                 1000         struct hlist_node *node;
1030                                                  1001 
1031         __hlist_for_each_rcu(node, head)         1002         __hlist_for_each_rcu(node, head)
1032                 if (pos-- == 0)                  1003                 if (pos-- == 0)
1033                         return node;             1004                         return node;
1034         return NULL;                             1005         return NULL;
1035 }                                                1006 }
1036 EXPORT_SYMBOL(seq_hlist_start_rcu);              1007 EXPORT_SYMBOL(seq_hlist_start_rcu);
1037                                                  1008 
1038 /**                                              1009 /**
1039  * seq_hlist_start_head_rcu - start an iterat    1010  * seq_hlist_start_head_rcu - start an iteration of a hlist protected by RCU
1040  * @head: the head of the hlist                  1011  * @head: the head of the hlist
1041  * @pos:  the start position of the sequence     1012  * @pos:  the start position of the sequence
1042  *                                               1013  *
1043  * Called at seq_file->op->start(). Call this    1014  * Called at seq_file->op->start(). Call this function if you want to
1044  * print a header at the top of the output.      1015  * print a header at the top of the output.
1045  *                                               1016  *
1046  * This list-traversal primitive may safely r    1017  * This list-traversal primitive may safely run concurrently with
1047  * the _rcu list-mutation primitives such as     1018  * the _rcu list-mutation primitives such as hlist_add_head_rcu()
1048  * as long as the traversal is guarded by rcu    1019  * as long as the traversal is guarded by rcu_read_lock().
1049  */                                              1020  */
1050 struct hlist_node *seq_hlist_start_head_rcu(s    1021 struct hlist_node *seq_hlist_start_head_rcu(struct hlist_head *head,
1051                                             l    1022                                             loff_t pos)
1052 {                                                1023 {
1053         if (!pos)                                1024         if (!pos)
1054                 return SEQ_START_TOKEN;          1025                 return SEQ_START_TOKEN;
1055                                                  1026 
1056         return seq_hlist_start_rcu(head, pos     1027         return seq_hlist_start_rcu(head, pos - 1);
1057 }                                                1028 }
1058 EXPORT_SYMBOL(seq_hlist_start_head_rcu);         1029 EXPORT_SYMBOL(seq_hlist_start_head_rcu);
1059                                                  1030 
1060 /**                                              1031 /**
1061  * seq_hlist_next_rcu - move to the next posi    1032  * seq_hlist_next_rcu - move to the next position of the hlist protected by RCU
1062  * @v:    the current iterator                   1033  * @v:    the current iterator
1063  * @head: the head of the hlist                  1034  * @head: the head of the hlist
1064  * @ppos: the current position                   1035  * @ppos: the current position
1065  *                                               1036  *
1066  * Called at seq_file->op->next().               1037  * Called at seq_file->op->next().
1067  *                                               1038  *
1068  * This list-traversal primitive may safely r    1039  * This list-traversal primitive may safely run concurrently with
1069  * the _rcu list-mutation primitives such as     1040  * the _rcu list-mutation primitives such as hlist_add_head_rcu()
1070  * as long as the traversal is guarded by rcu    1041  * as long as the traversal is guarded by rcu_read_lock().
1071  */                                              1042  */
1072 struct hlist_node *seq_hlist_next_rcu(void *v    1043 struct hlist_node *seq_hlist_next_rcu(void *v,
1073                                       struct     1044                                       struct hlist_head *head,
1074                                       loff_t     1045                                       loff_t *ppos)
1075 {                                                1046 {
1076         struct hlist_node *node = v;             1047         struct hlist_node *node = v;
1077                                                  1048 
1078         ++*ppos;                                 1049         ++*ppos;
1079         if (v == SEQ_START_TOKEN)                1050         if (v == SEQ_START_TOKEN)
1080                 return rcu_dereference(head->    1051                 return rcu_dereference(head->first);
1081         else                                     1052         else
1082                 return rcu_dereference(node->    1053                 return rcu_dereference(node->next);
1083 }                                                1054 }
1084 EXPORT_SYMBOL(seq_hlist_next_rcu);               1055 EXPORT_SYMBOL(seq_hlist_next_rcu);
1085                                                  1056 
1086 /**                                              1057 /**
1087  * seq_hlist_start_percpu - start an iteratio !! 1058  * seq_hlist_start_precpu - start an iteration of a percpu hlist array
1088  * @head: pointer to percpu array of struct h    1059  * @head: pointer to percpu array of struct hlist_heads
1089  * @cpu:  pointer to cpu "cursor"                1060  * @cpu:  pointer to cpu "cursor"
1090  * @pos:  start position of sequence             1061  * @pos:  start position of sequence
1091  *                                               1062  *
1092  * Called at seq_file->op->start().              1063  * Called at seq_file->op->start().
1093  */                                              1064  */
1094 struct hlist_node *                              1065 struct hlist_node *
1095 seq_hlist_start_percpu(struct hlist_head __pe    1066 seq_hlist_start_percpu(struct hlist_head __percpu *head, int *cpu, loff_t pos)
1096 {                                                1067 {
1097         struct hlist_node *node;                 1068         struct hlist_node *node;
1098                                                  1069 
1099         for_each_possible_cpu(*cpu) {            1070         for_each_possible_cpu(*cpu) {
1100                 hlist_for_each(node, per_cpu_    1071                 hlist_for_each(node, per_cpu_ptr(head, *cpu)) {
1101                         if (pos-- == 0)          1072                         if (pos-- == 0)
1102                                 return node;     1073                                 return node;
1103                 }                                1074                 }
1104         }                                        1075         }
1105         return NULL;                             1076         return NULL;
1106 }                                                1077 }
1107 EXPORT_SYMBOL(seq_hlist_start_percpu);           1078 EXPORT_SYMBOL(seq_hlist_start_percpu);
1108                                                  1079 
1109 /**                                              1080 /**
1110  * seq_hlist_next_percpu - move to the next p    1081  * seq_hlist_next_percpu - move to the next position of the percpu hlist array
1111  * @v:    pointer to current hlist_node          1082  * @v:    pointer to current hlist_node
1112  * @head: pointer to percpu array of struct h    1083  * @head: pointer to percpu array of struct hlist_heads
1113  * @cpu:  pointer to cpu "cursor"                1084  * @cpu:  pointer to cpu "cursor"
1114  * @pos:  start position of sequence             1085  * @pos:  start position of sequence
1115  *                                               1086  *
1116  * Called at seq_file->op->next().               1087  * Called at seq_file->op->next().
1117  */                                              1088  */
1118 struct hlist_node *                              1089 struct hlist_node *
1119 seq_hlist_next_percpu(void *v, struct hlist_h    1090 seq_hlist_next_percpu(void *v, struct hlist_head __percpu *head,
1120                         int *cpu, loff_t *pos    1091                         int *cpu, loff_t *pos)
1121 {                                                1092 {
1122         struct hlist_node *node = v;             1093         struct hlist_node *node = v;
1123                                                  1094 
1124         ++*pos;                                  1095         ++*pos;
1125                                                  1096 
1126         if (node->next)                          1097         if (node->next)
1127                 return node->next;               1098                 return node->next;
1128                                                  1099 
1129         for (*cpu = cpumask_next(*cpu, cpu_po    1100         for (*cpu = cpumask_next(*cpu, cpu_possible_mask); *cpu < nr_cpu_ids;
1130              *cpu = cpumask_next(*cpu, cpu_po    1101              *cpu = cpumask_next(*cpu, cpu_possible_mask)) {
1131                 struct hlist_head *bucket = p    1102                 struct hlist_head *bucket = per_cpu_ptr(head, *cpu);
1132                                                  1103 
1133                 if (!hlist_empty(bucket))        1104                 if (!hlist_empty(bucket))
1134                         return bucket->first;    1105                         return bucket->first;
1135         }                                        1106         }
1136         return NULL;                             1107         return NULL;
1137 }                                                1108 }
1138 EXPORT_SYMBOL(seq_hlist_next_percpu);            1109 EXPORT_SYMBOL(seq_hlist_next_percpu);
1139                                                  1110 
1140 void __init seq_file_init(void)                  1111 void __init seq_file_init(void)
1141 {                                                1112 {
1142         seq_file_cache = KMEM_CACHE(seq_file,    1113         seq_file_cache = KMEM_CACHE(seq_file, SLAB_ACCOUNT|SLAB_PANIC);
1143 }                                                1114 }
1144                                                  1115 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php