- ndp->ni_dent.d_ino = ip->i_number;
- newentrysize = DIRSIZ(&ndp->ni_dent);
- if (ndp->ni_count == 0) {
+#ifdef DIAGNOSTIC
+ if ((cnp->cn_flags & SAVENAME) == 0)
+ panic("direnter: missing name");
+#endif
+ dp = VTOI(dvp);
+ newdir.d_ino = ip->i_number;
+ newdir.d_namlen = cnp->cn_namelen;
+ bcopy(cnp->cn_nameptr, newdir.d_name, (unsigned)cnp->cn_namelen + 1);
+ if (dvp->v_mount->mnt_maxsymlinklen > 0)
+ newdir.d_type = IFTODT(ip->i_mode);
+ else {
+ newdir.d_type = 0;
+# if (BYTE_ORDER == LITTLE_ENDIAN)
+ { u_char tmp = newdir.d_namlen;
+ newdir.d_namlen = newdir.d_type;
+ newdir.d_type = tmp; }
+# endif
+ }
+ newentrysize = DIRSIZ(FSFMT(dvp), &newdir);
+ if (dp->i_count == 0) {