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


C++ OBD_FREE函数代码示例

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


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

示例1: mdd_changelog_mask_seq_write

static ssize_t
mdd_changelog_mask_seq_write(struct file *file, const char __user *buffer,
                             size_t count, loff_t *off)
{
    struct seq_file *m = file->private_data;
    struct mdd_device *mdd = m->private;
    char *kernbuf;
    int rc;
    ENTRY;

    if (count >= PAGE_SIZE)
        RETURN(-EINVAL);
    OBD_ALLOC(kernbuf, PAGE_SIZE);
    if (kernbuf == NULL)
        RETURN(-ENOMEM);
    if (copy_from_user(kernbuf, buffer, count))
        GOTO(out, rc = -EFAULT);
    kernbuf[count] = 0;

    rc = cfs_str2mask(kernbuf, changelog_type2str, &mdd->mdd_cl.mc_mask,
                      CHANGELOG_MINMASK, CHANGELOG_ALLMASK);
    if (rc == 0)
        rc = count;
out:
    OBD_FREE(kernbuf, PAGE_SIZE);
    return rc;
}
开发者ID:rread,项目名称:lustre,代码行数:27,代码来源:mdd_lproc.c

示例2: lprocfs_wr_changelog_mask

static int lprocfs_wr_changelog_mask(struct file *file, const char *buffer,
				     unsigned long count, void *data)
{
	struct mdd_device *mdd = data;
	char *kernbuf;
	int rc;
	ENTRY;

	if (count >= PAGE_CACHE_SIZE)
		RETURN(-EINVAL);
	OBD_ALLOC(kernbuf, PAGE_CACHE_SIZE);
	if (kernbuf == NULL)
		RETURN(-ENOMEM);
	if (copy_from_user(kernbuf, buffer, count))
		GOTO(out, rc = -EFAULT);
	kernbuf[count] = 0;

	rc = cfs_str2mask(kernbuf, changelog_type2str, &mdd->mdd_cl.mc_mask,
			  CHANGELOG_MINMASK, CHANGELOG_ALLMASK);
	if (rc == 0)
		rc = count;
out:
	OBD_FREE(kernbuf, PAGE_CACHE_SIZE);
	return rc;
}
开发者ID:hejin,项目名称:lustre-stable,代码行数:25,代码来源:mdd_lproc.c

示例3: lmd_parse_string

static int lmd_parse_string(char **handle, char *ptr)
{
	char   *tail;
	int     length;

	if ((handle == NULL) || (ptr == NULL))
		return -EINVAL;

	if (*handle != NULL) {
		OBD_FREE(*handle, strlen(*handle) + 1);
		*handle = NULL;
	}

	tail = strchr(ptr, ',');
	if (tail == NULL)
		length = strlen(ptr);
	else
		length = tail - ptr;

	OBD_ALLOC(*handle, length + 1);
	if (*handle == NULL)
		return -ENOMEM;

	memcpy(*handle, ptr, length);
	(*handle)[length] = '\0';

	return 0;
}
开发者ID:IDM350,项目名称:linux,代码行数:28,代码来源:obd_mount.c

示例4: ofd_lvbo_free

/**
 * Implementation of ldlm_valblock_ops::lvbo_free for OFD.
 *
 * This function frees allocated LVB data if it associated with the given
 * LDLM resource.
 *
 * \param[in] res	LDLM resource
 *
 * \retval		0 on successful setup
 * \retval		negative value on error
 */
static int ofd_lvbo_free(struct ldlm_resource *res)
{
	if (res->lr_lvb_data)
		OBD_FREE(res->lr_lvb_data, res->lr_lvb_len);

	return 0;
}
开发者ID:EMSL-MSC,项目名称:lustre-release,代码行数:18,代码来源:ofd_lvb.c

示例5: mds_lov_clean

static int mds_lov_clean(struct obd_device *obd)
{
        struct mds_obd *mds = &obd->u.mds;
        struct obd_device *osc = mds->mds_lov_obd;
        ENTRY;

        if (mds->mds_profile) {
                class_del_profile(mds->mds_profile);
                OBD_FREE(mds->mds_profile, strlen(mds->mds_profile) + 1);
                mds->mds_profile = NULL;
        }

        /* There better be a lov */
        if (!osc)
                RETURN(0);
        if (IS_ERR(osc))
                RETURN(PTR_ERR(osc));

        obd_register_observer(osc, NULL);

        /* Give lov our same shutdown flags */
        osc->obd_force = obd->obd_force;
        osc->obd_fail = obd->obd_fail;

        /* Cleanup the lov */
        obd_disconnect(mds->mds_lov_exp);
        class_manual_cleanup(osc);

        RETURN(0);
}
开发者ID:DCteam,项目名称:lustre,代码行数:30,代码来源:handler.c

示例6: client_fid_init

int client_fid_init(struct obd_device *obd,
		    struct obd_export *exp, enum lu_cli_type type)
{
	struct client_obd *cli = &obd->u.cli;
	char *prefix;
	int rc;
	ENTRY;

	OBD_ALLOC_PTR(cli->cl_seq);
	if (cli->cl_seq == NULL)
		RETURN(-ENOMEM);

	OBD_ALLOC(prefix, MAX_OBD_NAME + 5);
	if (prefix == NULL)
		GOTO(out_free_seq, rc = -ENOMEM);

	snprintf(prefix, MAX_OBD_NAME + 5, "cli-%s", obd->obd_name);

	/* Init client side sequence-manager */
	rc = seq_client_init(cli->cl_seq, exp, type, prefix, NULL);
	OBD_FREE(prefix, MAX_OBD_NAME + 5);
	if (rc)
		GOTO(out_free_seq, rc);

	RETURN(rc);
out_free_seq:
	OBD_FREE_PTR(cli->cl_seq);
	cli->cl_seq = NULL;
	return rc;
}
开发者ID:Cool-Joe,项目名称:imx23-audio,代码行数:30,代码来源:fid_handler.c

示例7: enc_pools_free

static inline void enc_pools_free(void)
{
        LASSERT(page_pools.epp_max_pools);
        LASSERT(page_pools.epp_pools);

        OBD_FREE(page_pools.epp_pools,
                 page_pools.epp_max_pools * sizeof(*page_pools.epp_pools));
}
开发者ID:DCteam,项目名称:lustre,代码行数:8,代码来源:sec_bulk.c

示例8: lustre_free_lsi

static int lustre_free_lsi(struct super_block *sb)
{
	struct lustre_sb_info *lsi = s2lsi(sb);

	LASSERT(lsi != NULL);
	CDEBUG(D_MOUNT, "Freeing lsi %p\n", lsi);

	/* someone didn't call server_put_mount. */
	LASSERT(atomic_read(&lsi->lsi_mounts) == 0);

	if (lsi->lsi_lmd != NULL) {
		if (lsi->lsi_lmd->lmd_dev != NULL)
			OBD_FREE(lsi->lsi_lmd->lmd_dev,
				 strlen(lsi->lsi_lmd->lmd_dev) + 1);
		if (lsi->lsi_lmd->lmd_profile != NULL)
			OBD_FREE(lsi->lsi_lmd->lmd_profile,
				 strlen(lsi->lsi_lmd->lmd_profile) + 1);
		if (lsi->lsi_lmd->lmd_mgssec != NULL)
			OBD_FREE(lsi->lsi_lmd->lmd_mgssec,
				 strlen(lsi->lsi_lmd->lmd_mgssec) + 1);
		if (lsi->lsi_lmd->lmd_opts != NULL)
			OBD_FREE(lsi->lsi_lmd->lmd_opts,
				 strlen(lsi->lsi_lmd->lmd_opts) + 1);
		if (lsi->lsi_lmd->lmd_exclude_count)
			OBD_FREE(lsi->lsi_lmd->lmd_exclude,
				 sizeof(lsi->lsi_lmd->lmd_exclude[0]) *
				 lsi->lsi_lmd->lmd_exclude_count);
		if (lsi->lsi_lmd->lmd_mgs != NULL)
			OBD_FREE(lsi->lsi_lmd->lmd_mgs,
				 strlen(lsi->lsi_lmd->lmd_mgs) + 1);
		if (lsi->lsi_lmd->lmd_osd_type != NULL)
			OBD_FREE(lsi->lsi_lmd->lmd_osd_type,
				 strlen(lsi->lsi_lmd->lmd_osd_type) + 1);
		if (lsi->lsi_lmd->lmd_params != NULL)
			OBD_FREE(lsi->lsi_lmd->lmd_params, 4096);

		OBD_FREE(lsi->lsi_lmd, sizeof(*lsi->lsi_lmd));
	}

	LASSERT(lsi->lsi_llsbi == NULL);
	OBD_FREE(lsi, sizeof(*lsi));
	s2lsi_nocast(sb) = NULL;

	return 0;
}
开发者ID:IDM350,项目名称:linux,代码行数:45,代码来源:obd_mount.c

