With the introduce of VFS the typedef for fs_file_t & fs_dir_t don't
exist anymore so we need to use 'struct fs_dir_t' or 'struct fs_file_t'.
Fix up some places that got missed in the VFS conversion.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add support for Virtual File system Switch (VFS) by
introducing mount point concept to Zephyr. This allows
the applications to mount multiple file systems at
different mount points (ex: "/fatfs" and "/nffs"). The
mount point structure contains all the necessary info
required to instantiate, mount and operate on file system.
Decouple applications from directly accessing individual
file systems API's or internal functions by introducing
file system registration mechanism in VFS.
Move the file system defination and mount responsibility
to application so that application can decide which file system
to use and where to mount.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
It is faster to operate directly on flash_area pointer instead
of fetch it all the time using the fcb flash area id.
Also as f_area_id was needed only for get appropriate flash_area
pointer, so it is better to pass it only while initialization
the fcb and not store it in fcb instance data at all.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Previously flash_area structure was the parameter for the callback
function for transferring sector location info.
Now flash_sector is used so relevant flash_area is missing for
the callback.
This patch introduces structure fcb_entry_ctx which incorporates
entries' location and relevant flash area. It is used to pass complete
information to the callback. Additional pointer to the flash_area fcb
speeds up operations.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Prior to this commit: `struct fcb` contained a pointer to an array of
`struct flash_area`. Each entry in the array represented a flash sector
that the fcb comprised.
After commit: `struct fcb` contains a pointer to an array of `struct
flash_sector`, not `struct flash_area`.
Rationale: The FCB needs to know which sectors it occupies for its
rotate operation. However, the `flash_area` type is meant to represent
a collection of sectors, not a single sector. `struct flash_area`
contains information that the fcb does not need (e.g., area ID and
device ID). Furthermore, the flash_map API provides a means of
converting a flash area ID to an array of sectors
(`flash_area_get_sectors()`), but no way to convert to an array of
areas.
Signed-off-by: Christopher Collins <ccollins@apache.org>
Zephyr already supports NFFS as a storage layer, but it might
be a little bit too heavyweight for certain applications in
memory-restricted ICs.
This module is response for need of Lightweight flash storage
capability. FCB is ported form MyNewt as native zephyr module.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Of the filesystems under subsys/fs/, only the ELM FAT filesystem needs
the disk layer as others (like NFFS) talk directly to the flash API.
This removes the need to define CONFIG_DISK_ERASE_BLOCK_SIZE and
similar which are used by the disk subsystem but not by NFFS.
Signed-off-by: Michael Hope <mlhx@google.com>
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.
Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.
This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.
For users that just want to continue their work with minimal
disruption the following should suffice:
Install CMake 3.8.2+
Port any out-of-tree Makefiles to CMake.
Learn the absolute minimum about the new command line interface:
$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..
$ cd build
$ make
PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
Add following commands to fs shell:
- rf <filename>
- read <filename> [<offset> [<length>]]
- write <filename> [-o <offset>] <byte1> [<byte2> ... [<byteN>]]
- trunc <filename> [<length>]
For writes without offset specified, new data is appended to file.
For truncaces without length specified, 0 is default value.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
This patch moves code to create absolute path of file/directory to
separate helper since the same code is used in few places.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
This patch adds filesystem interface implementation for NFFS.
Default configuration for mem slabs sizes are the same as in Mynewt.
Origin: Original
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.
Jira: ZEP-2051
Change-Id: Icbf9e542b23208890a3a32358447d44cdc274ef1
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t. This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.
We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.
We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.
Jira: ZEP-2051
Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The fat library uses its own typedef for integer parms and expects a
UINT to be either 16 or 32-bits in length. We potentially get into
trouble when we build with newlib if we use an uint32_t. Lets just use
unsigned int which should cover all cases for us.
Change-Id: I3dbbf4871ab65dd12488d41cb06a06387c128339
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.
Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.
Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file. Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.
Jira: ZEP-1457
Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Disk IO functions are used by both FS and USB Mass Storage.
This patch refactors those from FS directory to a separate one.
In addition existing, config options were modified to make
stuff meaningful.
Jira: ZEP-1276
Change-Id: Ia2a2e18f3dbbbdb964c3dc0427d8138ad86134cd
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
This moves the shell component into its own subsys and groups all
related files and options into a single place.
Additionally, one Kconfig option will now be required to enable the
shell:
CONFIG_CONSOLE_SHELL=y
The header files was also moved to include/shell/shell.h and can be now
referenced with
#include <shell/shell.h>
instead of
#include <misc/shell.h>
Updated documentation as well.
Change-Id: Iffbba4acfa05408055e9fd28dffa213451351f94
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit improves source code readability by breaking long
expressions found at some if statements.
Some minor style issues are also fixed by this patch.
Change-Id: I0c8e42eaf0fca3a98490c54a0ccb941766c50fa3
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
This patch removes "FAT" from files names, config names and
symbol names so as to avoid confusion, when other modules use
them in a more generic way.
Also flash_disk_access.c and ram_disk_access.c now exports generic
disk_access symbols as defined in include/disk_access.h rather
than FAT specific ones in fs/fat_diskio.h. Thus modules like
USB which need to use disk_access interface is not dependent
on symbols from ELMChan FAT module. Also fat_diskio.h
is removed.
Further the shim between ELM chan and Zephyr is modified as
per these changes.
Change-Id: Ifd80f14a629e467ee9c7a9aaff8a4896eed11982
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Add a simple shell that allows exploring the contents of the file
system.
Jira: ZEP-1235
Change-Id: Iaa49f0be18980dd740e9552ddf4761196a818884
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
FS_FAT_FLASH_DISK_W25QXXDV is a boolean so "" makes no sense.
Change-Id: Ic43529928d80bcd76c2876219990bcec86657d3d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The flash and RAM disk options are mutually exclusive (evident e.g. in
both defining FS_VOLUME_SIZE and FS_BLOCK_SIZE variables), so they
should really be inside a choice-endchoice block. The duplicated
options can also taken care of with a single definition using
conditional default values.
Change-Id: I87733f0c342166a9e03aa0e1f34390d91107b137
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The namespace allocated for the filesystem API is fs_* and FS_*. That
means all symbols and defines should adhere to it.
Jira: ZEP-1155
Change-Id: I422310448b7c7c347f621aea6d7b1d97ef25c94d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Subsystems code will reside in subsys/ folder. This patch creates the
folder and moves FS code there.
Jira: ZEP-1120
Change-Id: If3b1bcb996c5fbd4056cd5d1920d41d29810d6b2
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>