File System

The OpenHarmony LiteOS-M kernel supports the FAT file system (FATFS) and LittleFS. Table 1 lists the comparison of the functions supported by these two file systems.

Table 1 Function list

Category

API

Description

FATFS

LittleFS

File management

open

Opens a file.

Supported

Supported

close

Closes a file.

Supported

Supported

read

Reads a file.

Supported

Supported

write

Writes data to a file.

Supported

Supported

lseek

Sets the file offset.

Supported

Supported

unlink

Deletes a file.

Supported

Supported

rename

Renames a file.

Supported

Supported

fstat

Obtains file information based on the file handle.

Supported

Supported

stat

Obtains file information based on the file path name.

Supported

Supported

fsync

Saves file updates to a storage device.

Supported

Supported

Directory management

mkdir

Creates a directory.

Supported

Supported

opendir

Opens a directory.

Supported

Supported

readdir

Reads the content of a directory.

Supported

Supported

closedir

Closes a directory.

Supported

Supported

rmdir

Deletes a directory.

Supported

Supported

Partition management

mount

Mounts a partition.

Supported

Supported

umount

Unmounts a partition.

Supported

Supported

umount2

Forcibly unmounts a partition using the MNT_FORCE parameter.

Supported

Not supported

statfs

Obtains partition information.

Supported

Not supported