Exemple #1
0
int seq_open_net(struct inode *ino, struct file *f,
		 const struct seq_operations *ops, int size)
{
	struct net *net;
	struct seq_net_private *p;

	BUG_ON(size < sizeof(*p));

	/* only permit access to /proc/net/dev */
	if (
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
	    ops != ipv6_seq_ops_addr && 
#endif
	    ops != &dev_seq_ops && gr_proc_is_restricted())
		return -EACCES;

	net = get_proc_net(ino);
	if (net == NULL)
		return -ENXIO;

	p = __seq_open_private(f, ops, size);
	if (p == NULL) {
		put_net(net);
		return -ENOMEM;
	}
#ifdef CONFIG_NET_NS
	p->net = net;
#endif
	return 0;
}
static int __vcc_seq_open(struct inode *inode, struct file *file,
	int family, const struct seq_operations *ops)
{
	struct vcc_state *state;

	state = __seq_open_private(file, ops, sizeof(*state));
	if (state == NULL)
		return -ENOMEM;

	state->family = family;
	return 0;
}
Exemple #3
0
int raw_seq_open(struct file *file,
		 struct raw_hashinfo *h, const struct seq_operations *ops)
{
	struct raw_iter_state *i;

	i = __seq_open_private(file, ops, sizeof(struct raw_iter_state));
	if (i == NULL)
		return -ENOMEM;

	i->h = h;
	return 0;
}
static int proc_maps_open(struct inode *inode, struct file *file,
			const struct seq_operations *ops, int psize)
{
	struct proc_maps_private *priv = __seq_open_private(file, ops, psize);

	if (!priv)
		return -ENOMEM;

	priv->inode = inode;
	priv->mm = proc_mem_open(inode, PTRACE_MODE_READ);
	if (IS_ERR(priv->mm)) {
		int err = PTR_ERR(priv->mm);

		seq_release_private(inode, file);
		return err;
	}

	return 0;
}
Exemple #5
0
int seq_open_net(struct inode *ino, struct file *f,
		 const struct seq_operations *ops, int size)
{
	struct net *net;
	struct seq_net_private *p;

	BUG_ON(size < sizeof(*p));

	net = get_proc_net(ino);
	if (net == NULL)
		return -ENXIO;

	p = __seq_open_private(f, ops, size);
	if (p == NULL) {
		put_net(net);
		return -ENOMEM;
	}
#ifdef CONFIG_NET_NS
	p->net = net;
#endif
	return 0;
}