9
0
Fork 0

svn_rev_452

add erase function
This commit is contained in:
Sascha Hauer 2007-07-05 18:01:55 +02:00 committed by Sascha Hauer
parent a042aaae0a
commit 44635dd22e
1 changed files with 18 additions and 1 deletions

19
fs/fs.c
View File

@ -47,7 +47,7 @@ static int init_cwd(void)
return 0;
}
core_initcall(init_cwd);
postcore_initcall(init_cwd);
/*
* - Remove all multiple slashes
@ -448,6 +448,23 @@ out:
return errno;
}
int erase(int fd, size_t count, unsigned long offset)
{
struct device_d *dev;
struct fs_driver_d *fsdrv;
FILE *f = &files[fd];
dev = f->dev;
fsdrv = (struct fs_driver_d *)dev->driver->type_data;
if (f->pos + count > f->size)
count = f->size - f->pos;
errno = fsdrv->erase(dev, f, count, offset);
return errno;
}
int close(int fd)
{
struct device_d *dev;