• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GF_ASSERT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: glusterd_mgmt_v3_unlock_send_resp

static int
glusterd_mgmt_v3_unlock_send_resp (rpcsvc_request_t *req, int32_t status)
{

        gd1_mgmt_v3_unlock_rsp          rsp   = {{0},};
        int                             ret   = -1;
        xlator_t                       *this  = NULL;

        this = THIS;
        GF_ASSERT (this);
        GF_ASSERT (req);

        rsp.op_ret = status;
        if (rsp.op_ret)
                rsp.op_errno = errno;

        glusterd_get_uuid (&rsp.uuid);

        ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
                                     (xdrproc_t)xdr_gd1_mgmt_v3_unlock_rsp);

        gf_log (this->name, GF_LOG_DEBUG,
                "Responded to mgmt_v3 unlock, ret: %d", ret);

        return ret;
}
开发者ID:systemjj,项目名称:glusterfs,代码行数:26,代码来源:glusterd-mgmt-handler.c


示例2: get_checksum_for_path

int
get_checksum_for_path (char *path, uint32_t *checksum)
{
        int     ret = -1;
        int     fd = -1;

        GF_ASSERT (path);
        GF_ASSERT (checksum);

        fd = open (path, O_RDWR);

        if (fd == -1) {
                gf_log (THIS->name, GF_LOG_ERROR, "Unable to open %s, errno: %d",
                        path, errno);
                goto out;
        }

        ret = get_checksum_for_file (fd, checksum);

out:
        if (fd != -1)
                close (fd);

        return ret;
}
开发者ID:aravindhramu,项目名称:glusterfs,代码行数:25,代码来源:common-utils.c


示例3: glusterd_syctasked_mgmt_v3_unlock

static int
glusterd_syctasked_mgmt_v3_unlock (rpcsvc_request_t *req,
                                  gd1_mgmt_v3_unlock_req *unlock_req,
                                  glusterd_op_lock_ctx_t *ctx)
{
        int32_t                         ret         = -1;
        xlator_t                       *this        = NULL;

        this = THIS;
        GF_ASSERT (this);
        GF_ASSERT (req);
        GF_ASSERT (ctx);

        /* Trying to release multiple mgmt_v3 locks */
        ret = glusterd_multiple_mgmt_v3_unlock (ctx->dict, ctx->uuid);
        if (ret) {
                gf_log (this->name, GF_LOG_ERROR,
                        "Failed to release mgmt_v3 locks for %s",
                        uuid_utoa(ctx->uuid));
        }

        ret = glusterd_mgmt_v3_unlock_send_resp (req, ret);

        gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
        return ret;
}
开发者ID:systemjj,项目名称:glusterfs,代码行数:26,代码来源:glusterd-mgmt-handler.c


示例4: gf_store_validate_key_value

int32_t
gf_store_validate_key_value (char *storepath, char *key, char *val,
                             gf_store_op_errno_t *op_errno)
{
        int ret = 0;

        GF_ASSERT (op_errno);
        GF_ASSERT (storepath);

        if ((key == NULL) && (val == NULL)) {
                ret = -1;
                gf_log ("", GF_LOG_ERROR, "Glusterd store may be corrupted, "
                        "Invalid key and value (null) in %s", storepath);
                *op_errno = GD_STORE_KEY_VALUE_NULL;
        } else if (key == NULL) {
                ret = -1;
                gf_log ("", GF_LOG_ERROR, "Glusterd store may be corrupted, "
                        "Invalid key (null) in %s", storepath);
                *op_errno = GD_STORE_KEY_NULL;
        } else if (val == NULL) {
                ret = -1;
                gf_log ("", GF_LOG_ERROR, "Glusterd store may be corrupted, "
                        "Invalid value (null) for key %s in %s", key,
                        storepath);
                *op_errno = GD_STORE_VALUE_NULL;
        } else {
                ret = 0;
                *op_errno = GD_STORE_SUCCESS;
        }

        return ret;
}
开发者ID:AsherBond,项目名称:snap-shot-glusterfs,代码行数:32,代码来源:store.c


示例5: runner_insert_arg

