fs: replace broken dev_protect with protect_file function
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
82875bfd52
commit
2baeaf38f3
15
fs/fs.c
15
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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue