当前位置: 首页>>代码示例>>C++>>正文


C++ LIBCFS_FREE函数代码示例

本文整理汇总了C++中LIBCFS_FREE函数的典型用法代码示例。如果您正苦于以下问题:C++ LIBCFS_FREE函数的具体用法?C++ LIBCFS_FREE怎么用?C++ LIBCFS_FREE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LIBCFS_FREE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: lst_batch_run_ioctl

static int
lst_batch_run_ioctl(lstio_batch_run_args_t *args)
{
	int rc;
	char *name;

	if (args->lstio_bat_key != console_session.ses_key)
		return -EACCES;

	if (!args->lstio_bat_namep ||
	    args->lstio_bat_nmlen <= 0 ||
	    args->lstio_bat_nmlen > LST_NAME_SIZE)
		return -EINVAL;

	LIBCFS_ALLOC(name, args->lstio_bat_nmlen + 1);
	if (!name)
		return -ENOMEM;

	if (copy_from_user(name, args->lstio_bat_namep,
			   args->lstio_bat_nmlen)) {
		LIBCFS_FREE(name, args->lstio_bat_nmlen + 1);
		return -EFAULT;
	}

	name[args->lstio_bat_nmlen] = 0;

	rc = lstcon_batch_run(name, args->lstio_bat_timeout,
			      args->lstio_bat_resultp);

	LIBCFS_FREE(name, args->lstio_bat_nmlen + 1);

	return rc;
}
开发者ID:513855417,项目名称:linux,代码行数:33,代码来源:conctl.c

示例2: lst_group_del_ioctl

static int
lst_group_del_ioctl(lstio_group_del_args_t *args)
{
	int rc;
	char *name;

	if (args->lstio_grp_key != console_session.ses_key)
		return -EACCES;

	if (!args->lstio_grp_namep ||
	    args->lstio_grp_nmlen <= 0 ||
	    args->lstio_grp_nmlen > LST_NAME_SIZE)
		return -EINVAL;

	LIBCFS_ALLOC(name, args->lstio_grp_nmlen + 1);
	if (!name)
		return -ENOMEM;

	if (copy_from_user(name, args->lstio_grp_namep,
			   args->lstio_grp_nmlen)) {
		LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);
		return -EFAULT;
	}

	name[args->lstio_grp_nmlen] = 0;

	rc = lstcon_group_del(name);

	LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);

	return rc;
}
开发者ID:513855417,项目名称:linux,代码行数:32,代码来源:conctl.c

示例3: lst_batch_add_ioctl

int
lst_batch_add_ioctl(lstio_batch_add_args_t *args)
{
        int             rc;
        char           *name;

        if (args->lstio_bat_key != console_session.ses_key)
                return -EACCES;

        if (args->lstio_bat_namep == NULL ||
            args->lstio_bat_nmlen <= 0 ||
            args->lstio_bat_nmlen > LST_NAME_SIZE)
                return -EINVAL;

        LIBCFS_ALLOC(name, args->lstio_bat_nmlen + 1);
        if (name == NULL)
                return -ENOMEM;

        if (cfs_copy_from_user(name,
                               args->lstio_bat_namep,
                               args->lstio_bat_nmlen)) {
                LIBCFS_FREE(name, args->lstio_bat_nmlen + 1);
                return -EFAULT;
        }

        name[args->lstio_bat_nmlen] = 0;

        rc = lstcon_batch_add(name);

        LIBCFS_FREE(name, args->lstio_bat_nmlen + 1);

        return rc;
}
开发者ID:DCteam,项目名称:lustre,代码行数:33,代码来源:conctl.c

示例4: lst_group_update_ioctl

