1 /* 2 * CDDL HEADER START 3 * 4 * Copyright(c) 2007-2008 Intel Corporation. All rights reserved. 5 * The contents of this file are subject to the terms of the 6 * Common Development and Distribution License (the "License"). 7 * You may not use this file except in compliance with the License. 8 * 9 * You can obtain a copy of the license at: 10 * http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When using or redistributing this file, you may do so under the 15 * License only. No other modification of this header is permitted. 16 * 17 * If applicable, add the following below this CDDL HEADER, with the 18 * fields enclosed by brackets "[]" replaced with your own identifying 19 * information: Portions Copyright [yyyy] [name of copyright owner] 20 * 21 * CDDL HEADER END 22 */ 23 24 /* 25 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 26 * Use is subject to license terms of the CDDL. 27 */ 28 29 #include "ixgbe_sw.h" 30 31 #define LOG_BUF_LEN 128 32 33 /* 34 * ixgbe_notice - Report a run-time event (CE_NOTE, to console & log) 35 */ 36 void 37 ixgbe_notice(void *arg, const char *fmt, ...) 38 { 39 ixgbe_t *ixgbep = (ixgbe_t *)arg; 40 char buf[LOG_BUF_LEN]; 41 va_list ap; 42 43 va_start(ap, fmt); 44 (void) vsnprintf(buf, sizeof (buf), fmt, ap); 45 va_end(ap); 46 47 if (ixgbep != NULL) 48 cmn_err(CE_NOTE, "%s%d: %s", MODULE_NAME, ixgbep->instance, 49 buf); 50 else 51 cmn_err(CE_NOTE, "%s: %s", MODULE_NAME, buf); 52 } 53 54 /* 55 * ixgbe_log - Log a run-time event (CE_NOTE, to log only) 56 */ 57 void 58 ixgbe_log(void *arg, const char *fmt, ...) 59 { 60 ixgbe_t *ixgbep = (ixgbe_t *)arg; 61 char buf[LOG_BUF_LEN]; 62 va_list ap; 63 64 va_start(ap, fmt); 65 (void) vsnprintf(buf, sizeof (buf), fmt, ap); 66 va_end(ap); 67 68 if (ixgbep != NULL) 69 cmn_err(CE_NOTE, "!%s%d: %s", MODULE_NAME, ixgbep->instance, 70 buf); 71 else 72 cmn_err(CE_NOTE, "!%s: %s", MODULE_NAME, buf); 73 } 74 75 /* 76 * ixgbe_error - Log a run-time problem (CE_WARN, to log only) 77 */ 78 void 79 ixgbe_error(void *arg, const char *fmt, ...) 80 { 81 ixgbe_t *ixgbep = (ixgbe_t *)arg; 82 char buf[LOG_BUF_LEN]; 83 va_list ap; 84 85 va_start(ap, fmt); 86 (void) vsnprintf(buf, sizeof (buf), fmt, ap); 87 va_end(ap); 88 89 if (ixgbep != NULL) 90 cmn_err(CE_WARN, "!%s%d: %s", MODULE_NAME, ixgbep->instance, 91 buf); 92 else 93 cmn_err(CE_WARN, "!%s: %s", MODULE_NAME, buf); 94 } 95