From 2baeaf38f3d9ace1fb06fdd2f84294c311bf33bf Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 2 Oct 2009 15:23:22 +0200 Subject: fs: replace broken dev_protect with protect_file function Signed-off-by: Sascha Hauer --- fs/fs.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'fs') 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; -- cgit v1.2.3