Skip to content

Commit

Permalink
fs: remove fs_utils.c
Browse files Browse the repository at this point in the history
fs_initiate(), fs_clean(), fs_erase(), fs_recover() functions are API
functions for application. But these functions call kernel space
functions and this can break protection build. And also these functions
do not work proprely with new MTD layers. And also these functions
support only smartfs not all file systems even though function's prefix
is fs_xxx. I think it's better to remove these functions and
re-implement if there is a request for these functions.

Change-Id: I410684d7b789b743707c0cb03ed3d2ec4a8fd729
Signed-off-by: EunBong Song <[email protected]>
  • Loading branch information
EunBongSong authored and Heesub Shin committed Apr 18, 2017
1 parent 7d39132 commit 36c4a32
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 504 deletions.
28 changes: 0 additions & 28 deletions apps/examples/testcase/le_tc/filesystem/ReadMe.txt

This file was deleted.

82 changes: 1 addition & 81 deletions apps/examples/testcase/le_tc/filesystem/fs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,77 +331,6 @@ static int make_long_file(void)
return ret;
}

#ifdef CONFIG_FS_SMARTFS
static int fs_util_fs_erase_tc(void)
{
int ret;
printf("%d. fs_erase Test started. Please wait...\n", g_tc_count++);

/* Erase entire flash */
ret = fs_erase(MOUNT_DEV_DIR);
if (ret != OK) {
printf("fs_erase Failed : %d\n", ret);
g_tc_fail_count++;
return ret;
}
printf("PASS!\n");
return ret;
}

static int fs_util_fs_clean_tc(void)
{
int ret;
printf("%d. fs_clean Test started. Please wait...\n", g_tc_count++);

/* Erase entire flash */
ret = fs_clean(MOUNT_DEV_DIR);
if (ret != OK) {
printf("fs_clean Failed : %d\n", ret);
g_tc_fail_count++;
return ret;
}
printf("PASS!\n");

return ret;

}

static int fs_util_fs_initiate_tc(void)
{
int ret;

printf("%d. fs_initiate Test started. Please wait...\n", g_tc_count++);

/* Initiate file system */
ret = fs_initiate(MOUNT_DEV_DIR, TARGET_FS_NAME);
if (ret != OK) {
printf("fs_initiate Failed : %d\n", ret);
g_tc_fail_count++;
return ret;
}
printf("PASS!\n");

return ret;
}

#ifdef CONFIG_SMARTFS_SECTOR_RECOVERY
static int fs_util_fs_recover_tc(void)
{
int ret;

printf("%d. fs_recover Test started. Please wait...\n", g_tc_count++);
ret = fs_recover();
if (ret != OK) {
printf("fs_recover Failed : %d\n", ret);
g_tc_fail_count++;
return ret;
}
printf("PASS!\n");

return ret;
}
#endif
#endif /* END OF CONFIG_FS_SMARTFS */

