24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * CDDL HEADER START
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * The contents of this file are subject to the terms of the
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * Common Development and Distribution License (the "License").
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * You may not use this file except in compliance with the License.
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * See the License for the specific language governing permissions
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * and limitations under the License.
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * When distributing Covered Code, include this CDDL HEADER in each
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * If applicable, add the following below this CDDL HEADER, with the
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * fields enclosed by brackets "[]" replaced with your own identifying
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * information: Portions Copyright [yyyy] [name of copyright owner]
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * CDDL HEADER END
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * Use is subject to license terms.
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock#pragma ident "%Z%%M% %I% %E% SMI"
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock/*PRINTFLIKE1*/
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrockddump(const char *label, const void *data, size_t length)
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock for (byte_count = 0; byte_count < length; byte_count += i) {
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock (void) snprintf(linep, bufleft, "0x%08x ", byte_count);
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * Inner loop processes 16 bytes at a time, or less
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * if we have less than 16 bytes to go
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock for (i = 0; (i < 16) && ((byte_count + i) < length); i++) {
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock (void) snprintf(linep, bufleft, "%02X", (unsigned int)
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock if (i == 7)
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * If i is less than 16, then we had less than 16 bytes
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * written to the output. We need to fixup the alignment
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * to allow the "text" output to be aligned
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock if (i < 16) {
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock while (numspaces-- > 0) {
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock for (i = 0; (i < 16) && ((byte_count + i) < length); i++) {
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrockconst char *
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock return ("memory allocation failure");
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock return ("failed to open device");
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock return ("no supported communication protocol");
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock return ("disk status information not supported");
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock return ("not a valid simulator file");
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock return ("I/O error from device");
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock return ("unknown error");
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock return (-1);