[PATCH 2/4] UML - Code tidying under arch/um/os-Linux

2007-10-30 Thread Jeff Dike
From: WANG Cong <[EMAIL PROTECTED]>

This patch contains varied fixes and improvements for some files under
arch/um/os-Linux/, such as a typo fix in a perror message, a missing
argument fix for a printf, some constifying for pointers and so on.

[ jdike - made sigprocmask failure return -errno instead of -1 ]

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>
---
 arch/um/include/os.h|   12 ++--
 arch/um/os-Linux/file.c |   14 +++---
 arch/um/os-Linux/main.c |   12 
 arch/um/os-Linux/mem.c  |5 -
 arch/um/os-Linux/signal.c   |3 ++-
 arch/um/os-Linux/start_up.c |2 +-
 6 files changed, 28 insertions(+), 20 deletions(-)

Index: linux-2.6.22/arch/um/include/os.h
===
--- linux-2.6.22.orig/arch/um/include/os.h  2007-10-29 12:51:14.0 
-0400
+++ linux-2.6.22/arch/um/include/os.h   2007-10-29 12:56:18.0 -0400
@@ -137,24 +137,24 @@ extern int os_set_owner(int fd, int pid)
 extern int os_mode_fd(int fd, int mode);
 
 extern int os_seek_file(int fd, unsigned long long offset);
-extern int os_open_file(char *file, struct openflags flags, int mode);
+extern int os_open_file(const char *file, struct openflags flags, int mode);
 extern int os_read_file(int fd, void *buf, int len);
 extern int os_write_file(int fd, const void *buf, int count);
-extern int os_file_size(char *file, unsigned long long *size_out);
-extern int os_file_modtime(char *file, unsigned long *modtime);
+extern int os_file_size(const char *file, unsigned long long *size_out);
+extern int os_file_modtime(const char *file, unsigned long *modtime);
 extern int os_pipe(int *fd, int stream, int close_on_exec);
 extern int os_set_fd_async(int fd, int owner);
 extern int os_clear_fd_async(int fd);
 extern int os_set_fd_block(int fd, int blocking);
 extern int os_accept_connection(int fd);
-extern int os_create_unix_socket(char *file, int len, int close_on_exec);
+extern int os_create_unix_socket(const char *file, int len, int close_on_exec);
 extern int os_shutdown_socket(int fd, int r, int w);
 extern void os_close_file(int fd);
 extern int os_rcv_fd(int fd, int *helper_pid_out);
 extern int create_unix_socket(char *file, int len, int close_on_exec);
-extern int os_connect_socket(char *name);
+extern int os_connect_socket(const char *name);
 extern int os_file_type(char *file);