static void
runner_insert_arg (runner_t *runner, char *arg)
{
        int i = 0;

        GF_ASSERT (arg);

        if (runner->runerr)
                return;

        for (i = 0; i < runner->argvlen; i++) {
                if (runner->argv[i] == NULL)
                        break;
        }
        GF_ASSERT (i < runner->argvlen);

        if (i == runner->argvlen - 1) {
                runner->argv = GF_REALLOC (runner->argv,
                                           runner->argvlen * 2 * sizeof (*runner->argv));
                if (!runner->argv) {
                        runner->runerr = errno;
                        return;
                }
                memset (/* "+" is aware of the type of its left side,
                         * no need to multiply with type-size */
                        runner->argv + runner->argvlen,
                        0, runner->argvlen * sizeof (*runner->argv));
                runner->argvlen *= 2;
        }

        runner->argv[i] = arg;
}
开发者ID:AsherBond,项目名称:glusterfs,代码行数:32,代码来源:run.c


示例6: glusterd_op_state_machine_mgmt_v3_unlock

static int
glusterd_op_state_machine_mgmt_v3_unlock (rpcsvc_request_t *req,
                                         gd1_mgmt_v3_unlock_req *lock_req,
                                         glusterd_op_lock_ctx_t *ctx)
{
        int32_t                           ret      = -1;
        xlator_t                         *this     = NULL;

        this = THIS;
        GF_ASSERT (this);
        GF_ASSERT (req);

        ret = glusterd_op_sm_inject_event (GD_OP_EVENT_UNLOCK,
                                           &lock_req->txn_id, ctx);
        if (ret)
                gf_msg (this->name, GF_LOG_ERROR, 0,
                        GD_MSG_OP_EVENT_UNLOCK_FAIL,
                        "Failed to inject event GD_OP_EVENT_UNLOCK");

        glusterd_friend_sm ();
        glusterd_op_sm ();

        gf_msg_trace (this->name, 0, "Returning %d", ret);
        return ret;
}
开发者ID:sungsoo,项目名称:glusterfs,代码行数:25,代码来源:glusterd-mgmt-handler.c


示例7: gf_store_lock

int
gf_store_lock (gf_store_handle_t *sh)
{
        int                     ret;

        GF_ASSERT (sh);
        GF_ASSERT (sh->path);
        GF_ASSERT (sh->locked == F_ULOCK);

        sh->fd = open (sh->path, O_RDWR);
        if (sh->fd == -1) {
                gf_log ("", GF_LOG_ERROR, "Failed to open '%s': %s", sh->path,
                        strerror (errno));
                return -1;
        }

        ret = lockf (sh->fd, F_LOCK, 0);
        if (ret)
                gf_log ("", GF_LOG_ERROR, "Failed to gain lock on '%s': %s",
                        sh->path, strerror (errno));
        else
                /* sh->locked is protected by the lockf(sh->fd) above */
                sh->locked = F_LOCK;

        return ret;
}
开发者ID:AsherBond,项目名称:snap-shot-glusterfs,代码行数:26,代码来源:store.c


示例8: glusterd_synctasked_mgmt_v3_lock

static int
glusterd_synctasked_mgmt_v3_lock (rpcsvc_request_t *req,
                                gd1_mgmt_v3_lock_req *lock_req,
                                glusterd_op_lock_ctx_t *ctx)
{
        int32_t                         ret         = -1;
        xlator_t                       *this        = NULL;
        uint32_t                        op_errno    = 0;

        this = THIS;
        GF_ASSERT (this);
        GF_ASSERT (req);
        GF_ASSERT (ctx);
        GF_ASSERT (ctx->dict);

        /* Trying to acquire multiple mgmt_v3 locks */
        ret = glusterd_multiple_mgmt_v3_lock (ctx->dict, ctx->uuid, &op_errno);
        if (ret)
                gf_msg (this->name, GF_LOG_ERROR, 0,
                        GD_MSG_MGMTV3_LOCK_GET_FAIL,
                        "Failed to acquire mgmt_v3 locks for %s",
                         uuid_utoa (ctx->uuid));

        ret = glusterd_mgmt_v3_lock_send_resp (req, ret, op_errno);

        gf_msg_trace (this->name, 0, "Returning %d", ret);
        return ret;
}
开发者ID:sungsoo,项目名称:glusterfs,代码行数:28,代码来源:glusterd-mgmt-handler.c


