Re: [U-Boot] [PATCH v3 7/8] sandbox: Add flags for open() call

2012-02-15 Thread Simon Glass
Hi Mike,

On Tue, Jan 24, 2012 at 1:45 PM, Mike Frysinger vap...@gentoo.org wrote:
 On Monday 23 January 2012 01:48:52 Simon Glass wrote:
 This provides a way for callers to create files for writing. We define
 flags which mirror the POSIX values.

 there are no POSIX values, just names.  the way the defines get interpreted is
 left up to implementations.

 @@ -19,11 +24,7 @@
   * MA 02111-1307 USA
   */

 -/*
 - * Operating System Interface
 - *
 - * This provides access to useful OS routines from the sandbox
 architecture - */
 +struct sandbox_state;

 looks like unrelated stuff got squished into here

We need to declare the struct. The comment change is because you said
we should put the purpose of the file at the top, and I thought it
didn't really warrant a new commit?


 +#define OS_O_RDONLY  0
 +#define OS_O_WRONLY  1
 +#define      OS_O_RDWR       2
 +#define OS_O_CREAT   0100

 seems to be whitespace mismatch between #define and the actual define.  some
 use tabs and some spaces ?
 -mike

Fixed.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 7/8] sandbox: Add flags for open() call

2012-01-24 Thread Mike Frysinger
On Monday 23 January 2012 01:48:52 Simon Glass wrote:
 This provides a way for callers to create files for writing. We define
 flags which mirror the POSIX values.

there are no POSIX values, just names.  the way the defines get interpreted is 
left up to implementations.

 @@ -19,11 +24,7 @@
   * MA 02111-1307 USA
   */
 
 -/*
 - * Operating System Interface
 - *
 - * This provides access to useful OS routines from the sandbox
 architecture - */
 +struct sandbox_state;

looks like unrelated stuff got squished into here

 +#define OS_O_RDONLY  0
 +#define OS_O_WRONLY  1
 +#define  OS_O_RDWR   2
 +#define OS_O_CREAT   0100

seems to be whitespace mismatch between #define and the actual define.  some 
use tabs and some spaces ?
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 7/8] sandbox: Add flags for open() call

2012-01-22 Thread Simon Glass
This provides a way for callers to create files for writing. We define
flags which mirror the POSIX values.

Another approach would be to translate the flags at runtime. Perhaps we can
leave to whoever wants to port this to another OS?

Signed-off-by: Simon Glass s...@chromium.org
---
Changes in v3:
- Change open() flags enum to #define

 arch/sandbox/cpu/os.c |2 +-
 include/os.h  |   16 +++-
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index 093e7dc..9f93f83 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -47,7 +47,7 @@ ssize_t os_write(int fd, const void *buf, size_t count)
 
 int os_open(const char *pathname, int flags)
 {
-   return open(pathname, flags);
+   return open(pathname, flags, 0777);
 }
 
 int os_close(int fd)
diff --git a/include/os.h b/include/os.h
index f3af4f0..a3c1e84 100644
--- a/include/os.h
+++ b/include/os.h
@@ -1,4 +1,9 @@
 /*
+ * Operating System Interface
+ *
+ * This provides access to useful OS routines for the sandbox architecture.
+ * They are kept in a separate file so we can include system headers.
+ *
  * Copyright (c) 2011 The Chromium OS Authors.
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -19,11 +24,7 @@
  * MA 02111-1307 USA
  */
 
-/*
- * Operating System Interface
- *
- * This provides access to useful OS routines from the sandbox architecture
- */
+struct sandbox_state;
 
 /**
  * Access to the OS read() system call
@@ -45,6 +46,11 @@ ssize_t os_read(int fd, void *buf, size_t count);
  */
 ssize_t os_write(int fd, const void *buf, size_t count);
 
+#define OS_O_RDONLY0
+#define OS_O_WRONLY1
+#defineOS_O_RDWR   2
+#define OS_O_CREAT 0100
+
 /**
  * Access to the OS open() system call
  *
-- 
1.7.7.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot