aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/tty_log.c
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-05-06 17:51:35 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:13:03 -0400
commita61f334fd2864b9b040f7e882726426ed7e8a317 (patch)
tree51874236a1f324a2664118f54aadd9ba3beb95ca /arch/um/os-Linux/tty_log.c
parentef0470c053274c343b2be8737e0146d65e17f9be (diff)
uml: convert libc layer to call read and write
This patch converts calls in the os layer to os_{read,write}_file to calls directly to libc read() and write() where it is clear that the I/O buffer is in the kernel. We can do that here instead of calling os_{read,write}_file_k since we are in libc code and can call libc directly. With the change in the calls, error handling needs to be changed to refer to errno directly rather than the return value of the call. CATCH_EINTR wrappers were also added where needed. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/os-Linux/tty_log.c')
-rw-r--r--arch/um/os-Linux/tty_log.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/arch/um/os-Linux/tty_log.c b/arch/um/os-Linux/tty_log.c
index ae9adb1b74f2..d11a55baa6bd 100644
--- a/arch/um/os-Linux/tty_log.c
+++ b/arch/um/os-Linux/tty_log.c
@@ -53,8 +53,8 @@ int open_tty_log(void *tty, void *current_tty)
53 .direction = 0, 53 .direction = 0,
54 .sec = tv.tv_sec, 54 .sec = tv.tv_sec,
55 .usec = tv.tv_usec } ); 55 .usec = tv.tv_usec } );
56 os_write_file(tty_log_fd, &data, sizeof(data)); 56 write(tty_log_fd, &data, sizeof(data));
57 os_write_file(tty_log_fd, &current_tty, data.len); 57 write(tty_log_fd, &current_tty, data.len);
58 return tty_log_fd; 58 return tty_log_fd;
59 } 59 }
60 60
@@ -83,7 +83,7 @@ void close_tty_log(int fd, void *tty)
83 .direction = 0, 83 .direction = 0,
84 .sec = tv.tv_sec, 84 .sec = tv.tv_sec,
85 .usec = tv.tv_usec } ); 85 .usec = tv.tv_usec } );
86 os_write_file(tty_log_fd, &data, sizeof(data)); 86 write(tty_log_fd, &data, sizeof(data));
87 return; 87 return;
88 } 88 }
89 os_close_file(fd); 89 os_close_file(fd);
@@ -98,10 +98,10 @@ static int log_chunk(int fd, const char *buf, int len)
98 try = (len > sizeof(chunk)) ? sizeof(chunk) : len; 98 try = (len > sizeof(chunk)) ? sizeof(chunk) : len;
99 missed = copy_from_user_proc(chunk, (char *) buf, try); 99 missed = copy_from_user_proc(chunk, (char *) buf, try);
100 try -= missed; 100 try -= missed;
101 n = os_write_file(fd, chunk, try); 101 n = write(fd, chunk, try);
102 if(n != try) { 102 if(n != try) {
103 if(n < 0) 103 if(n < 0)
104 return n; 104 return -errno;
105 return -EIO; 105 return -EIO;
106 } 106 }
107 if(missed != 0) 107 if(missed != 0)
@@ -130,7 +130,7 @@ int write_tty_log(int fd, const char *buf, int len, void *tty, int is_read)
130 .direction = direction, 130 .direction = direction,
131 .sec = tv.tv_sec, 131 .sec = tv.tv_sec,
132 .usec = tv.tv_usec } ); 132 .usec = tv.tv_usec } );
133 os_write_file(tty_log_fd, &data, sizeof(data)); 133 write(tty_log_fd, &data, sizeof(data));
134 } 134 }
135 135
136 return log_chunk(fd, buf, len); 136 return log_chunk(fd, buf, len);
@@ -161,7 +161,7 @@ void log_exec(char **argv, void *tty)
161 .direction = 0, 161 .direction = 0,
162 .sec = tv.tv_sec, 162 .sec = tv.tv_sec,
163 .usec = tv.tv_usec } ); 163 .usec = tv.tv_usec } );
164 os_write_file(tty_log_fd, &data, sizeof(data)); 164 write(tty_log_fd, &data, sizeof(data));
165 165
166 for(ptr = argv; ; ptr++){ 166 for(ptr = argv; ; ptr++){
167 if(copy_from_user_proc(&arg, ptr, sizeof(arg))) 167 if(copy_from_user_proc(&arg, ptr, sizeof(arg)))