diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2009-10-02 15:23:22 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-10-02 15:23:22 +0200 |
commit | 2baeaf38f3d9ace1fb06fdd2f84294c311bf33bf (patch) | |
tree | a3dfb815c5d15e232c4a3bd7f020cf484e4a8fb0 /fs | |
parent | 82875bfd5209c6dc2877001050069de36a18704f (diff) | |
download | barebox-2baeaf38f3d9ace1fb06fdd2f84294c311bf33bf.tar.gz barebox-2baeaf38f3d9ace1fb06fdd2f84294c311bf33bf.tar.xz |
fs: replace broken dev_protect with protect_file function
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fs.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -605,6 +605,21 @@ int protect(int fd, size_t count, unsigned long offset, int prot) } EXPORT_SYMBOL(protect); +int protect_file(const char *file, int prot) +{ + int fd, ret; + + fd = open(file, O_WRONLY); + if (fd < 0) + return fd; + + ret = protect(fd, ~0, 0, prot); + + close(fd); + + return ret; +} + void *memmap(int fd, int flags) { struct device_d *dev; |