798};
799
800static int xt_table_open(struct inode *inode, struct file *file)
801{
802 int ret;
803 struct xt_names_priv *priv;
804
805 ret = seq_open_net(inode, file, &xt_table_seq_ops,
806 sizeof(struct xt_names_priv));
807 if (!ret) {
808 priv = ((struct seq_file *)file->private_data)->private;
809 priv->af = (unsigned long)PDE(inode)->data;
810 }
811 return ret;
812}
813
814static const struct file_operations xt_table_ops = {
815 .owner = THIS_MODULE,
816 .open = xt_table_open,
817 .read = seq_read,
818 .llseek = seq_lseek,
819 .release = seq_release_net,
820};
821
822static void *xt_match_seq_start(struct seq_file *seq, loff_t *pos)
823{
824 struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private;
825 u_int16_t af = (unsigned long)pde->data;
826
827 mutex_lock(&xt[af].mutex);
828 return seq_list_start(&xt[af].match, *pos);
829}
830
831static void *xt_match_seq_next(struct seq_file *seq, void *v, loff_t *pos)
832{
833 struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private;
834 u_int16_t af = (unsigned long)pde->data;
835
836 return seq_list_next(v, &xt[af].match, pos);
837}
838