示例9: __gf_free

void
__gf_free (void *free_ptr)
{
        size_t          req_size = 0;
        char            *ptr = NULL;
        uint32_t        type = 0;
        xlator_t        *xl = NULL;

        if (!gf_mem_acct_enable) {
                FREE (free_ptr);
                return;
        }

        if (!free_ptr)
                return;

        ptr = (char *)free_ptr - 8 - 4;

        if (GF_MEM_HEADER_MAGIC != *(uint32_t *)ptr) {
                //Possible corruption, assert here
                GF_ASSERT (0);
        }

        *(uint32_t *)ptr = 0;

        ptr = ptr - sizeof(xlator_t *);
        memcpy (&xl, ptr, sizeof(xlator_t *));

        if (!xl) {
                //gf_free expects xl to be available
                GF_ASSERT (0);
        }

        if (!xl->mem_acct.rec) {
                ptr = (char *)free_ptr - GF_MEM_HEADER_SIZE;
                goto free;
        }


        ptr = ptr - sizeof(size_t);
        memcpy (&req_size, ptr, sizeof (size_t));
        ptr = ptr - 4;
        type = *(uint32_t *)ptr;

        if (GF_MEM_TRAILER_MAGIC != *(uint32_t *)
            ((char *)free_ptr + req_size)) {
                // This points to a memory overrun
                GF_ASSERT (0);
        }
        *(uint32_t *) ((char *)free_ptr + req_size) = 0;

        LOCK (&xl->mem_acct.rec[type].lock);
        {
                xl->mem_acct.rec[type].size -= req_size;
                xl->mem_acct.rec[type].num_allocs--;
        }
        UNLOCK (&xl->mem_acct.rec[type].lock);
free:
        FREE (ptr);
}
开发者ID:lkundrak,项目名称:glusterfs,代码行数:60,代码来源:mem-pool.c


示例10: __gf_free

void
__gf_free (void *free_ptr)
{
        size_t          req_size = 0;
        char            *ptr = NULL;
        uint32_t        type = 0;
        xlator_t        *xl = NULL;

        if (!THIS->ctx->mem_acct_enable) {
                FREE (free_ptr);
                return;
        }

        if (!free_ptr)
                return;

        ptr = (char *)free_ptr - 8 - 4;

        //Possible corruption, assert here
        GF_ASSERT (GF_MEM_HEADER_MAGIC == *(uint32_t *)ptr);

        *(uint32_t *)ptr = 0;

        ptr = ptr - sizeof(xlator_t *);
        memcpy (&xl, ptr, sizeof(xlator_t *));

        //gf_free expects xl to be available
        GF_ASSERT (xl != NULL);

        if (!xl->mem_acct.rec) {
                ptr = (char *)free_ptr - GF_MEM_HEADER_SIZE;
                goto free;
        }


        ptr = ptr - sizeof(size_t);
        memcpy (&req_size, ptr, sizeof (size_t));
        ptr = ptr - 4;
        type = *(uint32_t *)ptr;

        // This points to a memory overrun
        GF_ASSERT (GF_MEM_TRAILER_MAGIC ==
                *(uint32_t *)((char *)free_ptr + req_size));

        *(uint32_t *) ((char *)free_ptr + req_size) = 0;

        LOCK (&xl->mem_acct.rec[type].lock);
        {
                xl->mem_acct.rec[type].size -= req_size;
                xl->mem_acct.rec[type].num_allocs--;
                /* If all the instaces are freed up then ensure typestr is
                 * set to NULL */
                if (!xl->mem_acct.rec[type].num_allocs)
                        xl->mem_acct.rec[type].typestr = NULL;
        }
        UNLOCK (&xl->mem_acct.rec[type].lock);
free:
        FREE (ptr);
}
开发者ID:GlusterFS,项目名称:glusterfs,代码行数:59,代码来源:mem-pool.c


