git.openpandora.org
/
pandora-u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cdd140a
)
sandbox: Support file truncation with os_open()
author
Simon Glass
<sjg@chromium.org>
Mon, 1 Oct 2018 17:55:07 +0000
(11:55 -0600)
committer
Simon Glass
<sjg@chromium.org>
Tue, 9 Oct 2018 10:40:26 +0000
(
04:40
-0600)
At present files are not truncated on writing. This is a useful feature.
Add support for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
arch/sandbox/cpu/os.c
patch
|
blob
|
history
include/os.h
patch
|
blob
|
history
diff --git
a/arch/sandbox/cpu/os.c
b/arch/sandbox/cpu/os.c
index
d4d6d78
..
1d87a53
100644
(file)
--- a/
arch/sandbox/cpu/os.c
+++ b/
arch/sandbox/cpu/os.c
@@
-85,6
+85,8
@@
int os_open(const char *pathname, int os_flags)
if (os_flags & OS_O_CREAT)
flags |= O_CREAT;
+ if (os_flags & OS_O_TRUNC)
+ flags |= O_TRUNC;
return open(pathname, flags, 0777);
}
diff --git
a/include/os.h
b/include/os.h
index
7116f87
..
9e3a561
100644
(file)
--- a/
include/os.h
+++ b/
include/os.h
@@
-75,6
+75,7
@@
int os_open(const char *pathname, int flags);
#define OS_O_RDWR 2
#define OS_O_MASK 3 /* Mask for read/write flags */
#define OS_O_CREAT 0100
+#define OS_O_TRUNC 01000
/**
* Access to the OS close() system call