9
0
Fork 0

fs: replace broken dev_protect with protect_file function

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2009-10-02 15:23:22 +02:00
parent 82875bfd52
commit 2baeaf38f3
2 changed files with 16 additions and 0 deletions

15
fs/fs.c
View File

@ -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;

View File

@ -132,6 +132,7 @@ int umount(const char *pathname);
/* not-so-standard functions */
int erase(int fd, size_t count, unsigned long offset);
int protect(int fd, size_t count, unsigned long offset, int prot);
int protect_file(const char *file, int prot);
void *memmap(int fd, int flags);
#define PROT_READ 1