kernel/netgraph7: Use kprintf etc. directly instead of defining printf.
authorSascha Wildner <saw@online.de>
Tue, 15 Jul 2014 08:42:17 +0000 (10:42 +0200)
committerSascha Wildner <saw@online.de>
Tue, 15 Jul 2014 08:42:17 +0000 (10:42 +0200)
While here, remove some commented out code from dragonfly.h

In-discussion-with: nant

31 files changed:
sys/netgraph7/bluetooth/drivers/bt3c/ng_bt3c_pccard.c
sys/netgraph7/bluetooth/drivers/h4/ng_h4.c
sys/netgraph7/bluetooth/drivers/h4/ng_h4_var.h
sys/netgraph7/bluetooth/drivers/ubt/ng_ubt.c
sys/netgraph7/bluetooth/hci/ng_hci_cmds.c
sys/netgraph7/bluetooth/hci/ng_hci_main.c
sys/netgraph7/bluetooth/hci/ng_hci_ulpi.c
sys/netgraph7/bluetooth/hci/ng_hci_var.h
sys/netgraph7/bluetooth/l2cap/ng_l2cap_cmds.c
sys/netgraph7/bluetooth/l2cap/ng_l2cap_llpi.c
sys/netgraph7/bluetooth/l2cap/ng_l2cap_main.c
sys/netgraph7/bluetooth/l2cap/ng_l2cap_var.h
sys/netgraph7/bluetooth/socket/ng_btsocket_hci_raw.c
sys/netgraph7/bluetooth/socket/ng_btsocket_l2cap.c
sys/netgraph7/bluetooth/socket/ng_btsocket_l2cap_raw.c
sys/netgraph7/bluetooth/socket/ng_btsocket_rfcomm.c
sys/netgraph7/bridge/ng_bridge.c
sys/netgraph7/cisco/ng_cisco.c
sys/netgraph7/dragonfly.h
sys/netgraph7/eiface/ng_eiface.c
sys/netgraph7/lmi/ng_lmi.c
sys/netgraph7/netgraph.h
sys/netgraph7/netgraph/ng_base.c
sys/netgraph7/netgraph/ng_parse.c
sys/netgraph7/ng_device.c
sys/netgraph7/ng_fec.c
sys/netgraph7/ng_source.c
sys/netgraph7/ng_split.c
sys/netgraph7/ppp/ng_ppp.c
sys/netgraph7/socket/ng_socket.c
sys/netgraph7/tty/ng_tty.c

index 0e747c3..5354c7c 100644 (file)
@@ -378,7 +378,7 @@ ng_bt3c_rcvmsg(node_p node, item_p item, hook_p lasthook)
                        if (rsp == NULL)
                                error = ENOMEM;
                        else
