unnecessary bcopy in namei()
Ed Trujillo
edmund at turtlevax.UUCP
Fri Apr 5 09:43:33 AEST 1985
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
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list