TMFPS: Now basically functional although not heavily tested
This commit is contained in:
parent
c25adcb74c
commit
b489cd9610
@ -11019,5 +11019,5 @@
|
||||
README file for more info (2015-10-08).
|
||||
* stm32 F4: Fix some TIM12 pin mappings. From Max Kriegleder
|
||||
(2015-10-9).
|
||||
* fs/tmpfs: TMPFS file system is code complete, but not yet functional
|
||||
(2015-10-9).
|
||||
* fs/tmpfs: TMPFS file system is code complete and bascially functional
|
||||
although it has not been heavilay tested (2015-10-9).
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit b705a3fefb00ce13be249f47a17d80cdfa7bf71c
|
||||
Subproject commit 7a768453c1ca9602d668c79d45db141b74d5c215
|
@ -6,7 +6,7 @@
|
||||
config FS_TMPFS
|
||||
bool "TMPFS file system"
|
||||
default n
|
||||
depends on !DISABLE_MOUNTPOINT && EXPERIMENTAL
|
||||
depends on !DISABLE_MOUNTPOINT
|
||||
select FS_READABLE
|
||||
select FS_WRITABLE
|
||||
---help---
|
||||
|
@ -667,6 +667,8 @@ static int tmpfs_create_file(FAR struct tmpfs_s *fs,
|
||||
name = copy;
|
||||
parent = fs->tfs_root;
|
||||
|
||||
/* Lock the root directory to emulate the behavior of tmpfs_find_directory() */
|
||||
|
||||
tmpfs_lock_directory(parent);
|
||||
parent->tdo_refs++;
|
||||
}
|
||||
@ -677,7 +679,7 @@ static int tmpfs_create_file(FAR struct tmpfs_s *fs,
|
||||
*name++ = '\0';
|
||||
|
||||
/* Locate the parent directory that should contain this name.
|
||||
* On success, tmpfs_find_directory() will lockthe parent
|
||||
* On success, tmpfs_find_directory() will lock the parent
|
||||
* directory and increment the reference count.
|
||||
*/
|
||||
|
||||
@ -724,6 +726,11 @@ static int tmpfs_create_file(FAR struct tmpfs_s *fs,
|
||||
goto errout_with_file;
|
||||
}
|
||||
|
||||
/* Release the reference and lock on the parent directory */
|
||||
|
||||
parent->tdo_refs--;
|
||||
tmpfs_unlock_directory(parent);
|
||||
|
||||
/* Free the copy of the relpath and return success */
|
||||
|
||||
kmm_free(copy);
|
||||
@ -856,8 +863,8 @@ static int tmpfs_create_directory(FAR struct tmpfs_s *fs,
|
||||
goto errout_with_parent;
|
||||
}
|
||||
|
||||
/* Allocate an empty directory object. There is no reference on the new
|
||||
* directory and the object is not locked.
|
||||
/* Allocate an empty directory object. NOTE that there is no reference on
|
||||
* the new directory and the object is not locked.
|
||||
*/
|
||||
|
||||
newtdo = tmpfs_alloc_directory();
|
||||
@ -883,7 +890,13 @@ static int tmpfs_create_directory(FAR struct tmpfs_s *fs,
|
||||
tmpfs_unlock_directory(parent);
|
||||
kmm_free(copy);
|
||||
|
||||
*tdo = newtdo;
|
||||
/* Return the (unlocked, unreferenced) directory object to the caller */
|
||||
|
||||
if (tdo != NULL)
|
||||
{
|
||||
*tdo = newtdo;
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
||||
/* Error exits */
|
||||
@ -1263,12 +1276,12 @@ static int tmpfs_foreach(FAR struct tmpfs_directory_s *tdo,
|
||||
{
|
||||
/* Lock the object and take a reference */
|
||||
|
||||
to = tdo->tdo_entry[index].tde_object;
|
||||
tmpfs_lock_object(to);
|
||||
to->to_refs++;
|
||||
|
||||
/* Is the next entry a directory? */
|
||||
|
||||
to = tdo->tdo_entry[index].tde_object;
|
||||
if (to->to_type == TMPFS_DIRECTORY)
|
||||
{
|
||||
FAR struct tmpfs_directory_s *next =
|
||||
@ -2159,9 +2172,7 @@ static int tmpfs_mkdir(FAR struct inode *mountpt, FAR const char *relpath,
|
||||
|
||||
tmpfs_lock(fs);
|
||||
|
||||
/* Create the directory. This will lock the newly directory with a
|
||||
* a reference count of one.
|
||||
*/
|
||||
/* Create the directory. */
|
||||
|
||||
ret = tmpfs_create_directory(fs, relpath, NULL);
|
||||
tmpfs_unlock(fs);
|
||||
|
Loading…
Reference in New Issue
Block a user