-                               snprintf(rsp->data, NG_TEXTRESPONSE,
+                               ksnprintf(rsp->data, NG_TEXTRESPONSE,
                                        "Hook: %s\n" \
                                        "Flags: %#x\n" \
                                        "Debug: %d\n"  \
@@ -749,7 +749,7 @@ bt3c_intr(void *context)
        u_int16_t       control, status;
 
        if (sc == NULL || sc->ith == NULL) {
-               printf("%s: bogus interrupt\n", NG_BT3C_NODE_TYPE);
+               kprintf("%s: bogus interrupt\n", NG_BT3C_NODE_TYPE);
                return;
        }
 
@@ -1194,7 +1194,7 @@ bt3c_modevent(module_t mod, int event, void *data)
        case MOD_LOAD:
                error = ng_newtype(&typestruct);
                if (error != 0)
-                       printf("%s: Could not register Netgraph node type, " \
+                       kprintf("%s: Could not register Netgraph node type, " \
                                "error=%d\n", NG_BT3C_NODE_TYPE, error);
                break;
 
index 4934141..395fb87 100644 (file)
@@ -183,7 +183,7 @@ ng_h4_open(struct cdev *dev, struct tty *tp)
        if (error != 0) {
                NG_H4_UNLOCK(sc);
 
-               printf("%s: Unable to create new node!\n", __func__);
+               kprintf("%s: Unable to create new node!\n", __func__);
 
                mtx_destroy(&sc->outq.ifq_mtx);
                bzero(sc, sizeof(*sc));
@@ -194,13 +194,13 @@ ng_h4_open(struct cdev *dev, struct tty *tp)
        }
 
        /* Assign node its name */
-       snprintf(name, sizeof(name), "%s%d", typestruct.name, ng_h4_node ++);
+       ksnprintf(name, sizeof(name), "%s%d", typestruct.name, ng_h4_node ++);
 
        error = ng_name_node(sc->node, name);
        if (error != 0) {
                NG_H4_UNLOCK(sc);
 
-               printf("%s: %s - node name exists?\n", __func__, name);
+               kprintf("%s: %s - node name exists?\n", __func__, name);
 
                NG_NODE_UNREF(sc->node);
                mtx_destroy(&sc->outq.ifq_mtx);
@@ -872,7 +872,7 @@ ng_h4_rcvmsg(node_p node, item_p item, hook_p lasthook)
                        if (resp == NULL)
                                error = ENOMEM;
                        else
-                               snprintf(resp->data, NG_TEXTRESPONSE,
+                               ksnprintf(resp->data, NG_TEXTRESPONSE,
                                        "Hook: %s\n"   \
                                        "Debug: %d\n"  \
                                        "State: %d\n"  \
@@ -1016,7 +1016,7 @@ ng_h4_mod_event(module_t mod, int event, void *data)
                mtx_unlock(&Giant);
 
                if (ng_h4_ldisc < 0) {
-                       printf("%s: can't register H4 line discipline\n",
+                       kprintf("%s: can't register H4 line discipline\n",
                                __func__);
                        error = EIO;
                }
index e87c756..36d2556 100644 (file)
@@ -29,7 +29,6 @@
  *
  * $Id: ng_h4_var.h,v 1.5 2005/10/31 17:57:43 max Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/drivers/h4/ng_h4_var.h,v 1.6 2007/08/13 17:19:28 emax Exp $
- * $DragonFly: src/sys/netgraph7/bluetooth/drivers/h4/ng_h4_var.h,v 1.2 2008/06/26 23:05:40 dillon Exp $
  * 
  * Based on:
  * ---------
@@ -55,10 +54,10 @@ MALLOC_DECLARE(M_NETGRAPH_H4);
  * Debug
  */
 
-#define        NG_H4_ALERT     if (sc->debug >= NG_H4_ALERT_LEVEL) printf
-#define        NG_H4_ERR       if (sc->debug >= NG_H4_ERR_LEVEL)   printf
-#define        NG_H4_WARN      if (sc->debug >= NG_H4_WARN_LEVEL)  printf
-#define        NG_H4_INFO      if (sc->debug >= NG_H4_INFO_LEVEL)  printf
+#define        NG_H4_ALERT     if (sc->debug >= NG_H4_ALERT_LEVEL) kprintf
+#define        NG_H4_ERR       if (sc->debug >= NG_H4_ERR_LEVEL)   kprintf
+#define        NG_H4_WARN      if (sc->debug >= NG_H4_WARN_LEVEL)  kprintf
+#define        NG_H4_INFO      if (sc->debug >= NG_H4_INFO_LEVEL)  kprintf
 
 #define NG_H4_HIWATER          256     /* High water mark on output */
 
index 0b6abfb..758e1fd 100644 (file)
@@ -1576,7 +1576,7 @@ ng_ubt_rcvmsg(node_p node, item_p item, hook_p lasthook)
                                break;
                        }
 
-                       snprintf(rsp->data, NG_TEXTRESPONSE,
+                       ksnprintf(rsp->data, NG_TEXTRESPONSE,
                                "Hook: %s\n" \
                                "Task flags: %#x\n" \
                                "Debug: %d\n" \
@@ -1834,7 +1834,7 @@ ubt_modevent(module_t mod, int event, void *data)
        case MOD_LOAD:
                error = ng_newtype(&typestruct);
                if (error != 0)
-                       printf("%s: Could not register Netgraph node type, " \
+                       kprintf("%s: Could not register Netgraph node type, " \
                                "error=%d\n", NG_UBT_NODE_TYPE, error);
                break;
 
index 289e01f..c611886 100644 (file)
@@ -29,7 +29,6 @@
  *
  * $Id: ng_hci_cmds.c,v 1.4 2003/09/08 18:57:51 max Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/hci/ng_hci_cmds.c,v 1.7 2005/01/07 01:45:43 imp Exp $
- * $DragonFly: src/sys/netgraph7/bluetooth/hci/ng_hci_cmds.c,v 1.2 2008/06/26 23:05:40 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -387,7 +386,7 @@ ng_hci_process_command_timeout(node_p node, hook_p hook, void *arg1, int arg2)
        u_int16_t        opcode;
 
        if (NG_NODE_NOT_VALID(node)) {
-               printf("%s: Netgraph node is not valid\n", __func__);
+               kprintf("%s: Netgraph node is not valid\n", __func__);
                return;
        }
 
index 36bfd6f..eb96a3e 100644 (file)
@@ -29,7 +29,6 @@
  *
  * $Id: ng_hci_main.c,v 1.2 2003/03/18 00:09:36 max Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/hci/ng_hci_main.c,v 1.6 2005/01/07 01:45:43 imp Exp $
- * $DragonFly: src/sys/netgraph7/bluetooth/hci/ng_hci_main.c,v 1.2 2008/06/26 23:05:40 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -308,7 +307,7 @@ ng_hci_default_rcvmsg(node_p node, item_p item, hook_p lasthook)
                        NG_HCI_BUFF_SCO_TOTAL(unit->buffer, sco_total);
                        NG_HCI_BUFF_SCO_SIZE(unit->buffer, sco_size);
 
-                       snprintf(rsp->data, NG_TEXTRESPONSE,
+                       ksnprintf(rsp->data, NG_TEXTRESPONSE,
                                "bdaddr %x:%x:%x:%x:%x:%x\n" \
                                "Hooks  %s %s %s %s\n" \
                                "State  %#x\n" \
index ec6ed46..07c0cd3 100644 (file)
@@ -29,7 +29,6 @@
  *
  * $Id: ng_hci_ulpi.c,v 1.7 2003/09/08 18:57:51 max Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/hci/ng_hci_ulpi.c,v 1.8 2005/01/07 01:45:43 imp Exp $
- * $DragonFly: src/sys/netgraph7/bluetooth/hci/ng_hci_ulpi.c,v 1.2 2008/06/26 23:05:40 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -1156,7 +1155,7 @@ ng_hci_process_con_timeout(node_p node, hook_p hook, void *arg1, int con_handle)
        ng_hci_unit_con_p       con = NULL;
 
        if (NG_NODE_NOT_VALID(node)) {
-               printf("%s: Netgraph node is not valid\n", __func__);
+               kprintf("%s: Netgraph node is not valid\n", __func__);
                return;
        }
 
index 6129b5d..76161b8 100644 (file)
@@ -29,7 +29,6 @@
  *
  * $Id: ng_hci_var.h,v 1.3 2003/04/26 22:35:21 max Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/hci/ng_hci_var.h,v 1.6 2005/01/07 01:45:43 imp Exp $
- * $DragonFly: src/sys/netgraph7/bluetooth/hci/ng_hci_var.h,v 1.2 2008/06/26 23:05:40 dillon Exp $
  */
 
 #ifndef _NETGRAPH_HCI_VAR_H_
@@ -43,10 +42,10 @@ MALLOC_DECLARE(M_NETGRAPH_HCI);
 #endif /* NG_SEPARATE_MALLOC */
 
 /* Debug */
-#define        NG_HCI_ALERT    if (unit->debug >= NG_HCI_ALERT_LEVEL) printf
-#define        NG_HCI_ERR      if (unit->debug >= NG_HCI_ERR_LEVEL)   printf
-#define        NG_HCI_WARN     if (unit->debug >= NG_HCI_WARN_LEVEL)  printf
-#define        NG_HCI_INFO     if (unit->debug >= NG_HCI_INFO_LEVEL)  printf
+#define        NG_HCI_ALERT    if (unit->debug >= NG_HCI_ALERT_LEVEL) kprintf
+#define        NG_HCI_ERR      if (unit->debug >= NG_HCI_ERR_LEVEL)   kprintf
+#define        NG_HCI_WARN     if (unit->debug >= NG_HCI_WARN_LEVEL)  kprintf
+#define        NG_HCI_INFO     if (unit->debug >= NG_HCI_INFO_LEVEL)  kprintf
 
 /* Wrapper around m_pullup */
 #define NG_HCI_M_PULLUP(m, s)                          \
index 2068f35..9baf983 100644 (file)
@@ -29,7 +29,6 @@
  *
  * $Id: ng_l2cap_cmds.c,v 1.2 2003/09/08 19:11:45 max Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.c,v 1.7 2007/03/28 21:25:56 emax Exp $
- * $DragonFly: src/sys/netgraph7/bluetooth/l2cap/ng_l2cap_cmds.c,v 1.2 2008/06/26 23:05:40 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -333,7 +332,7 @@ ng_l2cap_process_command_timeout(node_p node, hook_p hook, void *arg1, int arg2)
        u_int8_t        ident = ((arg2 >> 16) & 0xff);
 
        if (NG_NODE_NOT_VALID(node)) {
-               printf("%s: Netgraph node is not valid\n", __func__);
+               kprintf("%s: Netgraph node is not valid\n", __func__);
                return;
        }
 
index 6d898b6..3203879 100644 (file)
@@ -29,7 +29,6 @@
  *
  * $Id: ng_l2cap_llpi.c,v 1.5 2003/09/08 19:11:45 max Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c,v 1.9 2005/07/29 14:44:17 emax Exp $
- * $DragonFly: src/sys/netgraph7/bluetooth/l2cap/ng_l2cap_llpi.c,v 1.2 2008/06/26 23:05:40 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -814,7 +813,7 @@ ng_l2cap_process_lp_timeout(node_p node, hook_p hook, void *arg1, int con_handle
        ng_l2cap_con_p  con = NULL;
 
        if (NG_NODE_NOT_VALID(node)) {
-               printf("%s: Netgraph node is not valid\n", __func__);
+               kprintf("%s: Netgraph node is not valid\n", __func__);
                return;
        }
 
@@ -860,7 +859,7 @@ ng_l2cap_process_discon_timeout(node_p node, hook_p hook, void *arg1, int con_ha
        int                      error;
 
        if (NG_NODE_NOT_VALID(node)) {
-               printf("%s: Netgraph node is not valid\n", __func__);
+               kprintf("%s: Netgraph node is not valid\n", __func__);
                return;
        }
 
index 8699ed8..52ea4f8 100644 (file)
@@ -29,7 +29,6 @@
  *
  * $Id: ng_l2cap_main.c,v 1.2 2003/04/28 21:44:59 max Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/l2cap/ng_l2cap_main.c,v 1.5 2005/01/07 01:45:43 imp Exp $
- * $DragonFly: src/sys/netgraph7/bluetooth/l2cap/ng_l2cap_main.c,v 1.2 2008/06/26 23:05:40 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -488,7 +487,7 @@ ng_l2cap_default_rcvmsg(node_p node, item_p item, hook_p lasthook)
                        if (rsp == NULL)
                                error = ENOMEM;
                        else
-                               snprintf(rsp->data, NG_TEXTRESPONSE,
+                               ksnprintf(rsp->data, NG_TEXTRESPONSE,
                                        "bdaddr %x:%x:%x:%x:%x:%x, " \
                                        "pkt_size %d\n" \
                                        "Hooks %s %s %s\n" \
index 9a83c84..8454716 100644 (file)
@@ -29,7 +29,6 @@
  *
  * $Id: ng_l2cap_var.h,v 1.2 2003/04/28 21:44:59 max Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/l2cap/ng_l2cap_var.h,v 1.6 2005/01/07 01:45:43 imp Exp $
- * $DragonFly: src/sys/netgraph7/bluetooth/l2cap/ng_l2cap_var.h,v 1.2 2008/06/26 23:05:40 dillon Exp $
  */
 
 #ifndef _NETGRAPH_L2CAP_VAR_H_
@@ -43,10 +42,10 @@ MALLOC_DECLARE(M_NETGRAPH_L2CAP);
 #endif /* NG_SEPARATE_MALLOC */
 
 /* Debug */
-#define        NG_L2CAP_ALERT  if (l2cap->debug >= NG_L2CAP_ALERT_LEVEL) printf
-#define        NG_L2CAP_ERR    if (l2cap->debug >= NG_L2CAP_ERR_LEVEL)   printf
-#define        NG_L2CAP_WARN   if (l2cap->debug >= NG_L2CAP_WARN_LEVEL)  printf
-#define        NG_L2CAP_INFO   if (l2cap->debug >= NG_L2CAP_INFO_LEVEL)  printf
+#define        NG_L2CAP_ALERT  if (l2cap->debug >= NG_L2CAP_ALERT_LEVEL) kprintf
+#define        NG_L2CAP_ERR    if (l2cap->debug >= NG_L2CAP_ERR_LEVEL)   kprintf
+#define        NG_L2CAP_WARN   if (l2cap->debug >= NG_L2CAP_WARN_LEVEL)  kprintf
+#define        NG_L2CAP_INFO   if (l2cap->debug >= NG_L2CAP_INFO_LEVEL)  kprintf
 
 /* Wrapper around m_pullup */
 #define NG_L2CAP_M_PULLUP(m, s) \
index 99e9291..f2b72d8 100644 (file)
@@ -29,7 +29,6 @@
  *
  * $Id: ng_btsocket_hci_raw.c,v 1.14 2003/09/14 23:29:06 max Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c,v 1.23 2006/11/06 13:42:04 rwatson Exp $
- * $DragonFly: src/sys/netgraph7/bluetooth/socket/ng_btsocket_hci_raw.c,v 1.2 2008/06/26 23:05:40 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -143,19 +142,19 @@ SYSCTL_INT(_net_bluetooth_hci_sockets_raw, OID_AUTO, queue_drops, CTLFLAG_RD,
 /* Debug */
 #define NG_BTSOCKET_HCI_RAW_INFO \
        if (ng_btsocket_hci_raw_debug_level >= NG_BTSOCKET_INFO_LEVEL) \
-               printf
+               kprintf
 
 #define NG_BTSOCKET_HCI_RAW_WARN \
        if (ng_btsocket_hci_raw_debug_level >= NG_BTSOCKET_WARN_LEVEL) \
-               printf
+               kprintf
 
 #define NG_BTSOCKET_HCI_RAW_ERR \
        if (ng_btsocket_hci_raw_debug_level >= NG_BTSOCKET_ERR_LEVEL) \
-               printf
+               kprintf
 
 #define NG_BTSOCKET_HCI_RAW_ALERT \
        if (ng_btsocket_hci_raw_debug_level >= NG_BTSOCKET_ALERT_LEVEL) \
-               printf
+               kprintf
 
 /****************************************************************************
  ****************************************************************************
@@ -787,7 +786,7 @@ ng_btsocket_hci_raw_init(void)
                                                 M_NETGRAPH_BTSOCKET_HCI_RAW,
                                                 M_WAITOK | M_NULLOK | M_ZERO);
        if (ng_btsocket_hci_raw_sec_filter == NULL) {
-               printf("%s: Could not allocate security filter!\n", __func__);
+               kprintf("%s: Could not allocate security filter!\n", __func__);
                return;
        }
 
@@ -1039,7 +1038,7 @@ ng_btsocket_hci_raw_control(struct socket *so, u_long cmd, caddr_t data,
                return (EBUSY);
        }
 
-       snprintf(path, sizeof(path), "%s:", pcb->addr.hci_node);
+       ksnprintf(path, sizeof(path), "%s:", pcb->addr.hci_node);
 
        switch (cmd) {
        case SIOC_HCI_RAW_NODE_GET_STATE: {
index 32029f1..5681596 100644 (file)
@@ -29,7 +29,6 @@
  *
  * $Id: ng_btsocket_l2cap.c,v 1.16 2003/09/14 23:29:06 max Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c,v 1.25 2007/10/31 16:17:20 emax Exp $
- * $DragonFly: src/sys/netgraph7/bluetooth/socket/ng_btsocket_l2cap.c,v 1.2 2008/06/26 23:05:40 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -128,19 +127,19 @@ SYSCTL_INT(_net_bluetooth_l2cap_sockets_seq, OID_AUTO, queue_drops,
 /* Debug */
 #define NG_BTSOCKET_L2CAP_INFO \
        if (ng_btsocket_l2cap_debug_level >= NG_BTSOCKET_INFO_LEVEL) \
-               printf
+               kprintf
 
 #define NG_BTSOCKET_L2CAP_WARN \
        if (ng_btsocket_l2cap_debug_level >= NG_BTSOCKET_WARN_LEVEL) \
-               printf
+               kprintf
 
 #define NG_BTSOCKET_L2CAP_ERR \
        if (ng_btsocket_l2cap_debug_level >= NG_BTSOCKET_ERR_LEVEL) \
-               printf
+               kprintf
 
 #define NG_BTSOCKET_L2CAP_ALERT \
        if (ng_btsocket_l2cap_debug_level >= NG_BTSOCKET_ALERT_LEVEL) \
-               printf
+               kprintf
 
 /* 
  * Netgraph message processing routines
index 20f74b7..f052009 100644 (file)
@@ -29,7 +29,6 @@
  *
  * $Id: ng_btsocket_l2cap_raw.c,v 1.12 2003/09/14 23:29:06 max Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c,v 1.20 2006/11/06 13:42:04 rwatson Exp $
- * $DragonFly: src/sys/netgraph7/bluetooth/socket/ng_btsocket_l2cap_raw.c,v 1.2 2008/06/26 23:05:40 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -147,19 +146,19 @@ SYSCTL_INT(_net_bluetooth_l2cap_sockets_raw, OID_AUTO, queue_drops,
 /* Debug */
 #define NG_BTSOCKET_L2CAP_RAW_INFO \
        if (ng_btsocket_l2cap_raw_debug_level >= NG_BTSOCKET_INFO_LEVEL) \
-               printf
+               kprintf
 
 #define NG_BTSOCKET_L2CAP_RAW_WARN \
        if (ng_btsocket_l2cap_raw_debug_level >= NG_BTSOCKET_WARN_LEVEL) \
-               printf
+               kprintf
 
 #define NG_BTSOCKET_L2CAP_RAW_ERR \
        if (ng_btsocket_l2cap_raw_debug_level >= NG_BTSOCKET_ERR_LEVEL) \
-               printf
+               kprintf
 
 #define NG_BTSOCKET_L2CAP_RAW_ALERT \
        if (ng_btsocket_l2cap_raw_debug_level >= NG_BTSOCKET_ALERT_LEVEL) \
-               printf
+               kprintf
 
 /*****************************************************************************
  *****************************************************************************
index 4490224..51cc86f 100644 (file)
@@ -71,19 +71,19 @@ MALLOC_DEFINE(M_NETGRAPH_BTSOCKET_RFCOMM, "netgraph_btsocks_rfcomm",
 /* Debug */
 #define NG_BTSOCKET_RFCOMM_INFO \
        if (ng_btsocket_rfcomm_debug_level >= NG_BTSOCKET_INFO_LEVEL) \
-               printf
+               kprintf
 
 #define NG_BTSOCKET_RFCOMM_WARN \
        if (ng_btsocket_rfcomm_debug_level >= NG_BTSOCKET_WARN_LEVEL) \
-               printf
+               kprintf
 
 #define NG_BTSOCKET_RFCOMM_ERR \
        if (ng_btsocket_rfcomm_debug_level >= NG_BTSOCKET_ERR_LEVEL) \
-               printf
+               kprintf
 
 #define NG_BTSOCKET_RFCOMM_ALERT \
        if (ng_btsocket_rfcomm_debug_level >= NG_BTSOCKET_ALERT_LEVEL) \
-               printf
+               kprintf
 
 #define        ALOT    0x7fff
 
index 2860b81..93a0123 100644 (file)
@@ -594,7 +594,7 @@ ng_bridge_rcvdata(hook_p hook, item_p item)
                                        char suffix[32];
 
                                        if (ifp != NULL)
-                                               snprintf(suffix, sizeof(suffix),
+                                               ksnprintf(suffix, sizeof(suffix),
                                                    " (%s)", ifp->if_xname);
                                        else
                                                *suffix = '\0';
@@ -1037,9 +1037,9 @@ ng_bridge_nodename(node_p node)
        static char name[NG_NODESIZ];
 
        if (NG_NODE_NAME(node) != NULL)
-               snprintf(name, sizeof(name), "%s", NG_NODE_NAME(node));
+               ksnprintf(name, sizeof(name), "%s", NG_NODE_NAME(node));
        else
-               snprintf(name, sizeof(name), "[%x]", ng_node2ID(node));
+               ksnprintf(name, sizeof(name), "[%x]", ng_node2ID(node));
        return name;
 }
 
index b973864..848422b 100644 (file)
@@ -260,9 +260,9 @@ cisco_rcvmsg(node_p node, item_p item, hook_p lasthook)
                                break;
                        }
                        arg = (char *) resp->data;
-                       pos = sprintf(arg,
+                       pos = ksprintf(arg,
                          "keepalive period: %d sec; ", KEEPALIVE_SECS);
-                       pos += sprintf(arg + pos,
+                       pos += ksprintf(arg + pos,
                          "unacknowledged keepalives: %ld", sc->seqRetries);
                        resp->header.arglen = pos + 1;
                        break;
index e15b29d..4a36b90 100644 (file)
@@ -42,25 +42,12 @@ typedef __va_list   va_list;
 #define va_start(ap,last)      __va_start(ap,last)
 #define va_end(ap)     __va_end(ap)
 
-/*
-#define mtx_assert(mtx, MA_OWNED)              \
-                       KKASSERT(mtx_owned(&(mtx)->lock))
-
-#define mtx_assert(mtx, MA_NOTOWNED)           \
-                       KKASSERT(mtx_notowned(&(mtx)->lock))
-*/
-
 #define IFNET_RLOCK()  crit_enter()
 #define IFNET_RUNLOCK()        crit_exit()
 
 #define IFQ_LOCK(ifq)  ALTQ_LOCK((ifq))
 #define IFQ_UNLOCK(ifq)        ALTQ_UNLOCK((ifq))
 
-#define printf         kprintf
-#define sprintf                ksprintf
-#define snprintf       ksnprintf
-#define vsnprintf      kvsnprintf
-
 #define CTR1(ktr_line, ...)
 #define CTR2(ktr_line, ...)
 #define CTR3(ktr_line, ...)
index d1bbb14..7c57c28 100644 (file)
@@ -374,7 +374,7 @@ ng_eiface_constructor(node_p node)
 #if 0
        /* Give this node name */
        bzero(ifname, sizeof(ifname));
-       sprintf(ifname, "if%s", ifp->if_xname);
+       ksprintf(ifname, "if%s", ifp->if_xname);
        (void)ng_name_node(node, ifname);
 #endif
 
index 594c7eb..ae6d99e 100644 (file)
@@ -462,18 +462,18 @@ nglmi_rcvmsg(node_p node, item_p item, hook_p lasthook)
                                break;
                        }
                        arg = resp->data;
-                       pos = sprintf(arg, "protocol %s ", sc->protoname);
+                       pos = ksprintf(arg, "protocol %s ", sc->protoname);
                        if (sc->flags & SCF_FIXED)
-                               pos += sprintf(arg + pos, "fixed\n");
+                               pos += ksprintf(arg + pos, "fixed\n");
                        else if (sc->flags & SCF_AUTO)
-                               pos += sprintf(arg + pos, "auto-detecting\n");
+                               pos += ksprintf(arg + pos, "auto-detecting\n");
                        else
-                               pos += sprintf(arg + pos, "auto on dlci %d\n",
+                               pos += ksprintf(arg + pos, "auto on dlci %d\n",
                                    (sc->lmi_channel == sc->lmi_channel0) ?
                                    0 : 1023);
-                       pos += sprintf(arg + pos,
+                       pos += ksprintf(arg + pos,
                            "keepalive period: %d seconds\n", sc->liv_rate);
-                       pos += sprintf(arg + pos,
+                       pos += ksprintf(arg + pos,
                            "unacknowledged keepalives: %ld\n",
                            sc->seq_retries);
                        for (count = 0;
@@ -481,7 +481,7 @@ nglmi_rcvmsg(node_p node, item_p item, hook_p lasthook)
                              && (pos < (NG_TEXTRESPONSE - 20)));
                             count++) {
                                if (sc->dlci_state[count]) {
-                                       pos += sprintf(arg + pos,
+                                       pos += ksprintf(arg + pos,
                                               "dlci %d %s\n", count,
                                               (sc->dlci_state[count]
                                        == DLCI_UP) ? "up" : "down");
@@ -1003,7 +1003,7 @@ print:
                        pos = 0;
                        j = 0;
                        while ((j++ < 16) && k < m->m_len) {
-                               pos += sprintf(buf + pos, "%c%02x",
+                               pos += ksprintf(buf + pos, "%c%02x",
                                               ((loc == k) ? '>' : ' '),
                                               bp[k]);
                                k++;
@@ -1030,7 +1030,7 @@ reject:
                        pos = 0;
                        j = 0;
                        while ((j++ < 16) && k < m->m_len) {
-                               pos += sprintf(buf + pos, "%c%02x",
+                               pos += ksprintf(buf + pos, "%c%02x",
                                               ((loc == k) ? '>' : ' '),
                                               bp[k]);
                                k++;
index 26caf89..b0ab39d 100644 (file)
@@ -186,7 +186,7 @@ static __inline void
 _chkhook(hook_p hook, char *file, int line)
 {
        if (hook->hk_magic != HK_MAGIC) {
-               printf("Accessing freed hook ");
+               kprintf("Accessing freed hook ");
                dumphook(hook, file, line);
        }
        hook->lastline = line;
@@ -432,7 +432,7 @@ static __inline void
 _chknode(node_p node, char *file, int line)
 {
        if (node->nd_magic != ND_MAGIC) {
-               printf("Accessing freed node ");
+               kprintf("Accessing freed node ");
                dumpnode(node, file, line);
        }
        node->lastline = line;
index 38123c5..956de06 100644 (file)
@@ -689,7 +689,7 @@ ng_rmnode(node_p node, hook_p dummy1, void *dummy2, int dummy3)
                return;
 
        if (node == &ng_deadnode) {
-               printf ("shutdown called on deadnode\n");
+               kprintf ("shutdown called on deadnode\n");
                return;
        }
 
@@ -1129,7 +1129,7 @@ ng_destroy_hook(hook_p hook)
        node_p node;
 
        if (hook == &ng_deadhook) {     /* better safe than sorry */
-               printf("ng_destroy_hook called on deadhook\n");
+               kprintf("ng_destroy_hook called on deadhook\n");
                return;
        }
 
@@ -1237,7 +1237,7 @@ ng_newtype(struct ng_type *tp)
        || (namelen >= NG_TYPESIZ)) {
                TRAP_ERROR();
                if (tp->version != NG_ABI_VERSION) {
-                       printf("Netgraph: Node type rejected. ABI mismatch. Suggest recompile\n");
+                       kprintf("Netgraph: Node type rejected. ABI mismatch. Suggest recompile\n");
                }
                return (EINVAL);
        }
@@ -1327,7 +1327,7 @@ ng_con_part3(node_p node, item_p item, hook_p hook)
        if (hook->hk_node->nd_type->connect) {
                if ((error = (*hook->hk_node->nd_type->connect) (hook))) {
                        ng_destroy_hook(hook);  /* also zaps peer */
-                       printf("failed in ng_con_part3()\n");
+                       kprintf("failed in ng_con_part3()\n");
                        ERROUT(error);
                }
        }
@@ -1361,7 +1361,7 @@ ng_con_part2(node_p node, item_p item, hook_p hook)
        if (ng_findhook(node, NG_HOOK_NAME(hook)) != NULL) {
                TRAP_ERROR();
                ng_destroy_hook(hook); /* should destroy peer too */
-               printf("failed in ng_con_part2()\n");
+               kprintf("failed in ng_con_part2()\n");
                ERROUT(EEXIST);
        }
        /*
@@ -1374,7 +1374,7 @@ ng_con_part2(node_p node, item_p item, hook_p hook)
                if ((error = (*node->nd_type->newhook)(node, hook,
                    hook->hk_name))) {
                        ng_destroy_hook(hook); /* should destroy peer too */
-                       printf("failed in ng_con_part2()\n");
+                       kprintf("failed in ng_con_part2()\n");
                        ERROUT(error);
                }
        }
@@ -1401,7 +1401,7 @@ ng_con_part2(node_p node, item_p item, hook_p hook)
        if (hook->hk_node->nd_type->connect) {
                if ((error = (*hook->hk_node->nd_type->connect) (hook))) {
                        ng_destroy_hook(hook);  /* also zaps peer */
-                       printf("failed in ng_con_part2(A)\n");
+                       kprintf("failed in ng_con_part2(A)\n");
                        ERROUT(error);
                }
        }
@@ -1413,7 +1413,7 @@ ng_con_part2(node_p node, item_p item, hook_p hook)
        peer = hook->hk_peer;
        if (peer == &ng_deadhook) {
                TOPOLOGY_RUNLOCK();
-               printf("failed in ng_con_part2(B)\n");
+               kprintf("failed in ng_con_part2(B)\n");
                ng_destroy_hook(hook);
                ERROUT(ENOENT);
        }
@@ -1421,7 +1421,7 @@ ng_con_part2(node_p node, item_p item, hook_p hook)
 
        if ((error = ng_send_fn2(peer->hk_node, peer, item, &ng_con_part3,
            NULL, 0, NG_REUSE_ITEM))) {
-               printf("failed in ng_con_part2(C)\n");
+               kprintf("failed in ng_con_part2(C)\n");
                ng_destroy_hook(hook);  /* also zaps peer */
                return (error);         /* item was consumed. */
        }
@@ -1473,7 +1473,7 @@ ng_con_nodes(item_p item, node_p node, const char *name,
         */
        if ((error = ng_send_fn2(node2, hook2, item, &ng_con_part2, NULL, 0,
            NG_NOFLAGS))) {
-               printf("failed in ng_con_nodes(): %d\n", error);
+               kprintf("failed in ng_con_nodes(): %d\n", error);
                ng_destroy_hook(hook);  /* also zaps peer */
        }
 
@@ -1778,7 +1778,7 @@ ng_path2noderef(node_p here, const char *address,
                        TRAP_ERROR();
                        NG_NODE_UNREF(node);
 #if 0
-                       printf("hooknotvalid %s %s %d %d %d %d ",
+                       kprintf("hooknotvalid %s %s %d %d %d %d ",
                                        path,
                                        segment,
                                        hook == NULL,
@@ -2429,7 +2429,7 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook)
                }
 
                /* Convert command name to ASCII */
-               snprintf(ascii->header.cmdstr, sizeof(ascii->header.cmdstr),
+               ksnprintf(ascii->header.cmdstr, sizeof(ascii->header.cmdstr),
                    "%s", c->name);
 
                /* Convert command arguments to ASCII */
@@ -2830,43 +2830,43 @@ SYSCTL_INT(_net_graph, OID_AUTO, msg_version, CTLFLAG_RD, 0, NG_VERSION, "");
 void
 dumphook (hook_p hook, char *file, int line)
 {
-       printf("hook: name %s, %d refs, Last touched:\n",
+       kprintf("hook: name %s, %d refs, Last touched:\n",
                _NG_HOOK_NAME(hook), hook->hk_refs);
-       printf("        Last active @ %s, line %d\n",
+       kprintf("       Last active @ %s, line %d\n",
                hook->lastfile, hook->lastline);
        if (line) {
-               printf(" problem discovered at file %s, line %d\n", file, line);
+               kprintf(" problem discovered at file %s, line %d\n", file, line);
        }
 }
 
 void
 dumpnode(node_p node, char *file, int line)
 {
-       printf("node: ID [%x]: type '%s', %d hooks, flags 0x%x, %d refs, %s:\n",
+       kprintf("node: ID [%x]: type '%s', %d hooks, flags 0x%x, %d refs, %s:\n",
                _NG_NODE_ID(node), node->nd_type->name,
                node->nd_numhooks, node->nd_flags,
                node->nd_refs, node->nd_name);
-       printf("        Last active @ %s, line %d\n",
+       kprintf("       Last active @ %s, line %d\n",
                node->lastfile, node->lastline);
        if (line) {
-               printf(" problem discovered at file %s, line %d\n", file, line);
+               kprintf(" problem discovered at file %s, line %d\n", file, line);
        }
 }
 
 void
 dumpitem(item_p item, char *file, int line)
 {
-       printf(" ACTIVE item, last used at %s, line %d",
+       kprintf(" ACTIVE item, last used at %s, line %d",
                item->lastfile, item->lastline);
        switch(item->el_flags & NGQF_TYPE) {
        case NGQF_DATA:
-               printf(" - [data]\n");
+               kprintf(" - [data]\n");
                break;
        case NGQF_MESG:
-               printf(" - retaddr[%d]:\n", _NGI_RETADDR(item));
+               kprintf(" - retaddr[%d]:\n", _NGI_RETADDR(item));
                break;
        case NGQF_FN:
-               printf(" - fn@%p (%p, %p, %p, %d (%x))\n",
+               kprintf(" - fn@%p (%p, %p, %p, %d (%x))\n",
                        _NGI_FN(item),
                        _NGI_NODE(item),
                        _NGI_HOOK(item),
@@ -2875,7 +2875,7 @@ dumpitem(item_p item, char *file, int line)
                        item->body.fn.fn_arg2);
                break;
        case NGQF_FN2:
-               printf(" - fn2@%p (%p, %p, %p, %d (%x))\n",
+               kprintf(" - fn2@%p (%p, %p, %p, %d (%x))\n",
                        _NGI_FN2(item),
                        _NGI_NODE(item),
                        _NGI_HOOK(item),
@@ -2885,9 +2885,9 @@ dumpitem(item_p item, char *file, int line)
                break;
        }
        if (line) {
-               printf(" problem discovered at file %s, line %d\n", file, line);
+               kprintf(" problem discovered at file %s, line %d\n", file, line);
                if (_NGI_NODE(item)) {
-                       printf("node %p ([%x])\n",
+                       kprintf("node %p ([%x])\n",
                                _NGI_NODE(item), ng_node2ID(_NGI_NODE(item)));
                }
        }
@@ -2899,7 +2899,7 @@ ng_dumpitems(void)
        item_p item;
        int i = 1;
        TAILQ_FOREACH(item, &ng_itemlist, all) {
-               printf("[%d] ", i++);
+               kprintf("[%d] ", i++);
                dumpitem(item, NULL, 0);
        }
 }
@@ -2911,7 +2911,7 @@ ng_dumpnodes(void)
        int i = 1;
        mtx_lock(&ng_nodelist_mtx);
        SLIST_FOREACH(node, &ng_allnodes, nd_all) {
-               printf("[%d] ", i++);
+               kprintf("[%d] ", i++);
                dumpnode(node, NULL, 0);
        }
        mtx_unlock(&ng_nodelist_mtx);
@@ -2924,7 +2924,7 @@ ng_dumphooks(void)
        int i = 1;
        mtx_lock(&ng_nodelist_mtx);
        SLIST_FOREACH(hook, &ng_allhooks, hk_all) {
-               printf("[%d] ", i++);
+               kprintf("[%d] ", i++);
                dumphook(hook, NULL, 0);
        }
        mtx_unlock(&ng_nodelist_mtx);
@@ -2961,12 +2961,12 @@ SYSCTL_PROC(_debug, OID_AUTO, ng_dump_items, CTLTYPE_INT | CTLFLAG_RW,
 #define        ITEM_DEBUG_CHECKS                                               \
        do {                                                            \
                if (NGI_NODE(item) ) {                                  \
-                       printf("item already has node");                \
+                       kprintf("item already has node");               \
                        kdb_enter(KDB_WHY_NETGRAPH, "has node");        \
                        NGI_CLR_NODE(item);                             \
                }                                                       \
                if (NGI_HOOK(item) ) {                                  \
-                       printf("item already has hook");                \
+                       kprintf("item already has hook");               \
                        kdb_enter(KDB_WHY_NETGRAPH, "has hook");        \
                        NGI_CLR_HOOK(item);                             \
                }                                                       \
index f5debd9..187d6c9 100644 (file)
@@ -1057,7 +1057,7 @@ ng_enaddr_unparse(const struct ng_parse_type *type,
 {
        int len;
 
-       len = snprintf(cbuf, cbuflen, "%02x:%02x:%02x:%02x:%02x:%02x",
+       len = ksnprintf(cbuf, cbuflen, "%02x:%02x:%02x:%02x:%02x:%02x",
            data[*off], data[*off + 1], data[*off + 2],
            data[*off + 3], data[*off + 4], data[*off + 5]);
        if (len >= cbuflen)
@@ -1636,7 +1636,7 @@ ng_parse_append(char **cbufp, int *cbuflenp, const char *fmt, ...)
        int len;
 
        va_start(args, fmt);
-       len = vsnprintf(*cbufp, *cbuflenp, fmt, args);
+       len = kvsnprintf(*cbufp, *cbuflenp, fmt, args);
        va_end(args);
        if (len >= *cbuflenp)
                return ERANGE;
@@ -1864,7 +1864,7 @@ ng_encode_string(const char *raw, int slen)
                        break;
                default:
                        if (*raw < 0x20 || *raw > 0x7e) {
-                               off += sprintf(cbuf + off,
+                               off += ksprintf(cbuf + off,
                                    "\\x%02x", (u_char)*raw);
                                break;
                        }
index 502a1fe..a4a292c 100644 (file)
@@ -32,7 +32,7 @@
  */
 
 #if 0
-#define        DBG do { printf("ng_device: %s\n", __func__ ); } while (0)
+#define        DBG do { kprintf("ng_device: %s\n", __func__ ); } while (0)
 #else
 #define        DBG do {} while (0)
 #endif
@@ -179,7 +179,7 @@ ng_device_constructor(node_p node)
        priv->ngddev = make_dev(&ngd_cdevsw, unit2minor(priv->unit), UID_ROOT,
            GID_WHEEL, 0600, NG_DEVICE_DEVNAME "%d", priv->unit);
        if(priv->ngddev == NULL) {
-               printf("%s(): make_dev() failed\n",__func__);
+               kprintf("%s(): make_dev() failed\n",__func__);
                mtx_destroy(&priv->ngd_mtx);
                mtx_destroy(&priv->readq.ifq_mtx);
                free_unr(ngd_unit, priv->unit);
@@ -383,7 +383,7 @@ ngdioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td
        NG_MKMESSAGE(msg, NGM_DEVICE_COOKIE, cmd, sizeof(struct ngd_param_s),
                        M_WAITOK);
        if (msg == NULL) {
-               printf("%s(): msg == NULL\n",__func__);
+               kprintf("%s(): msg == NULL\n",__func__);
                goto nomsg;
        }
 
@@ -393,7 +393,7 @@ ngdioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td
 
        NG_SEND_MSG_HOOK(error, sc->node, msg, connection->active_hook, 0);
        if(error)
-               printf("%s(): NG_SEND_MSG_HOOK error: %d\n",__func__,error);
+               kprintf("%s(): NG_SEND_MSG_HOOK error: %d\n",__func__,error);
 
 nomsg:
 
index 194c357..240efb8 100644 (file)
@@ -361,7 +361,7 @@ ng_fec_addport(struct ng_fec_private *priv, char *iface)
 
        /* Only allow reconfiguration if not running. */
        if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-               printf("fec%d: can't add new iface; bundle is running\n",
+               kprintf("fec%d: can't add new iface; bundle is running\n",
                    priv->unit);
                return (EINVAL);
        }
@@ -369,14 +369,14 @@ ng_fec_addport(struct ng_fec_private *priv, char *iface)
        /* Find the interface */
        bifp = ifunit(iface);
        if (bifp == NULL) {
-               printf("fec%d: tried to add iface %s, which "
+               kprintf("fec%d: tried to add iface %s, which "
                    "doesn't seem to exist\n", priv->unit, iface);
                return(ENOENT);
        }
 
        /* See if we have room in the bundle */
        if (b->fec_ifcnt == FEC_BUNDLESIZ) {
-               printf("fec%d: can't add new iface; bundle is full\n",
+               kprintf("fec%d: can't add new iface; bundle is full\n",
                    priv->unit);
                return(ENOSPC);
        }
@@ -384,7 +384,7 @@ ng_fec_addport(struct ng_fec_private *priv, char *iface)
        /* See if the interface is already in the bundle */
        TAILQ_FOREACH(p, &b->ng_fec_ports, fec_list) {
                if (p->fec_if == bifp) {
-                       printf("fec%d: iface %s is already in this "
+                       kprintf("fec%d: iface %s is already in this "
                            "bundle\n", priv->unit, iface);
                        return(EINVAL);
                }
@@ -397,7 +397,7 @@ ng_fec_addport(struct ng_fec_private *priv, char *iface)
         */
        if (b->fec_if_output != NULL) {
                if (b->fec_if_output != bifp->if_output) {
-                       printf("fec%d: iface %s is not the same type "
+                       kprintf("fec%d: iface %s is not the same type "
                            "as the other interface(s) already in "
                            "the bundle\n", priv->unit, iface);
                        return(EINVAL);
@@ -472,7 +472,7 @@ ng_fec_delport(struct ng_fec_private *priv, char *iface)
 
        /* Only allow reconfiguration if not running. */
        if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-               printf("fec%d: can't remove iface; bundle is running\n",
+               kprintf("fec%d: can't remove iface; bundle is running\n",
                    priv->unit);
                return (EINVAL);
        }
@@ -480,7 +480,7 @@ ng_fec_delport(struct ng_fec_private *priv, char *iface)
        /* Find the interface */
        bifp = ifunit(iface);
        if (bifp == NULL) {
-               printf("fec%d: tried to remove iface %s, which "
+               kprintf("fec%d: tried to remove iface %s, which "
                    "doesn't seem to exist\n", priv->unit, iface);
                return(ENOENT);
        }
@@ -491,7 +491,7 @@ ng_fec_delport(struct ng_fec_private *priv, char *iface)
        }
 
        if (p == NULL) {
-               printf("fec%d: tried to remove iface %s which "
+               kprintf("fec%d: tried to remove iface %s which "
                    "is not in our bundle\n", priv->unit, iface);
                return(EINVAL);
        }
@@ -621,7 +621,7 @@ ng_fec_init(void *arg)
        b = &priv->fec_bundle;
 
        if (b->fec_ifcnt != 2 && b->fec_ifcnt != FEC_BUNDLESIZ) {
-               printf("fec%d: invalid bundle "
+               kprintf("fec%d: invalid bundle "
                    "size: %d\n", priv->unit,
                    b->fec_ifcnt);
                return;
@@ -687,7 +687,7 @@ ng_fec_tick(void *arg)
                ifp = p->fec_if;
                error = (*ifp->if_ioctl)(ifp, SIOCGIFMEDIA, (caddr_t)&ifmr);
                if (error) {
-                       printf("fec%d: failed to check status "
+                       kprintf("fec%d: failed to check status "
                            "of link %s\n", priv->unit, ifp->if_xname);
                        continue;
                }
@@ -697,7 +697,7 @@ ng_fec_tick(void *arg)
                                if (p->fec_ifstat == -1 ||
                                    p->fec_ifstat == 0) {
                                        p->fec_ifstat = 1;
-                                       printf("fec%d: port %s in bundle "
+                                       kprintf("fec%d: port %s in bundle "
                                            "is up\n", priv->unit,
                                            ifp->if_xname);
                                }
@@ -705,7 +705,7 @@ ng_fec_tick(void *arg)
                                if (p->fec_ifstat == -1 ||
                                    p->fec_ifstat == 1) {
                                        p->fec_ifstat = 0;
-                                       printf("fec%d: port %s in bundle "
+                                       kprintf("fec%d: port %s in bundle "
                                            "is down\n", priv->unit,
                                            ifp->if_xname);
                                }
@@ -803,7 +803,7 @@ ng_fec_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
                                /* Sanity. */
                                if (b->fec_ifcnt != 2 &&
                                    b->fec_ifcnt != FEC_BUNDLESIZ) {
-                                       printf("fec%d: invalid bundle "
+                                       kprintf("fec%d: invalid bundle "
                                            "size: %d\n", priv->unit,
                                            b->fec_ifcnt);
                                        error = EINVAL;
index 3a2c91b..0af2a64 100644 (file)
@@ -614,7 +614,7 @@ ng_source_store_output_ifp(sc_p sc, char *ifname)
        ifp = ifunit(ifname);
 
        if (ifp == NULL) {
-               printf("%s: can't find interface %d\n", __func__, if_index);
+               kprintf("%s: can't find interface %d\n", __func__, if_index);
                return (EINVAL);
        }
        sc->output_ifp = ifp;
@@ -627,7 +627,7 @@ ng_source_store_output_ifp(sc_p sc, char *ifname)
         */
        s = splimp();           /* XXX is this required? */
        if (ifp->if_snd.ifq_maxlen < NG_SOURCE_DRIVER_IFQ_MAXLEN) {
-               printf("ng_source: changing ifq_maxlen from %d to %d\n",
+               kprintf("ng_source: changing ifq_maxlen from %d to %d\n",
                    ifp->if_snd.ifq_maxlen, NG_SOURCE_DRIVER_IFQ_MAXLEN);
                ifq_set_maxlen(&ifp->if_snd, NG_SOURCE_DRIVER_IFQ_MAXLEN);
        }
@@ -680,7 +680,7 @@ static int
 ng_source_start(sc_p sc, uint64_t packets)
 {
        if (sc->output_ifp == NULL) {
-               printf("ng_source: start without iface configured\n");
+               kprintf("ng_source: start without iface configured\n");
                return (ENXIO);
        }
 
index d39057b..42840fb 100644 (file)
@@ -132,7 +132,7 @@ ng_split_rcvdata(hook_p hook, item_p item)
        int             error = 0;
 
        if (hook == priv->out) {
-               printf("ng_split: got packet from out hook!\n");
+               kprintf("ng_split: got packet from out hook!\n");
                NG_FREE_ITEM(item);
                error = EINVAL;
        } else if ((hook == priv->in) && (priv->mixed != NULL)) {
index ee3de82..8a8b84e 100644 (file)
@@ -1517,7 +1517,7 @@ ng_ppp_mp_recv(node_p node, item_p item, uint16_t proto, uint16_t linkNum)
 
        /* Get a new frag struct from the free queue */
        if ((frag = TAILQ_FIRST(&priv->fragsfree)) == NULL) {
-               printf("No free fragments headers in ng_ppp!\n");
+               kprintf("No free fragments headers in ng_ppp!\n");
                NG_FREE_M(m);
                goto process;
        }
index ae87bbc..7b92b5d 100644 (file)
@@ -286,7 +286,7 @@ ngc_send(netmsg_t netmsg)
                        }
 
                        /* Not found, try to load it as a loadable module. */
-                       snprintf(filename, sizeof(filename), "ng_%s.ko",
+                       ksnprintf(filename, sizeof(filename), "ng_%s.ko",
                            mkp->type);
                        error = linker_load_file(filename, &fileid);
                        if (error != 0) {
@@ -308,13 +308,13 @@ ngc_send(netmsg_t netmsg)
        if ((error = ng_address_path((pcbp->sockdata->node), item, path, 0))
            != 0) {
 #ifdef TRACE_MESSAGES
-               printf("ng_address_path: errx=%d\n", error);
+               kprintf("ng_address_path: errx=%d\n", error);
 #endif
                goto release;
        }
 
 #ifdef TRACE_MESSAGES
-       printf("[%x]:<---------[socket]: c=<%d>cmd=%x(%s) f=%x #%d (%s)\n",
+       kprintf("[%x]:<---------[socket]: c=<%d>cmd=%x(%s) f=%x #%d (%s)\n",
                item->el_dest->nd_ID,
                msg->header.typecookie,
                msg->header.cmd,
@@ -373,7 +373,7 @@ ngc_connect(netmsg_t msg)
         * At this time refuse to do this.. it used to
         * do something but it was undocumented and not used.
         */
-       printf("program tried to connect control socket to remote node\n");
+       kprintf("program tried to connect control socket to remote node\n");
        lwkt_replymsg(&msg->connect.base.lmsg, EINVAL);
 }
 
@@ -900,7 +900,7 @@ ngs_rcvmsg(node_p node, item_p item, hook_p lasthook)
        so = pcbp->ng_socket;
 
 #ifdef TRACE_MESSAGES
-       printf("[%x]:---------->[socket]: c=<%d>cmd=%x(%s) f=%x #%d\n",
+       kprintf("[%x]:---------->[socket]: c=<%d>cmd=%x(%s) f=%x #%d\n",
                retaddr,
                msg->header.typecookie,
                msg->header.cmd,
@@ -929,10 +929,10 @@ ngs_rcvmsg(node_p node, item_p item, hook_p lasthook)
        bzero(&addr, sizeof(addr));
        addr.sg_len = sizeof(addr);
        addr.sg_family = AF_NETGRAPH;
-       addrlen = snprintf((char *)&addr.sg_data, sizeof(addr.sg_data),
+       addrlen = ksnprintf((char *)&addr.sg_data, sizeof(addr.sg_data),
            "[%x]:", retaddr);
        if (addrlen < 0 || addrlen > sizeof(addr.sg_data)) {
-               printf("%s: snprintf([%x]) failed - %d\n", __func__, retaddr,
+               kprintf("%s: ksnprintf([%x]) failed - %d\n", __func__, retaddr,
                    addrlen);
                NG_FREE_MSG(msg);
                return (EINVAL);
index 694677f..7da3b71 100644 (file)
@@ -209,7 +209,7 @@ ngt_open(struct cdev *dev, struct tty *tp)
        }
 
        atomic_add_int(&ngt_unit, 1);
-       snprintf(name, sizeof(name), "%s%d", typestruct.name, ngt_unit);
+       ksnprintf(name, sizeof(name), "%s%d", typestruct.name, ngt_unit);
 
        /* Assign node its name */
        if ((error = ng_name_node(sc->node, name))) {