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


C++ LOG_err函数代码示例

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


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

示例1: dir_tree_file_remove

// remove file
gboolean dir_tree_file_remove (DirTree *dtree, fuse_ino_t ino, DirTree_file_remove_cb file_remove_cb, fuse_req_t req)
{
    DirEntry *en;
    FileRemoveData *data;
    
    LOG_debug (DIR_TREE_LOG, "Removing  inode %"INO_FMT, ino);

    en = g_hash_table_lookup (dtree->h_inodes, GUINT_TO_POINTER (ino));

    // if entry does not exist
    // or it's not a directory type ?
    if (!en) {
        LOG_err (DIR_TREE_LOG, "Entry (ino = %"INO_FMT") not found !", ino);
        file_remove_cb (req, FALSE);
        return FALSE;
    }

    if (en->type != DET_file) {
        LOG_err (DIR_TREE_LOG, "Entry (ino = %"INO_FMT") is not a file !", ino);
        file_remove_cb (req, FALSE);
        return FALSE;
    }

    data = g_new0 (FileRemoveData, 1);
    data->dtree = dtree;
    data->ino = ino;
    data->en = en;
    data->file_remove_cb = file_remove_cb;
    data->req = req;

    s3client_pool_get_client (application_get_ops_client_pool (dtree->app),
        dir_tree_file_remove_on_http_client_cb, data);
        
    return TRUE;
}
开发者ID:SaqlainAbbas,项目名称:s3ffs,代码行数:36,代码来源:dir_tree.c

示例2: fileio_write_on_multipart_init_cb

static void fileio_write_on_multipart_init_cb (HttpConnection *con, void *ctx, gboolean success,
    const gchar *buf, size_t buf_len,
    G_GNUC_UNUSED struct evkeyvalq *headers)
{
    FileWriteData *wdata = (FileWriteData *) ctx;
    gchar *uploadid;

    http_connection_release (con);

    wdata->fop->multipart_initiated = TRUE;

    if (!success || !buf_len) {
        LOG_err (FIO_LOG, INO_CON_H"Failed to get multipart init data from the server !", INO_T (wdata->ino), con);
        wdata->on_buffer_written_cb (wdata->fop, wdata->ctx, FALSE, 0);
        g_free (wdata);
        return;
    }

    uploadid = get_uploadid (buf, buf_len);
    if (!uploadid) {
        LOG_err (FIO_LOG, INO_CON_H"Failed to parse multipart init data!", INO_T (wdata->ino), con);
        wdata->on_buffer_written_cb (wdata->fop, wdata->ctx, FALSE, 0);
        g_free (wdata);
        return;
    }
    wdata->fop->uploadid = g_strdup (uploadid);
    xmlFree (uploadid);

    // done, resume uploading part
    wdata->fop->part_number = 1;
    fileio_write_send_part (wdata);
}
开发者ID:Nimain,项目名称:riofs,代码行数:32,代码来源:file_io_ops.c

示例3: s3http_connection_file_send

