root/include/linux/seq_file_net.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. seq_file_net
  2. seq_file_single_net

   1 /* SPDX-License-Identifier: GPL-2.0 */
   2 #ifndef __SEQ_FILE_NET_H__
   3 #define __SEQ_FILE_NET_H__
   4 
   5 #include <linux/seq_file.h>
   6 
   7 struct net;
   8 extern struct net init_net;
   9 
  10 struct seq_net_private {
  11 #ifdef CONFIG_NET_NS
  12         struct net *net;
  13 #endif
  14 };
  15 
  16 static inline struct net *seq_file_net(struct seq_file *seq)
  17 {
  18 #ifdef CONFIG_NET_NS
  19         return ((struct seq_net_private *)seq->private)->net;
  20 #else
  21         return &init_net;
  22 #endif
  23 }
  24 
  25 /*
  26  * This one is needed for proc_create_net_single since net is stored directly
  27  * in private not as a struct i.e. seq_file_net can't be used.
  28  */
  29 static inline struct net *seq_file_single_net(struct seq_file *seq)
  30 {
  31 #ifdef CONFIG_NET_NS
  32         return (struct net *)seq->private;
  33 #else
  34         return &init_net;
  35 #endif
  36 }
  37 
  38 #endif

/* [<][>][^][v][top][bottom][index][help] */