1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

Change NDFREE() from a macro to a function for the time being; the macro

version caused intolerable bloat (30k).  I'm likely to revisit this with an
attempt at a smarter macro.

Bloat noticed by:       bde
This commit is contained in:
Eivind Eklund 2000-01-08 16:20:06 +00:00
parent 8ab2eee110
commit e12d97d239
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=55611
3 changed files with 69 additions and 36 deletions

View File

@ -56,6 +56,7 @@
#include <sys/kthread.h>
#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/reboot.h>
#include <sys/socket.h>
@ -2888,3 +2889,36 @@ vn_isdisk(vp)
return (1);
}
void
NDFREE(ndp, flags)
struct nameidata *ndp;
const uint flags;
{
if (!(flags & NDF_NO_FREE_PNBUF) &&
(ndp->ni_cnd.cn_flags & HASBUF)) {
zfree(namei_zone, ndp->ni_cnd.cn_pnbuf);
ndp->ni_cnd.cn_flags &= ~HASBUF;
}
if (!(flags & NDF_NO_DVP_UNLOCK) &&
(ndp->ni_cnd.cn_flags & LOCKPARENT) &&
ndp->ni_dvp != ndp->ni_vp)
VOP_UNLOCK(ndp->ni_dvp, 0, ndp->ni_cnd.cn_proc);
if (!(flags & NDF_NO_DVP_RELE) &&
(ndp->ni_cnd.cn_flags & (LOCKPARENT|WANTPARENT))) {
vrele(ndp->ni_dvp);
ndp->ni_dvp = NULL;
}
if (!(flags & NDF_NO_VP_UNLOCK) &&
(ndp->ni_cnd.cn_flags & LOCKLEAF) && ndp->ni_vp)
VOP_UNLOCK(ndp->ni_vp, 0, ndp->ni_cnd.cn_proc);
if (!(flags & NDF_NO_VP_RELE) &&
ndp->ni_vp) {
vrele(ndp->ni_vp);
ndp->ni_vp = NULL;
}
if (!(flags & NDF_NO_STARTDIR_RELE) &&
(ndp->ni_cnd.cn_flags & SAVESTART)) {
vrele(ndp->ni_startdir);
ndp->ni_startdir = NULL;
}
}

View File

@ -56,6 +56,7 @@
#include <sys/kthread.h>
#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/reboot.h>
#include <sys/socket.h>
@ -2888,3 +2889,36 @@ vn_isdisk(vp)
return (1);
}
void
NDFREE(ndp, flags)
struct nameidata *ndp;
const uint flags;
{
if (!(flags & NDF_NO_FREE_PNBUF) &&
(ndp->ni_cnd.cn_flags & HASBUF)) {
zfree(namei_zone, ndp->ni_cnd.cn_pnbuf);
ndp->ni_cnd.cn_flags &= ~HASBUF;
}
if (!(flags & NDF_NO_DVP_UNLOCK) &&
(ndp->ni_cnd.cn_flags & LOCKPARENT) &&
ndp->ni_dvp != ndp->ni_vp)
VOP_UNLOCK(ndp->ni_dvp, 0, ndp->ni_cnd.cn_proc);
if (!(flags & NDF_NO_DVP_RELE) &&
(ndp->ni_cnd.cn_flags & (LOCKPARENT|WANTPARENT))) {
vrele(ndp->ni_dvp);
ndp->ni_dvp = NULL;
}
if (!(flags & NDF_NO_VP_UNLOCK) &&
(ndp->ni_cnd.cn_flags & LOCKLEAF) && ndp->ni_vp)
VOP_UNLOCK(ndp->ni_vp, 0, ndp->ni_cnd.cn_proc);
if (!(flags & NDF_NO_VP_RELE) &&
ndp->ni_vp) {
vrele(ndp->ni_vp);
ndp->ni_vp = NULL;
}
if (!(flags & NDF_NO_STARTDIR_RELE) &&
(ndp->ni_cnd.cn_flags & SAVESTART)) {
vrele(ndp->ni_startdir);
ndp->ni_startdir = NULL;
}
}

View File

@ -171,42 +171,7 @@ NDINIT(ndp, op, flags, segflg, namep, p)
#define NDF_NO_FREE_PNBUF 0x00000020
#define NDF_ONLY_PNBUF (~NDF_NO_FREE_PNBUF)
#define NDFREE(ndp, flags) do { \
struct nameidata *_ndp = (ndp); \
unsigned int _flags = (flags); \
\
if (!(_flags & NDF_NO_FREE_PNBUF) && \
(_ndp->ni_cnd.cn_flags & HASBUF)) { \
zfree(namei_zone, _ndp->ni_cnd.cn_pnbuf); \
_ndp->ni_cnd.cn_flags &= ~HASBUF; \
} \
if (!(_flags & NDF_NO_DVP_UNLOCK) && \
(_ndp->ni_cnd.cn_flags & LOCKPARENT) && \
_ndp->ni_dvp != _ndp->ni_vp) \
VOP_UNLOCK(_ndp->ni_dvp, 0, _ndp->ni_cnd.cn_proc); \
if (!(_flags & NDF_NO_DVP_RELE) && \
(_ndp->ni_cnd.cn_flags & (LOCKPARENT|WANTPARENT))) { \
vrele(_ndp->ni_dvp); \
_ndp->ni_dvp = NULL; \
} \
if (!(_flags & NDF_NO_VP_UNLOCK) && \
(_ndp->ni_cnd.cn_flags & LOCKLEAF) && _ndp->ni_vp) \
VOP_UNLOCK(_ndp->ni_vp, 0, _ndp->ni_cnd.cn_proc); \
if (!(_flags & NDF_NO_VP_RELE) && \
_ndp->ni_vp) { \
vrele(_ndp->ni_vp); \
_ndp->ni_vp = NULL; \
} \
if (!(_flags & NDF_NO_STARTDIR_RELE) && \
(_ndp->ni_cnd.cn_flags & SAVESTART)) { \
vrele(_ndp->ni_startdir); \
_ndp->ni_startdir = NULL; \
} \
} while (0)
#endif
#ifdef _KERNEL
void NDFREE __P((struct nameidata *, const uint));
int namei __P((struct nameidata *ndp));
int lookup __P((struct nameidata *ndp));