From nobody Wed Nov 5 09:21:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499423495442838.252014546537; Fri, 7 Jul 2017 03:31:35 -0700 (PDT) Received: from localhost ([::1]:55486 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTQXu-0006Dh-1d for importer@patchew.org; Fri, 07 Jul 2017 06:31:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTQTo-0002ai-LG for qemu-devel@nongnu.org; Fri, 07 Jul 2017 06:27:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTQTn-0001qQ-TS for qemu-devel@nongnu.org; Fri, 07 Jul 2017 06:27:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53720) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dTQTn-0001q0-Mr for qemu-devel@nongnu.org; Fri, 07 Jul 2017 06:27:19 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 811D8315D20; Fri, 7 Jul 2017 10:27:18 +0000 (UTC) Received: from thh440s.str.redhat.com (dhcp-200-180.str.redhat.com [10.33.200.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 278065F912; Fri, 7 Jul 2017 10:27:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 811D8315D20 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=thuth@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 811D8315D20 From: Thomas Huth To: qemu-devel@nongnu.org, Christian Borntraeger Date: Fri, 7 Jul 2017 12:27:00 +0200 Message-Id: <1499423224-23060-5-git-send-email-thuth@redhat.com> In-Reply-To: <1499423224-23060-1-git-send-email-thuth@redhat.com> References: <1499423224-23060-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 07 Jul 2017 10:27:18 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC PATCH v2 4/8] pc-bios/s390-ccw: Add a write() function for stdio X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cornelia Huck , Viktor Mihajlovski , Farhan Ali , Alexander Graf , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The stdio functions from the SLOF libc need a write() function for printing text to stdout/stderr. Let's implement this function by refactoring the code from sclp_print(). Signed-off-by: Thomas Huth Acked-by: Cornelia Huck --- pc-bios/s390-ccw/sclp.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pc-bios/s390-ccw/sclp.c b/pc-bios/s390-ccw/sclp.c index 2ee204a..f6466db 100644 --- a/pc-bios/s390-ccw/sclp.c +++ b/pc-bios/s390-ccw/sclp.c @@ -12,6 +12,8 @@ #include "s390-ccw.h" #include "sclp.h" =20 +long write(int fd, const void *buf, size_t len); + static char _sccb[PAGE_SIZE] __attribute__((__aligned__(4096))); =20 const unsigned char ebc2asc[256] =3D @@ -71,11 +73,14 @@ static int _strlen(const char *str) return i; } =20 -void sclp_print(const char *str) +long write(int fd, const void *str, size_t len) { - int len =3D _strlen(str); WriteEventData *sccb =3D (void *)_sccb; =20 + if (fd !=3D 1 && fd !=3D 2) { + return -EIO; + } + sccb->h.length =3D sizeof(WriteEventData) + len; sccb->h.function_code =3D SCLP_FC_NORMAL_WRITE; sccb->ebh.length =3D sizeof(EventBufferHeader) + len; @@ -84,6 +89,13 @@ void sclp_print(const char *str) memcpy(sccb->data, str, len); =20 sclp_service_call(SCLP_CMD_WRITE_EVENT_DATA, sccb); + + return len; +} + +void sclp_print(const char *str) +{ + write(1, str, _strlen(str)); } =20 void sclp_get_loadparm_ascii(char *loadparm) --=20 1.8.3.1