static int fs_vfs_mount_tc(void)
{
Expand Down Expand Up @@ -2076,12 +2005,7 @@ static int fs_sample_launcher(int argc, char **args)
{
g_tc_count = 1;
g_tc_fail_count = 0;
#ifdef CONFIG_FS_SMARTFS
fs_util_fs_initiate_tc();
#ifdef CONFIG_SMARTFS_SECTOR_RECOVERY
fs_util_fs_recover_tc();
#endif
#endif

fs_vfs_umount_tc();
fs_vfs_mount_tc();
fs_vfs_open_tc();
Expand Down Expand Up @@ -2138,10 +2062,6 @@ static int fs_sample_launcher(int argc, char **args)
libc_stdio_gets_s_tc();
libc_stdio_fileno_tc();
libc_stdio_ungetc_tc();
#ifdef CONFIG_FS_SMARTFS
fs_util_fs_clean_tc();
fs_util_fs_erase_tc();
#endif
printf("#########################################\n");
printf(" FS TC Result \n");
printf(" Total TC : %d \n", --g_tc_count);
Expand Down
14 changes: 0 additions & 14 deletions apps/examples/testcase/ta_tc/arastorage/itc/itc_arastorage_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,20 +633,6 @@ void itc_arastorage_cursor_get_string_value_p(void)

int itc_arastorage_launcher(int argc, FAR char *argv[])
{

#ifdef CONFIG_FS_SMARTFS
if (fs_erase("/dev/smart1") != OK) {
printf("Error erasing file system, STOP TEST!!\n");
return ERROR;
}

if (fs_initiate("/dev/smart1", "smartfs") != OK) {
printf("Error initiating file system, STOP TEST!!\n");
return ERROR;
}
printf("File system initiated!! START TEST!!\n");
#endif

total_fail = 0;
total_pass = 0;
itc_arastorage_db_init_deinit_p();
Expand Down
12 changes: 0 additions & 12 deletions apps/examples/testcase/ta_tc/arastorage/utc/utc_arastorage_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1422,18 +1422,6 @@ void utc_arastorage_cursor_get_string_value_tc_n(void)
int arastorage_sample_launcher(int argc, FAR char *argv[])
{

#ifdef CONFIG_FS_SMARTFS
if (fs_erase("/dev/smart1") != OK) {
printf("Error erasing file system, STOP TEST!!\n");
return ERROR;
}

if (fs_initiate("/dev/smart1", "smartfs") != OK) {
printf("Error initiating file system, STOP TEST!!\n");
return ERROR;
}
printf("File system initiated!! START TEST!!\n");
#endif
g_arastorage_tc_count = 1;
g_arastorage_tc_fail_count = 0;

Expand Down
16 changes: 0 additions & 16 deletions apps/system/utils/netcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@

#include <tinyara/clock.h>
#include <tinyara/net/net.h>
#include <tinyara/fs/fs_utils.h>
#include <net/lwip/netif.h>
#include <net/lwip/dhcp.h>
#include <net/lwip/stats.h>
Expand Down Expand Up @@ -386,21 +385,6 @@ int cmd_get(int argc, char **argv)

fullpath = get_fullpath(args.destpath);

printf("Doing FS setting...\n");
ret = fs_erase("/dev/smart1");
if (ret != OK) {
printf("FS erase error\n");
return;
}

ret = fs_initiate("/dev/smart1", "smartfs");
if (ret != OK) {
printf("FS initiate error");
return;
} else {
printf("FS initiate done\n");
}

/* Then perform the TFTP get operation */

printf("src: %s full: %s addr: %d bin: %d\n", args.srcpath, fullpath, args.ipaddr, args.binary);
Expand Down
2 changes: 1 addition & 1 deletion os/fs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
ASRCS =
AOBJS = $(ASRCS:.S=$(OBJEXT))

CSRCS = fs_initialize.c fs_utils.c
CSRCS = fs_initialize.c

DEPPATH = --dep-path .
VPATH = .
Expand Down
67 changes: 0 additions & 67 deletions os/fs/driver/mtd/smart.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,73 +493,6 @@ static void smart_free(FAR struct smart_struct_s *dev, FAR void *ptr)
}
#endif

/***************************************************************************************
* This is called from the fs_clean() API to release the memory acquired by MTD driver
**************************************************************************************/
int smart_clean(FAR struct inode *inode)
{
FAR struct smart_struct_s *dev = (FAR struct smart_struct_s *)inode->i_private;

if (dev != NULL) {

#ifdef CONFIG_SMARTFS_BAD_SECTOR

if (dev->bad_sector_rwbuffer != NULL) {
smart_free(dev, dev->bad_sector_rwbuffer);
dev->bad_sector_rwbuffer = NULL;
}

if (dev->badSectorList != NULL) {
smart_free(dev, dev->badSectorList);
dev->badSectorList = NULL;
}
#endif

#ifndef CONFIG_MTD_SMART_MINIMIZE_RAM
if (dev->sMap != NULL) {
smart_free(dev, dev->sMap);
dev->sMap = NULL;
}
#else
if (dev->sBitMap != NULL) {
smart_free(dev, dev->sBitMap);
dev->sBitMap = NULL;
}
if (dev->sCache != NULL) {
smart_free(dev, dev->sCache);
dev->sCache = NULL;
}
#endif
if (dev->rwbuffer != NULL) {
smart_free(dev, dev->rwbuffer);
dev->rwbuffer = NULL;
}
if (dev->bytebuffer != NULL) {
smart_free(dev, dev->bytebuffer);
dev->bytebuffer = NULL;
}
#ifdef CONFIG_MTD_SMART_WEAR_LEVEL
if (dev->wearstatus != NULL) {
smart_free(dev, dev->wearstatus);
dev->wearstatus = NULL;
}
#endif

#ifdef CONFIG_MTD_SMART_SECTOR_ERASE_DEBUG
if (dev->erasecounts != NULL) {
smart_free(dev, dev->erasecounts);
dev->erasecounts = NULL;
}
#endif
dev->releasecount = NULL;
dev->freecount = NULL;
}
kmm_free(dev);
dev = NULL;

return OK;
}

/****************************************************************************
* Private Functions
****************************************************************************/
Expand Down
Loading

0 comments on commit 36c4a32

Please sign in to comment.