🐞 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_serverip=192.168.40.223
hos_serverport=9099
hos_serverip=192.168.10.1
hos_serverport=9098
hos_accesskeyid="default"
hos_secretkey="default"
hos_log_path="./log/hoslog" #default
hos_log_level=30 #default
hos_log_level=10 #default
hos_poolsize=0 #default
hos_thread_sum=32 #default
hos_cache_size=102400 #default

View File

@@ -131,7 +131,7 @@ int main(int argc, char *argv[])
mode = BUFF_MODE | APPEND_MODE;
printf("hos_write buff start ...\n");
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)
{
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 average = 0.00;
long time = 0;
int err = 0;
//写文件
//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++)
{
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)
{
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 average = 0.00;
long record[30000] = {0};
int err = 0;
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++)
{