gboolean s3http_connection_file_send (S3HttpConnection *con, int fd, const gchar *resource_path, 
    S3HttpConnection_on_entry_sent_cb on_entry_sent_cb, gpointer ctx)
{
    gchar *req_path;
    gboolean res;
    FileSendData *data;
    struct evbuffer *output_buf = NULL;
    struct stat st;

    data = g_new0 (FileSendData, 1);
    data->on_entry_sent_cb = on_entry_sent_cb;
    data->ctx = ctx;

    LOG_debug (CON_SEND_LOG, "Sending file.. %p", data);

    if (fstat (fd, &st) < 0) {
        LOG_err (CON_SEND_LOG, "Failed to stat temp file !");
        s3http_connection_on_file_send_error (con, (void *) data);
        return FALSE;
    }

    output_buf = evbuffer_new ();
    if (!output_buf || evbuffer_add_file (output_buf, fd, 0, st.st_size) < 0) {
        LOG_err (CON_SEND_LOG, "Failed to read temp file !");
        s3http_connection_on_file_send_error (con, (void *) data);
        if (output_buf)
            evbuffer_free (output_buf);
        return FALSE;
    }

    req_path = g_strdup_printf ("%s", resource_path);

    LOG_debug (CON_SEND_LOG, "[%p %p] Sending %s file, req: %s, %"OFF_FMT"  buff: %zd", con, data, 
        resource_path, req_path, st.st_size, evbuffer_get_length (output_buf));

    res = s3http_connection_make_request (con, 
        resource_path, req_path, "PUT", 
        output_buf,
        s3http_connection_on_file_send_done,
        s3http_connection_on_file_send_error, 
        data
    );

    g_free (req_path);
    evbuffer_free (output_buf);

    if (!res) {
        LOG_err (CON_SEND_LOG, "Failed to create HTTP request !");
        s3http_connection_on_file_send_error (con, (void *) data);
        return FALSE;
    }

    return TRUE;
}
开发者ID:SaqlainAbbas,项目名称:s3ffs,代码行数:54,代码来源:s3http_connection_file_send.c

示例4: s3http_connection_create

// create S3HttpConnection object
// establish HTTP connections to S3
gpointer s3http_connection_create (Application *app)
{
    S3HttpConnection *con;
    int port;
    AppConf *conf;

    con = g_new0 (S3HttpConnection, 1);
    if (!con) {
        LOG_err (CON_LOG, "Failed to create S3HttpConnection !");
        return NULL;
    }
    
    conf = application_get_conf (app);
    con->app = app;
    con->bucket_name = g_strdup (application_get_bucket_name (app));

    con->is_acquired = FALSE;

    port = application_get_port (app);
    // if no port is specified, libevent returns -1
    if (port == -1) {
        port = conf->http_port;
    }

    LOG_debug (CON_LOG, "Connecting to %s:%d", 
        application_get_host (app),
        port
    );

    // XXX: implement SSL
    con->evcon = evhttp_connection_base_new (
        application_get_evbase (app),
        application_get_dnsbase (app),
        application_get_host (app),
        port
    );

    if (!con->evcon) {
        LOG_err (CON_LOG, "Failed to create evhttp_connection !");
        return NULL;
    }
    
    evhttp_connection_set_timeout (con->evcon, conf->timeout);
    evhttp_connection_set_retries (con->evcon, conf->retries);

    evhttp_connection_set_closecb (con->evcon, s3http_connection_on_close, con);

    return (gpointer)con;
}
开发者ID:SaqlainAbbas,项目名称:s3ffs,代码行数:51,代码来源:s3http_connection.c

示例5: fileio_release_complete_multipart

static void fileio_release_complete_multipart (FileIO *fop)
{
    if (!fop->uploadid) {
        LOG_err (FIO_LOG, INO_H"UploadID is not set, aborting operation !", INO_T (fop->ino));
        fileio_destroy (fop);
        return;
    }

    if (!client_pool_get_client (application_get_write_client_pool (fop->app),
        fileio_release_on_complete_con_cb, fop)) {
        LOG_err (FIO_LOG, INO_H"Failed to get HTTP client !", INO_T (fop->ino));
        fileio_destroy (fop);
        return;
     }
}
开发者ID:Nimain,项目名称:riofs,代码行数:15,代码来源:file_io_ops.c

示例6: evbuffer_remove

static GHashTable *bvalue_parse_dict (struct evbuffer *in)
{
    GHashTable *h_dict = NULL;
    gchar tmp[1];
    gchar c;
    BValue *key;
    gchar *key_str;
    BValue *value;
    size_t len;
    
    // remove "d"
    evbuffer_remove (in, tmp, 1);

    evbuffer_copyout (in, &c, 1);

    len = evbuffer_get_length (in);

    h_dict = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, bvalue_dict_item_free);

    while (c != 'e' && len > 1) {
        key = bvalue_create_from_buff (in);
        if (!bvalue_is_string (key))  {
            LOG_err (B_LOG, "Failed parsing Bencode Dict !");
            //XXX
            return NULL;
        }
        key_str = bvalue_get_string (key);
        if (!key_str) {
            LOG_err (B_LOG, "Failed parsing Bencode Dict !");
            //XXX
            return NULL;
        }

        value = bvalue_create_from_buff (in);

        g_hash_table_insert (h_dict, g_strdup (key_str), value);

        bvalue_destroy (key);


        len = evbuffer_get_length (in);
        evbuffer_copyout (in, &c, 1);
    }
    // remove "e"
    evbuffer_remove (in, tmp, 1);
    
    return h_dict;
}
开发者ID:wizzard,项目名称:tbfs_node_client,代码行数:48,代码来源:tbfs_bencode.c