static int
lst_group_update_ioctl(lstio_group_update_args_t *args)
{
	int     rc;
	char   *name;

	if (args->lstio_grp_key != console_session.ses_key)
		return -EACCES;

	if (args->lstio_grp_resultp == NULL ||
	    args->lstio_grp_namep == NULL ||
	    args->lstio_grp_nmlen <= 0 ||
	    args->lstio_grp_nmlen > LST_NAME_SIZE)
		return -EINVAL;

	LIBCFS_ALLOC(name, args->lstio_grp_nmlen + 1);
	if (name == NULL)
		return -ENOMEM;

	if (copy_from_user(name,
			   args->lstio_grp_namep,
			   args->lstio_grp_nmlen)) {
		LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);
		return -EFAULT;
	}

	name[args->lstio_grp_nmlen] = 0;

	switch (args->lstio_grp_opc) {
	case LST_GROUP_CLEAN:
		rc = lstcon_group_clean(name, args->lstio_grp_args);
		break;

	case LST_GROUP_REFRESH:
		rc = lstcon_group_refresh(name, args->lstio_grp_resultp);
		break;

	case LST_GROUP_RMND:
		if (args->lstio_grp_count  <= 0 ||
		    args->lstio_grp_idsp == NULL) {
			rc = -EINVAL;
			break;
		}
		rc = lstcon_nodes_remove(name, args->lstio_grp_count,
					 args->lstio_grp_idsp,
					 args->lstio_grp_resultp);
		break;

	default:
		rc = -EINVAL;
		break;
	}

	LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);

	return rc;
}
开发者ID:a2hojsjsjs,项目名称:linux,代码行数:57,代码来源:conctl.c

示例5: libcfs_ipif_free_enumeration

void
libcfs_ipif_free_enumeration (char **names, int n)
{
        int      i;

        LASSERT (n > 0);

        for (i = 0; i < n && names[i] != NULL; i++)
                LIBCFS_FREE(names[i], IFNAMSIZ);

        LIBCFS_FREE(names, n * sizeof(*names));
}
开发者ID:Lezval,项目名称:lustre,代码行数:12,代码来源:user-tcpip.c

示例6: usocklnd_handle_zc_req

/* Handle incoming ZC request from sender.
 * NB: it's called only from read_handler, so we're sure that
 * the conn cannot become zombie in the middle of processing */
int
usocklnd_handle_zc_req(usock_peer_t *peer, __u64 cookie)
{
        usock_conn_t   *conn;
        usock_zc_ack_t *zc_ack;
        int             type;
        int             rc;
        int             dummy;

        LIBCFS_ALLOC (zc_ack, sizeof(*zc_ack));
        if (zc_ack == NULL)
                return -ENOMEM;
        zc_ack->zc_cookie = cookie;

        /* Let's assume that CONTROL is the best type for zcack,
         * but userspace clients don't use typed connections */
        if (the_lnet.ln_pid & LNET_PID_USERFLAG)
                type = SOCKLND_CONN_ANY;
        else
                type = SOCKLND_CONN_CONTROL;

        rc = usocklnd_find_or_create_conn(peer, type, &conn, NULL, zc_ack,
                                          &dummy);
        if (rc != 0) {
                LIBCFS_FREE (zc_ack, sizeof(*zc_ack));
                return rc;
        }
        usocklnd_conn_decref(conn);

        return 0;
}
开发者ID:Lezval,项目名称:lustre,代码行数:34,代码来源:handlers.c

示例7: lwt_fini

void
lwt_fini ()
{
        int    i;

        lwt_control(0, 0);

        for (i = 0; i < cfs_num_online_cpus(); i++)
                while (lwt_cpus[i].lwtc_current_page != NULL) {
                        lwt_page_t *lwtp = lwt_cpus[i].lwtc_current_page;

                        if (cfs_list_empty (&lwtp->lwtp_list)) {
                                lwt_cpus[i].lwtc_current_page = NULL;
                        } else {
                                lwt_cpus[i].lwtc_current_page =
                                        cfs_list_entry (lwtp->lwtp_list.next,
                                                        lwt_page_t, lwtp_list);

                                cfs_list_del (&lwtp->lwtp_list);
                        }
                        
                        __free_page (lwtp->lwtp_page);
                        LIBCFS_FREE (lwtp, sizeof (*lwtp));
                }
}
开发者ID:girishshilamkar,项目名称:lustre-release,代码行数:25,代码来源:lwt.c

示例8: cfs_wi_shutdown

