/* register an RxRPC security handler for use by RxRPC  */
int rxrpc_register_security(struct rxrpc_security *sec)
/* register an RxRPC security handler for use by RxRPC  */
int rxrpc_register_security(struct rxrpc_security *sec)
{
	struct rxrpc_security *psec;
	int ret;
	_enter("");
	down_write(&rxrpc_security_sem);
	ret = -EEXIST;
	list_for_each_entry(psec, &rxrpc_security_methods, link) {
		if (psec->security_index == sec->security_index)
			goto out;
	}
	list_add(&sec->link, &rxrpc_security_methods);
	printk(KERN_NOTICE "RxRPC: Registered security type %d '%s'\n",
	       sec->security_index, sec->name);
	ret = 0;
out:
	up_write(&rxrpc_security_sem);
	_leave(" = %d", ret);
	return ret;
}