Changeset 30150 in vbox for trunk/src/VBox/Additions/linux/sharedfolders/utils.c
- Timestamp:
- Jun 10, 2010 4:05:56 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/sharedfolders/utils.c
r28998 r30150 642 642 } 643 643 644 void 645 sf_dir_info_empty(struct sf_dir_info *p) 646 { 647 struct list_head *list, *pos, *tmp; 648 TRACE (); 649 list = &p->info_list; 650 list_for_each_safe (pos, tmp, list) { 651 struct sf_dir_buf *b; 652 b = list_entry (pos, struct sf_dir_buf, head); 653 b->nb_entries = 0; 654 b->used_bytes = 0; 655 b->free_bytes = 16384; 656 } 657 } 658 644 659 struct sf_dir_info * 645 660 sf_dir_info_alloc (void) … … 659 674 660 675 static struct sf_dir_buf * 661 sf_get_ non_empty_dir_buf (struct sf_dir_info *sf_d)676 sf_get_empty_dir_buf (struct sf_dir_info *sf_d) 662 677 { 663 678 struct list_head *list, *pos; … … 672 687 } 673 688 else { 674 if (b-> free_bytes >0) {689 if (b->used_bytes == 0) { 675 690 return b; 676 691 } … … 695 710 } 696 711 697 b = sf_get_non_empty_dir_buf (sf_d);698 712 for (;;) { 699 713 int rc; … … 702 716 uint32_t nb_ents; 703 717 718 b = sf_get_empty_dir_buf (sf_d); 704 719 if (!b) { 705 720 b = sf_dir_buf_alloc (); … … 709 724 goto fail1; 710 725 } 711 } 712 713 list_add (&b->head, &sf_d->info_list); 726 list_add (&b->head, &sf_d->info_list); 727 } 714 728 715 729 buf = b->buf; … … 747 761 b->free_bytes -= buf_size; 748 762 b->used_bytes += buf_size; 749 b = NULL; 750 751 if (RT_FAILURE (rc)) { 763 764 if (RT_FAILURE (rc)) 752 765 break; 753 }754 766 } 755 767 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.