示例11: gf_store_unlock

void
gf_store_unlock (gf_store_handle_t *sh)
{
        GF_ASSERT (sh);
        GF_ASSERT (sh->locked == F_LOCK);

        sh->locked = F_ULOCK;
        lockf (sh->fd, F_ULOCK, 0);
        close (sh->fd);
}
开发者ID:AsherBond,项目名称:snap-shot-glusterfs,代码行数:10,代码来源:store.c


示例12: gf_mem_set_acct_info

void
gf_mem_set_acct_info (xlator_t *xl, char **alloc_ptr,
                      size_t size, uint32_t type)
{

        char    *ptr = NULL;

        if (!alloc_ptr)
                return;

        ptr = (char *) (*alloc_ptr);

        if (!xl) {
                GF_ASSERT (0);
        }

        if (!(xl->mem_acct.rec)) {
                GF_ASSERT (0);
        }

        if (type > xl->mem_acct.num_types) {
                GF_ASSERT (0);
        }

        LOCK(&xl->mem_acct.rec[type].lock);
        {
                xl->mem_acct.rec[type].size += size;
                xl->mem_acct.rec[type].num_allocs++;
                xl->mem_acct.rec[type].total_allocs++;
                xl->mem_acct.rec[type].max_size =
                        max (xl->mem_acct.rec[type].max_size,
                             xl->mem_acct.rec[type].size);
                xl->mem_acct.rec[type].max_num_allocs =
                        max (xl->mem_acct.rec[type].max_num_allocs,
                             xl->mem_acct.rec[type].num_allocs);
        }
        UNLOCK(&xl->mem_acct.rec[type].lock);

        *(uint32_t *)(ptr) = type;
        ptr = ptr + 4;
        memcpy (ptr, &size, sizeof(size_t));
        ptr += sizeof (size_t);
        memcpy (ptr, &xl, sizeof(xlator_t *));
        ptr += sizeof (xlator_t *);
        *(uint32_t *)(ptr) = GF_MEM_HEADER_MAGIC;
        ptr = ptr + 4;
        ptr = ptr + 8; //padding
        *(uint32_t *) (ptr + size) = GF_MEM_TRAILER_MAGIC;

        *alloc_ptr = (void *)ptr;
        return;
}
开发者ID:lkundrak,项目名称:glusterfs,代码行数:52,代码来源:mem-pool.c


示例13: gf_mem_set_acct_info

int
gf_mem_set_acct_info (xlator_t *xl, char **alloc_ptr, size_t size,
		      uint32_t type, const char *typestr)
{

        void              *ptr    = NULL;
        struct mem_header *header = NULL;

        if (!alloc_ptr)
                return -1;

        ptr = *alloc_ptr;

        GF_ASSERT (xl != NULL);

        GF_ASSERT (xl->mem_acct != NULL);

        GF_ASSERT (type <= xl->mem_acct->num_types);

        LOCK(&xl->mem_acct->rec[type].lock);
        {
		if (!xl->mem_acct->rec[type].typestr)
			xl->mem_acct->rec[type].typestr = typestr;
                xl->mem_acct->rec[type].size += size;
                xl->mem_acct->rec[type].num_allocs++;
                xl->mem_acct->rec[type].total_allocs++;
                xl->mem_acct->rec[type].max_size =
                        max (xl->mem_acct->rec[type].max_size,
                             xl->mem_acct->rec[type].size);
                xl->mem_acct->rec[type].max_num_allocs =
                        max (xl->mem_acct->rec[type].max_num_allocs,
                             xl->mem_acct->rec[type].num_allocs);
        }
        UNLOCK(&xl->mem_acct->rec[type].lock);

        INCREMENT_ATOMIC (xl->mem_acct->lock, xl->mem_acct->refcnt);

        header = (struct mem_header *) ptr;
        header->type = type;
        header->size = size;
        header->mem_acct = xl->mem_acct;
        header->magic = GF_MEM_HEADER_MAGIC;

        ptr += sizeof (struct mem_header);

        /* data follows in this gap of 'size' bytes */
        *(uint32_t *) (ptr + size) = GF_MEM_TRAILER_MAGIC;

        *alloc_ptr = ptr;
        return 0;
}
开发者ID:LlsDimple,项目名称:glusterfs,代码行数:51,代码来源:mem-pool.c