示例7: g_new0

/*{{{ create / destroy */
CacheMng *cache_mng_create (Application *app)
{
    CacheMng *cmng;

    cmng = g_new0 (CacheMng, 1);
    cmng->app = app;
    cmng->h_entries = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, cache_entry_destroy);
    cmng->q_lru = g_queue_new ();
    cmng->size = 0;
    cmng->check_time = time (NULL);
    cmng->max_size = conf_get_uint (application_get_conf (cmng->app), "filesystem.cache_dir_max_size");
    cmng->cache_dir = g_strdup_printf ("%s/%s", 
        conf_get_string (application_get_conf (cmng->app), "filesystem.cache_dir"), CACHE_MNGR_DIR);
    cmng->cache_hits = 0;
    cmng->cache_miss = 0;

    cache_mng_rm_cache_dir (cmng);
    if (g_mkdir_with_parents (cmng->cache_dir, 0700) != 0) {
        LOG_err (CMNG_LOG, "Failed to remove directory: %s", cmng->cache_dir);
        cache_mng_destroy (cmng);
        return NULL;
    }

    return cmng;
}
开发者ID:bfleischer,项目名称:riofs,代码行数:26,代码来源:cache_mng.c

示例8: application_on_bucket_versioning_cb

//  replies on bucket versioning information
static void application_on_bucket_versioning_cb (gpointer ctx, gboolean success,
    const gchar *buf, size_t buf_len)
{
    Application *app = (Application *)ctx;
    gchar *tmp;

    if (!success) {
        LOG_err (APP_LOG, "Failed to get bucket versioning!");
        application_exit (app);
        return;
    }

    if (buf_len > 1) {
        tmp = (gchar *)buf;
        tmp[buf_len - 1] = '\0';

        if (strstr (buf, "<Status>Enabled</Status>")) {
            LOG_debug (APP_LOG, "Bucket has versioning enabled !");
            conf_set_boolean (app->conf, "s3.versioning", TRUE);
        } else {
            LOG_debug (APP_LOG, "Bucket has versioning disabled !");
            conf_set_boolean (app->conf, "s3.versioning", FALSE);
        }
    } else {
        conf_set_boolean (app->conf, "s3.versioning", FALSE);
    }

    application_finish_initialization_and_run (app);
}
开发者ID:di-stars,项目名称:riofs,代码行数:30,代码来源:main.c

示例9: fileio_read_buffer

// if it's the first fuse read() request - send HEAD request to server
// else try to get data from local cache, otherwise download from the server
void fileio_read_buffer (FileIO *fop,
    size_t size, off_t off, fuse_ino_t ino,
    FileIO_on_buffer_read_cb on_buffer_read_cb, gpointer ctx)
{
    FileReadData *rdata;

    rdata = g_new0 (FileReadData, 1);
    rdata->fop = fop;
    rdata->size = size;
    rdata->off = off;
    rdata->ino = ino;
    rdata->on_buffer_read_cb = on_buffer_read_cb;
    rdata->ctx = ctx;
    rdata->request_offset = off;

    // send HEAD request first
    if (!rdata->fop->head_req_sent) {
         // get HTTP connection to download manifest or a full file
        if (!client_pool_get_client (application_get_read_client_pool (rdata->fop->app), fileio_read_on_head_con_cb, rdata)) {
            LOG_err (FIO_LOG, INO_H"Failed to get HTTP client !", INO_T (rdata->ino));
            rdata->on_buffer_read_cb (rdata->ctx, FALSE, NULL, 0);
            g_free (rdata);
        }

    // HEAD is sent, try to get data from cache
    } else {
        fileio_read_get_buf (rdata);
    }
}
开发者ID:Nimain,项目名称:riofs,代码行数:31,代码来源:file_io_ops.c

