qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Cornelia Huck <cohuck@redhat.com>
Cc: Alexander Graf <agraf@suse.de>,
	Farhan Ali <alifm@linux.vnet.ibm.com>,
	David Hildenbrand <david@redhat.com>,
	Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH v5 04/11] pc-bios/s390-ccw: Add a write() function for stdio
Date: Wed, 12 Jul 2017 14:49:46 +0200	[thread overview]
Message-ID: <1499863793-18627-5-git-send-email-thuth@redhat.com> (raw)
In-Reply-To: <1499863793-18627-1-git-send-email-thuth@redhat.com>

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().

Acked-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 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..b1fc8ff 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"
 
+long write(int fd, const void *str, size_t len);
+
 static char _sccb[PAGE_SIZE] __attribute__((__aligned__(4096)));
 
 const unsigned char ebc2asc[256] =
@@ -71,11 +73,14 @@ static int _strlen(const char *str)
     return i;
 }
 
-void sclp_print(const char *str)
+long write(int fd, const void *str, size_t len)
 {
-    int len = _strlen(str);
     WriteEventData *sccb = (void *)_sccb;
 
+    if (fd != 1 && fd != 2) {
+        return -EIO;
+    }
+
     sccb->h.length = sizeof(WriteEventData) + len;
     sccb->h.function_code = SCLP_FC_NORMAL_WRITE;
     sccb->ebh.length = sizeof(EventBufferHeader) + len;
@@ -84,6 +89,13 @@ void sclp_print(const char *str)
     memcpy(sccb->data, str, len);
 
     sclp_service_call(SCLP_CMD_WRITE_EVENT_DATA, sccb);
+
+    return len;
+}
+
+void sclp_print(const char *str)
+{
+    write(1, str, _strlen(str));
 }
 
 void sclp_get_loadparm_ascii(char *loadparm)
-- 
1.8.3.1

  parent reply	other threads:[~2017-07-12 12:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-12 12:49 [Qemu-devel] [PATCH v5 00/11] Implement network booting in the s390-ccw BIOS Thomas Huth
2017-07-12 12:49 ` [Qemu-devel] [PATCH v5 01/11] pc-bios/s390-ccw: Move libc functions to separate header Thomas Huth
2017-07-12 12:49 ` [Qemu-devel] [PATCH v5 02/11] pc-bios/s390-ccw: Move ebc2asc to sclp.c Thomas Huth
2017-07-12 12:49 ` [Qemu-devel] [PATCH v5 03/11] pc-bios/s390-ccw: Move virtio-block related functions into a separate file Thomas Huth
2017-07-12 12:49 ` Thomas Huth [this message]
2017-07-12 12:49 ` [Qemu-devel] [PATCH v5 05/11] pc-bios/s390-ccw: Move byteswap functions to a separate header Thomas Huth
2017-07-12 12:49 ` [Qemu-devel] [PATCH v5 06/11] pc-bios/s390-ccw: Remove unused structs from virtio.h Thomas Huth
2017-07-12 12:49 ` [Qemu-devel] [PATCH v5 07/11] pc-bios/s390-ccw: Add code for virtio feature negotiation Thomas Huth
2017-07-12 12:49 ` [Qemu-devel] [PATCH v5 08/11] roms/SLOF: Update submodule to latest status Thomas Huth
2017-07-12 12:49 ` [Qemu-devel] [PATCH v5 09/11] pc-bios/s390-ccw: Add core files for the network bootloading program Thomas Huth
2017-07-12 12:49 ` [Qemu-devel] [PATCH v5 10/11] pc-bios/s390-ccw: Add virtio-net driver code Thomas Huth
2017-07-12 12:49 ` [Qemu-devel] [PATCH v5 11/11] pc-bios/s390-ccw: Link libnet into the netboot image and do the TFTP load Thomas Huth
2017-07-12 13:00 ` [Qemu-devel] [PATCH v5 00/11] Implement network booting in the s390-ccw BIOS Christian Borntraeger
2017-07-12 13:04   ` Thomas Huth
2017-07-12 13:23     ` Cornelia Huck
2017-07-12 13:42 ` no-reply
2017-07-13 13:36 ` Viktor Mihajlovski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1499863793-18627-5-git-send-email-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=agraf@suse.de \
    --cc=alifm@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=mihajlov@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).