示例14: gf_mem_set_acct_info

//设置内存统计信息
int
gf_mem_set_acct_info (xlator_t *xl, char **alloc_ptr, size_t size,
		      uint32_t type, const char *typestr)
{

        char    *ptr = NULL;

        if (!alloc_ptr)
                return -1;

        ptr = (char *) (*alloc_ptr);

        GF_ASSERT (xl != NULL);

        GF_ASSERT (xl->mem_acct.rec != NULL);

        GF_ASSERT (type <= xl->mem_acct.num_types);

        LOCK(&xl->mem_acct.rec[type].lock);
        {
		if (!xl->mem_acct.rec[type].typestr)
			xl->mem_acct.rec[type].typestr = typestr;
                xl->mem_acct.rec[type].size += size;
                xl->mem_acct.rec[type].num_allocs++;
                xl->mem_acct.rec[type].total_allocs++;
                xl->mem_acct.rec[type].max_size =
                        max (xl->mem_acct.rec[type].max_size,
                             xl->mem_acct.rec[type].size);
                xl->mem_acct.rec[type].max_num_allocs =
                        max (xl->mem_acct.rec[type].max_num_allocs,
                             xl->mem_acct.rec[type].num_allocs);
        }
        UNLOCK(&xl->mem_acct.rec[type].lock);
        // http://blog.csdn.net/wangyuling1234567890/article/details/24564891 普通内存分配结构有错误
        //头大小: GF_MEM_HEADER_SIZE   (4 + sizeof (size_t) + sizeof (xlator_t *) + 4 + 8)
        *(uint32_t *)(ptr) = type;
        ptr = ptr + 4;
        memcpy (ptr, &size, sizeof(size_t));
        ptr += sizeof (size_t);
        memcpy (ptr, &xl, sizeof(xlator_t *));
        ptr += sizeof (xlator_t *);
        *(uint32_t *)(ptr) = GF_MEM_HEADER_MAGIC; //魔数
        ptr = ptr + 4;
        ptr = ptr + 8; //padding 填充
        //尾大小: GF_MEM_TRAILER_SIZE 8
        *(uint32_t *) (ptr + size) = GF_MEM_TRAILER_MAGIC; //魔数

        *alloc_ptr = (void *)ptr;
        return 0;
}
开发者ID:chenzhongtao,项目名称:mg_glusterfs,代码行数:51,代码来源:mem-pool.c


示例15: gf_store_read_and_tokenize

int
gf_store_read_and_tokenize (FILE *file, char *str, char **iter_key,
                            char **iter_val, gf_store_op_errno_t *store_errno)
{
        int32_t     ret         =   -1;
        char        *savetok    = NULL;
        char        *key        = NULL;
        char        *value      = NULL;
        char        *temp       = NULL;
        size_t       str_len    =    0;

        GF_ASSERT (file);
        GF_ASSERT (str);
        GF_ASSERT (iter_key);
        GF_ASSERT (iter_val);
        GF_ASSERT (store_errno);

        temp = fgets (str, PATH_MAX, file);
        if (temp == NULL || feof (file)) {
                ret = -1;
                *store_errno = GD_STORE_EOF;
                goto out;
        }

        str_len = strlen(str);
        str[str_len - 1] = '\0';
        /* Truncate the "\n", as fgets stores "\n" in str */

        key = strtok_r (str, "=", &savetok);
        if (!key) {
                ret = -1;
                *store_errno = GD_STORE_KEY_NULL;
                goto out;
        }

        value = strtok_r (NULL, "", &savetok);
        if (!value) {
                ret = -1;
                *store_errno = GD_STORE_VALUE_NULL;
                goto out;
        }

        *iter_key = key;
        *iter_val = value;
        *store_errno = GD_STORE_SUCCESS;
        ret = 0;
out:
        return ret;
}
开发者ID:JiejunLi,项目名称:glusterfs,代码行数:49,代码来源:store.c


