Exemplo n.º 1
0
Arquivo: main.c Projeto: OpenDZ/bus1
static long bus1_fop_ioctl(struct file *file,
			   unsigned int cmd,
			   unsigned long arg)
{
	struct bus1_peer *peer = file->private_data;
	int r;

	switch (cmd) {
	case BUS1_CMD_PEER_INIT:
		return bus1_peer_ioctl_init(peer, arg);
	case BUS1_CMD_PEER_QUERY:
	case BUS1_CMD_PEER_RESET:
	case BUS1_CMD_PEER_CLONE:
	case BUS1_CMD_NODE_DESTROY:
	case BUS1_CMD_HANDLE_RELEASE:
	case BUS1_CMD_SLICE_RELEASE:
	case BUS1_CMD_SEND:
	case BUS1_CMD_RECV:
		if (bus1_active_is_new(&peer->active))
			return -ENOTCONN;
		if (!bus1_peer_acquire(peer))
			return -ESHUTDOWN;
		r = bus1_peer_ioctl(peer, file, cmd, arg);
		bus1_peer_release(peer);
		return r;
	}

	return -ENOTTY;
}
Exemplo n.º 2
0
Arquivo: main.c Projeto: eworm-de/bus1
static long bus1_fop_ioctl(struct file *file,
			   unsigned int cmd,
			   unsigned long arg)
{
	struct bus1_peer *peer = file->private_data;
	int r;

	if (!bus1_peer_acquire(peer))
		return -ESHUTDOWN;

	r = bus1_peer_ioctl(peer, cmd, arg);

	bus1_peer_release(peer);
	return r;
}