diff mbox

[4/6] xenconsoled: delete two now unused functions

Message ID 1465228781-22754-5-git-send-email-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu June 6, 2016, 3:59 p.m. UTC
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/console/daemon/io.c | 47 -----------------------------------------------
 1 file changed, 47 deletions(-)

Comments

Ian Jackson July 8, 2016, 5:01 p.m. UTC | #1
Wei Liu writes ("[PATCH 4/6] xenconsoled: delete two now unused functions"):
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
diff mbox

Patch

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)