示例16: gf_mem_set_acct_info

int
gf_mem_set_acct_info (xlator_t *xl, char **alloc_ptr, size_t size,
		      uint32_t type, const char *typestr)
{

        char    *ptr = NULL;

        if (!alloc_ptr)
                return -1;

        ptr = (char *) (*alloc_ptr);

        GF_ASSERT (xl != NULL);

        GF_ASSERT (xl->mem_acct.rec != NULL);

        GF_ASSERT (type <= xl->mem_acct.num_types);

        LOCK(&xl->mem_acct.rec[type].lock);
        {
		if (!xl->mem_acct.rec[type].typestr)
			xl->mem_acct.rec[type].typestr = typestr;
                xl->mem_acct.rec[type].size += size;
                xl->mem_acct.rec[type].num_allocs++;
                xl->mem_acct.rec[type].total_allocs++;
                xl->mem_acct.rec[type].max_size =
                        max (xl->mem_acct.rec[type].max_size,
                             xl->mem_acct.rec[type].size);
                xl->mem_acct.rec[type].max_num_allocs =
                        max (xl->mem_acct.rec[type].max_num_allocs,
                             xl->mem_acct.rec[type].num_allocs);
        }
        UNLOCK(&xl->mem_acct.rec[type].lock);

        *(uint32_t *)(ptr) = type;
        ptr = ptr + 4;
        memcpy (ptr, &size, sizeof(size_t));
        ptr += sizeof (size_t);
        memcpy (ptr, &xl, sizeof(xlator_t *));
        ptr += sizeof (xlator_t *);
        *(uint32_t *)(ptr) = GF_MEM_HEADER_MAGIC;
        ptr = ptr + 4;
        ptr = ptr + 8; //padding
        *(uint32_t *) (ptr + size) = GF_MEM_TRAILER_MAGIC;

        *alloc_ptr = (void *)ptr;
        return 0;
}
开发者ID:GlusterFS,项目名称:glusterfs,代码行数:48,代码来源:mem-pool.c


示例17: gf_store_save_value

int32_t
gf_store_save_value (int fd, char *key, char *value)
{
        int32_t         ret = -1;
        int             dup_fd = -1;
        FILE           *fp  = NULL;

        GF_ASSERT (fd > 0);
        GF_ASSERT (key);
        GF_ASSERT (value);

        dup_fd = dup (fd);
        if (dup_fd == -1)
                goto out;

        fp = fdopen (dup_fd, "a+");
        if (fp == NULL) {
                gf_log ("", GF_LOG_WARNING, "fdopen failed.");
                ret = -1;
                goto out;
        }

        ret = fprintf (fp, "%s=%s\n", key, value);
        if (ret < 0) {
                gf_log ("", GF_LOG_WARNING, "Unable to store key: %s,"
                        "value: %s, error: %s", key, value,
                        strerror (errno));
                ret = -1;
                goto out;
        }

        ret = fflush (fp);
        if (feof (fp)) {
                gf_log ("", GF_LOG_WARNING,
                        "fflush failed, error: %s",
                        strerror (errno));
                ret = -1;
                goto out;
        }

        ret = 0;
out:
        if (fp)
                fclose (fp);

        gf_log ("", GF_LOG_DEBUG, "returning: %d", ret);
        return ret;
}
开发者ID:AsherBond,项目名称:snap-shot-glusterfs,代码行数:48,代码来源:store.c


示例18: xlator_volopt_dynload

