Magellan Linux

Diff of /trunk/mkinitrd-magellan/klibc/usr/utils/cpio.c

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

revision 1296 by niro, Fri Apr 24 18:32:46 2009 UTC revision 1297 by niro, Fri May 27 15:12:11 2011 UTC
# Line 104  struct new_cpio_header { Line 104  struct new_cpio_header {
104   char *c_tar_linkname;   char *c_tar_linkname;
105  };  };
106    
107  /* Total number of bytes read and written for all files.    /* Total number of bytes read and written for all files.
108   * Now that many tape drives hold more than 4Gb we need more than 32   * Now that many tape drives hold more than 4Gb we need more than 32
109   *  bits to hold input_bytes and output_bytes.   *  bits to hold input_bytes and output_bytes.
110   */   */
# Line 157  static void tape_fill_input_buffer(int i Line 157  static void tape_fill_input_buffer(int i
157     descriptor OUT_DES and reset `output_size' and `out_buff'.     descriptor OUT_DES and reset `output_size' and `out_buff'.
158     If `swapping_halfwords' or `swapping_bytes' is set,     If `swapping_halfwords' or `swapping_bytes' is set,
159     do the appropriate swapping first.  Our callers have     do the appropriate swapping first.  Our callers have
160     to make sure to only set these flags if `output_size'     to make sure to only set these flags if `output_size'
161     is appropriate (a multiple of 4 for `swapping_halfwords',     is appropriate (a multiple of 4 for `swapping_halfwords',
162     2 for `swapping_bytes').  The fact that DISK_IO_BLOCK_SIZE     2 for `swapping_bytes').  The fact that DISK_IO_BLOCK_SIZE
163     must always be a multiple of 4 helps us (and our callers)     must always be a multiple of 4 helps us (and our callers)
# Line 365  add_inode(unsigned long node_num, char * Line 365  add_inode(unsigned long node_num, char *
365   for (i = 0; i < hash_num; i++)   for (i = 0; i < hash_num; i++)
366   hash_insert(old_table[i]);   hash_insert(old_table[i]);
367    
368   if (old_table != NULL)   free(old_table);
  free(old_table);  
369   }   }
370    
371   /* Insert the new record and increment the count of elements in the   /* Insert the new record and increment the count of elements in the
# Line 407  static char *find_inode_file(unsigned lo Line 406  static char *find_inode_file(unsigned lo
406   return NULL;   return NULL;
407  }  }
408    
409  /* Try and create a hard link from FILE_NAME to another file  /* Try and create a hard link from FILE_NAME to another file
410     with the given major/minor device number and inode.  If no other     with the given major/minor device number and inode.  If no other
411     file with the same major/minor/inode numbers is known, add this file     file with the same major/minor/inode numbers is known, add this file
412     to the list of known files and associated major/minor/inode numbers     to the list of known files and associated major/minor/inode numbers
# Line 482  try_existing_file(struct new_cpio_header Line 481  try_existing_file(struct new_cpio_header
481   return 0;   return 0;
482  }  }
483    
484  /* The newc and crc formats store multiply linked copies of the same file  /* The newc and crc formats store multiply linked copies of the same file
485     in the archive only once.  The actual data is attached to the last link     in the archive only once.  The actual data is attached to the last link
486     in the archive, and the other links all have a filesize of 0.  When a     in the archive, and the other links all have a filesize of 0.  When a
487     file in the archive has multiple links and a filesize of 0, its data is     file in the archive has multiple links and a filesize of 0, its data is
488     probably "attatched" to another file in the archive, so we can't create     probably "attatched" to another file in the archive, so we can't create
489     it right away.  We have to "defer" creating it until we have created     it right away.  We have to "defer" creating it until we have created
490     the file that has the data "attatched" to it.  We keep a list of the     the file that has the data "attatched" to it.  We keep a list of the
# Line 680  copyin_regular_file(struct new_cpio_head Line 679  copyin_regular_file(struct new_cpio_head
679    
680   tape_skip_padding(in_file_des, file_hdr->c_filesize);   tape_skip_padding(in_file_des, file_hdr->c_filesize);
681   if (file_hdr->c_nlink > 1) {   if (file_hdr->c_nlink > 1) {
682   /* (see comment above for how the newc and crc formats   /* (see comment above for how the newc and crc formats
683     store multiple links).  Now that we have the data     store multiple links).  Now that we have the data
684     for this file, create any other links to it which     for this file, create any other links to it which
685     we defered.  */     we defered.  */
686   create_defered_links(file_hdr);   create_defered_links(file_hdr);
# Line 914  static void read_in_new_ascii(struct new Line 913  static void read_in_new_ascii(struct new
913   ah += 8;   ah += 8;
914   }   }
915   /* Read file name from input.  */   /* Read file name from input.  */
916   if (file_hdr->c_name != NULL)   free(file_hdr->c_name);
  free(file_hdr->c_name);  
917   file_hdr->c_name = (char *)xmalloc(file_hdr->c_namesize);   file_hdr->c_name = (char *)xmalloc(file_hdr->c_namesize);
918   tape_buffered_read(file_hdr->c_name, in_des,   tape_buffered_read(file_hdr->c_name, in_des,
919     (long)file_hdr->c_namesize);     (long)file_hdr->c_namesize);

Legend:
Removed from v.1296  
changed lines
  Added in v.1297