Changeset 11603
- Timestamp:
- Dec 28, 2010, 8:38:55 AM (12 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/fdlimit.c
r11602 r11603 73 73 74 74 static tr_bool 75 preallocate FileSparse( int fd, uint64_t length )75 preallocate_file_sparse( int fd, uint64_t length ) 76 76 { 77 77 const char zero = '\0'; … … 95 95 96 96 static tr_bool 97 preallocate FileFull( const char * filename, uint64_t length )97 preallocate_file_full( const char * filename, uint64_t length ) 98 98 { 99 99 tr_bool success = 0; … … 376 376 377 377 if( writable && !alreadyExisted && ( allocation == TR_PREALLOCATE_FULL ) ) 378 if( preallocate FileFull( filename, file_size ) )378 if( preallocate_file_full( filename, file_size ) ) 379 379 tr_dbg( "Preallocated file \"%s\"", filename ); 380 380 … … 409 409 410 410 if( writable && !alreadyExisted && ( allocation == TR_PREALLOCATE_SPARSE ) ) 411 preallocate FileSparse( o->fd, file_size );411 preallocate_file_sparse( o->fd, file_size ); 412 412 413 413 /* Many (most?) clients request blocks in ascending order, … … 426 426 { 427 427 struct tr_cached_file * begin; 428 struct tr_cached_file * end;428 const struct tr_cached_file * end; 429 429 }; 430 430 … … 458 458 fileset_close_all( set ); 459 459 tr_free( set->begin ); 460 set-> begin = set->end= NULL;460 set->end = set->begin = NULL; 461 461 } 462 462 … … 504 504 } 505 505 506 static int 507 fileset_get_size( const struct tr_fileset * set ) 508 { 509 return set ? set->end - set->begin : 0; 510 } 511 506 512 /*** 507 513 **** … … 556 562 const char * filename, 557 563 tr_bool writable, 558 tr_preallocation_mode preallocation_mode,564 tr_preallocation_mode allocation, 559 565 uint64_t file_size ) 560 566 { … … 569 575 if( !cached_file_is_open( o ) ) 570 576 { 571 const int err = cached_file_open( o, filename, writable, preallocation_mode, file_size );577 const int err = cached_file_open( o, filename, writable, allocation, file_size ); 572 578 if( err ) { 573 579 errno = err; … … 738 744 739 745 int 740 tr_fdGetFileLimit( const tr_session * session ) 741 { 742 const struct tr_fileset * set = session && session->fdInfo ? &session->fdInfo->fileset : NULL; 743 return set ? set->end - set->begin : 0; 746 tr_fdGetFileLimit( tr_session * session ) 747 { 748 return fileset_get_size( get_fileset( session ) ); 744 749 } 745 750 -
trunk/libtransmission/fdlimit.h
r11602 r11603 25 25 void tr_fdSetFileLimit( tr_session * session, int limit ); 26 26 27 int tr_fdGetFileLimit( consttr_session * session );27 int tr_fdGetFileLimit( tr_session * session ); 28 28 29 29 void tr_fdSetGlobalPeerLimit( tr_session * session, int limit );
Note: See TracChangeset
for help on using the changeset viewer.