Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site turtlevax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!decwrl!turtlevax!edmund From: edmund@turtlevax.UUCP (Ed Trujillo) Newsgroups: net.bugs.4bsd Subject: unnecessary bcopy in namei() Message-ID: <713@turtlevax.UUCP> Date: Thu, 4-Apr-85 18:43:33 EST Article-I.D.: turtleva.713 Posted: Thu Apr 4 18:43:33 1985 Date-Received: Sat, 6-Apr-85 02:01:49 EST Distribution: net Organization: CADLINC, Inc. @ Menlo Park, CA Lines: 34 Index: sys/ufs_nami.c 4.2BSD Description: The bcopy done once a file name is found in the namei() routine doesn't seem to be necessary. By inspection of the code, we find ourselves at the label "found:" iff ep->d_namlen == u.u_dent.d_namlen && !bcmp(u.u_dent.d_name, ep->d_name, ep->d_namlen). Since we know that the two names match (ep and u.u_dent.d_name) at the label found and that u.u_dent.d_namlen == ep->d_namlen the wholesale copy of ep isn't necessary. We do need the inode number and reclen. We replace the bcopy by a simple assignment. Repeat-By: Inspect the code. Fix: replace the line after the label "found" : bcopy((caddr_t)ep, (caddr_t)&u.u_dent, (u_int)DIRSIZ(ep)); by the lines : u.u_dent.d_ino = ep->d_ino; u.u_dent.d_reclen = ep->d_reclen; -- Ed(mund) Trujillo @ CADLINC, Menlo Park, CA {amd,decwrl,nsc,seismo,spar}!turtlevax!edmund