diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2007-07-05 18:01:55 +0200 |
---|---|---|
committer | Sascha Hauer <sha@octopus.labnet.pengutronix.de> | 2007-07-05 18:01:55 +0200 |
commit | 44635dd22e0283614c21e4444cf93bea2e5695b4 (patch) | |
tree | 2b6e3e61f94dfe368a25dac77af8865e50144954 /fs | |
parent | a042aaae0abd055cae8d4153702af7b9c59cbacc (diff) | |
download | barebox-44635dd22e0283614c21e4444cf93bea2e5695b4.tar.gz barebox-44635dd22e0283614c21e4444cf93bea2e5695b4.tar.xz |
svn_rev_452
add erase function
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fs.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -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; |