mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
vfs: drop unused abs_path parameter
This commit is contained in:
parent
0e181e9ec3
commit
85dd564f87
@ -222,14 +222,12 @@ static fatfs_file_desc_t * _get_fatfs_file_desc(vfs_file_t *f)
|
|||||||
return (fatfs_file_desc_t *)(uintptr_t)f->private_data.buffer;
|
return (fatfs_file_desc_t *)(uintptr_t)f->private_data.buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _open(vfs_file_t *filp, const char *name, int flags, mode_t mode,
|
static int _open(vfs_file_t *filp, const char *name, int flags, mode_t mode)
|
||||||
const char *abs_path)
|
|
||||||
{
|
{
|
||||||
fatfs_file_desc_t *fd = _get_fatfs_file_desc(filp);
|
fatfs_file_desc_t *fd = _get_fatfs_file_desc(filp);
|
||||||
fatfs_desc_t *fs_desc = (fatfs_desc_t *)filp->mp->private_data;
|
fatfs_desc_t *fs_desc = (fatfs_desc_t *)filp->mp->private_data;
|
||||||
_build_abs_path(fs_desc, name);
|
_build_abs_path(fs_desc, name);
|
||||||
|
|
||||||
(void) abs_path;
|
|
||||||
(void) mode; /* fatfs can't use mode param with f_open*/
|
(void) mode; /* fatfs can't use mode param with f_open*/
|
||||||
DEBUG("fatfs_vfs.c: _open: private_data = %p, name = %s; flags = 0x%x\n",
|
DEBUG("fatfs_vfs.c: _open: private_data = %p, name = %s; flags = 0x%x\n",
|
||||||
filp->mp->private_data, name, flags);
|
filp->mp->private_data, name, flags);
|
||||||
@ -416,11 +414,10 @@ static inline DIR * _get_DIR(vfs_DIR *d)
|
|||||||
return (DIR *)(uintptr_t)d->private_data.buffer;
|
return (DIR *)(uintptr_t)d->private_data.buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _opendir(vfs_DIR *dirp, const char *dirname, const char *abs_path)
|
static int _opendir(vfs_DIR *dirp, const char *dirname)
|
||||||
{
|
{
|
||||||
DIR *dir = _get_DIR(dirp);
|
DIR *dir = _get_DIR(dirp);
|
||||||
fatfs_desc_t *fs_desc = (fatfs_desc_t *)dirp->mp->private_data;
|
fatfs_desc_t *fs_desc = (fatfs_desc_t *)dirp->mp->private_data;
|
||||||
(void) abs_path;
|
|
||||||
|
|
||||||
_build_abs_path(fs_desc, dirname);
|
_build_abs_path(fs_desc, dirname);
|
||||||
|
|
||||||
|
@ -286,11 +286,10 @@ static inline lfs_file_t * _get_lfs_file(vfs_file_t *f)
|
|||||||
return (lfs_file_t *)(uintptr_t)f->private_data.buffer;
|
return (lfs_file_t *)(uintptr_t)f->private_data.buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _open(vfs_file_t *filp, const char *name, int flags, mode_t mode, const char *abs_path)
|
static int _open(vfs_file_t *filp, const char *name, int flags, mode_t mode)
|
||||||
{
|
{
|
||||||
littlefs_desc_t *fs = filp->mp->private_data;
|
littlefs_desc_t *fs = filp->mp->private_data;
|
||||||
lfs_file_t *fp = _get_lfs_file(filp);
|
lfs_file_t *fp = _get_lfs_file(filp);
|
||||||
(void) abs_path;
|
|
||||||
(void) mode;
|
(void) mode;
|
||||||
|
|
||||||
mutex_lock(&fs->lock);
|
mutex_lock(&fs->lock);
|
||||||
@ -320,7 +319,7 @@ static int _open(vfs_file_t *filp, const char *name, int flags, mode_t mode, con
|
|||||||
l_flags |= LFS_O_EXCL;
|
l_flags |= LFS_O_EXCL;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG("littlefs: open: %s (abs_path: %s), flags: 0x%x\n", name, abs_path, (int) l_flags);
|
DEBUG("littlefs: open: %s, flags: 0x%x\n", name, (int) l_flags);
|
||||||
|
|
||||||
int ret = lfs_file_open(&fs->fs, fp, name, l_flags);
|
int ret = lfs_file_open(&fs->fs, fp, name, l_flags);
|
||||||
mutex_unlock(&fs->lock);
|
mutex_unlock(&fs->lock);
|
||||||
@ -477,16 +476,15 @@ static inline lfs_dir_t * _get_lfs_dir(vfs_DIR *dirp)
|
|||||||
return (lfs_dir_t *)(uintptr_t)dirp->private_data.buffer;
|
return (lfs_dir_t *)(uintptr_t)dirp->private_data.buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _opendir(vfs_DIR *dirp, const char *dirname, const char *abs_path)
|
static int _opendir(vfs_DIR *dirp, const char *dirname)
|
||||||
{
|
{
|
||||||
(void)abs_path;
|
|
||||||
littlefs_desc_t *fs = dirp->mp->private_data;
|
littlefs_desc_t *fs = dirp->mp->private_data;
|
||||||
lfs_dir_t *dir = _get_lfs_dir(dirp);
|
lfs_dir_t *dir = _get_lfs_dir(dirp);
|
||||||
|
|
||||||
mutex_lock(&fs->lock);
|
mutex_lock(&fs->lock);
|
||||||
|
|
||||||
DEBUG("littlefs: opendir: dirp=%p, dirname=%s (abs_path=%s)\n",
|
DEBUG("littlefs: opendir: dirp=%p, dirname=%s\n",
|
||||||
(void *)dirp, dirname, abs_path);
|
(void *)dirp, dirname);
|
||||||
|
|
||||||
int ret = lfs_dir_open(&fs->fs, dir, dirname);
|
int ret = lfs_dir_open(&fs->fs, dir, dirname);
|
||||||
mutex_unlock(&fs->lock);
|
mutex_unlock(&fs->lock);
|
||||||
|
@ -291,11 +291,10 @@ static inline lfs_file_t * _get_lfs_file(vfs_file_t *f)
|
|||||||
return (lfs_file_t *)(uintptr_t)f->private_data.buffer;
|
return (lfs_file_t *)(uintptr_t)f->private_data.buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _open(vfs_file_t *filp, const char *name, int flags, mode_t mode, const char *abs_path)
|
static int _open(vfs_file_t *filp, const char *name, int flags, mode_t mode)
|
||||||
{
|
{
|
||||||
littlefs2_desc_t *fs = filp->mp->private_data;
|
littlefs2_desc_t *fs = filp->mp->private_data;
|
||||||
lfs_file_t *fp = _get_lfs_file(filp);
|
lfs_file_t *fp = _get_lfs_file(filp);
|
||||||
(void) abs_path;
|
|
||||||
(void) mode;
|
(void) mode;
|
||||||
|
|
||||||
mutex_lock(&fs->lock);
|
mutex_lock(&fs->lock);
|
||||||
@ -325,7 +324,7 @@ static int _open(vfs_file_t *filp, const char *name, int flags, mode_t mode, con
|
|||||||
l_flags |= LFS_O_EXCL;
|
l_flags |= LFS_O_EXCL;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG("littlefs: open: %s (abs_path: %s), flags: 0x%x\n", name, abs_path, (int) l_flags);
|
DEBUG("littlefs: open: %s, flags: 0x%x\n", name, (int) l_flags);
|
||||||
|
|
||||||
int ret = lfs_file_open(&fs->fs, fp, name, l_flags);
|
int ret = lfs_file_open(&fs->fs, fp, name, l_flags);
|
||||||
mutex_unlock(&fs->lock);
|
mutex_unlock(&fs->lock);
|
||||||
@ -482,16 +481,15 @@ static inline lfs_dir_t * _get_lfs_dir(vfs_DIR *dirp)
|
|||||||
return (lfs_dir_t *)(uintptr_t)dirp->private_data.buffer;
|
return (lfs_dir_t *)(uintptr_t)dirp->private_data.buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _opendir(vfs_DIR *dirp, const char *dirname, const char *abs_path)
|
static int _opendir(vfs_DIR *dirp, const char *dirname)
|
||||||
{
|
{
|
||||||
(void)abs_path;
|
|
||||||
littlefs2_desc_t *fs = dirp->mp->private_data;
|
littlefs2_desc_t *fs = dirp->mp->private_data;
|
||||||
lfs_dir_t *dir = _get_lfs_dir(dirp);
|
lfs_dir_t *dir = _get_lfs_dir(dirp);
|
||||||
|
|
||||||
mutex_lock(&fs->lock);
|
mutex_lock(&fs->lock);
|
||||||
|
|
||||||
DEBUG("littlefs: opendir: dirp=%p, dirname=%s (abs_path=%s)\n",
|
DEBUG("littlefs: opendir: dirp=%p, dirname=%s\n",
|
||||||
(void *)dirp, dirname, abs_path);
|
(void *)dirp, dirname);
|
||||||
|
|
||||||
int ret = lfs_dir_open(&fs->fs, dir, dirname);
|
int ret = lfs_dir_open(&fs->fs, dir, dirname);
|
||||||
mutex_unlock(&fs->lock);
|
mutex_unlock(&fs->lock);
|
||||||
|
@ -246,10 +246,9 @@ static int _statvfs(vfs_mount_t *mountp, const char *restrict path, struct statv
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _open(vfs_file_t *filp, const char *name, int flags, mode_t mode, const char *abs_path)
|
static int _open(vfs_file_t *filp, const char *name, int flags, mode_t mode)
|
||||||
{
|
{
|
||||||
spiffs_desc_t *fs_desc = filp->mp->private_data;
|
spiffs_desc_t *fs_desc = filp->mp->private_data;
|
||||||
(void) abs_path;
|
|
||||||
DEBUG("spiffs: open: private_data = %p\n", filp->mp->private_data);
|
DEBUG("spiffs: open: private_data = %p\n", filp->mp->private_data);
|
||||||
|
|
||||||
spiffs_flags s_flags = 0;
|
spiffs_flags s_flags = 0;
|
||||||
@ -280,7 +279,7 @@ static int _open(vfs_file_t *filp, const char *name, int flags, mode_t mode, con
|
|||||||
s_flags |= SPIFFS_O_EXCL;
|
s_flags |= SPIFFS_O_EXCL;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG("spiffs: open: %s (abs_path: %s), flags: 0x%x, mode: %d\n", name, abs_path, (int) s_flags, (int) mode);
|
DEBUG("spiffs: open: %s, flags: 0x%x, mode: %d\n", name, (int) s_flags, (int) mode);
|
||||||
|
|
||||||
s32_t ret = SPIFFS_open(&fs_desc->fs, name, s_flags, mode);
|
s32_t ret = SPIFFS_open(&fs_desc->fs, name, s_flags, mode);
|
||||||
if (ret >= 0) {
|
if (ret >= 0) {
|
||||||
@ -368,11 +367,10 @@ static spiffs_DIR * _get_spifs_dir(vfs_DIR *dirp)
|
|||||||
return (spiffs_DIR *)(uintptr_t)&dirp->private_data.buffer[0];
|
return (spiffs_DIR *)(uintptr_t)&dirp->private_data.buffer[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _opendir(vfs_DIR *dirp, const char *dirname, const char *abs_path)
|
static int _opendir(vfs_DIR *dirp, const char *dirname)
|
||||||
{
|
{
|
||||||
spiffs_desc_t *fs_desc = dirp->mp->private_data;
|
spiffs_desc_t *fs_desc = dirp->mp->private_data;
|
||||||
spiffs_DIR *d = _get_spifs_dir(dirp);
|
spiffs_DIR *d = _get_spifs_dir(dirp);
|
||||||
(void) abs_path;
|
|
||||||
|
|
||||||
spiffs_DIR *res = SPIFFS_opendir(&fs_desc->fs, dirname, d);
|
spiffs_DIR *res = SPIFFS_opendir(&fs_desc->fs, dirname, d);
|
||||||
if (res == NULL) {
|
if (res == NULL) {
|
||||||
|
@ -39,11 +39,11 @@ static int constfs_statvfs(vfs_mount_t *mountp, const char *restrict path, struc
|
|||||||
/* File operations */
|
/* File operations */
|
||||||
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);
|
||||||
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);
|
||||||
|
|
||||||
/* 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);
|
||||||
static int constfs_readdir(vfs_DIR *dirp, vfs_dirent_t *entry);
|
static int constfs_readdir(vfs_DIR *dirp, vfs_dirent_t *entry);
|
||||||
|
|
||||||
static const vfs_file_system_ops_t constfs_fs_ops = {
|
static const vfs_file_system_ops_t constfs_fs_ops = {
|
||||||
@ -162,12 +162,11 @@ static off_t constfs_lseek(vfs_file_t *filp, off_t off, int whence)
|
|||||||
return off;
|
return off;
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
(void) mode;
|
(void) mode;
|
||||||
(void) abs_path;
|
|
||||||
constfs_t *fs = filp->mp->private_data;
|
constfs_t *fs = filp->mp->private_data;
|
||||||
DEBUG("constfs_open: %p, \"%s\", 0x%x, 0%03lo, \"%s\"\n", (void *)filp, name, flags, (unsigned long)mode, abs_path);
|
DEBUG("constfs_open: %p, \"%s\", 0x%x, 0%03lo\"\n", (void *)filp, name, flags, (unsigned long)mode);
|
||||||
/* We only support read access */
|
/* We only support read access */
|
||||||
if ((flags & O_ACCMODE) != O_RDONLY) {
|
if ((flags & O_ACCMODE) != O_RDONLY) {
|
||||||
return -EROFS;
|
return -EROFS;
|
||||||
@ -203,10 +202,9 @@ static ssize_t constfs_read(vfs_file_t *filp, void *dest, size_t nbytes)
|
|||||||
return nbytes;
|
return nbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int constfs_opendir(vfs_DIR *dirp, const char *dirname, const char *abs_path)
|
static int constfs_opendir(vfs_DIR *dirp, const char *dirname)
|
||||||
{
|
{
|
||||||
(void) abs_path;
|
DEBUG("constfs_opendir: %p, \"%s\"\n", (void *)dirp, dirname);
|
||||||
DEBUG("constfs_opendir: %p, \"%s\", \"%s\"\n", (void *)dirp, dirname, abs_path);
|
|
||||||
if (strncmp(dirname, "/", 2) != 0) {
|
if (strncmp(dirname, "/", 2) != 0) {
|
||||||
/* We keep it simple and only support a flat file system, only a root directory */
|
/* We keep it simple and only support a flat file system, only a root directory */
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
@ -50,12 +50,12 @@ static mutex_t _devfs_mutex = MUTEX_INIT;
|
|||||||
|
|
||||||
/* File operations */
|
/* File operations */
|
||||||
/* open is overloaded to allow searching for the correct device */
|
/* open is overloaded to allow searching for the correct device */
|
||||||
static int devfs_open(vfs_file_t *filp, const char *name, int flags, mode_t mode, const char *abs_path);
|
static int devfs_open(vfs_file_t *filp, const char *name, int flags, mode_t mode);
|
||||||
/* A minimal fcntl is also provided to enable SETFL handling */
|
/* A minimal fcntl is also provided to enable SETFL handling */
|
||||||
static int devfs_fcntl(vfs_file_t *filp, int cmd, int arg);
|
static int devfs_fcntl(vfs_file_t *filp, int cmd, int arg);
|
||||||
|
|
||||||
/* Directory operations */
|
/* Directory operations */
|
||||||
static int devfs_opendir(vfs_DIR *dirp, const char *dirname, const char *abs_path);
|
static int devfs_opendir(vfs_DIR *dirp, const char *dirname);
|
||||||
static int devfs_readdir(vfs_DIR *dirp, vfs_dirent_t *entry);
|
static int devfs_readdir(vfs_DIR *dirp, vfs_dirent_t *entry);
|
||||||
static int devfs_closedir(vfs_DIR *dirp);
|
static int devfs_closedir(vfs_DIR *dirp);
|
||||||
|
|
||||||
@ -75,9 +75,9 @@ const vfs_file_system_t devfs_file_system = {
|
|||||||
.d_op = &devfs_dir_ops,
|
.d_op = &devfs_dir_ops,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int devfs_open(vfs_file_t *filp, const char *name, int flags, mode_t mode, const char *abs_path)
|
static int devfs_open(vfs_file_t *filp, const char *name, int flags, mode_t mode)
|
||||||
{
|
{
|
||||||
DEBUG("devfs_open: %p, \"%s\", 0x%x, 0%03lo, \"%s\"\n", (void *)filp, name, flags, (unsigned long)mode, abs_path);
|
DEBUG("devfs_open: %p, \"%s\", 0x%x, 0%03lo\n", (void *)filp, name, flags, (unsigned long)mode);
|
||||||
/* linear search through the device list */
|
/* linear search through the device list */
|
||||||
mutex_lock(&_devfs_mutex);
|
mutex_lock(&_devfs_mutex);
|
||||||
clist_node_t *it = _devfs_list.next;
|
clist_node_t *it = _devfs_list.next;
|
||||||
@ -98,7 +98,7 @@ static int devfs_open(vfs_file_t *filp, const char *name, int flags, mode_t mode
|
|||||||
filp->f_op = devp->f_op;
|
filp->f_op = devp->f_op;
|
||||||
/* Chain the open() method for the specific device */
|
/* Chain the open() method for the specific device */
|
||||||
if (filp->f_op->open != NULL) {
|
if (filp->f_op->open != NULL) {
|
||||||
return filp->f_op->open(filp, name, flags, mode, abs_path);
|
return filp->f_op->open(filp, name, flags, mode);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -122,10 +122,9 @@ static int devfs_fcntl(vfs_file_t *filp, int cmd, int arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int devfs_opendir(vfs_DIR *dirp, const char *dirname, const char *abs_path)
|
static int devfs_opendir(vfs_DIR *dirp, const char *dirname)
|
||||||
{
|
{
|
||||||
(void) abs_path;
|
DEBUG("devfs_opendir: %p, \"%s\"\n", (void *)dirp, dirname);
|
||||||
DEBUG("devfs_opendir: %p, \"%s\", \"%s\"\n", (void *)dirp, dirname, abs_path);
|
|
||||||
if (strncmp(dirname, "/", 2) != 0) {
|
if (strncmp(dirname, "/", 2) != 0) {
|
||||||
/* We keep it simple and only support a flat file system, only a root directory */
|
/* We keep it simple and only support a flat file system, only a root directory */
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
@ -476,12 +476,11 @@ struct vfs_file_ops {
|
|||||||
* @param[in] name null-terminated name of the file to open, relative to the file system root, including a leading slash
|
* @param[in] name null-terminated name of the file to open, relative to the file system root, including a leading slash
|
||||||
* @param[in] flags flags for opening, see man 2 open, man 3p open
|
* @param[in] flags flags for opening, see man 2 open, man 3p open
|
||||||
* @param[in] mode mode for creating a new file, see man 2 open, man 3p open
|
* @param[in] mode mode for creating a new file, see man 2 open, man 3p open
|
||||||
* @param[in] abs_path null-terminated name of the file to open, relative to the VFS root ("/")
|
|
||||||
*
|
*
|
||||||
* @return 0 on success
|
* @return 0 on success
|
||||||
* @return <0 on error
|
* @return <0 on error
|
||||||
*/
|
*/
|
||||||
int (*open) (vfs_file_t *filp, const char *name, int flags, mode_t mode, const char *abs_path);
|
int (*open) (vfs_file_t *filp, const char *name, int flags, mode_t mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read bytes from an open file
|
* @brief Read bytes from an open file
|
||||||
@ -528,12 +527,11 @@ struct vfs_dir_ops {
|
|||||||
*
|
*
|
||||||
* @param[in] dirp pointer to open directory
|
* @param[in] dirp pointer to open directory
|
||||||
* @param[in] name null-terminated name of the dir to open, relative to the file system root, including a leading slash
|
* @param[in] name null-terminated name of the dir to open, relative to the file system root, including a leading slash
|
||||||
* @param[in] abs_path null-terminated name of the dir to open, relative to the VFS root ("/")
|
|
||||||
*
|
*
|
||||||
* @return 0 on success
|
* @return 0 on success
|
||||||
* @return <0 on error
|
* @return <0 on error
|
||||||
*/
|
*/
|
||||||
int (*opendir) (vfs_DIR *dirp, const char *dirname, const char *abs_path);
|
int (*opendir) (vfs_DIR *dirp, const char *dirname);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read a single entry from the open directory dirp and advance the
|
* @brief Read a single entry from the open directory dirp and advance the
|
||||||
|
@ -298,7 +298,7 @@ int vfs_open(const char *name, int flags, mode_t mode)
|
|||||||
}
|
}
|
||||||
vfs_file_t *filp = &_vfs_open_files[fd];
|
vfs_file_t *filp = &_vfs_open_files[fd];
|
||||||
if (filp->f_op->open != NULL) {
|
if (filp->f_op->open != NULL) {
|
||||||
res = filp->f_op->open(filp, rel_path, flags, mode, name);
|
res = filp->f_op->open(filp, rel_path, flags, mode);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
/* something went wrong during open */
|
/* something went wrong during open */
|
||||||
DEBUG("vfs_open: open: ERR %d!\n", res);
|
DEBUG("vfs_open: open: ERR %d!\n", res);
|
||||||
@ -420,7 +420,7 @@ int vfs_opendir(vfs_DIR *dirp, const char *dirname)
|
|||||||
dirp->mp = mountp;
|
dirp->mp = mountp;
|
||||||
dirp->d_op = mountp->fs->d_op;
|
dirp->d_op = mountp->fs->d_op;
|
||||||
if (dirp->d_op->opendir != NULL) {
|
if (dirp->d_op->opendir != NULL) {
|
||||||
int res = dirp->d_op->opendir(dirp, rel_path, dirname);
|
int res = dirp->d_op->opendir(dirp, rel_path);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
/* remember to decrement the open_files count */
|
/* remember to decrement the open_files count */
|
||||||
atomic_fetch_sub(&mountp->open_files, 1);
|
atomic_fetch_sub(&mountp->open_files, 1);
|
||||||
@ -1114,7 +1114,7 @@ static bool _is_dir(vfs_mount_t *mountp, vfs_DIR *dir, const char *restrict path
|
|||||||
dir->d_op = ops;
|
dir->d_op = ops;
|
||||||
dir->mp = mountp;
|
dir->mp = mountp;
|
||||||
|
|
||||||
int res = ops->opendir(dir, path, path);
|
int res = ops->opendir(dir, path);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1140,7 +1140,7 @@ int vfs_sysop_stat_from_fstat(vfs_mount_t *mountp, const char *restrict path, st
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
int err = f_op->open(&filedir.file, path, 0, 0, NULL);
|
int err = f_op->open(&filedir.file, path, 0, 0);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
if (_is_dir(mountp, &filedir.dir, path)) {
|
if (_is_dir(mountp, &filedir.dir, path)) {
|
||||||
buf->st_mode = S_IFDIR;
|
buf->st_mode = S_IFDIR;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "embUnit.h"
|
#include "embUnit.h"
|
||||||
|
|
||||||
static int _mock_open(vfs_file_t *filp, const char *name, int flags, mode_t mode, const char *abs_path);
|
static int _mock_open(vfs_file_t *filp, const char *name, int flags, mode_t mode);
|
||||||
static ssize_t _mock_read(vfs_file_t *filp, void *dest, size_t nbytes);
|
static ssize_t _mock_read(vfs_file_t *filp, void *dest, size_t nbytes);
|
||||||
static ssize_t _mock_write(vfs_file_t *filp, const void *src, size_t nbytes);
|
static ssize_t _mock_write(vfs_file_t *filp, const void *src, size_t nbytes);
|
||||||
|
|
||||||
@ -55,12 +55,11 @@ static vfs_mount_t _test_devfs_mount = {
|
|||||||
.private_data = &_mock_private_data,
|
.private_data = &_mock_private_data,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int _mock_open(vfs_file_t *filp, const char *name, int flags, mode_t mode, const char *abs_path)
|
static int _mock_open(vfs_file_t *filp, const char *name, int flags, mode_t mode)
|
||||||
{
|
{
|
||||||
(void) name;
|
(void) name;
|
||||||
(void) flags;
|
(void) flags;
|
||||||
(void) mode;
|
(void) mode;
|
||||||
(void) abs_path;
|
|
||||||
if (filp->private_data.ptr != &_mock_private_data_tag) {
|
if (filp->private_data.ptr != &_mock_private_data_tag) {
|
||||||
return -4321;
|
return -4321;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user