int
xlator_volopt_dynload (char *xlator_type, void **dl_handle,
                       volume_opt_list_t *opt_list)
{
        int                     ret = -1;
        char                    *name = NULL;
        void                    *handle = NULL;
        volume_opt_list_t       *vol_opt = NULL;

        GF_VALIDATE_OR_GOTO ("xlator", xlator_type, out);

        GF_ASSERT (dl_handle);

        if (*dl_handle)
                if (dlclose (*dl_handle))
                        gf_log ("xlator", GF_LOG_WARNING, "Unable to close "
                                  "previously opened handle( may be stale)."
                                  "Ignoring the invalid handle");

        ret = gf_asprintf (&name, "%s/%s.so", XLATORDIR, xlator_type);
        if (-1 == ret) {
                gf_log ("xlator", GF_LOG_ERROR, "asprintf failed");
                goto out;
        }

        ret = -1;

        gf_log ("xlator", GF_LOG_TRACE, "attempt to load file %s", name);

        handle = dlopen (name, RTLD_NOW|RTLD_GLOBAL);
        if (!handle) {
                gf_log ("xlator", GF_LOG_WARNING, "%s", dlerror ());
                goto out;
        }
        *dl_handle = handle;


        vol_opt = GF_CALLOC (1, sizeof (volume_opt_list_t),
                         gf_common_mt_volume_opt_list_t);

        if (!vol_opt) {
                goto out;
        }

        if (!(vol_opt->given_opt = dlsym (handle, "options"))) {
                dlerror ();
                gf_log ("xlator", GF_LOG_DEBUG,
                         "Strict option validation not enforced -- neglecting");
        }
        opt_list->given_opt = vol_opt->given_opt;

        INIT_LIST_HEAD (&vol_opt->list);
        list_add_tail (&vol_opt->list, &opt_list->list);

        ret = 0;
 out:
        gf_log ("xlator", GF_LOG_DEBUG, "Returning %d", ret);
        return ret;

}
开发者ID:BillTheBest,项目名称:glusterfs,代码行数:60,代码来源:xlator.c


示例19: fini_db

/*Libgfdb API Function: Used to terminate/de-initialize db connection
 *                      (Destructor function for db connection object)
 * Arguments:
 *      _conn_node  :  GFDB Connection node
 * Returns : if successful return 0 or
 *          -ve value in case of failure*/
int
fini_db (gfdb_conn_node_t *_conn_node)
{
        int ret                                 = -1;
        gfdb_db_operations_t *db_operations_t   = NULL;

        CHECK_CONN_NODE_GOTO (_conn_node, empty);

        db_operations_t = &_conn_node->gfdb_connection.gfdb_db_operations;

        GF_ASSERT (db_operations_t->fini_db_op);

        ret = db_operations_t->fini_db_op(&_conn_node->gfdb_connection.
                                          gf_db_connection);
        if (ret) {
                gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
                        LG_MSG_CLOSE_CONNECTION_FAILED, "Failed close the db "
                        "connection");
                goto out;
        }

        ret = delete_conn_node (_conn_node);
        if (ret) {
                gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
                        LG_MSG_DELETE_FROM_LIST_FAILED, "Failed deleting "
                        "connection node from list");
        }
empty:
        ret = 0;
out:
        return ret;
}
开发者ID:2510,项目名称:glusterfs,代码行数:38,代码来源:gfdb_data_store.c


示例20: init_db_operations

/*Internal function: Used initialize/map db operation of
 * specified type of db plugin*/
static int
init_db_operations (gfdb_db_type_t       gfdb_db_type,
                    gfdb_db_operations_t *gfdb_db_operations)
{

        int ret = -1;

        GF_ASSERT (gfdb_db_operations);

        /*Clear the gfdb_db_operations*/
        gfdb_db_operations = memset(gfdb_db_operations, 0,
                                        sizeof(*gfdb_db_operations));
        switch (gfdb_db_type) {
        case GFDB_SQLITE3:
                gf_sqlite3_fill_db_operations (gfdb_db_operations);
                ret = 0;
                break;
        case GFDB_HYPERDEX:
        case GFDB_HASH_FILE_STORE:
        case GFDB_ROCKS_DB:
                gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
                        LG_MSG_UNSUPPORTED_PLUGIN, "Plugin not supported");
                break;
        case GFDB_INVALID_DB:
        case GFDB_DB_END:
                gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
                        LG_MSG_INVALID_DB_TYPE, "Invalid DB Type");
                break;
        }
        return ret;
}
开发者ID:2510,项目名称:glusterfs,代码行数:33,代码来源:gfdb_data_store.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GF_CALLOC函数代码示例发布时间:2022-05-30
下一篇:
C++ GFXDECODE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap