From 991f8e8c29124d8ce8169a18f897ed6af3d3adcb Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Mon, 14 Feb 2022 13:36:45 +0100 Subject: [PATCH] sys/fs/constfs: drop dummy implementations VFS will handle it if those functions are not implemented. --- sys/fs/constfs/constfs.c | 61 ---------------------------------------- 1 file changed, 61 deletions(-) diff --git a/sys/fs/constfs/constfs.c b/sys/fs/constfs/constfs.c index f3fcbe1c8f..3152db1b4d 100644 --- a/sys/fs/constfs/constfs.c +++ b/sys/fs/constfs/constfs.c @@ -33,46 +33,34 @@ #include "debug.h" /* 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_statvfs(vfs_mount_t *mountp, const char *restrict path, struct statvfs *restrict buf); /* File operations */ -static int constfs_close(vfs_file_t *filp); 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 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_write(vfs_file_t *filp, const void *src, size_t nbytes); /* Directory operations */ 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_closedir(vfs_DIR *dirp); static const vfs_file_system_ops_t constfs_fs_ops = { - .mount = constfs_mount, - .umount = constfs_umount, - .unlink = constfs_unlink, .statvfs = constfs_statvfs, .stat = constfs_stat, }; static const vfs_file_ops_t constfs_file_ops = { - .close = constfs_close, .fstat = constfs_fstat, .lseek = constfs_lseek, .open = constfs_open, .read = constfs_read, - .write = constfs_write, }; static const vfs_dir_ops_t constfs_dir_ops = { .opendir = constfs_opendir, .readdir = constfs_readdir, - .closedir = constfs_closedir, }; 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 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) { (void) name; @@ -162,13 +128,6 @@ static int constfs_statvfs(vfs_mount_t *mountp, const char *restrict path, struc 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) { 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; } -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) { (void) abs_path; @@ -298,14 +245,6 @@ static int constfs_readdir(vfs_DIR *dirp, vfs_dirent_t *entry) 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) { /* buffer is cleared by vfs already */