-extern int os_file_mode(char *file, struct openflags *mode_out);
+extern int os_file_mode(const char *file, struct openflags *mode_out);
 extern int os_lock_file(int fd, int excl);
 extern void os_flush_stdout(void);
 extern int os_stat_filesystem(char *path, long *bsize_out,
Index: linux-2.6.22/arch/um/os-Linux/file.c
===
--- linux-2.6.22.orig/arch/um/os-Linux/file.c   2007-10-29 12:51:14.0 
-0400
+++ linux-2.6.22/arch/um/os-Linux/file.c2007-10-29 12:56:18.0 
-0400
@@ -19,7 +19,7 @@
 #include "user.h"
 #include "kern_util.h"
 
-static void copy_stat(struct uml_stat *dst, struct stat64 *src)
+static void copy_stat(struct uml_stat *dst, const struct stat64 *src)
 {
*dst = ((struct uml_stat) {
.ust_dev = src->st_dev, /* device */
@@ -168,7 +168,7 @@ int os_file_type(char *file)
else return OS_TYPE_FILE;
 }
 
-int os_file_mode(char *file, struct openflags *mode_out)
+int os_file_mode(const char *file, struct openflags *mode_out)
 {
int err;
 
@@ -189,7 +189,7 @@ int os_file_mode(char *file, struct open
return err;
 }
 
-int os_open_file(char *file, struct openflags flags, int mode)
+int os_open_file(const char *file, struct openflags flags, int mode)
 {
int fd, err, f = 0;
 
@@ -216,7 +216,7 @@ int os_open_file(char *file, struct open
return fd;
 }
 
-int os_connect_socket(char *name)
+int os_connect_socket(const char *name)
 {
struct sockaddr_un sock;
int fd, err;
@@ -277,7 +277,7 @@ int os_write_file(int fd, const void *bu
return n;
 }
 
-int os_file_size(char *file, unsigned long long *size_out)
+int os_file_size(const char *file, unsigned long long *size_out)
 {
struct uml_stat buf;
int err;
@@ -314,7 +314,7 @@ int os_file_size(char *file, unsigned lo
return 0;
 }
 
-int os_file_modtime(char *file, unsigned long *modtime)
+int os_file_modtime(const char *file, unsigned long *modtime)
 {
struct uml_stat buf;
int err;
@@ -515,7 +515,7 @@ int os_rcv_fd(int fd, int *helper_pid_ou
return new;
 }
 
-int os_create_unix_socket(char *file, int len, int close_on_exec)
+int os_create_unix_socket(const char *file, int len, int close_on_exec)
 {
struct sockaddr_un addr;
int sock, err;
Index: linux-2.6.22/arch/um/os-Linux/main.c
===
--- linux-2.6.22.orig/arch/um/os-Linux/main.c   2007-10-29 

[PATCH 2/4] UML - Code tidying under arch/um/os-Linux

2007-10-30 Thread Jeff Dike
From: WANG Cong [EMAIL PROTECTED]

This patch contains varied fixes and improvements for some files under
arch/um/os-Linux/, such as a typo fix in a perror message, a missing
argument fix for a printf, some constifying for pointers and so on.

[ jdike - made sigprocmask failure return -errno instead of -1 ]

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Signed-off-by: Jeff Dike [EMAIL PROTECTED]
---
 arch/um/include/os.h|   12 ++--
 arch/um/os-Linux/file.c |   14 +++---
 arch/um/os-Linux/main.c |   12 
 arch/um/os-Linux/mem.c  |5 -
 arch/um/os-Linux/signal.c   |3 ++-
 arch/um/os-Linux/start_up.c |2 +-
 6 files changed, 28 insertions(+), 20 deletions(-)

Index: linux-2.6.22/arch/um/include/os.h
===
--- linux-2.6.22.orig/arch/um/include/os.h  2007-10-29 12:51:14.0 
-0400
+++ linux-2.6.22/arch/um/include/os.h   2007-10-29 12:56:18.0 -0400
@@ -137,24 +137,24 @@ extern int os_set_owner(int fd, int pid)
 extern int os_mode_fd(int fd, int mode);
 
 extern int os_seek_file(int fd, unsigned long long offset);
-extern int os_open_file(char *file, struct openflags flags, int mode);
+extern int os_open_file(const char *file, struct openflags flags, int mode);
 extern int os_read_file(int fd, void *buf, int len);
 extern int os_write_file(int fd, const void *buf, int count);
-extern int os_file_size(char *file, unsigned long long *size_out);
-extern int os_file_modtime(char *file, unsigned long *modtime);
+extern int os_file_size(const char *file, unsigned long long *size_out);
+extern int os_file_modtime(const char *file, unsigned long *modtime);
 extern int os_pipe(int *fd, int stream, int close_on_exec);
 extern int os_set_fd_async(int fd, int owner);
 extern int os_clear_fd_async(int fd);
 extern int os_set_fd_block(int fd, int blocking);
 extern int os_accept_connection(int fd);
-extern int os_create_unix_socket(char *file, int len, int close_on_exec);
+extern int os_create_unix_socket(const char *file, int len, int close_on_exec);
 extern int os_shutdown_socket(int fd, int r, int w);
 extern void os_close_file(int fd);
 extern int os_rcv_fd(int fd, int *helper_pid_out);
 extern int create_unix_socket(char *file, int len, int close_on_exec);
-extern int os_connect_socket(char *name);
+extern int os_connect_socket(const char *name);
 extern int os_file_type(char *file);
-extern int os_file_mode(char *file, struct openflags *mode_out);
+extern int os_file_mode(const char *file, struct openflags *mode_out);
 extern int os_lock_file(int fd, int excl);
 extern void os_flush_stdout(void);
 extern int os_stat_filesystem(char *path, long *bsize_out,
Index: linux-2.6.22/arch/um/os-Linux/file.c
===
--- linux-2.6.22.orig/arch/um/os-Linux/file.c   2007-10-29 12:51:14.0 
-0400
+++ linux-2.6.22/arch/um/os-Linux/file.c2007-10-29 12:56:18.0 
-0400
@@ -19,7 +19,7 @@
 #include user.h
 #include kern_util.h
 
-static void copy_stat(struct uml_stat *dst, struct stat64 *src)
+static void copy_stat(struct uml_stat *dst, const struct stat64 *src)
 {
*dst = ((struct uml_stat) {
.ust_dev = src-st_dev, /* device */
@@ -168,7 +168,7 @@ int os_file_type(char *file)
else return OS_TYPE_FILE;
 }
 
-int os_file_mode(char *file, struct openflags *mode_out)
+int os_file_mode(const char *file, struct openflags *mode_out)
 {
int err;
 
@@ -189,7 +189,7 @@ int os_file_mode(char *file, struct open
return err;
 }
 
-int os_open_file(char *file, struct openflags flags, int mode)
+int os_open_file(const char *file, struct openflags flags, int mode)
 {
int fd, err, f = 0;
 
@@ -216,7 +216,7 @@ int os_open_file(char *file, struct open
return fd;
 }
 
-int os_connect_socket(char *name)
+int os_connect_socket(const char *name)
 {
struct sockaddr_un sock;
int fd, err;
@@ -277,7 +277,7 @@ int os_write_file(int fd, const void *bu
return n;
 }
 
-int os_file_size(char *file, unsigned long long *size_out)
+int os_file_size(const char *file, unsigned long long *size_out)
 {
struct uml_stat buf;
int err;
@@ -314,7 +314,7 @@ int os_file_size(char *file, unsigned lo
return 0;
 }
 
-int os_file_modtime(char *file, unsigned long *modtime)
+int os_file_modtime(const char *file, unsigned long *modtime)
 {
struct uml_stat buf;
int err;
@@ -515,7 +515,7 @@ int os_rcv_fd(int fd, int *helper_pid_ou
return new;
 }
 
-int os_create_unix_socket(char *file, int len, int close_on_exec)
+int os_create_unix_socket(const char *file, int len, int close_on_exec)
 {
struct sockaddr_un addr;
int sock, err;
Index: linux-2.6.22/arch/um/os-Linux/main.c
===
--- linux-2.6.22.orig/arch/um/os-Linux/main.c   2007-10-29 12:51:31.0 
-0400