/* Create a socket. Initialise the socket, blank the addresses set the state.  */
static int atalk_create(struct net *net, struct socket *sock, int protocol, int kern)
/* Create a socket. Initialise the socket, blank the addresses set the state.  */
static int atalk_create(struct net *net, struct socket *sock, int protocol, int kern)
{
	struct sock *sk;
	int rc = -ESOCKTNOSUPPORT;
	if (!net_eq(net, &init_net))
		return -EAFNOSUPPORT;
	if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
		goto out;
	rc = -ENOMEM;
	sk = sk_alloc(net, PF_APPLETALK, GFP_KERNEL, &ddp_proto);
	if (!sk)
		goto out;
	rc = 0;
	sock->ops = &atalk_dgram_ops;
	sock_init_data(sock, sk);
	sock_set_flag(sk, SOCK_ZAPPED);
out:
	return rc;
}