Changeset 228 for branches/samba-3.2.x/source/smbd/files.c
- Timestamp:
- May 26, 2009, 9:44:50 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.2.x/source/smbd/files.c
r133 r228 123 123 chain_fsp = fsp; 124 124 125 /* A new fsp invalidates a negative fsp_fi_cache. */ 126 if (fsp_fi_cache.fsp == NULL) { 127 ZERO_STRUCT(fsp_fi_cache); 128 } 125 /* A new fsp invalidates the positive and 126 negative fsp_fi_cache as the new fsp is pushed 127 at the start of the list and we search from 128 a cache hit to the *end* of the list. */ 129 130 ZERO_STRUCT(fsp_fi_cache); 131 132 conn->num_files_open++; 129 133 130 134 *result = fsp; … … 327 331 328 332 for (fsp=Files;fsp;fsp=fsp->next) { 329 if ( fsp->fh->fd != -1 && 330 file_id_equal(&fsp->file_id, &id)) { 333 if (file_id_equal(&fsp->file_id, &id)) { 331 334 /* Setup positive cache. */ 332 335 fsp_fi_cache.fsp = fsp; … … 349 352 350 353 for (fsp = start_fsp->next;fsp;fsp=fsp->next) { 351 if ( fsp->fh->fd != -1 && 352 file_id_equal(&fsp->file_id, &start_fsp->file_id)) { 354 if (file_id_equal(&fsp->file_id, &start_fsp->file_id)) { 353 355 return fsp; 354 356 } … … 428 430 fsp->fnum, files_used)); 429 431 430 /* this is paranoia, just in case someone tries to reuse the 431 information */ 432 ZERO_STRUCTP(fsp); 432 fsp->conn->num_files_open--; 433 433 434 434 if (fsp == chain_fsp) { … … 445 445 vfs_remove_fsp_extension(fsp->vfs_extension->owner, fsp); 446 446 } 447 448 /* this is paranoia, just in case someone tries to reuse the 449 information */ 450 ZERO_STRUCTP(fsp); 447 451 448 452 SAFE_FREE(fsp); … … 501 505 ****************************************************************************/ 502 506 503 NTSTATUS dup_file_fsp(files_struct *fsp, 504 uint32 access_mask, 505 uint32 share_access, 506 uint32 create_options, 507 files_struct **result) 508 { 509 NTSTATUS status; 510 files_struct *dup_fsp; 511 512 status = file_new(fsp->conn, &dup_fsp); 513 514 if (!NT_STATUS_IS_OK(status)) { 515 return status; 516 } 517 518 SAFE_FREE(dup_fsp->fh); 519 520 dup_fsp->fh = fsp->fh; 521 dup_fsp->fh->ref_count++; 522 523 dup_fsp->file_id = fsp->file_id; 524 dup_fsp->initial_allocation_size = fsp->initial_allocation_size; 525 dup_fsp->mode = fsp->mode; 526 dup_fsp->file_pid = fsp->file_pid; 527 dup_fsp->vuid = fsp->vuid; 528 dup_fsp->open_time = fsp->open_time; 529 dup_fsp->access_mask = access_mask; 530 dup_fsp->share_access = share_access; 531 dup_fsp->oplock_type = fsp->oplock_type; 532 dup_fsp->can_lock = fsp->can_lock; 533 dup_fsp->can_read = (access_mask & (FILE_READ_DATA)) ? True : False; 534 if (!CAN_WRITE(fsp->conn)) { 535 dup_fsp->can_write = False; 507 void dup_file_fsp(files_struct *from, 508 uint32 access_mask, 509 uint32 share_access, 510 uint32 create_options, 511 files_struct *to) 512 { 513 SAFE_FREE(to->fh); 514 515 to->fh = from->fh; 516 to->fh->ref_count++; 517 518 to->file_id = from->file_id; 519 to->initial_allocation_size = from->initial_allocation_size; 520 to->mode = from->mode; 521 to->file_pid = from->file_pid; 522 to->vuid = from->vuid; 523 to->open_time = from->open_time; 524 to->access_mask = access_mask; 525 to->share_access = share_access; 526 to->oplock_type = from->oplock_type; 527 to->can_lock = from->can_lock; 528 to->can_read = (access_mask & (FILE_READ_DATA)) ? True : False; 529 if (!CAN_WRITE(from->conn)) { 530 to->can_write = False; 536 531 } else { 537 dup_fsp->can_write = (access_mask & (FILE_WRITE_DATA | FILE_APPEND_DATA)) ? True : False; 538 } 539 dup_fsp->print_file = fsp->print_file; 540 dup_fsp->modified = fsp->modified; 541 dup_fsp->is_directory = fsp->is_directory; 542 dup_fsp->is_stat = fsp->is_stat; 543 dup_fsp->aio_write_behind = fsp->aio_write_behind; 544 string_set(&dup_fsp->fsp_name,fsp->fsp_name); 545 546 *result = dup_fsp; 547 return NT_STATUS_OK; 548 } 532 to->can_write = (access_mask & (FILE_WRITE_DATA | FILE_APPEND_DATA)) ? True : False; 533 } 534 to->print_file = from->print_file; 535 to->modified = from->modified; 536 to->is_directory = from->is_directory; 537 to->is_stat = from->is_stat; 538 to->aio_write_behind = from->aio_write_behind; 539 string_set(&to->fsp_name,from->fsp_name); 540 }
Note:
See TracChangeset
for help on using the changeset viewer.