🐞 fix(TSG-8143): 区分hos_open_fd的错误值以及fd的值,不再共用一个返回值

This commit is contained in:
pengxuanzheng
2021-10-22 18:02:23 +08:00
parent 88a8dccbd0
commit 400c33e92e
8 changed files with 55 additions and 32 deletions

View File

@@ -1,10 +1,10 @@
[hos_default_conf] [hos_default_conf]
hos_serverip=192.168.40.223 hos_serverip=192.168.10.1
hos_serverport=9099 hos_serverport=9098
hos_accesskeyid="default" hos_accesskeyid="default"
hos_secretkey="default" hos_secretkey="default"
hos_log_path="./log/hoslog" #default hos_log_path="./log/hoslog" #default
hos_log_level=30 #default hos_log_level=10 #default
hos_poolsize=0 #default hos_poolsize=0 #default
hos_thread_sum=32 #default hos_thread_sum=32 #default
hos_cache_size=102400 #default hos_cache_size=102400 #default

View File

@@ -131,7 +131,7 @@ int main(int argc, char *argv[])
mode = BUFF_MODE | APPEND_MODE; mode = BUFF_MODE | APPEND_MODE;
printf("hos_write buff start ...\n"); printf("hos_write buff start ...\n");
snprintf(object, 1023, "%s_write_APPEND", file_name); snprintf(object, 1023, "%s_write_APPEND", file_name);
fd = hos_open_fd(bucket, object, callback, NULL, 0); int err = hos_open_fd(bucket, object, callback, NULL, 0, &fd);
if (hos_write(fd, buf, buffer.st_size) != HOS_CLIENT_OK) if (hos_write(fd, buf, buffer.st_size) != HOS_CLIENT_OK)
{ {
printf("error: hos_write failed 1st!\n"); printf("error: hos_write failed 1st!\n");

View File

@@ -122,6 +122,7 @@ static int upload_file(char *file, char *buff, int buff_len, thread_info_t *thre
double variance = 0.00; double variance = 0.00;
double average = 0.00; double average = 0.00;
long time = 0; long time = 0;
int err = 0;
//写文件 //写文件
//clock_gettime(CLOCK_MONOTONIC, &tstart); //clock_gettime(CLOCK_MONOTONIC, &tstart);
@@ -154,7 +155,7 @@ static int upload_file(char *file, char *buff, int buff_len, thread_info_t *thre
for (i = 0; i < g_test_count; i++) for (i = 0; i < g_test_count; i++)
{ {
clock_gettime(CLOCK_MONOTONIC, &tstart); clock_gettime(CLOCK_MONOTONIC, &tstart);
fd[i] = hos_open_fd(thread_info->bucket, thread_info->object, callback, NULL, thread_info->thread_num); err = hos_open_fd(thread_info->bucket, thread_info->object, callback, NULL, thread_info->thread_num, &fd[i]);
if (hos_write(fd[i], file, 0) != HOS_CLIENT_OK) if (hos_write(fd[i], file, 0) != HOS_CLIENT_OK)
{ {
printf("error:hos_write file:%s\n", file); printf("error:hos_write file:%s\n", file);
@@ -210,10 +211,11 @@ static int upload_buff(char * buff, int buff_len, thread_info_t *thread_info, ch
double variance = 0.00; double variance = 0.00;
double average = 0.00; double average = 0.00;
long record[30000] = {0}; long record[30000] = {0};
int err = 0;
if (g_mode & APPEND_MODE) if (g_mode & APPEND_MODE)
{ {
fd[0] = hos_open_fd(thread_info->bucket, thread_info->object, callback, NULL, thread_info->thread_num); err = hos_open_fd(thread_info->bucket, thread_info->object, callback, NULL, thread_info->thread_num, &fd[0]);
for (i = 0; i < g_test_count; i++) for (i = 0; i < g_test_count; i++)
{ {

View File

@@ -77,7 +77,8 @@ TEST(hos_close_fd, normal)
gtest_hos_handle_init(&expect_hos_handle, thread_num); gtest_hos_handle_init(&expect_hos_handle, thread_num);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
long fd = hos_open_fd(HOS_BUCKET, "object", NULL, NULL, 0); size_t fd = 0;
int err = hos_open_fd(HOS_BUCKET, "object", NULL, NULL, 0, &fd);
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
gtest_hos_fd_init(&expect_fd_info); gtest_hos_fd_init(&expect_fd_info);
@@ -121,7 +122,8 @@ TEST(hos_close_fd, paramer_error)
expect_hos_handle.hos_config.thread_num=2; expect_hos_handle.hos_config.thread_num=2;
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
long fd = hos_open_fd(HOS_BUCKET, "object", NULL, NULL, 0); size_t fd = 0;
int err = hos_open_fd(HOS_BUCKET, "object", NULL, NULL, 0, &fd);
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
gtest_hos_fd_init(&expect_fd_info); gtest_hos_fd_init(&expect_fd_info);

View File

@@ -77,13 +77,15 @@ TEST(hos_open_fd, normal)
gtest_hos_handle_init(&expect_hos_handle, 2); gtest_hos_handle_init(&expect_hos_handle, 2);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
size_t fd = hos_open_fd(HOS_BUCKET, "object", NULL, NULL, 0); size_t fd = 0;
int err = hos_open_fd(HOS_BUCKET, "object", NULL, NULL, 0, &fd);
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
gtest_hos_fd_init(&expect_fd_info[0]); gtest_hos_fd_init(&expect_fd_info[0]);
CheckStructGHosFdContext((hos_fd_context_t *)fd, &expect_fd_info[0]); CheckStructGHosFdContext((hos_fd_context_t *)fd, &expect_fd_info[0]);
size_t fd1 = hos_open_fd(HOS_BUCKET, "object", NULL, NULL, 1); size_t fd1 = 0;
err = hos_open_fd(HOS_BUCKET, "object", NULL, NULL, 1, &fd1);
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
gtest_hos_fd_init(&expect_fd_info[1]); gtest_hos_fd_init(&expect_fd_info[1]);
@@ -129,8 +131,9 @@ TEST(hos_open_fd, paramer_error)
gtest_hos_handle_init(&expect_hos_handle, 2); gtest_hos_handle_init(&expect_hos_handle, 2);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
int fd = hos_open_fd(NULL, "object", NULL, NULL, 0); size_t fd = 0;
EXPECT_EQ(fd, HOS_PARAMETER_ERROR); int err = hos_open_fd(NULL, "object", NULL, NULL, 0, &fd);
EXPECT_EQ(err, HOS_PARAMETER_ERROR);
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
@@ -164,8 +167,9 @@ TEST(hos_open_fd, over_threadnums)
gtest_hos_handle_init(&expect_hos_handle, 2); gtest_hos_handle_init(&expect_hos_handle, 2);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
int fd = hos_open_fd(HOS_CONF, "object", NULL, NULL, 3); size_t fd = 0;
EXPECT_EQ(fd, HOS_PARAMETER_ERROR); int err = hos_open_fd(HOS_CONF, "object", NULL, NULL, 3, &fd);
EXPECT_EQ(err, HOS_PARAMETER_ERROR);
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
@@ -190,6 +194,7 @@ TEST(hos_open_fd, over_threadnums)
TEST(hos_open_fd, not_init_instance) TEST(hos_open_fd, not_init_instance)
{ {
int fd = hos_open_fd(HOS_CONF, "object", NULL, NULL, 0); size_t fd = 0;
EXPECT_EQ(fd, HOS_INSTANCE_NOT_ENABLE); int err = hos_open_fd(HOS_CONF, "object", NULL, NULL, 0, &fd);
EXPECT_EQ(err, HOS_INSTANCE_NOT_ENABLE);
} }

View File

@@ -121,7 +121,8 @@ TEST(hos_write, normal)
data_info = (data_info_t *)expect_hos_handle.hos_func.fs2_info.reserved; data_info = (data_info_t *)expect_hos_handle.hos_func.fs2_info.reserved;
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
size_t fd = hos_open_fd(HOS_BUCKET, "object_buff", hos_write_buff_cb, (void *)"object_buff", 0); size_t fd = 0;
int err = hos_open_fd(HOS_BUCKET, "object_buff", hos_write_buff_cb, (void *)"object_buff", 0, &fd);
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
gtest_hos_fd_init(&expect_fd_info[0]); gtest_hos_fd_init(&expect_fd_info[0]);
@@ -140,7 +141,8 @@ TEST(hos_write, normal)
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
size_t fd1 = hos_open_fd(HOS_BUCKET, "object_append", hos_write_append_cb, (void *)"object_append", 1); size_t fd1 = 0;
err = hos_open_fd(HOS_BUCKET, "object_append", hos_write_append_cb, (void *)"object_append", 1, &fd1);
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
gtest_hos_fd_init(&expect_fd_info[1]); gtest_hos_fd_init(&expect_fd_info[1]);
@@ -222,7 +224,8 @@ TEST(hos_write, bucket_not_exits)
data_info = (data_info_t *)expect_hos_handle.hos_func.fs2_info.reserved; data_info = (data_info_t *)expect_hos_handle.hos_func.fs2_info.reserved;
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
size_t fd = hos_open_fd("bucket_not_exits", "object_buff", hos_bucket_not_exits_cb, (void *)"object_buff", 0); size_t fd = 0;
int err = hos_open_fd("bucket_not_exits", "object_buff", hos_bucket_not_exits_cb, (void *)"object_buff", 0, &fd);
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
gtest_hos_fd_init(&expect_fd_info[0]); gtest_hos_fd_init(&expect_fd_info[0]);
@@ -240,7 +243,8 @@ TEST(hos_write, bucket_not_exits)
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
size_t fd1 = hos_open_fd("bucket_not_exits", "object_append", hos_bucket_not_exits_cb, (void *)"object_append", 1); size_t fd1 = 0;
err = hos_open_fd("bucket_not_exits", "object_append", hos_bucket_not_exits_cb, (void *)"object_append", 1, &fd1);
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
gtest_hos_fd_init(&expect_fd_info[1]); gtest_hos_fd_init(&expect_fd_info[1]);
@@ -323,7 +327,8 @@ TEST(hos_write, sync_mode)
expect_hos_handle.hos_config.pool_thread_size = 0; expect_hos_handle.hos_config.pool_thread_size = 0;
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
size_t fd = hos_open_fd(HOS_BUCKET, "object_buff", NULL, NULL, 0); size_t fd = 0;
int err = hos_open_fd(HOS_BUCKET, "object_buff", NULL, NULL, 0, &fd);
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
gtest_hos_fd_init(&expect_fd_info[0]); gtest_hos_fd_init(&expect_fd_info[0]);
@@ -338,7 +343,8 @@ TEST(hos_write, sync_mode)
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
size_t fd1 = hos_open_fd(HOS_BUCKET, "object_append", NULL, NULL, 1); size_t fd1 = 0;
err = hos_open_fd(HOS_BUCKET, "object_append", NULL, NULL, 1, &fd1);
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
gtest_hos_fd_init(&expect_fd_info[1]); gtest_hos_fd_init(&expect_fd_info[1]);
@@ -418,7 +424,8 @@ TEST(hos_write, sync_mode_bucket_not_exits)
expect_hos_handle.hos_config.pool_thread_size = 0; expect_hos_handle.hos_config.pool_thread_size = 0;
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
size_t fd = hos_open_fd(HOS_CONF, "object_buff", NULL, NULL, 0); size_t fd = 0;
int err = hos_open_fd(HOS_CONF, "object_buff", NULL, NULL, 0, &fd);
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
gtest_hos_fd_init(&expect_fd_info[0]); gtest_hos_fd_init(&expect_fd_info[0]);
@@ -435,7 +442,8 @@ TEST(hos_write, sync_mode_bucket_not_exits)
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
size_t fd1 = hos_open_fd(HOS_CONF, "object_append", NULL, NULL, 1); size_t fd1 = 0;
err = hos_open_fd(HOS_CONF, "object_append", NULL, NULL, 1, &fd1);
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
gtest_hos_fd_init(&expect_fd_info[1]); gtest_hos_fd_init(&expect_fd_info[1]);
@@ -513,7 +521,8 @@ TEST(hos_write, paramer_error)
gtest_hos_handle_init(&expect_hos_handle, thread_num); gtest_hos_handle_init(&expect_hos_handle, thread_num);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
long fd = hos_open_fd(HOS_BUCKET, "object_buff", hos_callback, NULL, 0); size_t fd = 0;
int err = hos_open_fd(HOS_BUCKET, "object_buff", hos_callback, NULL, 0, &fd);
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
gtest_hos_fd_init(&expect_fd_info); gtest_hos_fd_init(&expect_fd_info);
@@ -597,7 +606,8 @@ TEST(hos_write, over_threadnums)
gtest_hos_handle_init(&expect_hos_handle, thread_num); gtest_hos_handle_init(&expect_hos_handle, thread_num);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
long fd = hos_open_fd(HOS_BUCKET, "object", NULL, NULL, 0); size_t fd = 0;
int err = hos_open_fd(HOS_BUCKET, "object", NULL, NULL, 0, &fd);
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
gtest_hos_fd_init(&expect_fd_info); gtest_hos_fd_init(&expect_fd_info);
@@ -657,7 +667,7 @@ static void *hos_function(void *ptr)
size_t thread_id = reinterpret_cast<size_t>(ptr); size_t thread_id = reinterpret_cast<size_t>(ptr);
hos_instance hos_instance = NULL; hos_instance hos_instance = NULL;
int i = 0; int i = 0;
long fd[HOS_FD_NUMS_LOCAL] = {0}; size_t fd[HOS_FD_NUMS_LOCAL] = {0};
char object[HOS_FD_NUMS_LOCAL][1024]; char object[HOS_FD_NUMS_LOCAL][1024];
int ret = 0; int ret = 0;
hos_instance_s expect_hos_instance; hos_instance_s expect_hos_instance;
@@ -665,6 +675,7 @@ static void *hos_function(void *ptr)
hos_fd_context_t expect_fd_info[32][20]; hos_fd_context_t expect_fd_info[32][20];
int thread_num = 32; int thread_num = 32;
data_info_t *data_info = NULL; data_info_t *data_info = NULL;
int err = 0;
{ {
hos_instance = hos_get_instance(); hos_instance = hos_get_instance();
@@ -683,8 +694,8 @@ static void *hos_function(void *ptr)
for (i = 0; i < HOS_FD_NUMS_LOCAL; i++) for (i = 0; i < HOS_FD_NUMS_LOCAL; i++)
{ {
snprintf(object[i], 1024, "object_%lu_%d", thread_id, i); snprintf(object[i], 1024, "object_%lu_%d", thread_id, i);
fd[i] = hos_open_fd(HOS_BUCKET, object[i], hos_callback, object[i], 0); err = hos_open_fd(HOS_BUCKET, object[i], hos_callback, object[i], 0, &fd[i]);
EXPECT_EQ(fd[i], i + 1); EXPECT_EQ(err, i + 1);
CheckHosInstance(hos_instance, &expect_hos_instance); CheckHosInstance(hos_instance, &expect_hos_instance);
CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle); CheckStructGHosHandle(&g_hos_handle, &expect_hos_handle);
gtest_hos_fd_init(&expect_fd_info[thread_id][i]); gtest_hos_fd_init(&expect_fd_info[thread_id][i]);

View File

@@ -892,10 +892,11 @@ int hos_upload_buf(const char *bucket, const char *object, const char *buf, size
return hos_upload_stream(bucket, object, buf, buf_len, callback, userdata, thread_id); return hos_upload_stream(bucket, object, buf, buf_len, callback, userdata, thread_id);
} }
long hos_open_fd(const char *bucket, const char *object, put_finished_callback callback, void *userdata, size_t thread_id) int hos_open_fd(const char *bucket, const char *object, put_finished_callback callback, void *userdata, size_t thread_id, size_t *fd)
{ {
if (g_hos_instance.status != INSTANCE_ENABLE_STATE) if (g_hos_instance.status != INSTANCE_ENABLE_STATE)
{ {
*fd = 0;
return HOS_INSTANCE_NOT_ENABLE; return HOS_INSTANCE_NOT_ENABLE;
} }
if ((bucket == NULL) || (object == NULL) || (thread_id > g_hos_handle.hos_config.thread_num) || strlen(bucket) == 0 || strlen(object) == 0) if ((bucket == NULL) || (object == NULL) || (thread_id > g_hos_handle.hos_config.thread_num) || strlen(bucket) == 0 || strlen(object) == 0)
@@ -903,6 +904,7 @@ long hos_open_fd(const char *bucket, const char *object, put_finished_callback c
MESA_HANDLE_RUNTIME_LOG(g_hos_handle.log, RLOG_LV_FATAL, "hos_open_fd", MESA_HANDLE_RUNTIME_LOG(g_hos_handle.log, RLOG_LV_FATAL, "hos_open_fd",
"error: [%s] bucket:%s, obejct:%s, thread_id:%lu", g_hos_instance.hos_url_prefix, "error: [%s] bucket:%s, obejct:%s, thread_id:%lu", g_hos_instance.hos_url_prefix,
(bucket == NULL)?"null":bucket, (object == NULL)?"null":object, thread_id); (bucket == NULL)?"null":bucket, (object == NULL)?"null":object, thread_id);
*fd = 0;
return HOS_PARAMETER_ERROR; return HOS_PARAMETER_ERROR;
} }
@@ -922,7 +924,8 @@ long hos_open_fd(const char *bucket, const char *object, put_finished_callback c
MESA_HANDLE_RUNTIME_LOG(g_hos_handle.log, RLOG_LV_DEBUG, "hos_open_fd", "debug: [%s] thread_id:%lu, fd:%lu", g_hos_instance.hos_url_prefix, thread_id, (long)&hos_fd); MESA_HANDLE_RUNTIME_LOG(g_hos_handle.log, RLOG_LV_DEBUG, "hos_open_fd", "debug: [%s] thread_id:%lu, fd:%lu", g_hos_instance.hos_url_prefix, thread_id, (long)&hos_fd);
return (long)hos_fd; *fd = (size_t)hos_fd;
return HOS_CLIENT_OK;
} }
int hos_write(size_t fd, const char *stream, size_t stream_len) int hos_write(size_t fd, const char *stream, size_t stream_len)

View File

@@ -130,7 +130,7 @@ int hos_upload_buf(const char *bucket, const char *object, const char *buf, size
* int mode 模式 (FILE OR BUFFER, APPEND OR NOT) * int mode 模式 (FILE OR BUFFER, APPEND OR NOT)
* 返回值 long 成功返回fd(fd >0)失败返回hoserros错误码 * 返回值 long 成功返回fd(fd >0)失败返回hoserros错误码
*************************************************************************************/ *************************************************************************************/
long hos_open_fd(const char *bucket, const char *object, put_finished_callback callback, void *userdata, size_t thread_id); int hos_open_fd(const char *bucket, const char *object, put_finished_callback callback, void *userdata, size_t thread_id, size_t *fd);
/************************************************************************************* /*************************************************************************************
* 函数名: hos_write * 函数名: hos_write
* 参数: size_t fd hos_open_fd返回的fd * 参数: size_t fd hos_open_fd返回的fd