mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
sys/fs/constfs: drop dummy implementations
VFS will handle it if those functions are not implemented.
This commit is contained in:
parent
ec0df56b67
commit
991f8e8c29
@ -33,46 +33,34 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
/* File system operations */
|
/* File system operations */
|
||||||
static int constfs_mount(vfs_mount_t *mountp);
|
|
||||||
static int constfs_umount(vfs_mount_t *mountp);
|
|
||||||
static int constfs_unlink(vfs_mount_t *mountp, const char *name);
|
|
||||||
static int constfs_stat(vfs_mount_t *mountp, const char *restrict name, struct stat *restrict buf);
|
static int constfs_stat(vfs_mount_t *mountp, const char *restrict name, struct stat *restrict buf);
|
||||||
static int constfs_statvfs(vfs_mount_t *mountp, const char *restrict path, struct statvfs *restrict buf);
|
static int constfs_statvfs(vfs_mount_t *mountp, const char *restrict path, struct statvfs *restrict buf);
|
||||||
|
|
||||||
/* File operations */
|
/* File operations */
|
||||||
static int constfs_close(vfs_file_t *filp);
|
|
||||||
static int constfs_fstat(vfs_file_t *filp, struct stat *buf);
|
static int constfs_fstat(vfs_file_t *filp, struct stat *buf);
|
||||||
static off_t constfs_lseek(vfs_file_t *filp, off_t off, int whence);
|
static off_t constfs_lseek(vfs_file_t *filp, off_t off, int whence);
|
||||||
static int constfs_open(vfs_file_t *filp, const char *name, int flags, mode_t mode, const char *abs_path);
|
static int constfs_open(vfs_file_t *filp, const char *name, int flags, mode_t mode, const char *abs_path);
|
||||||
static ssize_t constfs_read(vfs_file_t *filp, void *dest, size_t nbytes);
|
static ssize_t constfs_read(vfs_file_t *filp, void *dest, size_t nbytes);
|
||||||
static ssize_t constfs_write(vfs_file_t *filp, const void *src, size_t nbytes);
|
|
||||||
|
|
||||||
/* Directory operations */
|
/* Directory operations */
|
||||||
static int constfs_opendir(vfs_DIR *dirp, const char *dirname, const char *abs_path);
|
static int constfs_opendir(vfs_DIR *dirp, const char *dirname, const char *abs_path);
|
||||||
static int constfs_readdir(vfs_DIR *dirp, vfs_dirent_t *entry);
|
static int constfs_readdir(vfs_DIR *dirp, vfs_dirent_t *entry);
|
||||||
static int constfs_closedir(vfs_DIR *dirp);
|
|
||||||
|
|
||||||
static const vfs_file_system_ops_t constfs_fs_ops = {
|
static const vfs_file_system_ops_t constfs_fs_ops = {
|
||||||
.mount = constfs_mount,
|
|
||||||
.umount = constfs_umount,
|
|
||||||
.unlink = constfs_unlink,
|
|
||||||
.statvfs = constfs_statvfs,
|
.statvfs = constfs_statvfs,
|
||||||
.stat = constfs_stat,
|
.stat = constfs_stat,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const vfs_file_ops_t constfs_file_ops = {
|
static const vfs_file_ops_t constfs_file_ops = {
|
||||||
.close = constfs_close,
|
|
||||||
.fstat = constfs_fstat,
|
.fstat = constfs_fstat,
|
||||||
.lseek = constfs_lseek,
|
.lseek = constfs_lseek,
|
||||||
.open = constfs_open,
|
.open = constfs_open,
|
||||||
.read = constfs_read,
|
.read = constfs_read,
|
||||||
.write = constfs_write,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const vfs_dir_ops_t constfs_dir_ops = {
|
static const vfs_dir_ops_t constfs_dir_ops = {
|
||||||
.opendir = constfs_opendir,
|
.opendir = constfs_opendir,
|
||||||
.readdir = constfs_readdir,
|
.readdir = constfs_readdir,
|
||||||
.closedir = constfs_closedir,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const vfs_file_system_t constfs_file_system = {
|
const vfs_file_system_t constfs_file_system = {
|
||||||
@ -91,28 +79,6 @@ const vfs_file_system_t constfs_file_system = {
|
|||||||
*/
|
*/
|
||||||
static void _constfs_write_stat(const constfs_file_t *fp, struct stat *restrict buf);
|
static void _constfs_write_stat(const constfs_file_t *fp, struct stat *restrict buf);
|
||||||
|
|
||||||
static int constfs_mount(vfs_mount_t *mountp)
|
|
||||||
{
|
|
||||||
/* perform any extra initialization here */
|
|
||||||
(void) mountp; /* prevent warning: unused parameter */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int constfs_umount(vfs_mount_t *mountp)
|
|
||||||
{
|
|
||||||
/* free resources and perform any clean up here */
|
|
||||||
(void) mountp; /* prevent warning: unused parameter */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int constfs_unlink(vfs_mount_t *mountp, const char *name)
|
|
||||||
{
|
|
||||||
/* Removing files is prohibited */
|
|
||||||
(void) mountp; /* prevent warning: unused parameter */
|
|
||||||
(void) name; /* prevent warning: unused parameter */
|
|
||||||
return -EROFS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int constfs_stat(vfs_mount_t *mountp, const char *restrict name, struct stat *restrict buf)
|
static int constfs_stat(vfs_mount_t *mountp, const char *restrict name, struct stat *restrict buf)
|
||||||
{
|
{
|
||||||
(void) name;
|
(void) name;
|
||||||
@ -162,13 +128,6 @@ static int constfs_statvfs(vfs_mount_t *mountp, const char *restrict path, struc
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int constfs_close(vfs_file_t *filp)
|
|
||||||
{
|
|
||||||
/* perform any necessary clean ups */
|
|
||||||
(void) filp; /* prevent warning: unused parameter */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int constfs_fstat(vfs_file_t *filp, struct stat *buf)
|
static int constfs_fstat(vfs_file_t *filp, struct stat *buf)
|
||||||
{
|
{
|
||||||
constfs_file_t *fp = filp->private_data.ptr;
|
constfs_file_t *fp = filp->private_data.ptr;
|
||||||
@ -244,18 +203,6 @@ static ssize_t constfs_read(vfs_file_t *filp, void *dest, size_t nbytes)
|
|||||||
return nbytes;
|
return nbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t constfs_write(vfs_file_t *filp, const void *src, size_t nbytes)
|
|
||||||
{
|
|
||||||
DEBUG("constfs_write: %p, %p, %lu\n", (void *)filp, src, (unsigned long)nbytes);
|
|
||||||
/* Read only file system */
|
|
||||||
DEBUG("constfs_write: read only FS\n");
|
|
||||||
/* prevent warning: unused parameter */
|
|
||||||
(void) filp;
|
|
||||||
(void) src;
|
|
||||||
(void) nbytes;
|
|
||||||
return -EBADF;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int constfs_opendir(vfs_DIR *dirp, const char *dirname, const char *abs_path)
|
static int constfs_opendir(vfs_DIR *dirp, const char *dirname, const char *abs_path)
|
||||||
{
|
{
|
||||||
(void) abs_path;
|
(void) abs_path;
|
||||||
@ -298,14 +245,6 @@ static int constfs_readdir(vfs_DIR *dirp, vfs_dirent_t *entry)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int constfs_closedir(vfs_DIR *dirp)
|
|
||||||
{
|
|
||||||
/* Just an example, it's not necessary to define closedir if there is
|
|
||||||
* nothing to clean up */
|
|
||||||
(void) dirp;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void _constfs_write_stat(const constfs_file_t *fp, struct stat *restrict buf)
|
static void _constfs_write_stat(const constfs_file_t *fp, struct stat *restrict buf)
|
||||||
{
|
{
|
||||||
/* buffer is cleared by vfs already */
|
/* buffer is cleared by vfs already */
|
||||||
|
Loading…
Reference in New Issue
Block a user