示例10: fileio_read_on_get_cb

/*{{{ GET request */
static void fileio_read_on_get_cb (HttpConnection *con, void *ctx, gboolean success,
    const gchar *buf, size_t buf_len,
    G_GNUC_UNUSED struct evkeyvalq *headers)
{
    FileReadData *rdata = (FileReadData *) ctx;
    const char *versioning_header = NULL;

    // release HttpConnection
    http_connection_release (con);

    if (!success) {
        LOG_err (FIO_LOG, INO_CON_H"Failed to get file from server !", INO_T (rdata->ino), con);
        rdata->on_buffer_read_cb (rdata->ctx, FALSE, NULL, 0);
        g_free (rdata);
        return;
    }

    // store it in the local cache
    cache_mng_store_file_buf (application_get_cache_mng (rdata->fop->app),
        rdata->ino, buf_len, rdata->request_offset, (unsigned char *) buf,
        NULL, NULL);

    // update version ID
    versioning_header = http_find_header (headers, "x-amz-version-id");
    if (versioning_header) {
        cache_mng_update_version_id (application_get_cache_mng (rdata->fop->app), rdata->ino, versioning_header);
    }

    LOG_debug (FIO_LOG, INO_H"Storing [%"G_GUINT64_FORMAT" %zu]", INO_T(rdata->ino), rdata->request_offset, buf_len);

    // and read it
    fileio_read_get_buf (rdata);
}
开发者ID:Nimain,项目名称:riofs,代码行数:34,代码来源:file_io_ops.c

示例11: fileio_write_on_multipart_init_con_cb

// got HttpConnection object
static void fileio_write_on_multipart_init_con_cb (gpointer client, gpointer ctx)
{
    HttpConnection *con = (HttpConnection *) client;
    FileWriteData *wdata = (FileWriteData *) ctx;
    gboolean res;
    gchar *path;

    http_connection_acquire (con);

    path = g_strdup_printf ("%s?uploads", wdata->fop->fname);

    // send storage class with the init request
    http_connection_add_output_header (con, "x-amz-storage-class", conf_get_string (application_get_conf (con->app), "s3.storage_type"));

    res = http_connection_make_request (con,
        path, "POST", NULL, TRUE, NULL,
        fileio_write_on_multipart_init_cb,
        wdata
    );
    g_free (path);

    if (!res) {
        LOG_err (FIO_LOG, INO_CON_H"Failed to create HTTP request !", INO_T (wdata->ino), con);
        http_connection_release (con);
        wdata->on_buffer_written_cb (wdata->fop, wdata->ctx, FALSE, 0);
        g_free (wdata);
        return;
    }
}
开发者ID:Nimain,项目名称:riofs,代码行数:30,代码来源:file_io_ops.c

示例12: fileio_write_on_send_cb

// buffer is sent
static void fileio_write_on_send_cb (HttpConnection *con, void *ctx, gboolean success,
    G_GNUC_UNUSED const gchar *buf, G_GNUC_UNUSED size_t buf_len,
    G_GNUC_UNUSED struct evkeyvalq *headers)
{
    FileWriteData *wdata = (FileWriteData *) ctx;
    const char *versioning_header;

    http_connection_release (con);

    if (!success) {
        LOG_err (FIO_LOG, INO_CON_H"Failed to send bufer to server !", INO_T (wdata->ino), con);
        wdata->on_buffer_written_cb (wdata->fop, wdata->ctx, FALSE, 0);
        g_free (wdata);
        return;
    }

    versioning_header = http_find_header (headers, "x-amz-version-id");
    if (versioning_header) {
        cache_mng_update_version_id (application_get_cache_mng (wdata->fop->app),
            wdata->ino, versioning_header);
    }

    // empty part buffer
    evbuffer_drain (wdata->fop->write_buf, -1);

    // done sending part
    wdata->on_buffer_written_cb (wdata->fop, wdata->ctx, TRUE, wdata->buf_size);
    g_free (wdata);
}
开发者ID:Nimain,项目名称:riofs,代码行数:30,代码来源:file_io_ops.c

