/[hurd]/hurd/fatfs/fat.c
ViewVC logotype

Diff of /hurd/fatfs/fat.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by jbailey, Tue Jul 29 14:58:44 2003 UTC revision 1.4 by marcus, Sat Aug 2 21:32:52 2003 UTC
# Line 385  fat_extend_chain (struct node *node, clu Line 385  fat_extend_chain (struct node *node, clu
385          dn->last = dn->first = *table;          dn->last = dn->first = *table;
386        return 0;        return 0;
387      }      }
             
   spin_lock(&dn->chain_extension_lock);  
388        
389      spin_lock(&dn->chain_extension_lock);
390    
391    /* If we already have what we need, or we have all clusters that are    /* If we already have what we need, or we have all clusters that are
392       available without allocating new ones, go out.  */       available without allocating new ones, go out.  */
393    if (new_last_cluster < dn->length_of_chain    if (new_last_cluster < dn->length_of_chain
394        || (!create && dn->chain_complete))        || (!create && dn->chain_complete))
395      return 0;      {
396          spin_unlock(&dn->chain_extension_lock);
397          return 0;
398        }
399    
400    left = new_last_cluster + 1 - dn->length_of_chain;    left = new_last_cluster + 1 - dn->length_of_chain;
401    
# Line 517  fat_truncate_node (struct node *node, cl Line 520  fat_truncate_node (struct node *node, cl
520        /* Deallocate the complete file.  */        /* Deallocate the complete file.  */
521        node->dn->start_cluster = 0;        node->dn->start_cluster = 0;
522        pos = count = offs = 0;        pos = count = offs = 0;
523          node->dn->last = 0;
524      }      }
525    else    else
526      {      {
# Line 525  fat_truncate_node (struct node *node, cl Line 529  fat_truncate_node (struct node *node, cl
529        while (count-- > 0)        while (count-- > 0)
530          {          {
531            assert (next);            assert (next);
532    
533              /* This cluster is now the last cluster in the chain.  */
534              if (count == 0)
535                node->dn->last = next;
536    
537            next = next->next;            next = next->next;
538          }          }
539        assert (next);        assert (next);
# Line 566  fat_truncate_node (struct node *node, cl Line 575  fat_truncate_node (struct node *node, cl
575        free (next);        free (next);
576        next = next_next;        next = next_next;
577      }      }
578    
579      if (clusters_to_keep == 0)
580        node->dn->first = 0;
581      
582      node->dn->length_of_chain = clusters_to_keep;
583  }  }
584    
585    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26