From patchwork Mon Jun 6 15:59:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 9158703 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F056860573 for ; Mon, 6 Jun 2016 16:01:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD1A226B41 for ; Mon, 6 Jun 2016 16:01:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D07A128327; Mon, 6 Jun 2016 16:01:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8DEC720700 for ; Mon, 6 Jun 2016 16:01:50 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b9wwQ-0007K8-1x; Mon, 06 Jun 2016 15:59:50 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b9wwN-0007Iu-VV for xen-devel@lists.xenproject.org; Mon, 06 Jun 2016 15:59:48 +0000 Received: from [193.109.254.147] by server-12.bemta-14.messagelabs.com id CC/81-19610-3FD95575; Mon, 06 Jun 2016 15:59:47 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphkeJIrShJLcpLzFFi42JxWrrBXvfD3NB wg8YeJYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNWPPti1MBa95K/7MVm9g7OTuYuTkkBDwl1jy ejoriM0moCzxs7OXDcQWEdCTaDrwnBHEZhbwkvixoocdxBYWcJTYvWULkM3BwSKgInHqqzCIy SvgLHH2eRjERDmJ88d/MoPYnAIuEuf7voJ1CgGVzL01D8pWkOiYfowJxOYVEJQ4OfMJC8QmCY mDL14wg4yUEOCW+NttP4GRbxaSqllIqhYwMq1iVC9OLSpLLdI10ksqykzPKMlNzMzRNTQ00ct NLS5OTE/NSUwq1kvOz93ECAwlBiDYwdgyx/kQoyQHk5Io747+0HAhvqT8lMqMxOKM+KLSnNTi Q4wyHBxKErw35wDlBItS01Mr0jJzgEENk5bg4FES4T0GkuYtLkjMLc5Mh0idYlSUEuc9BJIQA ElklObBtcEi6RKjrJQwLyPQIUI8BalFuZklqPKvGMU5GJWEeaeBTOHJzCuBm/4KaDET0OJl14 JBFpckIqSkGhizzxTtfH34rPK02L87GDX5jv7ylwnRXHXG2b56a4PLs99Xmv813lw2UX3SvAo Dvhtvo967Psk+v+P4zx+J2Uzz2NfWG67T3L41T6dtIo+y030Ryxfxx9Wzef5NuP5zmpyUv4tL i5br4ozrT8uLXMyvbd69rLTpa9hCR1fvGu2itDSnlRmO/QpKLMUZiYZazEXFiQBANX8NnwIAA A== X-Env-Sender: prvs=9584f9c1d=wei.liu2@citrix.com X-Msg-Ref: server-11.tower-27.messagelabs.com!1465228782!37504805!2 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2209 invoked from network); 6 Jun 2016 15:59:44 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-11.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 6 Jun 2016 15:59:44 -0000 X-IronPort-AV: E=Sophos;i="5.26,427,1459814400"; d="scan'208";a="365531437" From: Wei Liu To: Xen-devel Date: Mon, 6 Jun 2016 16:59:39 +0100 Message-ID: <1465228781-22754-5-git-send-email-wei.liu2@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1465228781-22754-1-git-send-email-wei.liu2@citrix.com> References: <1465228781-22754-1-git-send-email-wei.liu2@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Wei Liu , Ian Jackson Subject: [Xen-devel] [PATCH 4/6] xenconsoled: delete two now unused functions X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Wei Liu Acked-by: Ian Jackson --- tools/console/daemon/io.c | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index c2f63e6..7c38232 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -113,21 +113,6 @@ struct domain { static struct domain *dom_head; -static int write_all(int fd, const char* buf, size_t len) -{ - while (len) { - ssize_t ret = write(fd, buf, len); - if (ret == -1 && errno == EINTR) - continue; - if (ret <= 0) - return -1; - len -= ret; - buf += ret; - } - - return 0; -} - static int write_logfile(struct logfile *logfile, const char *buf, size_t len) { @@ -137,38 +122,6 @@ static int write_logfile(struct logfile *logfile, const char *buf, return 0; } -static __attribute__((unused)) -int write_with_timestamp(int fd, const char *data, size_t sz, - int *needts) -{ - char ts[32]; - time_t now = time(NULL); - const struct tm *tmnow = localtime(&now); - size_t tslen = strftime(ts, sizeof(ts), "[%Y-%m-%d %H:%M:%S] ", tmnow); - const char *last_byte = data + sz - 1; - - while (data <= last_byte) { - const char *nl = memchr(data, '\n', last_byte + 1 - data); - int found_nl = (nl != NULL); - if (!found_nl) - nl = last_byte; - - if ((*needts && write_all(fd, ts, tslen)) - || write_all(fd, data, nl + 1 - data)) - return -1; - - *needts = found_nl; - data = nl + 1; - if (found_nl) { - // If we printed a newline, strip all \r following it - while (data <= last_byte && *data == '\r') - data++; - } - } - - return 0; -} - static int write_logfile_with_timestamp(struct logfile *logfile, const char *data, size_t sz, int *needts)