summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/fs.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/fs.c b/fs/fs.c
index 7c1f18ebae..8417067042 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -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;