1988};
1989
1990static struct net_proto_family packet_family_ops = {
1991 .family = PF_PACKET,
1992 .create = packet_create,
1993 .owner = THIS_MODULE,
1994};
1995
1996static struct notifier_block packet_netdev_notifier = {
1997 .notifier_call =packet_notifier,
1998};
1999
2000#ifdef CONFIG_PROC_FS
2001static inline struct sock *packet_seq_idx(struct net *net, loff_t off)
2002{
2003 struct sock *s;
2004 struct hlist_node *node;
2005
2006 sk_for_each(s, node, &net->packet.sklist) {
2007 if (!off--)
2008 return s;
2009 }
2010 return NULL;
2011}
2012
2013static void *packet_seq_start(struct seq_file *seq, loff_t *pos)
2014 __acquires(seq_file_net(seq)->packet.sklist_lock)
2015{
2016 struct net *net = seq_file_net(seq);
2017 read_lock(&net->packet.sklist_lock);
2018 return *pos ? packet_seq_idx(net, *pos - 1) : SEQ_START_TOKEN;
2019}
2020
2021static void *packet_seq_next(struct seq_file *seq, void *v, loff_t *pos)
2022{
2023 struct net *net = seq_file_net(seq);
2024 ++*pos;
2025 return (v == SEQ_START_TOKEN)
2026 ? sk_head(&net->packet.sklist)
2027 : sk_next((struct sock*)v) ;
2028}