mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 23:40:19 +08:00
Revert "fs/mount and fs/romfs: Add support to mount a ROMFS volume using an MTD driver interface using the standard mount() operation."
This reverts commit 5708a1ac73.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
@@ -125,9 +125,6 @@ static const struct fsmap_t g_bdfsmap[] =
|
|||||||
#ifdef MDFS_SUPPORT
|
#ifdef MDFS_SUPPORT
|
||||||
/* File systems that require MTD drivers */
|
/* File systems that require MTD drivers */
|
||||||
|
|
||||||
#ifdef CONFIG_FS_ROMFS
|
|
||||||
extern const struct mountpt_operations g_romfs_operations;
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_FS_SPIFFS
|
#ifdef CONFIG_FS_SPIFFS
|
||||||
extern const struct mountpt_operations g_spiffs_operations;
|
extern const struct mountpt_operations g_spiffs_operations;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+25
-71
@@ -37,7 +37,6 @@
|
|||||||
|
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/fs/ioctl.h>
|
#include <nuttx/fs/ioctl.h>
|
||||||
#include <nuttx/mtd/mtd.h>
|
|
||||||
|
|
||||||
#include "fs_romfs.h"
|
#include "fs_romfs.h"
|
||||||
|
|
||||||
@@ -538,16 +537,8 @@ int romfs_hwread(FAR struct romfs_mountpt_s *rm, FAR uint8_t *buffer,
|
|||||||
FAR struct inode *inode = rm->rm_blkdriver;
|
FAR struct inode *inode = rm->rm_blkdriver;
|
||||||
ssize_t nsectorsread = -ENODEV;
|
ssize_t nsectorsread = -ENODEV;
|
||||||
|
|
||||||
if (INODE_IS_MTD(inode))
|
nsectorsread =
|
||||||
{
|
inode->u.i_bops->read(inode, buffer, sector, nsectors);
|
||||||
nsectorsread =
|
|
||||||
MTD_BREAD(inode->u.i_mtd, sector, nsectors, buffer);
|
|
||||||
}
|
|
||||||
else if (inode->u.i_bops->read)
|
|
||||||
{
|
|
||||||
nsectorsread =
|
|
||||||
inode->u.i_bops->read(inode, buffer, sector, nsectors);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nsectorsread == (ssize_t)nsectors)
|
if (nsectorsread == (ssize_t)nsectors)
|
||||||
{
|
{
|
||||||
@@ -639,6 +630,7 @@ int romfs_filecacheread(FAR struct romfs_mountpt_s *rm,
|
|||||||
int romfs_hwconfigure(FAR struct romfs_mountpt_s *rm)
|
int romfs_hwconfigure(FAR struct romfs_mountpt_s *rm)
|
||||||
{
|
{
|
||||||
FAR struct inode *inode = rm->rm_blkdriver;
|
FAR struct inode *inode = rm->rm_blkdriver;
|
||||||
|
struct geometry geo;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Get the underlying device geometry */
|
/* Get the underlying device geometry */
|
||||||
@@ -650,72 +642,40 @@ int romfs_hwconfigure(FAR struct romfs_mountpt_s *rm)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (INODE_IS_MTD(inode))
|
ret = inode->u.i_bops->geometry(inode, &geo);
|
||||||
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
struct mtd_geometry_s mgeo;
|
return ret;
|
||||||
|
|
||||||
ret = MTD_IOCTL(inode->u.i_mtd, MTDIOC_GEOMETRY,
|
|
||||||
(unsigned long)&mgeo);
|
|
||||||
if (ret != OK)
|
|
||||||
{
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Save that information in the mount structure */
|
|
||||||
|
|
||||||
rm->rm_hwsectorsize = mgeo.blocksize;
|
|
||||||
rm->rm_hwnsectors = mgeo.neraseblocks *
|
|
||||||
(mgeo.erasesize / mgeo.blocksize);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (!geo.geo_available)
|
||||||
{
|
{
|
||||||
struct geometry geo;
|
return -EBUSY;
|
||||||
|
|
||||||
ret = inode->u.i_bops->geometry(inode, &geo);
|
|
||||||
if (ret != OK)
|
|
||||||
{
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!geo.geo_available)
|
|
||||||
{
|
|
||||||
return -EBUSY;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Save that information in the mount structure */
|
|
||||||
|
|
||||||
rm->rm_hwsectorsize = geo.geo_sectorsize;
|
|
||||||
rm->rm_hwnsectors = geo.geo_nsectors;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Save that information in the mount structure */
|
||||||
|
|
||||||
|
rm->rm_hwsectorsize = geo.geo_sectorsize;
|
||||||
|
rm->rm_hwnsectors = geo.geo_nsectors;
|
||||||
|
|
||||||
/* Determine if block driver supports the XIP mode of operation */
|
/* Determine if block driver supports the XIP mode of operation */
|
||||||
|
|
||||||
rm->rm_cachesector = (uint32_t)-1;
|
rm->rm_cachesector = (uint32_t)-1;
|
||||||
|
|
||||||
if (INODE_IS_MTD(inode))
|
if (inode->u.i_bops->ioctl)
|
||||||
{
|
|
||||||
ret = MTD_IOCTL(inode->u.i_mtd, BIOC_XIPBASE,
|
|
||||||
(unsigned long)&rm->rm_xipbase);
|
|
||||||
}
|
|
||||||
else if (inode->u.i_bops->ioctl != NULL)
|
|
||||||
{
|
{
|
||||||
ret = inode->u.i_bops->ioctl(inode, BIOC_XIPBASE,
|
ret = inode->u.i_bops->ioctl(inode, BIOC_XIPBASE,
|
||||||
(unsigned long)&rm->rm_xipbase);
|
(unsigned long)&rm->rm_xipbase);
|
||||||
}
|
if (ret == OK && rm->rm_xipbase)
|
||||||
else
|
{
|
||||||
{
|
/* Yes.. Then we will directly access the media (vs.
|
||||||
ret = -ENOTSUP;
|
* copying into an allocated sector buffer.
|
||||||
}
|
*/
|
||||||
|
|
||||||
if (ret == OK && rm->rm_xipbase)
|
rm->rm_buffer = rm->rm_xipbase;
|
||||||
{
|
rm->rm_cachesector = 0;
|
||||||
/* Yes.. Then we will directly access the media (vs.
|
return OK;
|
||||||
* copying into an allocated sector buffer.
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
rm->rm_buffer = rm->rm_xipbase;
|
|
||||||
rm->rm_cachesector = 0;
|
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate the device cache buffer for normal sector accesses */
|
/* Allocate the device cache buffer for normal sector accesses */
|
||||||
@@ -868,13 +828,7 @@ int romfs_checkmount(FAR struct romfs_mountpt_s *rm)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
inode = rm->rm_blkdriver;
|
inode = rm->rm_blkdriver;
|
||||||
if (INODE_IS_MTD(inode))
|
if (inode->u.i_bops->geometry)
|
||||||
{
|
|
||||||
/* It is impossible to remove MTD device */
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
else if (inode->u.i_bops->geometry)
|
|
||||||
{
|
{
|
||||||
ret = inode->u.i_bops->geometry(inode, &geo);
|
ret = inode->u.i_bops->geometry(inode, &geo);
|
||||||
if (ret == OK && geo.geo_available && !geo.geo_mediachanged)
|
if (ret == OK && geo.geo_available && !geo.geo_mediachanged)
|
||||||
|
|||||||
Reference in New Issue
Block a user