示例9: null_free_rs

static
void null_free_rs(struct ptlrpc_reply_state *rs)
{
        LASSERT_ATOMIC_GT(&rs->rs_svc_ctx->sc_refcount, 1);
        cfs_atomic_dec(&rs->rs_svc_ctx->sc_refcount);

        if (!rs->rs_prealloc)
                OBD_FREE(rs, rs->rs_size);
}
开发者ID:chaos,项目名称:lustre-kdmu,代码行数:9,代码来源:sec_null.c

示例10: null_free_repbuf

static
void null_free_repbuf(struct ptlrpc_sec *sec,
                      struct ptlrpc_request *req)
{
        LASSERT(req->rq_repbuf);

        OBD_FREE(req->rq_repbuf, req->rq_repbuf_len);
        req->rq_repbuf = NULL;
        req->rq_repbuf_len = 0;
}
开发者ID:chaos,项目名称:lustre-kdmu,代码行数:10,代码来源:sec_null.c

示例11: ll_release

/* should NOT be called with the dcache lock, see fs/dcache.c */
static void ll_release(struct dentry *de)
{
        struct ll_dentry_data *lld;
        ENTRY;
        LASSERT(de != NULL);
        lld = ll_d2d(de);
        if (lld == NULL) /* NFS copies the de->d_op methods (bug 4655) */
                RETURN_EXIT;

        if (lld->lld_it) {
                ll_intent_release(lld->lld_it);
                OBD_FREE(lld->lld_it, sizeof(*lld->lld_it));
        }
        LASSERT(lld->lld_cwd_count == 0);
        LASSERT(lld->lld_mnt_count == 0);
        OBD_FREE(de->d_fsdata, sizeof(*lld));

        EXIT;
}
开发者ID:LLNL,项目名称:lustre,代码行数:20,代码来源:dcache.c

示例12: enc_pools_add_pages

static int enc_pools_add_pages(int npages)
{
        static CFS_DECLARE_MUTEX(sem_add_pages);
        cfs_page_t   ***pools;
        int             npools, alloced = 0;
        int             i, j, rc = -ENOMEM;

        if (npages < PTLRPC_MAX_BRW_PAGES)
                npages = PTLRPC_MAX_BRW_PAGES;

        cfs_down(&sem_add_pages);

        if (npages + page_pools.epp_total_pages > page_pools.epp_max_pages)
                npages = page_pools.epp_max_pages - page_pools.epp_total_pages;
        LASSERT(npages > 0);

        page_pools.epp_st_grows++;

        npools = npages_to_npools(npages);
        OBD_ALLOC(pools, npools * sizeof(*pools));
        if (pools == NULL)
                goto out;

        for (i = 0; i < npools; i++) {
                OBD_ALLOC(pools[i], CFS_PAGE_SIZE);
                if (pools[i] == NULL)
                        goto out_pools;

                for (j = 0; j < PAGES_PER_POOL && alloced < npages; j++) {
                        pools[i][j] = cfs_alloc_page(CFS_ALLOC_IO |
                                                     CFS_ALLOC_HIGH);
                        if (pools[i][j] == NULL)
                                goto out_pools;

                        alloced++;
                }
        }
        LASSERT(alloced == npages);

        enc_pools_insert(pools, npools, npages);
        CDEBUG(D_SEC, "added %d pages into pools\n", npages);
        rc = 0;

out_pools:
        enc_pools_cleanup(pools, npools);
        OBD_FREE(pools, npools * sizeof(*pools));
out:
        if (rc) {
                page_pools.epp_st_grow_fails++;
                CERROR("Failed to allocate %d enc pages\n", npages);
        }

        cfs_up(&sem_add_pages);
        return rc;
}
开发者ID:DCteam,项目名称:lustre,代码行数:55,代码来源:sec_bulk.c

示例13: enc_pools_add_pages

