[comp.os.minix] ST Minix 1.5.0 upgrade problems: fs cdiff's.

mpsimon@phoenix.Princeton.EDU (M. Patrick Simon) (02/15/90)

ST Minix hackers--

     I am having problems patching the Minix 1.1 fs sources to
get 1.5. I have documented the problem in the shell archive below
(created on an Ultrix machine with the command:
shar readme fstest.crc time.c.cdif write.c.cdif > filename).
Any help would be appreciated.

--Patrick Simon    mpsimon@phoenix.princeton.edu    2-14-90

------------------cut everything above and including this line-----------
# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by phoenix!mpsimon on Wed Feb 14 13:31:37 EST 1990
# Contents:  readme fstest.crc time.c.cdif write.c.cdif
 
echo x - readme
sed 's/^@//' > "readme" <<'@//E*O*F readme//'

I am having some difficulties with patching the files in the fs
source directory on the ST. It looks to me like some of the .cdif files
are incorrect in fsshar1 and fsshar2, but I could have problems
with patch, or some other problems. I have worked through steps 1-32
in upgrading ST Minix to 1.5.0, and have used many of the suggestions
from the net to get through the problems encountered there, apparently
with success. Step 33 isn't working right. The crc's that I have after
patching from the fsshar1-2 distributions on top of the ST Minix 1.1
are included in the file fstest.crc, and they do not match for several files.
(Search for "crc-error" to locate those files which do not match.)
Also included are two of the .cdif files, modified by me to indicate
where I think the first error is in each of these files (there are
probably more). (Search for ERROR to locate the lines where I think
errors are.) The errors in the .cdif files appear to be omission of text
from the original files. Patch tossed out error messages for several files,
including the ones I have here, but I was not able to redirect patch's
output to a file to save those messages.

Anyone on the net have any suggestions on how to proceed?

--Patrick Simon    mpsimon@phoenix.princeton.edu       2-14-90

@//E*O*F readme//
chmod u=rw,g=,o= readme
 
echo x - fstest.crc
sed 's/^@//' > "fstest.crc" <<'@//E*O*F fstest.crc//'
19878   4197 at_makefile
46997   3007 buf.h
01929  11048 cache.c         crc-error
12890   3093 const.h         crc-error
41046    276 dev.h
21550   9093 device.c
09749    518 file.h
22121   3203 filedes.c
33856   1507 fproc.h
17961    861 fs.crc         crc-irrelevant-difference
25637    635 fs.h
65024   3629 glo.h
40506   7646 inode.c         crc-error
19687   1940 inode.h         crc-error
61434   5196 link.c
08114  16494 main.c
02299   8610 misc.c         crc-error
22925   6079 mount.c
14230  10462 open.c
44343   1617 param.h
51037  10720 path.c
46842   4266 pc_makefile
03416   8791 pipe.c
56875   5721 protect.c         crc-error
00000      0 proto.h
10057   1442 putc.c
01285  14898 read.c
58485   3255 st_makefile
36899   5301 stadir.c         crc-error
13682   8767 super.c         crc-error
36161   2071 super.h
48421   3695 table.c
37254   2404 time.c         crc-error
31979    705 type.h
08538   5279 utility.c
58403   7171 write.c         crc-error
@//E*O*F fstest.crc//
chmod u=rw,g=,o= fstest.crc
 
echo x - time.c.cdif
sed 's/^@//' > "time.c.cdif" <<'@//E*O*F time.c.cdif//'
*** ../../110/fs/time.c	Mon Jan  8 09:08:06 1990
--- time.c	Tue Jan  2 14:02:20 1990
***************
*** 7,22 ****
   *   do_tims:	perform the TIMES system call
   */
  
! #include "../h/const.h"
! #include "../h/type.h"
! #include "../h/callnr.h"
! #include "../h/com.h"
! #include "../h/error.h"
! #include "const.h"
! #include "type.h"
  #include "file.h"
  #include "fproc.h"
- #include "glo.h"
  #include "inode.h"
  #include "param.h"
  
--- 7,17 ----
   *   do_tims:	perform the TIMES system call
   */
  
