diff options
author | Miika Pekkarinen <miipekk@ihme.org> | 2006-03-30 10:20:44 +0000 |
---|---|---|
committer | Miika Pekkarinen <miipekk@ihme.org> | 2006-03-30 10:20:44 +0000 |
commit | 82f32e3f732fd8a18eae98486d483d66ccb9e12c (patch) | |
tree | 9959f3e44ad46d8e1a1a44716760e7e0f5805f4e /firmware | |
parent | e51490166568744e7838804d890e27cb15cee400 (diff) | |
download | rockbox-82f32e3f732fd8a18eae98486d483d66ccb9e12c.tar.gz rockbox-82f32e3f732fd8a18eae98486d483d66ccb9e12c.zip |
Do the dircache operation first to block properly when necessary.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9356 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/common/file.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c index a0b4296495..a83dc9548a 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c | |||
@@ -293,6 +293,9 @@ int remove(const char* name) | |||
293 | return fd * 10 - 1; | 293 | return fd * 10 - 1; |
294 | 294 | ||
295 | file = &openfiles[fd]; | 295 | file = &openfiles[fd]; |
296 | #ifdef HAVE_DIRCACHE | ||
297 | dircache_remove(name); | ||
298 | #endif | ||
296 | rc = fat_remove(&(file->fatfile)); | 299 | rc = fat_remove(&(file->fatfile)); |
297 | if ( rc < 0 ) { | 300 | if ( rc < 0 ) { |
298 | DEBUGF("Failed removing file: %d\n", rc); | 301 | DEBUGF("Failed removing file: %d\n", rc); |
@@ -301,9 +304,6 @@ int remove(const char* name) | |||
301 | } | 304 | } |
302 | 305 | ||
303 | file->size = 0; | 306 | file->size = 0; |
304 | #ifdef HAVE_DIRCACHE | ||
305 | dircache_remove(name); | ||
306 | #endif | ||
307 | 307 | ||
308 | rc = close(fd); | 308 | rc = close(fd); |
309 | if (rc<0) | 309 | if (rc<0) |
@@ -364,6 +364,10 @@ int rename(const char* path, const char* newpath) | |||
364 | return - 5; | 364 | return - 5; |
365 | 365 | ||
366 | file = &openfiles[fd]; | 366 | file = &openfiles[fd]; |
367 | #ifdef HAVE_DIRCACHE | ||
368 | dircache_rename(path, newpath); | ||
369 | #endif | ||
370 | |||
367 | rc = fat_rename(&file->fatfile, &dir->fatdir, nameptr, | 371 | rc = fat_rename(&file->fatfile, &dir->fatdir, nameptr, |
368 | file->size, file->attr); | 372 | file->size, file->attr); |
369 | #ifdef HAVE_MULTIVOLUME | 373 | #ifdef HAVE_MULTIVOLUME |
@@ -379,10 +383,6 @@ int rename(const char* path, const char* newpath) | |||
379 | return rc * 10 - 7; | 383 | return rc * 10 - 7; |
380 | } | 384 | } |
381 | 385 | ||
382 | #ifdef HAVE_DIRCACHE | ||
383 | dircache_rename(path, newpath); | ||
384 | #endif | ||
385 | |||
386 | rc = close(fd); | 386 | rc = close(fd); |
387 | if (rc<0) { | 387 | if (rc<0) { |
388 | errno = EIO; | 388 | errno = EIO; |