Changeset 5329
- Timestamp:
- 03/01/08 07:16:14 (4 months ago)
- Files:
-
- wired/trunk/wired/files.c (modified) (21 diffs)
- wired/trunk/wired/transfers.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wired/trunk/wired/files.c
r5317 r5329 73 73 static void wd_files_index_path(wi_string_t *, wi_file_t *, const char *); 74 74 75 static wd_file_type_t wd_files_type_with_stat(wi_string_t *path, struct stat *sbp);75 static wd_file_type_t wd_files_type_with_stat(wi_string_t *path, wi_file_stat_t *sbp); 76 76 77 77 static void wd_files_clear_comment(wi_string_t *); … … 127 127 wd_file_type_t type, pathtype; 128 128 wd_files_fts_action_t action; 129 struct statsb;129 wi_file_stat_t sb; 130 130 wi_uinteger_t pathlength; 131 131 int error; … … 232 232 case WD_FILE_TYPE_FILE: 233 233 default: 234 size = sb.s t_size;234 size = sb.size; 235 235 break; 236 236 } 237 237 238 238 /* 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)); 240 240 241 241 wd_reply(410, WI_STR("%#@%c%u%c%llu%c%#@%c%#@"), … … 266 266 267 267 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; 269 269 else 270 270 available = 0; … … 336 336 wi_file_offset_t size; 337 337 wd_file_type_t type; 338 struct statsb;338 wi_file_stat_t sb; 339 339 340 340 realpath = wd_files_real_path(path); … … 369 369 case WD_FILE_TYPE_FILE: 370 370 default: 371 size = sb.s t_size;371 size = sb.size; 372 372 checksum = wi_file_sha1(realpath, WD_FILES_CHECKSUM_SIZE); 373 373 break; 374 374 } 375 375 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)); 377 377 378 378 wd_reply(402, WI_STR("%#@%c%u%c%llu%c%#@%c%#@%c%#@%c%#@"), … … 439 439 wi_string_t *realfromname, *realtoname; 440 440 wi_string_t *path; 441 struct statsb;441 wi_file_stat_t sb; 442 442 wi_boolean_t result = false; 443 443 … … 556 556 wd_files_fts_action_t action; 557 557 wd_file_type_t type; 558 struct statsb;558 wi_file_stat_t sb; 559 559 wi_uinteger_t pathlength; 560 560 int error; … … 622 622 } 623 623 624 recurse = (alias && S_ISDIR(sb. st_mode));624 recurse = (alias && S_ISDIR(sb.mode)); 625 625 626 626 /* get file type */ … … 645 645 case WD_FILE_TYPE_FILE: 646 646 default: 647 size = sb.s t_size;647 size = sb.size; 648 648 break; 649 649 } 650 650 651 651 /* 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)); 653 653 654 654 wd_reply(420, WI_STR("%#s%#@%c%u%c%llu%c%#@%c%#@"), … … 690 690 wi_uinteger_t i = 0, pathlength, index; 691 691 wi_file_offset_t length; 692 struct statsb;692 wi_file_stat_t sb; 693 693 694 694 wi_rwlock_rdlock(wd_files_index_lock); … … 704 704 705 705 if(wi_file_stat(wd_settings.index, &sb)) 706 length = sb.s t_size;706 length = sb.size; 707 707 else 708 708 length = 0; … … 767 767 768 768 void wd_files_index(wi_boolean_t force) { 769 struct statsb;769 wi_file_stat_t sb; 770 770 wi_time_interval_t interval; 771 771 wi_boolean_t index = true; … … 773 773 if(!force) { 774 774 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)); 776 776 777 777 if(interval < wd_settings.indextime) { … … 914 914 wd_file_type_t type; 915 915 wd_files_fts_action_t action; 916 struct statsb;916 wi_file_stat_t sb; 917 917 int error; 918 918 wi_uinteger_t i = 0, pathlength; … … 985 985 } 986 986 987 recurse = (alias && S_ISDIR(sb. st_mode));987 recurse = (alias && S_ISDIR(sb.mode)); 988 988 989 989 /* get file type & size */ … … 1002 1002 case WD_FILE_TYPE_FILE: 1003 1003 default: 1004 size = sb.s t_size;1004 size = sb.size; 1005 1005 break; 1006 1006 } 1007 1007 1008 1008 /* 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)); 1010 1010 1011 1011 wi_file_write(file, WI_STR("%#s%c%#s%#@%c%u%c%llu%c%#@%c%#@\n"), … … 1019 1019 1020 1020 /* 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); 1022 1022 1023 1023 if(!wi_set_contains_data(wd_files_index_set, number)) { 1024 if(S_ISDIR(sb. st_mode)) {1024 if(S_ISDIR(sb.mode)) { 1025 1025 wd_directories_unique_count++; 1026 1026 } else { … … 1032 1032 } 1033 1033 1034 if(S_ISDIR(sb. st_mode)) {1034 if(S_ISDIR(sb.mode)) { 1035 1035 wd_directories_count++; 1036 1036 } else { … … 1069 1069 1070 1070 wd_file_type_t wd_files_type(wi_string_t *path) { 1071 struct statsb;1071 wi_file_stat_t sb; 1072 1072 1073 1073 if(!wi_file_stat(path, &sb)) { … … 1082 1082 1083 1083 1084 static wd_file_type_t wd_files_type_with_stat(wi_string_t *path, struct stat *sbp) {1084 static wd_file_type_t wd_files_type_with_stat(wi_string_t *path, wi_file_stat_t *sbp) { 1085 1085 wi_string_t *typepath, *string; 1086 struct statsb;1086 wi_file_stat_t sb; 1087 1087 wd_file_type_t type; 1088 1088 1089 if(!S_ISDIR(sbp-> st_mode))1089 if(!S_ISDIR(sbp->mode)) 1090 1090 return WD_FILE_TYPE_FILE; 1091 1091 1092 1092 typepath = wi_string_by_appending_path_component(path, WI_STR(WD_FILES_META_TYPE_PATH)); 1093 1093 1094 if(!wi_file_stat(typepath, &sb) || sb.s t_size > 8)1094 if(!wi_file_stat(typepath, &sb) || sb.size > 8) 1095 1095 return WD_FILE_TYPE_DIR; 1096 1096 wired/trunk/wired/transfers.c
r5313 r5329 101 101 wi_string_t *realpath; 102 102 wd_transfer_t *transfer; 103 struct statsb;103 wi_file_stat_t sb; 104 104 105 105 realpath = wd_files_real_path(path); … … 116 116 transfer->path = wi_retain(path); 117 117 transfer->realpath = wi_retain(realpath); 118 transfer->size = sb.s t_size;118 transfer->size = sb.size; 119 119 transfer->offset = offset; 120 120 transfer->transferred = offset; … … 138 138 wd_transfer_t *transfer; 139 139 wi_file_offset_t offset; 140 struct statsb;140 wi_file_stat_t sb; 141 141 142 142 realpath = wd_files_real_path(path); … … 155 155 offset = 0; 156 156 } else { 157 offset = sb.s t_size;158 159 if(sb.s t_size >= WD_FILES_CHECKSUM_SIZE) {157 offset = sb.size; 158 159 if(sb.size >= WD_FILES_CHECKSUM_SIZE) { 160 160 filechecksum = wi_file_sha1(realpath, WD_FILES_CHECKSUM_SIZE); 161 161