示例13: fileio_release_on_part_sent_cb

// file is sent
static void fileio_release_on_part_sent_cb (HttpConnection *con, void *ctx, gboolean success,
    G_GNUC_UNUSED const gchar *buf, G_GNUC_UNUSED size_t buf_len,
    G_GNUC_UNUSED struct evkeyvalq *headers)
{
    FileIO *fop = (FileIO *) ctx;
    const gchar *versioning_header;

    http_connection_release (con);

    if (!success) {
        LOG_err (FIO_LOG, INO_CON_H"Failed to send bufer to server !", INO_T (fop->ino), con);
        fileio_destroy (fop);
        return;
    }

    versioning_header = http_find_header (headers, "x-amz-version-id");
    if (versioning_header) {
        cache_mng_update_version_id (application_get_cache_mng (fop->app),
            fop->ino, versioning_header);
    }
    // if it's a multi part upload - Complete Multipart Upload
    if (fop->multipart_initiated) {
        fileio_release_complete_multipart (fop);

    // or we are done
    } else {
        fileio_release_update_headers (fop);
        //fileio_destroy (fop);
    }
}
开发者ID:Nimain,项目名称:riofs,代码行数:31,代码来源:file_io_ops.c

示例14: fileio_release_on_complete_cb

// multipart is sent
static void fileio_release_on_complete_cb (HttpConnection *con, void *ctx, gboolean success,
    G_GNUC_UNUSED const gchar *buf, G_GNUC_UNUSED size_t buf_len,
    G_GNUC_UNUSED struct evkeyvalq *headers)
{
    FileIO *fop = (FileIO *) ctx;
    const gchar *versioning_header;

    http_connection_release (con);

    if (!success) {
        LOG_err (FIO_LOG, INO_CON_H"Failed to send Multipart data to the server !", INO_T (fop->ino), con);
        fileio_destroy (fop);
        return;
    }

    versioning_header = http_find_header (headers, "x-amz-version-id");
    if (versioning_header) {
        cache_mng_update_version_id (application_get_cache_mng (fop->app),
            fop->ino, versioning_header);
    }

    // done
    LOG_debug (FIO_LOG, INO_CON_H"Multipart Upload is done !", INO_T (fop->ino), con);

    // fileio_destroy (fop);
    fileio_release_update_headers (fop);
}
开发者ID:Nimain,项目名称:riofs,代码行数:28,代码来源:file_io_ops.c

示例15: dir_tree_file_remove_on_http_client_cb

// HTTP client is ready for a new request
static void dir_tree_file_remove_on_http_client_cb (gpointer client, gpointer ctx)
{
    S3HttpConnection *http_con = (S3HttpConnection *) client;
    FileRemoveData *data = (FileRemoveData *) ctx;
    gchar *req_path;
    gboolean res;

    s3http_connection_acquire (http_con);

    req_path = g_strdup_printf ("%s", data->en->fullpath);

    res = s3http_connection_make_request (http_con, 
        req_path, req_path, "DELETE", 
        NULL,
        dir_tree_file_remove_on_http_client_data_cb,
        dir_tree_file_remove_on_http_client_error_cb,
        data
    );

    g_free (req_path);

    if (!res) {
        LOG_err (DIR_TREE_LOG, "Failed to create HTTP request !");
        data->file_remove_cb (data->req, FALSE);
        
        s3http_connection_release (http_con);
        g_free (data);
    }
}
开发者ID:SaqlainAbbas,项目名称:s3ffs,代码行数:30,代码来源:dir_tree.c


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