cam_xpt.c (685dc743dc3b5645e34836464128e1c0558b404b) cam_xpt.c (70f2356d364fdb7e2ff5487ae03125a338defd54)
1/*-
2 * Implementation of the Common Access Method Transport (XPT) layer.
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 *
6 * Copyright (c) 1997, 1998, 1999 Justin T. Gibbs.
7 * Copyright (c) 1997, 1998, 1999 Kenneth D. Merry.
8 * All rights reserved.

--- 3698 unchanged lines hidden (view full) ---

3707
3708 sbuf_new(&sb, buffer, XPT_PRINT_LEN, SBUF_FIXEDLEN);
3709 xpt_path_sbuf(path, &sb);
3710 sbuf_finish(&sb);
3711 printf("%s", sbuf_data(&sb));
3712 sbuf_delete(&sb);
3713}
3714
1/*-
2 * Implementation of the Common Access Method Transport (XPT) layer.
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 *
6 * Copyright (c) 1997, 1998, 1999 Justin T. Gibbs.
7 * Copyright (c) 1997, 1998, 1999 Kenneth D. Merry.
8 * All rights reserved.

--- 3698 unchanged lines hidden (view full) ---

3707
3708 sbuf_new(&sb, buffer, XPT_PRINT_LEN, SBUF_FIXEDLEN);
3709 xpt_path_sbuf(path, &sb);
3710 sbuf_finish(&sb);
3711 printf("%s", sbuf_data(&sb));
3712 sbuf_delete(&sb);
3713}
3714
3715void
3716xpt_print_device(struct cam_ed *device)
3715static void
3716xpt_device_sbuf(struct cam_ed *device, struct sbuf *sb)
3717{
3717{
3718
3719 if (device == NULL)
3718 if (device == NULL)
3720 printf("(nopath): ");
3719 sbuf_printf(sb, "(nopath): ");
3721 else {
3720 else {
3722 printf("(noperiph:%s%d:%d:%d:%jx): ", device->sim->sim_name,
3723 device->sim->unit_number,
3724 device->sim->bus_id,
3725 device->target->target_id,
3726 (uintmax_t)device->lun_id);
3721 sbuf_printf(sb, "(noperiph:%s%d:%d:%d:%jx): ",
3722 device->sim->sim_name,
3723 device->sim->unit_number,
3724 device->sim->bus_id,
3725 device->target->target_id,
3726 (uintmax_t)device->lun_id);
3727 }
3728}
3729
3730void
3731xpt_print(struct cam_path *path, const char *fmt, ...)
3732{
3733 va_list ap;
3734 struct sbuf sb;

--- 1803 unchanged lines hidden (view full) ---

5538 if (walker->v == action)
5539 return (walker->name);
5540 walker++;
5541 }
5542
5543 snprintf(buffer, sizeof(buffer), "%#x", action);
5544 return (buffer);
5545}
3727 }
3728}
3729
3730void
3731xpt_print(struct cam_path *path, const char *fmt, ...)
3732{
3733 va_list ap;
3734 struct sbuf sb;

--- 1803 unchanged lines hidden (view full) ---

5538 if (walker->v == action)
5539 return (walker->name);
5540 walker++;
5541 }
5542
5543 snprintf(buffer, sizeof(buffer), "%#x", action);
5544 return (buffer);
5545}
5546
5547void
5548xpt_cam_path_debug(struct cam_path *path, const char *fmt, ...)
5549{
5550 struct sbuf sbuf;
5551 char buf[XPT_PRINT_LEN]; /* balance to not eat too much stack */
5552 struct sbuf *sb = sbuf_new(&sbuf, buf, sizeof(buf), SBUF_FIXEDLEN);
5553 va_list ap;
5554
5555 sbuf_set_drain(sb, sbuf_printf_drain, NULL);
5556 xpt_path_sbuf(path, sb);
5557 va_start(ap, fmt);
5558 sbuf_vprintf(sb, fmt, ap);
5559 va_end(ap);
5560 sbuf_finish(sb);
5561 sbuf_delete(sb);
5562 if (cam_debug_delay != 0)
5563 DELAY(cam_debug_delay);
5564}
5565
5566void
5567xpt_cam_dev_debug(struct cam_ed *dev, const char *fmt, ...)
5568{
5569 struct sbuf sbuf;
5570 char buf[XPT_PRINT_LEN]; /* balance to not eat too much stack */
5571 struct sbuf *sb = sbuf_new(&sbuf, buf, sizeof(buf), SBUF_FIXEDLEN);
5572 va_list ap;
5573
5574 sbuf_set_drain(sb, sbuf_printf_drain, NULL);
5575 xpt_device_sbuf(dev, sb);
5576 va_start(ap, fmt);
5577 sbuf_vprintf(sb, fmt, ap);
5578 va_end(ap);
5579 sbuf_finish(sb);
5580 sbuf_delete(sb);
5581 if (cam_debug_delay != 0)
5582 DELAY(cam_debug_delay);
5583}
5584
5585void
5586xpt_cam_debug(const char *fmt, ...)
5587{
5588 struct sbuf sbuf;
5589 char buf[XPT_PRINT_LEN]; /* balance to not eat too much stack */
5590 struct sbuf *sb = sbuf_new(&sbuf, buf, sizeof(buf), SBUF_FIXEDLEN);
5591 va_list ap;
5592
5593 sbuf_set_drain(sb, sbuf_printf_drain, NULL);
5594 sbuf_printf(sb, "cam_debug: ");
5595 va_start(ap, fmt);
5596 sbuf_vprintf(sb, fmt, ap);
5597 va_end(ap);
5598 sbuf_finish(sb);
5599 sbuf_delete(sb);
5600 if (cam_debug_delay != 0)
5601 DELAY(cam_debug_delay);
5602}