/*
 * Common procedure for SM_MON/SM_UNMON calls
 */
static int
nsm_mon_unmon(struct nlm_host *host, u32 proc, struct nsm_res *res)
{
	struct rpc_clnt	*clnt;
	int		status;
	struct nsm_args	args;

	clnt = nsm_create();
	if (IS_ERR(clnt)) {
		status = PTR_ERR(clnt);
		goto out;
	}

	args.addr = host->h_addr.sin_addr.s_addr;
	args.proto= (host->h_proto<<1) | host->h_server;
	args.prog = NLM_PROGRAM;
	args.vers = host->h_version;
	args.proc = NLMPROC_NSM_NOTIFY;
	memset(res, 0, sizeof(*res));

	status = rpc_call(clnt, proc, &args, res, 0);
	if (status < 0)
		printk(KERN_DEBUG "nsm_mon_unmon: rpc failed, status=%d\n",
			status);
	else
		status = 0;
 out:
	return status;
}
Beispiel #2
0
/*
 * Common procedure for SM_MON/SM_UNMON calls
 */
static int
nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res)
{
	struct rpc_clnt	*clnt;
	int		status;
	struct nsm_args	args;
	struct rpc_message msg = {
		.rpc_argp	= &args,
		.rpc_resp	= res,
	};

	clnt = nsm_create();
	if (IS_ERR(clnt)) {
		status = PTR_ERR(clnt);
		goto out;
	}

	memset(&args, 0, sizeof(args));
	args.mon_name = nsm->sm_name;
	args.addr = nsm->sm_addr.sin_addr.s_addr;
	args.prog = NLM_PROGRAM;
	args.vers = 3;
	args.proc = NLMPROC_NSM_NOTIFY;
	memset(res, 0, sizeof(*res));

	msg.rpc_proc = &clnt->cl_procinfo[proc];
	status = rpc_call_sync(clnt, &msg, 0);
	if (status < 0)
		printk(KERN_DEBUG "nsm_mon_unmon: rpc failed, status=%d\n",
			status);
	else
		status = 0;
 out:
	return status;
}
Beispiel #3
0
/*
 * Common procedure for SM_MON/SM_UNMON calls
 */
static int
nsm_mon_unmon(struct nlm_host *host, char *what, u32 proc)
{
	struct rpc_clnt	*clnt;
	int		status;
	struct nsm_args	args;
	struct nsm_res	res;

	dprintk("lockd: nsm_%s(%s)\n", what, host->h_name);
	status = -EACCES;
	clnt = nsm_create();
	if (!clnt)
		goto out;

	args.addr = host->h_addr.sin_addr.s_addr;
	args.prog = NLM_PROGRAM;
	args.vers = 1;
	args.proc = NLMPROC_NSM_NOTIFY;

	status = rpc_call(clnt, proc, &args, &res, 0);
	if (status < 0) {
		printk(KERN_DEBUG "nsm_mon_unmon: rpc failed, status=%d\n",
			status);
		goto out;
	}

	status = -EACCES;
	if (res.status != 0) {
		printk(KERN_NOTICE "lockd: cannot %s %s\n", what, host->h_name);
		goto out;
	}

	nsm_local_state = res.state;
	status = 0;
out:
	return status;
}