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