void
cfs_wi_shutdown (void)
{
        int i;

        if (cfs_wi_data.wi_scheds == NULL)
                return;

        for (i = 0; i < cfs_wi_data.wi_nsched; i++)
                cfs_wi_sched_shutdown(&cfs_wi_data.wi_scheds[i]);

#ifdef __KERNEL__
        cfs_spin_lock(&cfs_wi_data.wi_glock);
        i = 2;
        while (cfs_wi_data.wi_nthreads != 0) {
                CDEBUG(IS_PO2(++i) ? D_WARNING : D_NET,
                       "waiting for %d threads to terminate\n",
                       cfs_wi_data.wi_nthreads);
                cfs_spin_unlock(&cfs_wi_data.wi_glock);

                cfs_pause(cfs_time_seconds(1));

                cfs_spin_lock(&cfs_wi_data.wi_glock);
        }
        cfs_spin_unlock(&cfs_wi_data.wi_glock);
#endif
        LIBCFS_FREE(cfs_wi_data.wi_scheds,
                    cfs_wi_data.wi_nsched * sizeof(cfs_wi_sched_t));
        return;
}
开发者ID:DCteam,项目名称:lustre,代码行数:30,代码来源:workitem.c

示例9: libcfs_ioctl

static int libcfs_ioctl(struct cfs_psdev_file *pfile,
			unsigned long cmd, void *arg)
{
	char    *buf;
	struct libcfs_ioctl_data *data;
	int err = 0;
	ENTRY;

	LIBCFS_ALLOC_GFP(buf, 1024, GFP_IOFS);
	if (buf == NULL)
		RETURN(-ENOMEM);

        /* 'cmd' and permissions get checked in our arch-specific caller */
        if (libcfs_ioctl_getdata(buf, buf + 800, (void *)arg)) {
                CERROR("PORTALS ioctl: data error\n");
                GOTO(out, err = -EINVAL);
        }
        data = (struct libcfs_ioctl_data *)buf;

        err = libcfs_ioctl_int(pfile, cmd, arg, data);

out:
        LIBCFS_FREE(buf, 1024);
        RETURN(err);
}
开发者ID:walgenbach,项目名称:lustre-release,代码行数:25,代码来源:module.c

示例10: lnet_selftest_exit

static void
lnet_selftest_exit(void)
{
	int i;

	switch (lst_init_step) {
	case LST_INIT_CONSOLE:
		lstcon_console_fini();
	case LST_INIT_FW:
		sfw_shutdown();
	case LST_INIT_RPC:
		srpc_shutdown();
	case LST_INIT_WI_TEST:
		for (i = 0;
		     i < cfs_cpt_number(lnet_cpt_table()); i++) {
			if (!lst_sched_test[i])
				continue;
			cfs_wi_sched_destroy(lst_sched_test[i]);
		}
		LIBCFS_FREE(lst_sched_test,
			    sizeof(lst_sched_test[0]) *
			    cfs_cpt_number(lnet_cpt_table()));
		lst_sched_test = NULL;

	case LST_INIT_WI_SERIAL:
		cfs_wi_sched_destroy(lst_sched_serial);
		lst_sched_serial = NULL;
	case LST_INIT_NONE:
		break;
	default:
		LBUG();
	}
}
开发者ID:020gzh,项目名称:linux,代码行数:33,代码来源:module.c

示例11: lc_watchdog_delete

void lc_watchdog_delete(struct lc_watchdog *lcw)
{
        int dead;

        ENTRY;
        LASSERT(lcw != NULL);

        cfs_timer_disarm(&lcw->lcw_timer);

        lcw_update_time(lcw, "stopped");

        cfs_spin_lock_bh(&lcw->lcw_lock);
        cfs_spin_lock_bh(&lcw_pending_timers_lock);
        if (unlikely(!cfs_list_empty(&lcw->lcw_list))) {
                cfs_list_del_init(&lcw->lcw_list);
                lcw->lcw_refcount--; /* -1 ref for pending list */
        }

        lcw->lcw_refcount--; /* -1 ref for owner */
        dead = lcw->lcw_refcount == 0;
        cfs_spin_unlock_bh(&lcw_pending_timers_lock);
        cfs_spin_unlock_bh(&lcw->lcw_lock);

        if (dead)
                LIBCFS_FREE(lcw, sizeof(*lcw));

        cfs_down(&lcw_refcount_sem);
        if (--lcw_refcount == 0)
                lcw_dispatch_stop();
        cfs_up(&lcw_refcount_sem);

        EXIT;
}
开发者ID:hpc,项目名称:lustre,代码行数:33,代码来源:watchdog.c

