[comp.os.minix] Version 1.2 mkfs.c

ast@cs.vu.nl (Andy Tanenbaum) (07/28/87)

Here is the diff listing between the latest mkfs.c and the 1.1 version.  To
install these fixes with Erik Baalbergen's fix program, type:
   fix mkfs.c diffs >newmkfs.c

Andy Tanenbaum (ast@cs.vu.nl)

------------------------ Cut here for diff listing -----------------
5c5
<  *	with blocksize = zonesize. During the course of action the
---
>  *	with blocksize = zonesize. During the course of time the
10,12c10,12
<  *	To compile this program for MS-DOS, say cc -DDOS mkfs.c diskio.asm
<  *	To compile this program for UNIX, say cc -DUNIX mkfs.c
<  *	To compile this program for MINIX, say cc mkfs.c
---
>  *	To compile this program for MS-DOS, use: cc -DDOS mkfs.c diskio.asm
>  *	To compile this program for UNIX,   use: cc -DUNIX mkfs.c
>  *	To compile this program for MINIX,  use: cc mkfs.c
32a33,34
> #undef major
> #undef minor
73,75c75,77
<     nrinodes, lct=1, disk, fd, print=0, file=0, override=0, simple=0;
< 
< long current_time;
---
>     nrinodes, lct=1, disk, fd, print=0, file=0, override=0, simple=0, dflag;
> 
> long current_time, bin_time;
106,108c108,119
<   /* process parameters and switches */
< 
<   current_time = time(0L);
---
> 
>   /* Get two times, the current time and the mod time of the binary of
>    * mkfs itself.  When the -d flag is used, the later time is put into
>    * the i_modtimes of all the files.  This feature is useful when producing
>    * a set of file systems, and one wants all the times to be identical.
>    * First you set the time of the mkfs binary to what you want, then go.
>    */  
>   current_time = time(0L);	/* time mkfs is being run */
>   stat(argv[0], &statbuf);
>   bin_time = statbuf.st_mtime;	/* time when mkfs binary was last modified */
> 
>   /* process parameters and switches */
128c139,140
< 		  default :
---
> 		    case 'd' : current_time = bin_time; dflag=1; break;
> 		    default  :
364a377
>   long timeval;
375c388,389
<      if (ct) add_zone (inode, z, (long) j, file_time(f) );
---
>      timeval = (dflag ? current_time : file_time(f) );
>      if (ct) add_zone (inode, z, (long) j, timeval );
448c462,463
<   int b, off, blk[INTS_PER_BLOCK], indir, i;
---
>   int b, off, indir, i;
>   zone_nr blk[NR_INDIRECTS];
472,474c487,489
<   for (i = 0; i < INTS_PER_BLOCK; i++)
< 	if (blk[i] == 0) {
< 		blk[i] = z;
---
>   for (i = 0; i < NR_INDIRECTS; i++)
> 	if (blk[i] == 0) {
> 		blk[i] = (zone_nr) z;
571c586
<   char buf[BLOCK_SIZE];
---
>   int buf[BLOCK_SIZE/sizeof(int)];
575,576c590,591
< 	w = i/8;
< 	s = i % 8;
---
> 	w = i / (8*sizeof(int));
> 	s = i % (8*sizeof(int));
622c637
<   for (k = 0; k < MAX_TOKEN; k++) parse[k] = 0;
---
>   for (k = 0; k < MAX_TOKENS; k++) parse[k] = 0;
678c693
<   write (2, s, s0-s );
---
>   write (2, s, (int)(s0-s) );