Changeset 5329

Show
Ignore:
Timestamp:
03/01/08 07:16:14 (4 months ago)
Author:
morris
Message:

Update for libwired

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wired/trunk/wired/files.c

    r5317 r5329  
    7373static void                                                                     wd_files_index_path(wi_string_t *, wi_file_t *, const char *); 
    7474 
    75 static wd_file_type_t                                           wd_files_type_with_stat(wi_string_t *path, struct stat *sbp); 
     75static wd_file_type_t                                           wd_files_type_with_stat(wi_string_t *path, wi_file_stat_t *sbp); 
    7676 
    7777static void                                                                     wd_files_clear_comment(wi_string_t *); 
     
    127127        wd_file_type_t                  type, pathtype; 
    128128        wd_files_fts_action_t   action; 
    129         struct stat                           sb; 
     129        wi_file_stat_t                        sb; 
    130130        wi_uinteger_t                   pathlength; 
    131131        int                                             error; 
     
    232232                        case WD_FILE_TYPE_FILE: 
    233233                        default: 
    234                                 size = sb.st_size; 
     234                                size = sb.size; 
    235235                                break; 
    236236                } 
    237237                 
    238238                /* reply file message */ 
    239                 string = wi_date_iso8601_string(wi_date_with_time(sb.st_mtime)); 
     239                string = wi_date_iso8601_string(wi_date_with_time(sb.mtime)); 
    240240                 
    241241                wd_reply(410, WI_STR("%#@%c%u%c%llu%c%#@%c%#@"), 
     
    266266 
    267267        if(upload && wi_file_statfs(realpath, &sfb)) 
    268                 available = (wi_file_offset_t) sfb.f_bavail * (wi_file_offset_t) sfb.f_frsize; 
     268                available = (wi_file_offset_t) sfb.bavail * (wi_file_offset_t) sfb.frsize; 
    269269        else 
    270270                available = 0; 
     
    336336        wi_file_offset_t        size; 
    337337        wd_file_type_t          type; 
    338         struct stat                   sb; 
     338        wi_file_stat_t                sb; 
    339339         
    340340        realpath = wd_files_real_path(path); 
     
    369369                case WD_FILE_TYPE_FILE: 
    370370                default: 
    371                         size = sb.st_size; 
     371                        size = sb.size; 
    372372                        checksum = wi_file_sha1(realpath, WD_FILES_CHECKSUM_SIZE); 
    373373                        break; 
    374374        } 
    375375         
    376         string = wi_date_iso8601_string(wi_date_with_time(sb.st_mtime)); 
     376        string = wi_date_iso8601_string(wi_date_with_time(sb.mtime)); 
    377377         
    378378        wd_reply(402, WI_STR("%#@%c%u%c%llu%c%#@%c%#@%c%#@%c%#@"), 
     
    439439        wi_string_t                     *realfromname, *realtoname; 
    440440        wi_string_t                     *path; 
    441         struct stat                   sb; 
     441        wi_file_stat_t                sb; 
    442442        wi_boolean_t            result = false; 
    443443         
     
    556556        wd_files_fts_action_t   action; 
    557557        wd_file_type_t                  type; 
    558         struct stat                           sb; 
     558        wi_file_stat_t                        sb; 
    559559        wi_uinteger_t                   pathlength; 
    560560        int                                             error; 
     
    622622                } 
    623623                 
    624                 recurse = (alias && S_ISDIR(sb.st_mode)); 
     624                recurse = (alias && S_ISDIR(sb.mode)); 
    625625                 
    626626                /* get file type */ 
     
    645645                                case WD_FILE_TYPE_FILE: 
    646646                                default: 
    647                                         size = sb.st_size; 
     647                                        size = sb.size; 
    648648                                        break; 
    649649                        } 
    650650                         
    651651                        /* reply file record */ 
    652                         string = wi_date_iso8601_string(wi_date_with_time(sb.st_mtime)); 
     652                        string = wi_date_iso8601_string(wi_date_with_time(sb.mtime)); 
    653653                         
    654654                        wd_reply(420, WI_STR("%#s%#@%c%u%c%llu%c%#@%c%#@"), 
     
    690690        wi_uinteger_t           i = 0, pathlength, index; 
    691691        wi_file_offset_t        length; 
    692         struct stat                   sb; 
     692        wi_file_stat_t                sb; 
    693693         
    694694        wi_rwlock_rdlock(wd_files_index_lock); 
     
    704704         
    705705        if(wi_file_stat(wd_settings.index, &sb)) 
    706                 length = sb.st_size; 
     706                length = sb.size; 
    707707        else 
    708708                length = 0; 
     
    767767 
    768768void wd_files_index(wi_boolean_t force) { 
    769         struct stat                   sb; 
     769        wi_file_stat_t                sb; 
    770770        wi_time_interval_t      interval; 
    771771        wi_boolean_t            index = true; 
     
    773773        if(!force) { 
    774774                if(wi_file_stat(wd_settings.index, &sb)) { 
    775                         interval = wi_date_time_interval_since_now(wi_date_with_time(sb.st_mtime)); 
     775                        interval = wi_date_time_interval_since_now(wi_date_with_time(sb.mtime)); 
    776776                         
    777777                        if(interval < wd_settings.indextime) { 
     
    914914        wd_file_type_t                  type; 
    915915        wd_files_fts_action_t   action; 
    916         struct stat                           sb; 
     916        wi_file_stat_t                        sb; 
    917917        int                                             error; 
    918918        wi_uinteger_t                   i = 0, pathlength; 
     
    985985                } 
    986986                 
    987                 recurse = (alias && S_ISDIR(sb.st_mode)); 
     987                recurse = (alias && S_ISDIR(sb.mode)); 
    988988                 
    989989                /* get file type & size */ 
     
    10021002                        case WD_FILE_TYPE_FILE: 
    10031003                        default: 
    1004                                 size = sb.st_size; 
     1004                                size = sb.size; 
    10051005                                break; 
    10061006                } 
    10071007                 
    10081008                /* write file record */ 
    1009                 string = wi_date_iso8601_string(wi_date_with_time(sb.st_mtime)); 
     1009                string = wi_date_iso8601_string(wi_date_with_time(sb.mtime)); 
    10101010                 
    10111011                wi_file_write(file, WI_STR("%#s%c%#s%#@%c%u%c%llu%c%#@%c%#@\n"), 
     
    10191019 
    10201020                /* track unique inodes */ 
    1021                 number = wi_number_with_value(WI_NUMBER_INO_T, &sb.st_ino); 
     1021                number = wi_number_with_value(WI_NUMBER_INO_T, &sb.ino); 
    10221022                 
    10231023                if(!wi_set_contains_data(wd_files_index_set, number)) { 
    1024                         if(S_ISDIR(sb.st_mode)) { 
     1024                        if(S_ISDIR(sb.mode)) { 
    10251025                                wd_directories_unique_count++; 
    10261026                        } else { 
     
    10321032                } 
    10331033 
    1034                 if(S_ISDIR(sb.st_mode)) { 
     1034                if(S_ISDIR(sb.mode)) { 
    10351035                        wd_directories_count++; 
    10361036                } else { 
     
    10691069 
    10701070wd_file_type_t wd_files_type(wi_string_t *path) { 
    1071         struct stat           sb; 
     1071        wi_file_stat_t        sb; 
    10721072         
    10731073        if(!wi_file_stat(path, &sb)) { 
     
    10821082 
    10831083 
    1084 static wd_file_type_t wd_files_type_with_stat(wi_string_t *path, struct stat *sbp) { 
     1084static wd_file_type_t wd_files_type_with_stat(wi_string_t *path, wi_file_stat_t *sbp) { 
    10851085        wi_string_t             *typepath, *string; 
    1086         struct stat           sb; 
     1086        wi_file_stat_t        sb; 
    10871087        wd_file_type_t  type; 
    10881088         
    1089         if(!S_ISDIR(sbp->st_mode)) 
     1089        if(!S_ISDIR(sbp->mode)) 
    10901090                return WD_FILE_TYPE_FILE; 
    10911091         
    10921092        typepath = wi_string_by_appending_path_component(path, WI_STR(WD_FILES_META_TYPE_PATH)); 
    10931093         
    1094         if(!wi_file_stat(typepath, &sb) || sb.st_size > 8) 
     1094        if(!wi_file_stat(typepath, &sb) || sb.size > 8) 
    10951095                return WD_FILE_TYPE_DIR; 
    10961096         
  • wired/trunk/wired/transfers.c

    r5313 r5329  
    101101        wi_string_t                     *realpath; 
    102102        wd_transfer_t           *transfer; 
    103         struct stat                   sb; 
     103        wi_file_stat_t                sb; 
    104104         
    105105        realpath = wd_files_real_path(path); 
     
    116116        transfer->path                  = wi_retain(path); 
    117117        transfer->realpath              = wi_retain(realpath); 
    118         transfer->size                  = sb.st_size; 
     118        transfer->size                  = sb.size; 
    119119        transfer->offset                = offset; 
    120120        transfer->transferred   = offset; 
     
    138138        wd_transfer_t           *transfer; 
    139139        wi_file_offset_t        offset; 
    140         struct stat                   sb; 
     140        wi_file_stat_t                sb; 
    141141         
    142142        realpath = wd_files_real_path(path); 
     
    155155                offset = 0; 
    156156        } else { 
    157                 offset = sb.st_size; 
    158                  
    159                 if(sb.st_size >= WD_FILES_CHECKSUM_SIZE) { 
     157                offset = sb.size; 
     158                 
     159                if(sb.size >= WD_FILES_CHECKSUM_SIZE) { 
    160160                        filechecksum = wi_file_sha1(realpath, WD_FILES_CHECKSUM_SIZE); 
    161161