[comp.os.minix] symbolic links for 1.5.3

stailey@iris613.gsfc.nasa.gov (Ken Stailey) (02/22/90)

Symbolic links are now available for MINIX 1.5.3 PC & ST
If you would like the beta upgrade kit please mail me a note
saying so.

For those of you who do not have access to a BSD UNIX or
System V R.4 et. al, a symbolic link is like a filename
that get substituted for another pathname when you try to
access it.  It is not limited to only joining things that
are on one disk.  It can be used to link directories
across filesystems to.

For example I have my manfiles & doc files on one floppy disk.
I can mount it in one location and link both /usr/man &
/usr/doc to it.  The more disks you have the more useful
it becomes to link between them.

This table summarizes the increase in size that the kit
causes to the fs.

  text	  data	   bss	 stack	memory
 27704	  1846	 40390	 61132	131072	fs.mix
  text	  data	   bss	 stack	memory
 26048	  1846	 40386	 62792	131072	../fs.old/fs.mix
======    ====   =====   =====  ======
  1656       0       4   -1660       0

This outline describes the changes that are made to the fs.

fs/path.c:
	o  modify eat_path() to check for sym. links at the end
	   of a path & loop back if one is found.
	o  modify last_dir() to check for sym. links and put
	   their targets into the path
	o  add slink_traverse() to change the path & curr.
	   directory to the base of the sym. link

fs/link.c:
	o  modify do_unlink() to work on sym. links by changing
	   their mode to regular & wipe_inode()ing them

fs/open.c:
	o  add do_slink() to make new sym. links
	o  modify new_inode() in a fashion similar to eat_path()

fs/inode.c:
	o  modify put_inode() to avoid truncating sym. links
	   even if their count is zero

fs/stadir.c:
	o  add do_lstat() to return the modes of a link instead
	   of its target
	o  add do_rdlink() to return the name of the target

fs/table.c:
	o  add the call vectors for do_slink(), do_rdlink() & do_lstat()

fs/glo.h:
	o  add a global var for number of symbolic link traverses
	o  add a global flag used to tell last_dir to reset # traverses

fs/proto.h:
	o  add prototypes for:  do_slink(), do_rdlink(), do_lstat(),
	   slink_traverse(),

include/errno.h:
	o  add ELOOP for "too many levels (traverses) of sym links"
	o  add ENOTSLINK for "not a sym. link" (used by do_rdlink())

include/limits.h:
	o  add SLINK_PATH_MAX = 30

minix/callnr.h:
	o  add SLINK = 45
	o  add LSTAT = 49
	o  add RDLINK = 50

minix/const.h:
	o  add I_SYM_LINK = 01000

sys/stat.h:
	o  add S_IFLNK = 01000
	o  add S_ISLNK macro
	o  modify S_IFMT = 0171000

libc.a:
	o  add interface functions for: symlink(), readlink() & lstat()
	o  change perror()'s sys_errlist to include new error numbers

tools:
	ls: change to use lstat() instead of stat()
	inodes: no changes -- already sym. link ready 8-)
	ln: change to support -s option
	rm: change to not reject sym. links because of access() saying
	    that the target is a directory.
	fsck: change to know about sym. links


INET stailey@iris613.gsfc.nasa.gov
UUCP {backbone}!dftsrv!iris613!stailey