Functions m_getm2() and m_get2() have different order of arguments,

and that can drive someone crazy. While m_get2() is young and not
documented yet, change its order of arguments to match m_getm2().

Sorry for churn, but better now than later.
This commit is contained in:
Gleb Smirnoff 2013-03-12 13:42:47 +00:00
parent d43e357b6a
commit 41a7572b26
9 changed files with 44 additions and 43 deletions

View File

@ -900,8 +900,8 @@ ate_intr(void *xsc)
remain = (sc->rx_descs[idx].status & ETH_LEN_MASK) - 4;
/* Get an appropriately sized mbuf. */
mb = m_get2(M_NOWAIT, MT_DATA, M_PKTHDR,
remain + ETHER_ALIGN);
mb = m_get2(remain + ETHER_ALIGN, M_NOWAIT, MT_DATA,
M_PKTHDR);
if (mb == NULL) {
sc->ifp->if_iqdrops++;
rxdhead->status = 0;

View File

@ -88,7 +88,7 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, m_defragrandomfailures, CTLFLAG_RW,
* m_get2() allocates minimum mbuf that would fit "size" argument.
*/
struct mbuf *
m_get2(int how, short type, int flags, int size)
m_get2(int size, int how, short type, int flags)
{
struct mb_args args;
struct mbuf *m, *n;

View File

@ -525,7 +525,7 @@ bpf_movein(struct uio *uio, int linktype, struct ifnet *ifp, struct mbuf **mp,
if (len < hlen || len - hlen > ifp->if_mtu)
return (EMSGSIZE);
m = m_get2(M_WAITOK, MT_DATA, M_PKTHDR, len);
m = m_get2(len, M_WAITOK, MT_DATA, M_PKTHDR);
if (m == NULL)
return (EIO);
m->m_pkthdr.len = m->m_len = len;

View File

@ -1760,7 +1760,7 @@ m_megapullup(struct mbuf *m, int len) {
if (m->m_next == NULL && M_WRITABLE(m) && M_TRAILINGSPACE(m) >= RESERVE)
return (m);
mcl = m_get2(M_NOWAIT, MT_DATA, M_PKTHDR, len + RESERVE);
mcl = m_get2(len + RESERVE, M_NOWAIT, MT_DATA, M_PKTHDR);
if (mcl == NULL)
goto bad;

View File

@ -1505,7 +1505,7 @@ pfsync_sendout(int schedswi)
return;
}
m = m_get2(M_NOWAIT, MT_DATA, M_PKTHDR, max_linkhdr + sc->sc_len);
m = m_get2(max_linkhdr + sc->sc_len, M_NOWAIT, MT_DATA, M_PKTHDR);
if (m == NULL) {
sc->sc_ifp->if_oerrors++;
V_pfsyncstats.pfsyncs_onomem++;

View File

@ -459,7 +459,7 @@ xdr_string_encode(char *str, int len)
if (mlen > MCLBYTES) /* If too big, we just can't do it. */
return (NULL);
m = m_get2(M_WAITOK, MT_DATA, 0, mlen);
m = m_get2(mlen, M_WAITOK, MT_DATA, 0);
xs = mtod(m, struct xdr_string *);
m->m_len = mlen;
xs->len = txdr_unsigned(len);

View File

@ -298,7 +298,7 @@ nfs_statfs(struct mount *mp, struct statfs *sbp)
} else
mtx_unlock(&nmp->nm_mtx);
nfsstats.rpccnt[NFSPROC_FSSTAT]++;
mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3));
mreq = m_get2(NFSX_FH(v3), M_WAITOK, MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(vp, v3);
@ -356,7 +356,7 @@ nfs_fsinfo(struct nfsmount *nmp, struct vnode *vp, struct ucred *cred,
u_int64_t maxfsize;
nfsstats.rpccnt[NFSPROC_FSINFO]++;
mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(1));
mreq = m_get2(NFSX_FH(1), M_WAITOK, MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(vp, 1);

View File

@ -294,7 +294,7 @@ nfs3_access_otw(struct vnode *vp, int wmode, struct thread *td,
struct nfsnode *np = VTONFS(vp);
nfsstats.rpccnt[NFSPROC_ACCESS]++;
mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + NFSX_UNSIGNED);
mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED, M_WAITOK, MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(vp, v3);
@ -714,7 +714,7 @@ nfs_getattr(struct vop_getattr_args *ap)
goto nfsmout;
}
nfsstats.rpccnt[NFSPROC_GETATTR]++;
mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3));
mreq = m_get2(NFSX_FH(v3), M_WAITOK, MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(vp, v3);
@ -873,7 +873,7 @@ nfs_setattrrpc(struct vnode *vp, struct vattr *vap, struct ucred *cred)
int v3 = NFS_ISV3(vp);
nfsstats.rpccnt[NFSPROC_SETATTR]++;
mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + NFSX_SATTR(v3));
mreq = m_get2(NFSX_FH(v3) + NFSX_SATTR(v3), M_WAITOK, MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(vp, v3);
@ -1037,8 +1037,8 @@ nfs_lookup(struct vop_lookup_args *ap)
nfsstats.lookupcache_misses++;
nfsstats.rpccnt[NFSPROC_LOOKUP]++;
len = cnp->cn_namelen;
mreq = m_get2(M_WAITOK, MT_DATA, 0,
NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len));
mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len), M_WAITOK,
MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(dvp, v3);
@ -1251,7 +1251,7 @@ nfs_readlinkrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
int v3 = NFS_ISV3(vp);
nfsstats.rpccnt[NFSPROC_READLINK]++;
mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3));
mreq = m_get2(NFSX_FH(v3), M_WAITOK, MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(vp, v3);
@ -1306,8 +1306,8 @@ nfs_readrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
while (tsiz > 0) {
nfsstats.rpccnt[NFSPROC_READ]++;
len = (tsiz > rsize) ? rsize : tsiz;
mreq = m_get2(M_WAITOK, MT_DATA, 0,
NFSX_FH(v3) + NFSX_UNSIGNED * 3);
mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED * 3, M_WAITOK,
MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(vp, v3);
@ -1379,8 +1379,8 @@ nfs_writerpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
while (tsiz > 0) {
nfsstats.rpccnt[NFSPROC_WRITE]++;
len = (tsiz > wsize) ? wsize : tsiz;
mreq = m_get2(M_WAITOK, MT_DATA, 0,
NFSX_FH(v3) + 5 * NFSX_UNSIGNED + nfsm_rndup(len));
mreq = m_get2(NFSX_FH(v3) + 5 * NFSX_UNSIGNED + nfsm_rndup(len),
M_WAITOK, MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(vp, v3);
@ -1502,8 +1502,8 @@ nfs_mknodrpc(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp,
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)) != 0)
return (error);
nfsstats.rpccnt[NFSPROC_MKNOD]++;
mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + 4 * NFSX_UNSIGNED +
nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3));
mreq = m_get2(NFSX_FH(v3) + 4 * NFSX_UNSIGNED +
nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3), M_WAITOK, MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(dvp, v3);
@ -1606,8 +1606,8 @@ nfs_create(struct vop_create_args *ap)
fmode |= O_EXCL;
again:
nfsstats.rpccnt[NFSPROC_CREATE]++;
mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + 2 * NFSX_UNSIGNED +
nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3));
mreq = m_get2(NFSX_FH(v3) + 2 * NFSX_UNSIGNED +
nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3), M_WAITOK, MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(dvp, v3);
@ -1788,8 +1788,8 @@ nfs_removerpc(struct vnode *dvp, const char *name, int namelen,
int v3 = NFS_ISV3(dvp);
nfsstats.rpccnt[NFSPROC_REMOVE]++;
mreq = m_get2(M_WAITOK, MT_DATA, 0,
NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(namelen));
mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(namelen),
M_WAITOK, MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(dvp, v3);
@ -1924,8 +1924,8 @@ nfs_renamerpc(struct vnode *fdvp, const char *fnameptr, int fnamelen,
int v3 = NFS_ISV3(fdvp);
nfsstats.rpccnt[NFSPROC_RENAME]++;
mreq = m_get2(M_WAITOK, MT_DATA, 0, (NFSX_FH(v3) + NFSX_UNSIGNED)*2 +
nfsm_rndup(fnamelen) + nfsm_rndup(tnamelen));
mreq = m_get2((NFSX_FH(v3) + NFSX_UNSIGNED)*2 + nfsm_rndup(fnamelen) +
nfsm_rndup(tnamelen), M_WAITOK, MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(fdvp, v3);
@ -1983,8 +1983,8 @@ nfs_link(struct vop_link_args *ap)
v3 = NFS_ISV3(vp);
nfsstats.rpccnt[NFSPROC_LINK]++;
mreq = m_get2(M_WAITOK, MT_DATA, 0,
NFSX_FH(v3)*2 + NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen));
mreq = m_get2(NFSX_FH(v3)*2 + NFSX_UNSIGNED +
nfsm_rndup(cnp->cn_namelen), M_WAITOK, MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(vp, v3);
@ -2029,8 +2029,9 @@ nfs_symlink(struct vop_symlink_args *ap)
nfsstats.rpccnt[NFSPROC_SYMLINK]++;
slen = strlen(ap->a_target);
mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + 2*NFSX_UNSIGNED +
nfsm_rndup(cnp->cn_namelen) + nfsm_rndup(slen) + NFSX_SATTR(v3));
mreq = m_get2(NFSX_FH(v3) + 2*NFSX_UNSIGNED +
nfsm_rndup(cnp->cn_namelen) + nfsm_rndup(slen) + NFSX_SATTR(v3),
M_WAITOK, MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(dvp, v3);
@ -2123,8 +2124,8 @@ nfs_mkdir(struct vop_mkdir_args *ap)
return (error);
len = cnp->cn_namelen;
nfsstats.rpccnt[NFSPROC_MKDIR]++;
mreq = m_get2(M_WAITOK, MT_DATA, 0,
NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len) + NFSX_SATTR(v3));
mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len) +
NFSX_SATTR(v3), M_WAITOK, MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(dvp, v3);
@ -2188,8 +2189,8 @@ nfs_rmdir(struct vop_rmdir_args *ap)
if (dvp == vp)
return (EINVAL);
nfsstats.rpccnt[NFSPROC_RMDIR]++;
mreq = m_get2(M_WAITOK, MT_DATA, 0,
NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen));
mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED +
nfsm_rndup(cnp->cn_namelen), M_WAITOK, MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(dvp, v3);
@ -2307,8 +2308,8 @@ nfs_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
*/
while (more_dirs && bigenough) {
nfsstats.rpccnt[NFSPROC_READDIR]++;
mreq = m_get2(M_WAITOK, MT_DATA, 0,
NFSX_FH(v3) + NFSX_READDIR(v3));
mreq = m_get2(NFSX_FH(v3) + NFSX_READDIR(v3), M_WAITOK,
MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(vp, v3);
@ -2513,8 +2514,8 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
*/
while (more_dirs && bigenough) {
nfsstats.rpccnt[NFSPROC_READDIRPLUS]++;
mreq = m_get2(M_WAITOK, MT_DATA, 0,
NFSX_FH(1) + 6 * NFSX_UNSIGNED);
mreq = m_get2(NFSX_FH(1) + 6 * NFSX_UNSIGNED, M_WAITOK,
MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(vp, 1);
@ -2818,8 +2819,8 @@ nfs_lookitup(struct vnode *dvp, const char *name, int len, struct ucred *cred,
int v3 = NFS_ISV3(dvp);
nfsstats.rpccnt[NFSPROC_LOOKUP]++;
mreq = m_get2(M_WAITOK, MT_DATA, 0,
NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len));
mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len),
M_WAITOK, MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(dvp, v3);
@ -2897,7 +2898,7 @@ nfs_commit(struct vnode *vp, u_quad_t offset, int cnt, struct ucred *cred,
}
mtx_unlock(&nmp->nm_mtx);
nfsstats.rpccnt[NFSPROC_COMMIT]++;
mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(1));
mreq = m_get2(NFSX_FH(1), M_WAITOK, MT_DATA, 0);
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(vp, 1);

View File

@ -801,7 +801,7 @@ int m_dup_pkthdr(struct mbuf *, struct mbuf *, int);
u_int m_fixhdr(struct mbuf *);
struct mbuf *m_fragment(struct mbuf *, int, int);
void m_freem(struct mbuf *);
struct mbuf *m_get2(int, short, int, int);
struct mbuf *m_get2(int, int, short, int);
struct mbuf *m_getjcl(int, short, int, int);
struct mbuf *m_getm2(struct mbuf *, int, int, short, int);
struct mbuf *m_getptr(struct mbuf *, int, int *);