! #include "fs.h"
! #include <minix/callnr.h>
! #include <minix/com.h>
  #include "file.h"
  #include "fproc.h"
  #include "inode.h"
  #include "param.h"
  
***************
*** 31,37 ****
  
    register struct inode *rip;
    register int r;
-   extern struct inode *eat_path();
  
    /* Temporarily open the file. */
    if (fetch_name(utime_file, utime_length, M1) != OK) return(err_code);
--- 26,31 ----   <-- ERROR, shouldn't 6 lines of c code follow?
***************
*** 40,45 ****
--- 34,40 ----
    /* Only the owner of a file or the super_user can change its time. */
    r = OK;
    if (rip->i_uid != fp->fp_effuid && !super_user) r = EPERM;
+   if (read_only(rip) != OK) r = EROFS;	/* not even su can touch if R/O */
    if (r == OK) {
  	rip->i_modtime = update_time;
  	rip->i_dirt = DIRTY;
***************
*** 58,65 ****
  {
  /* Perform the time(tp) system call. */
  
-   extern real_time clock_time();
- 
    reply_l1 = clock_time();	/* return time in seconds */
    return(OK);
  }
--- 53,58 ----
***************
*** 89,95 ****
  {
  /* Perform the times(buffer) system call. */
  
!   real_time t[4];
  
    sys_times(who, t);
    reply_t1 = t[0];
--- 82,88 ----
  {
  /* Perform the times(buffer) system call. */
  
!   time_t t[4];
  
    sys_times(who, t);
    reply_t1 = t[0];
@//E*O*F time.c.cdif//
chmod u=rw,g=,o= time.c.cdif
 
echo x - write.c.cdif
sed 's/^@//' > "write.c.cdif" <<'@//E*O*F write.c.cdif//'
*** ../../110/fs/write.c	Mon Jan  8 09:08:09 1990
--- write.c	Tue Jan  2 14:02:22 1990
***************
*** 8,25 ****
   *   new_block:    acquire a new block
   */
  
! #include "../h/const.h"
! #include "../h/type.h"
! #include "../h/error.h"
! #include "const.h"
! #include "type.h"
  #include "buf.h"
  #include "file.h"
  #include "fproc.h"
- #include "glo.h"
  #include "inode.h"
  #include "super.h"
  
  /*===========================================================================*
   *				do_write				     *
   *===========================================================================*/
--- 8,22 ----
   *   new_block:    acquire a new block
   */
  
! #include "fs.h"
  #include "buf.h"
  #include "file.h"
  #include "fproc.h"
  #include "inode.h"
  #include "super.h"
  
+ FORWARD int write_map();
+ 
  /*===========================================================================*
   *				do_write				     *
   *===========================================================================*/
***************
*** 35,41 ****
   *===========================================================================*/
  PRIVATE int write_map(rip, position, new_zone)
  register struct inode *rip;	/* pointer to inode to be changed */
! file_pos position;		/* file address to be mapped */
  zone_nr new_zone;		/* zone # to be inserted */
  {
  /* Write a new zone into an inode. */
--- 32,38 ----
   *===========================================================================*/
  PRIVATE int write_map(rip, position, new_zone)
  register struct inode *rip;	/* pointer to inode to be changed */
! off_t position;			/* file address to be mapped */
  zone_nr new_zone;		/* zone # to be inserted */
  {
  /* Write a new zone into an inode. */
***************
*** 47,56 ****
    struct buf *bp;
    int new_ind, new_dbl;
  
-   extern zone_nr alloc_zone();
-   extern struct buf *get_block();
-   extern real_time clock_time();
- 
    rip->i_dirt = DIRTY;		/* inode will be changed */
    bp = NIL_BUF;
    scale = scale_factor(rip);	/* for zone-block conversion */
--- 44,49 ----   <-- ERROR, shouldn't 6 lines of c code follow?
***************
*** 58,64 ****
  
    /* Is 'position' to be found in the inode itself? */
    if (zone < NR_DZONE_NUM) {
! 	rip->i_zone[zone] = new_zone;
  	rip->i_modtime = clock_time();
  	return(OK);
    }
--- 51,57 ----
  
    /* Is 'position' to be found in the inode itself? */
    if (zone < NR_DZONE_NUM) {
! 	rip->i_zone[(int) zone] = new_zone;
  	rip->i_modtime = clock_time();
  	return(OK);
    }
***************
*** 109,115 ****
    b = (block_nr) *zp << scale;
    bp = get_block(rip->i_dev, b, (new_ind ? NO_READ : NORMAL) );
    if (new_ind) zero_block(bp);
!   bp->b_ind[excess] = new_zone;
    rip->i_modtime = clock_time();
    bp->b_dirt = DIRTY;
    put_block(bp, INDIRECT_BLOCK);
--- 102,108 ----
    b = (block_nr) *zp << scale;
    bp = get_block(rip->i_dev, b, (new_ind ? NO_READ : NORMAL) );
    if (new_ind) zero_block(bp);
!   bp->b_ind[(int) excess] = new_zone;
    rip->i_modtime = clock_time();
    bp->b_dirt = DIRTY;
    put_block(bp, INDIRECT_BLOCK);
***************
*** 120,128 ****
  /*===========================================================================*
   *				clear_zone				     *
   *===========================================================================*/
! PUBLIC clear_zone(rip, pos, flag)
  register struct inode *rip;	/* inode to clear */
! file_pos pos;			/* points to block to clear */
  int flag;			/* 0 if called by read_write, 1 by new_block */
  {
  /* Zero a zone, possibly starting in the middle.  The parameter 'pos' gives
--- 113,121 ----
  /*===========================================================================*
   *				clear_zone				     *
   *===========================================================================*/
! PUBLIC void clear_zone(rip, pos, flag)
  register struct inode *rip;	/* inode to clear */
! off_t pos;			/* points to block to clear */
  int flag;			/* 0 if called by read_write, 1 by new_block */
  {
  /* Zero a zone, possibly starting in the middle.  The parameter 'pos' gives
***************
*** 132,142 ****
  
    register struct buf *bp;
    register block_nr b, blo, bhi;
!   register file_pos next;
    register int scale;
    register zone_type zone_size;
-   extern struct buf *get_block();
-   extern block_nr read_map();
  
    /* If the block size and zone size are the same, clear_zone() not needed. */
    if ( (scale = scale_factor(rip)) == 0) return;
--- 125,133 ----
  
    register struct buf *bp;
    register block_nr b, blo, bhi;
!   register off_t next;
    register int scale;
    register zone_type zone_size;
  
    /* If the block size and zone size are the same, clear_zone() not needed. */
    if ( (scale = scale_factor(rip)) == 0) return;
***************
*** 165,171 ****
   *===========================================================================*/
  PUBLIC struct buf *new_block(rip, position)
  register struct inode *rip;	/* pointer to inode */
! file_pos position;		/* file pointer */
  {
  /* Acquire a new block and return a pointer to it.  Doing so may require
   * allocating a complete zone, and then returning the initial block.
--- 156,162 ----
   *===========================================================================*/
  PUBLIC struct buf *new_block(rip, position)
  register struct inode *rip;	/* pointer to inode */
! off_t position;			/* file pointer */
  {
  /* Acquire a new block and return a pointer to it.  Doing so may require
   * allocating a complete zone, and then returning the initial block.
***************
*** 178,187 ****
    zone_type zone_size;
    int scale, r;
    struct super_block *sp;
-   extern struct buf *get_block();
-   extern struct super_block *get_super();
-   extern block_nr read_map();
-   extern zone_nr alloc_zone();
  
    /* Is another block available in the current zone? */
    if ( (b = read_map(rip, position)) == NO_BLOCK) {
--- 169,174 ----
***************
*** 216,222 ****
  /*===========================================================================*
   *				zero_block				     *
   *===========================================================================*/
! PUBLIC zero_block(bp)
  register struct buf *bp;	/* pointer to buffer to zero */
  {
  /* Zero a block. */
--- 203,209 ----
  /*===========================================================================*
   *				zero_block				     *
   *===========================================================================*/
! PUBLIC void zero_block(bp)
  register struct buf *bp;	/* pointer to buffer to zero */
  {
  /* Zero a block. */
@//E*O*F write.c.cdif//
chmod u=rw,g=,o= write.c.cdif
 
exit 0