示例#1
0
文件: module.c 项目: 513855417/linux
static int
lnet_ioctl(unsigned int cmd, struct libcfs_ioctl_hdr *hdr)
{
	int rc;

	switch (cmd) {
	case IOC_LIBCFS_CONFIGURE: {
		struct libcfs_ioctl_data *data =
			(struct libcfs_ioctl_data *)hdr;

		if (data->ioc_hdr.ioc_len < sizeof(*data))
			return -EINVAL;

		the_lnet.ln_nis_from_mod_params = data->ioc_flags;
		return lnet_configure(NULL);
	}

	case IOC_LIBCFS_UNCONFIGURE:
		return lnet_unconfigure();

	case IOC_LIBCFS_ADD_NET:
		return lnet_dyn_configure(hdr);

	case IOC_LIBCFS_DEL_NET:
		return lnet_dyn_unconfigure(hdr);

	default:
		/*
		 * Passing LNET_PID_ANY only gives me a ref if the net is up
		 * already; I'll need it to ensure the net can't go down while
		 * I'm called into it
		 */
		rc = LNetNIInit(LNET_PID_ANY);
		if (rc >= 0) {
			rc = LNetCtl(cmd, hdr);
			LNetNIFini();
		}
		return rc;
	}
}
示例#2
0
文件: module.c 项目: LLNL/lustre
int
lnet_ioctl(unsigned int cmd, struct libcfs_ioctl_data *data)
{
        int   rc;

        switch (cmd) {
        case IOC_LIBCFS_CONFIGURE:
                return lnet_configure(NULL);

        case IOC_LIBCFS_UNCONFIGURE:
                return lnet_unconfigure();
                
        default:
                /* Passing LNET_PID_ANY only gives me a ref if the net is up
                 * already; I'll need it to ensure the net can't go down while
                 * I'm called into it */
                rc = LNetNIInit(LNET_PID_ANY);
                if (rc >= 0) {
                        rc = LNetCtl(cmd, data);
                        LNetNIFini();
                }
                return rc;
        }
}