static int enc_pools_add_pages(int npages)
{
    static DEFINE_MUTEX(add_pages_mutex);
    struct page   ***pools;
    int	     npools, alloced = 0;
    int	     i, j, rc = -ENOMEM;

    if (npages < PTLRPC_MAX_BRW_PAGES)
        npages = PTLRPC_MAX_BRW_PAGES;

    mutex_lock(&add_pages_mutex);

    if (npages + page_pools.epp_total_pages > page_pools.epp_max_pages)
        npages = page_pools.epp_max_pages - page_pools.epp_total_pages;
    LASSERT(npages > 0);

    page_pools.epp_st_grows++;

    npools = npages_to_npools(npages);
    OBD_ALLOC(pools, npools * sizeof(*pools));
    if (pools == NULL)
        goto out;

    for (i = 0; i < npools; i++) {
        OBD_ALLOC(pools[i], PAGE_CACHE_SIZE);
        if (pools[i] == NULL)
            goto out_pools;

        for (j = 0; j < PAGES_PER_POOL && alloced < npages; j++) {
            pools[i][j] = alloc_page(GFP_NOFS |
                                     __GFP_HIGHMEM);
            if (pools[i][j] == NULL)
                goto out_pools;

            alloced++;
        }
    }
    LASSERT(alloced == npages);

    enc_pools_insert(pools, npools, npages);
    CDEBUG(D_SEC, "added %d pages into pools\n", npages);
    rc = 0;

out_pools:
    enc_pools_cleanup(pools, npools);
    OBD_FREE(pools, npools * sizeof(*pools));
out:
    if (rc) {
        page_pools.epp_st_grow_fails++;
        CERROR("Failed to allocate %d enc pages\n", npages);
    }

    mutex_unlock(&add_pages_mutex);
    return rc;
}
开发者ID:borkmann,项目名称:kasan,代码行数:55,代码来源:sec_bulk.c

示例14: osd_oi_fini

void osd_oi_fini(struct osd_thread_info *info, struct osd_device *osd)
{
	if (unlikely(osd->od_oi_table == NULL))
		return;

        osd_oi_table_put(info, osd->od_oi_table, osd->od_oi_count);

        OBD_FREE(osd->od_oi_table,
                 sizeof(*(osd->od_oi_table)) * OSD_OI_FID_NR_MAX);
        osd->od_oi_table = NULL;
}
开发者ID:Keeper-of-the-Keys,项目名称:Lustre,代码行数:11,代码来源:osd_oi.c

示例15: lmd_make_exclusion

/* mount -v  -o exclude=lustre-OST0001:lustre-OST0002 -t lustre ... */
static int lmd_make_exclusion(struct lustre_mount_data *lmd, const char *ptr)
{
	const char *s1 = ptr, *s2;
	__u32 index, *exclude_list;
	int rc = 0, devmax;

	/* The shortest an ost name can be is 8 chars: -OST0000.
	   We don't actually know the fsname at this time, so in fact
	   a user could specify any fsname. */
	devmax = strlen(ptr) / 8 + 1;

	/* temp storage until we figure out how many we have */
	OBD_ALLOC(exclude_list, sizeof(index) * devmax);
	if (!exclude_list)
		return -ENOMEM;

	/* we enter this fn pointing at the '=' */
	while (*s1 && *s1 != ' ' && *s1 != ',') {
		s1++;
		rc = server_name2index(s1, &index, &s2);
		if (rc < 0) {
			CERROR("Can't parse server name '%s': rc = %d\n",
			       s1, rc);
			break;
		}
		if (rc == LDD_F_SV_TYPE_OST)
			exclude_list[lmd->lmd_exclude_count++] = index;
		else
			CDEBUG(D_MOUNT, "ignoring exclude %.*s: type = %#x\n",
			       (uint)(s2-s1), s1, rc);
		s1 = s2;
		/* now we are pointing at ':' (next exclude)
		   or ',' (end of excludes) */
		if (lmd->lmd_exclude_count >= devmax)
			break;
	}
	if (rc >= 0) /* non-err */
		rc = 0;

	if (lmd->lmd_exclude_count) {
		/* permanent, freed in lustre_free_lsi */
		OBD_ALLOC(lmd->lmd_exclude, sizeof(index) *
			  lmd->lmd_exclude_count);
		if (lmd->lmd_exclude) {
			memcpy(lmd->lmd_exclude, exclude_list,
			       sizeof(index) * lmd->lmd_exclude_count);
		} else {
			rc = -ENOMEM;
			lmd->lmd_exclude_count = 0;
		}
	}
	OBD_FREE(exclude_list, sizeof(index) * devmax);
	return rc;
}
开发者ID:IDM350,项目名称:linux,代码行数:55,代码来源:obd_mount.c


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