2

I'm taking a course in OS involving minix and I would like some advice.

I'm trying to figure out how to modify the minix so that it's ls -s will do the same thing as in linux.

I understand that although minix and linux ls -s are similar, when a file is purposely made using: dd of=XXXX bs=4096 count=1 seek=5, linux will display the file size is 4 blocks while minix will display 24 blocks.

I understand why this happens, because unlike minix, linux recognises there is 20 empty blocks, so it reports it's logical size, ignoring the empty blocks.
I've been trying to figure out where to start, my lecturer pointed me to servers/fs/stadir.c so I've looked up the class.

The only part that I find relevant(involves st_size) is:

statbuf.st_size = rip->i_size;

      if (rip->i_pipe == I_PIPE) {
            statbuf.st_mode &= ~I_REGULAR;  /* wipe out I_REGULAR bit for pipes */
            if (fil_ptr != NIL_FILP && fil_ptr->filp_mode & R_BIT) 
                    statbuf.st_size -= fil_ptr->filp_pos;
      }

This is line 27700-27706 of minix source code.

Can someone give me tip on where to look, or if I'm looking at the correct place, hint or something.

ymn
  • 2,175
  • 2
  • 21
  • 39
solaris
  • 33
  • 3

0 Answers0