From owner-svn-src-all@freebsd.org Wed Jul 22 18:21:37 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C2A6135B6CC; Wed, 22 Jul 2020 18:21:37 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BBkLn4nxkz4Xy9; Wed, 22 Jul 2020 18:21:37 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6DFB4B75C; Wed, 22 Jul 2020 18:21:37 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 06MILb9P060788; Wed, 22 Jul 2020 18:21:37 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06MILbjm060787; Wed, 22 Jul 2020 18:21:37 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202007221821.06MILbjm060787@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 22 Jul 2020 18:21:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r363424 - head/sys/cam/mmc X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/cam/mmc X-SVN-Commit-Revision: 363424 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jul 2020 18:21:37 -0000 Author: manu Date: Wed Jul 22 18:21:37 2020 New Revision: 363424 URL: https://svnweb.freebsd.org/changeset/base/363424 Log: mmccam: Use a sbuf for the mmc ident function While here fix a typo. Modified: head/sys/cam/mmc/mmc_xpt.c Modified: head/sys/cam/mmc/mmc_xpt.c ============================================================================== --- head/sys/cam/mmc/mmc_xpt.c Wed Jul 22 17:37:11 2020 (r363423) +++ head/sys/cam/mmc/mmc_xpt.c Wed Jul 22 18:21:37 2020 (r363424) @@ -408,27 +408,47 @@ mmc_announce_periph(struct cam_periph *periph) void mmc_print_ident(struct mmc_params *ident_data) { - printf("Relative addr: %08x\n", ident_data->card_rca); - printf("Card features: <"); - if (ident_data->card_features & CARD_FEATURE_MMC) - printf("MMC "); - if (ident_data->card_features & CARD_FEATURE_MEMORY) - printf("Memory "); - if (ident_data->card_features & CARD_FEATURE_SDHC) - printf("High-Capacity "); - if (ident_data->card_features & CARD_FEATURE_SD20) - printf("SD2.0-Conditions "); - if (ident_data->card_features & CARD_FEATURE_SDIO) - printf("SDIO "); - printf(">\n"); + struct sbuf *sb; + bool space = false; - if (ident_data->card_features & CARD_FEATURE_MEMORY) - printf("Card memory OCR: %08x\n", ident_data->card_ocr); + sb = sbuf_new_auto(); + sbuf_printf(sb, "Relative addr: %08x\n", ident_data->card_rca); + sbuf_printf(sb, "Card features: <"); + if (ident_data->card_features & CARD_FEATURE_MMC) { + sbuf_printf(sb, "MMC"); + space = true; + } + if (ident_data->card_features & CARD_FEATURE_MEMORY) { + sbuf_printf(sb, "%sMemory", space ? " " : ""); + space = true; + } + if (ident_data->card_features & CARD_FEATURE_SDHC) { + sbuf_printf(sb, "%sHigh-Capacity", space ? " " : ""); + space = true; + } + if (ident_data->card_features & CARD_FEATURE_SD20) { + sbuf_printf(sb, "%sSD2.0-Conditions", space ? " " : ""); + space = true; + } + if (ident_data->card_features & CARD_FEATURE_SDIO) { + sbuf_printf(sb, "%sSDIO", space ? " " : ""); + space = true; + } + sbuf_printf(sb, ">\n"); - if (ident_data->card_features & CARD_FEATURE_SDIO) { - printf("Card IO OCR: %08x\n", ident_data->io_ocr); - printf("Number of funcitions: %u\n", ident_data->sdio_func_count); - } + if (ident_data->card_features & CARD_FEATURE_MEMORY) + sbuf_printf(sb, "Card memory OCR: %08x\n", + ident_data->card_ocr); + + if (ident_data->card_features & CARD_FEATURE_SDIO) { + sbuf_printf(sb, "Card IO OCR: %08x\n", ident_data->io_ocr); + sbuf_printf(sb, "Number of functions: %u\n", + ident_data->sdio_func_count); + } + + sbuf_finish(sb); + printf("%s", sbuf_data(sb)); + sbuf_clear(sb); } static void