Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Updated file_sync-standalone to use an internal htonll (renamed to avoid conflicts where real htonll implementations exist) |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
fc476508a49ec91dc98299caee5d21ab |
User & Date: | rkeene 2008-11-09 19:44:53 |
Context
2008-11-12
| ||
17:43 | Updated "file_sync" to use MD5 instead of MD4 for hashing check-in: e063cc9d59 user: rkeene tags: trunk | |
2008-11-09
| ||
19:44 | Updated file_sync-standalone to use an internal htonll (renamed to avoid conflicts where real htonll implementations exist) check-in: fc476508a4 user: rkeene tags: trunk | |
14:42 | Updated file_sync-standalone to compile on OpenBSD: - Reordered #includes - Changed implementation of ntohll() to use ntohl() to determine endian-ness check-in: 63e724bd6e user: rkeene tags: trunk | |
Changes
Changes to tools/file_sync-standalone.c.
︙ | ︙ | |||
84 85 86 87 88 89 90 | static void rsaref_MD4Update(rsaref_MD4_CTX *, unsigned char *, unsigned int); static void rsaref_MD4Final(unsigned char [16], rsaref_MD4_CTX *); /* MD4.H ENDS */ uint64_t net_bytesout = 0; uint64_t net_bytesin = 0; | | | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | static void rsaref_MD4Update(rsaref_MD4_CTX *, unsigned char *, unsigned int); static void rsaref_MD4Final(unsigned char [16], rsaref_MD4_CTX *); /* MD4.H ENDS */ uint64_t net_bytesout = 0; uint64_t net_bytesin = 0; static uint64_t internal_htonll(uint64_t n) { static int swapped_byte_order = -1; uint64_t retval; if (swapped_byte_order == -1) { if (htonl(0xffff0000) == 0xffff0000) { swapped_byte_order = 0; } else { |
︙ | ︙ | |||
106 107 108 109 110 111 112 | retval = ((uint64_t) htonl(n & 0xFFFFFFFFLLU)) << 32; retval |= htonl((n & 0xFFFFFFFF00000000LLU) >> 32); } return(retval); } | | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | retval = ((uint64_t) htonl(n & 0xFFFFFFFFLLU)) << 32; retval |= htonl((n & 0xFFFFFFFF00000000LLU) >> 32); } return(retval); } static uint64_t internal_ntohll(uint64_t n) { static int swapped_byte_order = -1; uint64_t retval; if (swapped_byte_order == -1) { if (htonl(0xffff0000) == 0xffff0000) { swapped_byte_order = 0; } else { |
︙ | ︙ | |||
336 337 338 339 340 341 342 | if (!buf) { close(fd); close(sockfd); CHECKPOINT; return(-1); } | | | | 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | if (!buf) { close(fd); close(sockfd); CHECKPOINT; return(-1); } filesize = internal_htonll(filesize); blocksize = htonl(blocksize); write_ret = write_large_net(sockfd, &filesize, sizeof(filesize)); if (write_ret != sizeof(filesize)) { close(fd); close(sockfd); CHECKPOINT; return(-1); } write_ret = write_large_net(sockfd, &blocksize, sizeof(blocksize)); if (write_ret != sizeof(blocksize)) { close(fd); close(sockfd); CHECKPOINT; return(-1); } filesize = internal_ntohll(filesize); blocksize = ntohl(blocksize); while (1) { read_ret = read_large(fd, buf, blocksize); if (read_ret < 0) { retval = -1; CHECKPOINT; |
︙ | ︙ | |||
513 514 515 516 517 518 519 | close(fd); close(sockfd); close(master_sockfd); CHECKPOINT; return(-1); } | | | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | close(fd); close(sockfd); close(master_sockfd); CHECKPOINT; return(-1); } filesize_s = filesize = internal_ntohll(filesize); blocksize = ntohl(blocksize); blockok_size = filesize / (8 * blocksize); if ((filesize % (8 * blocksize)) != 0) { blockok_size++; } |
︙ | ︙ |