summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_mn.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2000-12-18 20:03:32 +0000
committerjulian <julian@FreeBSD.org>2000-12-18 20:03:32 +0000
commit0c949560a12dd18943b66fe09bd06d3c34e5cf7a (patch)
tree5466b04ac515e8d01f9b135b6c119744a1138d82 /sys/pci/if_mn.c
parente6bd476191c5b338634a02b0a6de56aa7f23cf37 (diff)
downloadFreeBSD-src-0c949560a12dd18943b66fe09bd06d3c34e5cf7a.zip
FreeBSD-src-0c949560a12dd18943b66fe09bd06d3c34e5cf7a.tar.gz
Divorce the kernel binary ABI version number from the message
format version number. (userland programs should not need to be recompiled when the netgraph kernel internal ABI is changed. Also fix modules that don;t handle the fact that a caller may not supply a return message pointer. (benign at the moment because the calling code checks, but that will change)
Diffstat (limited to 'sys/pci/if_mn.c')
-rw-r--r--sys/pci/if_mn.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/sys/pci/if_mn.c b/sys/pci/if_mn.c
index 43ac489..8028389 100644
--- a/sys/pci/if_mn.c
+++ b/sys/pci/if_mn.c
@@ -187,7 +187,7 @@ static ng_rcvdata_t ngmn_rcvdata;
static ng_disconnect_t ngmn_disconnect;
static struct ng_type mntypestruct = {
- NG_VERSION,
+ NG_ABI_VERSION,
NG_MN_NODE_TYPE,
NULL,
ngmn_constructor,
@@ -281,9 +281,11 @@ ngmn_shutdown(node_p nodep)
}
static int
-ngmn_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, struct ng_mesg **resp, hook_p lasthook)
+ngmn_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr,
+ struct ng_mesg **rptr, hook_p lasthook)
{
struct softc *sc;
+ struct ng_mesg *resp = NULL;
struct schan *sch;
char *arg;
int pos, i;
@@ -291,19 +293,20 @@ ngmn_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, struct ng_mes
sc = node->private;
if (msg->header.typecookie != NGM_GENERIC_COOKIE ||
+ rptr == NULL || /* temporary */
msg->header.cmd != NGM_TEXT_STATUS) {
- if (resp)
- *resp = NULL;
+ if (rptr)
+ *rptr = NULL;
FREE(msg, M_NETGRAPH);
return (EINVAL);
}
- NG_MKRESPONSE(*resp, msg, sizeof(struct ng_mesg) + NG_TEXTRESPONSE,
+ NG_MKRESPONSE(resp, msg, sizeof(struct ng_mesg) + NG_TEXTRESPONSE,
M_NOWAIT);
- if (*resp == NULL) {
+ if (resp == NULL) {
FREE(msg, M_NETGRAPH);
return (ENOMEM);
}
- arg = (char *)(*resp)->data;
+ arg = (char *)resp->data;
pos = 0;
pos += sprintf(pos + arg,"Framer status %b;\n", sc->framer_state, "\20"
"\40LOS\37AIS\36LFA\35RRA"
@@ -371,7 +374,14 @@ ngmn_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, struct ng_mes
pos += sprintf(arg + pos, " Xmit bytes pending %ld\n",
sch->tx_pending);
}
- (*resp)->header.arglen = pos + 1;
+ resp->header.arglen = pos + 1;
+
+ /* Take care of synchronous response, if any */
+ if (rptr)
+ *rptr = resp;
+ else if (resp)
+ FREE(resp, M_NETGRAPH); /* Will eventually send the hard way */
+
FREE(msg, M_NETGRAPH);
return (0);
}
OpenPOWER on IntegriCloud