Changeset 8556

Show
Ignore:
Timestamp:
10/11/10 17:35:16 (3 years ago)
Author:
sampson
Message:

Porting BMI sockets

Location:
branches/windows-client
Files:
6 added
11 modified

Legend:

Unmodified
Added
Removed
  • branches/windows-client/include/pvfs2-types.h

    r8540 r8556  
    2121#ifdef WIN32 
    2222#include "wincommon.h" 
    23 /* define struct timeval */ 
    24 struct timeval  
    25 { 
    26     long tv_sec; 
    27     long tv_usec; 
    28 }; 
    2923#else 
    3024#include <sys/time.h> 
  • branches/windows-client/projects/OrangeFS/OrangeFS.sln

    r8546 r8556  
    2121EndProject 
    2222Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "id-generator", "id-generator\id-generator.vcxproj", "{0CBAD436-373C-4F35-A620-2D46C12D8FE0}" 
     23EndProject 
     24Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bmi", "bmi\bmi.vcxproj", "{B7F1BEBC-F833-448A-829A-3505019C8169}" 
     25EndProject 
     26Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-bmi-client", "test-bmi-client\test-bmi-client.vcxproj", "{490C6444-6931-4D69-9EC0-B104920591ED}" 
     27        ProjectSection(ProjectDependencies) = postProject 
     28                {9C95DF0D-5B60-4E94-94ED-000861C651B4} = {9C95DF0D-5B60-4E94-94ED-000861C651B4} 
     29                {0CBAD436-373C-4F35-A620-2D46C12D8FE0} = {0CBAD436-373C-4F35-A620-2D46C12D8FE0} 
     30                {62A89A5C-1B78-40B7-BB6A-6E5A06DB06E1} = {62A89A5C-1B78-40B7-BB6A-6E5A06DB06E1} 
     31                {A7C0F968-DACA-4BFE-B36F-46FDAEB8EF1D} = {A7C0F968-DACA-4BFE-B36F-46FDAEB8EF1D} 
     32                {B7F1BEBC-F833-448A-829A-3505019C8169} = {B7F1BEBC-F833-448A-829A-3505019C8169} 
     33                {9138ABF9-041F-4A55-9E87-0F433719F4FC} = {9138ABF9-041F-4A55-9E87-0F433719F4FC} 
     34        EndProjectSection 
     35EndProject 
     36Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-bmi-server", "test-bmi-server\test-bmi-server.vcxproj", "{AC842F24-4342-42D1-928D-19176B22917C}" 
     37        ProjectSection(ProjectDependencies) = postProject 
     38                {9C95DF0D-5B60-4E94-94ED-000861C651B4} = {9C95DF0D-5B60-4E94-94ED-000861C651B4} 
     39                {0CBAD436-373C-4F35-A620-2D46C12D8FE0} = {0CBAD436-373C-4F35-A620-2D46C12D8FE0} 
     40                {62A89A5C-1B78-40B7-BB6A-6E5A06DB06E1} = {62A89A5C-1B78-40B7-BB6A-6E5A06DB06E1} 
     41                {A7C0F968-DACA-4BFE-B36F-46FDAEB8EF1D} = {A7C0F968-DACA-4BFE-B36F-46FDAEB8EF1D} 
     42                {B7F1BEBC-F833-448A-829A-3505019C8169} = {B7F1BEBC-F833-448A-829A-3505019C8169} 
     43                {9138ABF9-041F-4A55-9E87-0F433719F4FC} = {9138ABF9-041F-4A55-9E87-0F433719F4FC} 
     44        EndProjectSection 
    2345EndProject 
    2446Global 
     
    5072                {0CBAD436-373C-4F35-A620-2D46C12D8FE0}.Release|Win32.ActiveCfg = Release|Win32 
    5173                {0CBAD436-373C-4F35-A620-2D46C12D8FE0}.Release|Win32.Build.0 = Release|Win32 
     74                {B7F1BEBC-F833-448A-829A-3505019C8169}.Debug|Win32.ActiveCfg = Debug|Win32 
     75                {B7F1BEBC-F833-448A-829A-3505019C8169}.Debug|Win32.Build.0 = Debug|Win32 
     76                {B7F1BEBC-F833-448A-829A-3505019C8169}.Release|Win32.ActiveCfg = Release|Win32 
     77                {B7F1BEBC-F833-448A-829A-3505019C8169}.Release|Win32.Build.0 = Release|Win32 
     78                {490C6444-6931-4D69-9EC0-B104920591ED}.Debug|Win32.ActiveCfg = Debug|Win32 
     79                {490C6444-6931-4D69-9EC0-B104920591ED}.Debug|Win32.Build.0 = Debug|Win32 
     80                {490C6444-6931-4D69-9EC0-B104920591ED}.Release|Win32.ActiveCfg = Release|Win32 
     81                {490C6444-6931-4D69-9EC0-B104920591ED}.Release|Win32.Build.0 = Release|Win32 
     82                {AC842F24-4342-42D1-928D-19176B22917C}.Debug|Win32.ActiveCfg = Debug|Win32 
     83                {AC842F24-4342-42D1-928D-19176B22917C}.Debug|Win32.Build.0 = Debug|Win32 
     84                {AC842F24-4342-42D1-928D-19176B22917C}.Release|Win32.ActiveCfg = Release|Win32 
     85                {AC842F24-4342-42D1-928D-19176B22917C}.Release|Win32.Build.0 = Release|Win32 
    5286        EndGlobalSection 
    5387        GlobalSection(SolutionProperties) = preSolution 
  • branches/windows-client/projects/OrangeFS/bmi_wintcp/bmi_wintcp.vcxproj

    r8546 r8556  
    6666  <ItemGroup> 
    6767    <ClCompile Include="..\..\..\src\io\bmi\bmi_wintcp\bmi-wintcp.c" /> 
     68    <ClCompile Include="..\..\..\src\io\bmi\bmi_wintcp\socket-collection.c" /> 
    6869    <ClCompile Include="..\..\..\src\io\bmi\bmi_wintcp\sockio.c" /> 
    6970  </ItemGroup> 
  • branches/windows-client/src/common/quicklist/quicklist.h

    r8540 r8556  
    196196 * @member:     the name of the list_struct within the struct. 
    197197 */ 
    198 #define qlist_for_each_entry(pos, head, member)                         \ 
     198#ifdef WIN32 
     199#define qlist_for_each_entry(pos, head, member, type)        \ 
     200    for (pos = qlist_entry((head)->next, type, member);      \ 
     201         &pos->member != (head);                             \ 
     202         pos = qlist_entry(pos->member.next, type, member))   
     203#else 
     204#define qlist_for_each_entry(pos, head, member)                 \ 
    199205    for (pos = qlist_entry((head)->next, typeof(*pos), member); \ 
    200          &pos->member != (head);                                        \ 
    201          pos = qlist_entry(pos->member.next, typeof(*pos), member))     \ 
    202  
     206         &pos->member != (head);                                \ 
     207         pos = qlist_entry(pos->member.next, typeof(*pos), member))      
     208#endif 
    203209/** 
    204210 * qlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry 
  • branches/windows-client/src/common/windows/wincommon.h

    r8550 r8556  
    3131    if (ret == 0) 
    3232    { 
    33         tv->tv_sec = timebuffer.time; 
     33        tv->tv_sec = (long) timebuffer.time; 
    3434        tv->tv_usec = timebuffer.millitm * 1000; 
    3535    } 
  • branches/windows-client/src/io/bmi/bmi.c

    r8317 r8556  
    1515#include <assert.h> 
    1616#include <time.h> 
     17#ifndef WIN32 
    1718#include <sys/time.h> 
     19#endif 
    1820#include <stdio.h> 
    1921 
     
    2931#include "pvfs2-internal.h" 
    3032#include "pvfs2-debug.h" 
     33 
     34#ifdef WIN32 
     35#include "wincommon.h" 
     36 
     37#define EREMOTE       66 
     38#define EHOSTDOWN    112 
     39#endif 
    3140 
    3241static int bmi_initialized_count = 0; 
     
    9911000    int position = 0; 
    9921001    int tmp_outcount = 0; 
     1002#ifdef WIN32 
     1003    struct bmi_method_unexpected_info *sub_info =  
     1004        (struct bmi_method_unexpected_info *)  
     1005        malloc(sizeof(struct bmi_method_unexpected_info) * incount); 
     1006#else 
    9931007    struct bmi_method_unexpected_info sub_info[incount]; 
     1008#endif 
    9941009    ref_st_p tmp_ref = NULL; 
    9951010    int tmp_active_method_count = 0; 
     
    10041019 
    10051020    if (max_idle_time_ms < 0) 
     1021    { 
     1022#ifdef WIN32 
     1023        free(sub_info); 
     1024#endif 
    10061025        return (bmi_errno_to_pvfs(-EINVAL)); 
     1026    } 
    10071027 
    10081028    *outcount = 0; 
     
    10201040            { 
    10211041                /* can't recover from this */ 
     1042#ifdef WIN32 
     1043                free(sub_info); 
     1044#endif 
    10221045                gossip_lerr("Error: critical BMI_testunexpected failure.\n"); 
    10231046                return (ret); 
     
    10441067        { 
    10451068            /* yeah, right */ 
     1069#ifdef WIN32 
     1070            free(sub_info); 
     1071#endif 
    10461072            gossip_lerr("Error: critical BMI_testunexpected failure.\n"); 
    10471073            gen_mutex_unlock(&ref_mutex); 
     
    10551081        info_array[i].addr = tmp_ref->bmi_addr; 
    10561082    } 
     1083#ifdef WIN32 
     1084    free(sub_info); 
     1085#endif 
    10571086    /* return 1 if anything completed */ 
    10581087    if (ret == 0 && *outcount > 0) 
     
    10831112    int tmp_outcount = 0; 
    10841113    int tmp_active_method_count = 0; 
     1114#ifndef WIN32 
    10851115    struct timespec ts; 
     1116#endif 
    10861117 
    10871118    gen_mutex_lock(&active_method_count_mutex); 
     
    10991130        if(max_idle_time_ms > 0) 
    11001131        { 
    1101             ts.tv_sec = 0; 
     1132#ifdef WIN32 
     1133            Sleep(2); 
     1134#else 
     1135            ts.tv_sec = 0; 
    11021136            ts.tv_nsec = 2000; 
    11031137            nanosleep(&ts, NULL); 
     1138#endif 
    11041139        } 
    11051140        return(0); 
     
    22772312{ 
    22782313    struct method_drop_addr_query query; 
     2314    int ret = 0; 
    22792315    query.response = 0; 
    22802316    query.addr = tmp_ref->method_addr; 
    2281     int ret = 0; 
    22822317 
    22832318    /* reference count is zero; ask module if it wants us to discard 
     
    23402375        gen_mutex_unlock(&bmi_addr_force_drop_list_mutex); 
    23412376        gen_mutex_lock(&ref_mutex); 
     2377#ifdef WIN32 
     2378        qlist_for_each_entry(ref_item, cur_ref_list, list_link, ref_st) 
     2379#else 
    23422380        qlist_for_each_entry(ref_item, cur_ref_list, list_link) 
     2381#endif 
    23432382        { 
    23442383             if ((ref_item->ref_count == 0) && 
  • branches/windows-client/src/io/bmi/bmi_wintcp/bmi-wintcp.c

    r8554 r8556  
    23902390 
    23912391    tcp_op_data = (struct tcp_op *) new_method_op->method_data; 
    2392     tcp_op_data->tcp_op_state = (bmi_tcp_state) tcp_op_state; 
     2392    tcp_op_data->tcp_op_state = (enum bmi_tcp_state) tcp_op_state; 
    23932393    tcp_op_data->env = header; 
    23942394 
  • branches/windows-client/src/io/bmi/bmi_wintcp/socket-collection.c

    r8516 r8556  
    1616 */ 
    1717#include <stdio.h> 
    18 #include <sys/poll.h> 
    1918#include <string.h> 
    20 #include <unistd.h> 
    2119#include <errno.h> 
    2220 
  • branches/windows-client/src/io/bmi/reference-list.h

    r7466 r8556  
    1919#include "quicklist.h" 
    2020#include "quickhash.h" 
     21 
     22#ifdef WIN32 
     23/* interface is a macro on Windows */ 
     24#undef  interface 
     25#define interface    _interface 
     26#endif 
    2127 
    2228typedef struct qlist_head *ref_list_p; 
  • branches/windows-client/test/io/bmi/test-bmi-client.c

    r7500 r8556  
    1515#include <stdio.h> 
    1616#include <errno.h> 
     17#ifndef WIN32 
    1718#include <unistd.h> 
     19#endif 
    1820#include <stdlib.h> 
    1921#include <string.h> 
     
    298300} 
    299301 
    300  
     302#ifdef WIN32 
     303static struct options *parse_args( 
     304    int argc, 
     305    char *argv[]) 
     306{ 
     307    int argi = 1, len, ret; 
     308    struct options *tmp_opts = malloc(sizeof(struct options)); 
     309    if (!tmp_opts) 
     310    { 
     311        goto parse_args_error; 
     312    } 
     313 
     314    /* defaults */ 
     315    tmp_opts->hostid = NULL; 
     316    tmp_opts->message_size = 32000; 
     317 
     318    while (argi < argc) 
     319    { 
     320        if (strcmp(argv[argi], "-h") == 0) 
     321        { 
     322            len = strlen(argv[++argi]) + 1; 
     323            tmp_opts->hostid = (char *) malloc(len); 
     324            if (tmp_opts->hostid == NULL) 
     325            { 
     326                goto parse_args_error; 
     327            } 
     328            memcpy(tmp_opts->hostid, argv[argi], len); 
     329            argi++; 
     330        } 
     331        else if (strcmp(argv[argi], "-s") == 0) 
     332        { 
     333            ret = sscanf(argv[++argi], "%d", &tmp_opts->message_size); 
     334            if (ret < -1) 
     335            { 
     336                goto parse_args_error; 
     337            } 
     338            argi++; 
     339        } 
     340        else { 
     341            goto parse_args_error; 
     342        } 
     343    } 
     344 
     345    /* if we didn't get a host argument, fill in a default: */ 
     346    if (tmp_opts->hostid == NULL) { 
     347        len = (strlen(DEFAULT_HOSTID)) + 1; 
     348        if ((tmp_opts->hostid = malloc(len)) == NULL) 
     349        { 
     350            goto parse_args_error; 
     351        } 
     352        memcpy(tmp_opts->hostid, DEFAULT_HOSTID, len); 
     353    } 
     354 
     355    return (tmp_opts); 
     356 
     357  parse_args_error: 
     358 
     359    /* if an error occurs, just free everything and return NULL */ 
     360    if (tmp_opts) 
     361    { 
     362        if (tmp_opts->hostid) 
     363        { 
     364            free(tmp_opts->hostid); 
     365        } 
     366        free(tmp_opts); 
     367    } 
     368    return (NULL); 
     369} 
     370#else 
    301371static struct options *parse_args( 
    302372    int argc, 
     
    371441    return (NULL); 
    372442} 
     443#endif /* WIN32 */ 
    373444 
    374445/* 
  • branches/windows-client/test/io/bmi/test-bmi-server.c

    r7500 r8556  
    1515#include <stdio.h> 
    1616#include <errno.h> 
     17#ifndef WIN32 
    1718#include <unistd.h> 
     19#endif 
    1820#include <stdlib.h> 
    1921#include <string.h> 
     
    240242 
    241243 
     244#ifdef WIN32 
     245static struct options *parse_args( 
     246    int argc, 
     247    char *argv[]) 
     248{ 
     249    int argi = 1, len; 
     250    struct options *tmp_opts = malloc(sizeof(struct options)); 
     251    if (!tmp_opts) 
     252    { 
     253        goto parse_args_error; 
     254    } 
     255 
     256    /* defaults */ 
     257    tmp_opts->hostid = NULL; 
     258 
     259    while (argi < argc) 
     260    { 
     261        if (strcmp(argv[argi], "-h") == 0) 
     262        { 
     263            len = strlen(argv[++argi]) + 1; 
     264            tmp_opts->hostid = (char *) malloc(len); 
     265            if (tmp_opts->hostid == NULL) 
     266            { 
     267                goto parse_args_error; 
     268            } 
     269            memcpy(tmp_opts->hostid, argv[argi], len); 
     270            argi++; 
     271        } 
     272        else { 
     273            goto parse_args_error; 
     274        } 
     275    } 
     276 
     277    /* if we didn't get a host argument, fill in a default: */ 
     278    if (tmp_opts->hostid == NULL) { 
     279        len = (strlen(DEFAULT_HOSTID)) + 1; 
     280        if ((tmp_opts->hostid = malloc(len)) == NULL) 
     281        { 
     282            goto parse_args_error; 
     283        } 
     284        memcpy(tmp_opts->hostid, DEFAULT_HOSTID, len); 
     285    } 
     286 
     287    return (tmp_opts); 
     288 
     289  parse_args_error: 
     290 
     291    /* if an error occurs, just free everything and return NULL */ 
     292    if (tmp_opts) 
     293    { 
     294        if (tmp_opts->hostid) 
     295        { 
     296            free(tmp_opts->hostid); 
     297        } 
     298        free(tmp_opts); 
     299    } 
     300    return (NULL); 
     301} 
     302#else 
    242303static struct options *parse_args( 
    243304    int argc, 
     
    301362    return (NULL); 
    302363} 
     364#endif 
    303365 
    304366/*