示例12: cfs_cpt_table_free

void
cfs_cpt_table_free(struct cfs_cpt_table *cptab)
{
	LASSERT(cptab->ctb_version == CFS_CPU_VERSION_MAGIC);

	LIBCFS_FREE(cptab, sizeof(*cptab));
}
开发者ID:hejin,项目名称:lustre-stable,代码行数:7,代码来源:libcfs_cpu.c

示例13: lst_stat_query_ioctl

static int
lst_stat_query_ioctl(lstio_stat_args_t *args)
{
	int rc;
	char *name;

	/* TODO: not finished */
	if (args->lstio_sta_key != console_session.ses_key)
		return -EACCES;

	if (args->lstio_sta_resultp == NULL ||
	    (args->lstio_sta_namep  == NULL &&
	     args->lstio_sta_idsp   == NULL) ||
	    args->lstio_sta_nmlen <= 0 ||
	    args->lstio_sta_nmlen > LST_NAME_SIZE)
		return -EINVAL;

	if (args->lstio_sta_idsp != NULL &&
	    args->lstio_sta_count <= 0)
		return -EINVAL;

	LIBCFS_ALLOC(name, args->lstio_sta_nmlen + 1);
	if (name == NULL)
		return -ENOMEM;

	if (copy_from_user(name, args->lstio_sta_namep,
			       args->lstio_sta_nmlen)) {
		LIBCFS_FREE(name, args->lstio_sta_nmlen + 1);
		return -EFAULT;
	}

	if (args->lstio_sta_idsp == NULL) {
		rc = lstcon_group_stat(name, args->lstio_sta_timeout,
				       args->lstio_sta_resultp);
	} else {
		rc = lstcon_nodes_stat(args->lstio_sta_count,
				       args->lstio_sta_idsp,
				       args->lstio_sta_timeout,
				       args->lstio_sta_resultp);
	}

	LIBCFS_FREE(name, args->lstio_sta_nmlen + 1);

	return rc;
}
开发者ID:a2hojsjsjs,项目名称:linux,代码行数:45,代码来源:conctl.c

示例14: cfs_percpt_lock_free

/** destroy cpu-partition lock, see libcfs_private.h for more detail */
void
cfs_percpt_lock_free(struct cfs_percpt_lock *pcl)
{
	LASSERT(pcl->pcl_locks != NULL);
	LASSERT(!pcl->pcl_locked);

	cfs_percpt_free(pcl->pcl_locks);
	LIBCFS_FREE(pcl, sizeof(*pcl));
}
开发者ID:Chong-Li,项目名称:cse522,代码行数:10,代码来源:libcfs_lock.c

示例15: libcfs_socketpair

int
libcfs_socketpair(cfs_socket_t **sockp)
{
        int rc, i, fdp[2];

        LIBCFS_ALLOC(sockp[0], sizeof(cfs_socket_t));
        if (sockp[0] == NULL) {
                CERROR ("Can't alloc memory for cfs_socket_t (1)\n");
                return -ENOMEM;
        }

        LIBCFS_ALLOC(sockp[1], sizeof(cfs_socket_t));
        if (sockp[1] == NULL) {
                CERROR ("Can't alloc memory for cfs_socket_t (2)\n");
                LIBCFS_FREE(sockp[0], sizeof(cfs_socket_t));
                return -ENOMEM;
        }

        rc = socketpair(AF_UNIX, SOCK_STREAM, 0, fdp);
        if (rc != 0) {
                rc = -errno;
                CERROR ("Cannot create socket pair\n");
                LIBCFS_FREE(sockp[0], sizeof(cfs_socket_t));
                LIBCFS_FREE(sockp[1], sizeof(cfs_socket_t));
                return rc;
        }

        sockp[0]->s_fd = fdp[0];
        sockp[1]->s_fd = fdp[1];

        for (i = 0; i < 2; i++) {
                rc = libcfs_fcntl_nonblock(sockp[i]);
                if (rc) {
                        libcfs_sock_release(sockp[0]);
                        libcfs_sock_release(sockp[1]);
                        return rc;
                }
        }

        return 0;
}
开发者ID:Lezval,项目名称:lustre,代码行数:41,代码来源:user-tcpip.c


注:本文中的LIBCFS_FREE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。