Subject: misc/3335: optional size reduction in sys/lib/libsa/nfs.c
To: None <gnats-bugs@gnats.netbsd.org>
From: Matthias Drochner <drochner@zelz26.zel.kfa-juelich.de>
List: netbsd-bugs
Date: 03/15/1997 15:06:30
>Number:         3335
>Category:       misc
>Synopsis:       sometimes every byte of ROM space is valuable
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 15 06:20:02 1997
>Last-Modified:
>Originator:     Matthias Drochner
>Organization:
	KFA Juelich
>Release:        NetBSD-current
>Environment:
	NetBSD-current, i386
System: NetBSD zelz26 1.2C NetBSD 1.2C (TULIP2) #1: Tue Mar 11 16:31:29 MET 1997 drochner@zelz26:/home/drochner/netbsd-970206/sys/arch/i386/compile/TULIP2 i386


>Description:
	When some bytes decide if a program fits into a ROM, one looks for
places where to save space. There are probably more places in libsa where some
bytes can be squeezed out, but symlink support in NFS makes a difference of more
than 700 bytes on the i386. Depending on the setup, symlinks might be no big
gain because they point into filesystems which are not mounted by the bootloader.
The appended patches put the NFS symlink support into conditionals
"#ifndef NFS_NOSYMLINK".
>How-To-Repeat:
	Try to make a 32k BOOT EPROM with RARP/BOOTPARAM/NFS and compression
support.
>Fix:
*** /zelnfs/p3/drochner/netbsd-current/src/sys/lib/libsa/nfs.c  Fri Dec 27 13:19:51 1996
--- nfs.c       Tue Mar 11 15:12:53 1997
***************
*** 82,85 ****
--- 82,86 ----
  };

+ #ifndef NFS_NOSYMLINK
  struct nfs_readlnk_repl {
        n_long  errno;
***************
*** 87,90 ****
--- 88,92 ----
        char    path[NFS_MAXPATHLEN];
  };
+ #endif

  struct nfs_iodesc {
***************
*** 227,230 ****
--- 229,233 ----
  }

+ #ifndef NFS_NOSYMLINK
  /*
   * Get the destination of a symbolic link.
***************
*** 271,274 ****
--- 274,278 ----
        return (0);
  }
+ #endif

  /*
***************
*** 382,385 ****
--- 386,390 ----
  {
        struct nfs_iodesc *newfd, *currfd;
+ #ifndef NFS_NOSYMLINK
        register char *cp, *ncp;
        register int c;
***************
*** 387,390 ****
--- 392,396 ----
        char linkbuf[NFS_MAXPATHLEN + 1];
        int nlinks = 0;
+ #endif
        int error = 0;

***************
*** 401,404 ****
--- 407,411 ----
        newfd = 0;

+ #ifndef NFS_NOSYMLINK
        cp = path;
        while (*cp) {
***************
*** 495,498 ****
--- 502,513 ----

  out:
+ #else
+       /* allocate file system specific data structure */
+       currfd = alloc(sizeof(*currfd));
+       currfd->iodesc = nfs_root_node.iodesc;
+       currfd->off = 0;
+
+       error = nfs_lookupfh(&nfs_root_node, path, currfd);
+ #endif
        if (!error) {
                f->f_fsdata = (void *)currfd;

>Audit-Trail:
>Unformatted: