fstat: Add skeleton implmentations of fstat() in all file systems.

This commit is contained in:
Gregory Nutt
2017-02-12 13:42:27 -06:00
parent c5a8e96dbc
commit 7d91fabf01
13 changed files with 283 additions and 88 deletions
+18 -1
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* fs/binfs/fs_binfs.c * fs/binfs/fs_binfs.c
* *
* Copyright (C) 2011-2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2011-2013, 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -70,6 +70,7 @@ static ssize_t binfs_read(FAR struct file *filep, char *buffer, size_t buflen);
static int binfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg); static int binfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
static int binfs_dup(FAR const struct file *oldp, FAR struct file *newp); static int binfs_dup(FAR const struct file *oldp, FAR struct file *newp);
static int binfs_fstat(FAR const struct file *filep, FAR struct stat *buf);
static int binfs_opendir(struct inode *mountpt, const char *relpath, static int binfs_opendir(struct inode *mountpt, const char *relpath,
struct fs_dirent_s *dir); struct fs_dirent_s *dir);
@@ -108,6 +109,7 @@ const struct mountpt_operations binfs_operations =
NULL, /* sync */ NULL, /* sync */
binfs_dup, /* dup */ binfs_dup, /* dup */
binfs_fstat, /* fstat */
binfs_opendir, /* opendir */ binfs_opendir, /* opendir */
NULL, /* closedir */ NULL, /* closedir */
@@ -245,6 +247,21 @@ static int binfs_dup(FAR const struct file *oldp, FAR struct file *newp)
return OK; return OK;
} }
/****************************************************************************
* Name: binfs_fstat
*
* Description:
* Obtain information about an open file associated with the file
* descriptor 'fd', and will write it to the area pointed to by 'buf'.
*
****************************************************************************/
static int binfs_fstat(FAR const struct file *filep, FAR struct stat *buf)
{
#warning Missing logic
return -ENOSYS;
}
/**************************************************************************** /****************************************************************************
* Name: binfs_opendir * Name: binfs_opendir
* *
+19 -1
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* fs/fat/fs_fat32.c * fs/fat/fs_fat32.c
* *
* Copyright (C) 2007-2009, 2011-2015 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2009, 2011-2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* References: * References:
@@ -84,6 +84,8 @@ static int fat_ioctl(FAR struct file *filep, int cmd,
static int fat_sync(FAR struct file *filep); static int fat_sync(FAR struct file *filep);
static int fat_dup(FAR const struct file *oldp, FAR struct file *newp); static int fat_dup(FAR const struct file *oldp, FAR struct file *newp);
static int fat_fstat(FAR const struct file *filep,
FAR struct stat *buf);
static int fat_opendir(FAR struct inode *mountpt, static int fat_opendir(FAR struct inode *mountpt,
FAR const char *relpath, FAR struct fs_dirent_s *dir); FAR const char *relpath, FAR struct fs_dirent_s *dir);
@@ -129,6 +131,7 @@ const struct mountpt_operations fat_operations =
fat_sync, /* sync */ fat_sync, /* sync */
fat_dup, /* dup */ fat_dup, /* dup */
fat_fstat, /* fstat */
fat_opendir, /* opendir */ fat_opendir, /* opendir */
NULL, /* closedir */ NULL, /* closedir */
@@ -1606,6 +1609,21 @@ errout_with_semaphore:
return ret; return ret;
} }
/****************************************************************************
* Name: fat_fstat
*
* Description:
* Obtain information about an open file associated with the file
* descriptor 'fd', and will write it to the area pointed to by 'buf'.
*
****************************************************************************/
static int fat_fstat(FAR const struct file *filep, FAR struct stat *buf)
{
#warning Missing logic
return -ENOSYS;
}
/**************************************************************************** /****************************************************************************
* Name: fat_readdir * Name: fat_readdir
* *
+18
View File
@@ -80,6 +80,8 @@ static int hostfs_ioctl(FAR struct file *filep, int cmd,
static int hostfs_sync(FAR struct file *filep); static int hostfs_sync(FAR struct file *filep);
static int hostfs_dup(FAR const struct file *oldp, static int hostfs_dup(FAR const struct file *oldp,
FAR struct file *newp); FAR struct file *newp);
static int hostfs_fstat(FAR const struct file *filep,
FAR struct stat *buf);
static int hostfs_opendir(FAR struct inode *mountpt, static int hostfs_opendir(FAR struct inode *mountpt,
FAR const char *relpath, FAR const char *relpath,
@@ -136,6 +138,7 @@ const struct mountpt_operations hostfs_operations =
hostfs_sync, /* sync */ hostfs_sync, /* sync */
hostfs_dup, /* dup */ hostfs_dup, /* dup */
hostfs_fstat, /* fstat */
hostfs_opendir, /* opendir */ hostfs_opendir, /* opendir */
hostfs_closedir, /* closedir */ hostfs_closedir, /* closedir */
@@ -644,6 +647,21 @@ static int hostfs_dup(FAR const struct file *oldp, FAR struct file *newp)
return OK; return OK;
} }
/****************************************************************************
* Name: hostfs_fstat
*
* Description:
* Obtain information about an open file associated with the file
* descriptor 'fd', and will write it to the area pointed to by 'buf'.
*
****************************************************************************/
static int hostfs_fstat(FAR const struct file *filep, FAR struct stat *buf)
{
#warning Missing logic
return -ENOSYS;
}
/**************************************************************************** /****************************************************************************
* Name: hostfs_opendir * Name: hostfs_opendir
* *
+19 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* fs/nfs/nfs_vfsops.c * fs/nfs/nfs_vfsops.c
* *
* Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2012-2013, 2015, 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved. * Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved.
* Author: Jose Pablo Rojas Vargas <jrojas@nx-engineering.com> * Author: Jose Pablo Rojas Vargas <jrojas@nx-engineering.com>
* Gregory Nutt <gnutt@nuttx.org> * Gregory Nutt <gnutt@nuttx.org>
@@ -131,6 +131,7 @@ static ssize_t nfs_read(FAR struct file *filep, char *buffer, size_t buflen);
static ssize_t nfs_write(FAR struct file *filep, const char *buffer, static ssize_t nfs_write(FAR struct file *filep, const char *buffer,
size_t buflen); size_t buflen);
static int nfs_dup(FAR const struct file *oldp, FAR struct file *newp); static int nfs_dup(FAR const struct file *oldp, FAR struct file *newp);
static int nfs_fstat(FAR const struct file *filep, FAR struct stat *buf);
static int nfs_opendir(struct inode *mountpt, const char *relpath, static int nfs_opendir(struct inode *mountpt, const char *relpath,
struct fs_dirent_s *dir); struct fs_dirent_s *dir);
static int nfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir); static int nfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir);
@@ -168,6 +169,7 @@ const struct mountpt_operations nfs_operations =
NULL, /* sync */ NULL, /* sync */
nfs_dup, /* dup */ nfs_dup, /* dup */
nfs_fstat, /* fstat */
nfs_opendir, /* opendir */ nfs_opendir, /* opendir */
NULL, /* closedir */ NULL, /* closedir */
@@ -1114,7 +1116,7 @@ errout_with_semaphore:
} }
/**************************************************************************** /****************************************************************************
* Name: binfs_dup * Name: nfs_dup
* *
* Description: * Description:
* Duplicate open file data in the new file structure. * Duplicate open file data in the new file structure.
@@ -1173,6 +1175,21 @@ static int nfs_dup(FAR const struct file *oldp, FAR struct file *newp)
return OK; return OK;
} }
/****************************************************************************
* Name: nfs_fstat
*
* Description:
* Obtain information about an open file associated with the file
* descriptor 'fd', and will write it to the area pointed to by 'buf'.
*
****************************************************************************/
static int nfs_fstat(FAR const struct file *filep, FAR struct stat *buf)
{
#warning Missing logic
return -ENOSYS;
}
/**************************************************************************** /****************************************************************************
* Name: nfs_opendir * Name: nfs_opendir
* *
+2 -1
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* fs/nxffs/nxffs.h * fs/nxffs/nxffs.h
* *
* Copyright (C) 2011, 2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2013, 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* References: Linux/Documentation/filesystems/romfs.txt * References: Linux/Documentation/filesystems/romfs.txt
@@ -1092,6 +1092,7 @@ ssize_t nxffs_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen); size_t buflen);
int nxffs_ioctl(FAR struct file *filep, int cmd, unsigned long arg); int nxffs_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
int nxffs_dup(FAR const struct file *oldp, FAR struct file *newp); int nxffs_dup(FAR const struct file *oldp, FAR struct file *newp);
int nxffs_fstat(FAR const struct file *filep, FAR struct stat *buf);
int nxffs_opendir(FAR struct inode *mountpt, FAR const char *relpath, int nxffs_opendir(FAR struct inode *mountpt, FAR const char *relpath,
FAR struct fs_dirent_s *dir); FAR struct fs_dirent_s *dir);
int nxffs_readdir(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir); int nxffs_readdir(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir);
+2 -1
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* fs/nxffs/nxffs_initialize.c * fs/nxffs/nxffs_initialize.c
* *
* Copyright (C) 2011, 2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2013, 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* References: Linux/Documentation/filesystems/romfs.txt * References: Linux/Documentation/filesystems/romfs.txt
@@ -73,6 +73,7 @@ const struct mountpt_operations nxffs_operations =
NULL, /* sync -- No buffered data */ NULL, /* sync -- No buffered data */
nxffs_dup, /* dup */ nxffs_dup, /* dup */
nxffs_fstat, /* fstat */
nxffs_opendir, /* opendir */ nxffs_opendir, /* opendir */
NULL, /* closedir */ NULL, /* closedir */
+17 -1
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* fs/nxffs/nxffs_stat.c * fs/nxffs/nxffs_stat.c
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* References: Linux/Documentation/filesystems/romfs.txt * References: Linux/Documentation/filesystems/romfs.txt
@@ -175,3 +175,19 @@ errout_with_semaphore:
errout: errout:
return ret; return ret;
} }
/****************************************************************************
* Name: nxffs_fstat
*
* Description:
* Obtain information about an open file associated with the file
* descriptor 'fd', and will write it to the area pointed to by 'buf'.
*
****************************************************************************/
int nxffs_fstat(FAR const struct file *filep, FAR struct stat *buf)
{
#warning Missing logic
return -ENOSYS;
}
+19 -1
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* fs/procfs/fs_procfs.c * fs/procfs/fs_procfs.c
* *
* Copyright (C) 2013-2016 Gregory Nutt. All rights reserved. * Copyright (C) 2013-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -183,6 +183,8 @@ static int procfs_ioctl(FAR struct file *filep, int cmd,
static int procfs_dup(FAR const struct file *oldp, static int procfs_dup(FAR const struct file *oldp,
FAR struct file *newp); FAR struct file *newp);
static int procfs_fstat(FAR const struct file *filep,
FAR struct stat *buf);
static int procfs_opendir(FAR struct inode *mountpt, const char *relpath, static int procfs_opendir(FAR struct inode *mountpt, const char *relpath,
FAR struct fs_dirent_s *dir); FAR struct fs_dirent_s *dir);
@@ -235,6 +237,7 @@ const struct mountpt_operations procfs_operations =
NULL, /* sync */ NULL, /* sync */
procfs_dup, /* dup */ procfs_dup, /* dup */
procfs_fstat, /* fstat */
procfs_opendir, /* opendir */ procfs_opendir, /* opendir */
procfs_closedir, /* closedir */ procfs_closedir, /* closedir */
@@ -460,6 +463,21 @@ static int procfs_dup(FAR const struct file *oldp, FAR struct file *newp)
return oldattr->procfsentry->ops->dup(oldp, newp); return oldattr->procfsentry->ops->dup(oldp, newp);
} }
/****************************************************************************
* Name: procfs_fstat
*
* Description:
* Obtain information about an open file associated with the file
* descriptor 'fd', and will write it to the area pointed to by 'buf'.
*
****************************************************************************/
static int procfs_fstat(FAR const struct file *filep, FAR struct stat *buf)
{
#warning Missing logic
return -ENOSYS;
}
/**************************************************************************** /****************************************************************************
* Name: procfs_opendir * Name: procfs_opendir
* *
+21 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* rm/romfs/fs_romfs.h * rm/romfs/fs_romfs.h
* *
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2009, 2011, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* References: Linux/Documentation/filesystems/romfs.txt * References: Linux/Documentation/filesystems/romfs.txt
@@ -76,7 +76,10 @@ static off_t romfs_seek(FAR struct file *filep, off_t offset, int whence);
static int romfs_ioctl(FAR struct file *filep, int cmd, static int romfs_ioctl(FAR struct file *filep, int cmd,
unsigned long arg); unsigned long arg);
static int romfs_dup(FAR const struct file *oldp, FAR struct file *newp); static int romfs_dup(FAR const struct file *oldp,
FAR struct file *newp);
static int romfs_fstat(FAR const struct file *filep,
FAR struct stat *buf);
static int romfs_opendir(FAR struct inode *mountpt, static int romfs_opendir(FAR struct inode *mountpt,
FAR const char *relpath, FAR const char *relpath,
@@ -116,6 +119,7 @@ const struct mountpt_operations romfs_operations =
NULL, /* sync */ NULL, /* sync */
romfs_dup, /* dup */ romfs_dup, /* dup */
romfs_fstat, /* fstat */
romfs_opendir, /* opendir */ romfs_opendir, /* opendir */
NULL, /* closedir */ NULL, /* closedir */
@@ -676,6 +680,21 @@ errout_with_semaphore:
return ret; return ret;
} }
/****************************************************************************
* Name: romfs_fstat
*
* Description:
* Obtain information about an open file associated with the file
* descriptor 'fd', and will write it to the area pointed to by 'buf'.
*
****************************************************************************/
static int romfs_fstat(FAR const struct file *filep, FAR struct stat *buf)
{
#warning Missing logic
return -ENOSYS;
}
/**************************************************************************** /****************************************************************************
* Name: romfs_opendir * Name: romfs_opendir
* *
+51 -17
View File
@@ -69,33 +69,50 @@
static int smartfs_open(FAR struct file *filep, const char *relpath, static int smartfs_open(FAR struct file *filep, const char *relpath,
int oflags, mode_t mode); int oflags, mode_t mode);
static int smartfs_close(FAR struct file *filep); static int smartfs_close(FAR struct file *filep);
static ssize_t smartfs_read(FAR struct file *filep, char *buffer, size_t buflen); static ssize_t smartfs_read(FAR struct file *filep, char *buffer,
size_t buflen);
static ssize_t smartfs_write(FAR struct file *filep, const char *buffer, static ssize_t smartfs_write(FAR struct file *filep, const char *buffer,
size_t buflen); size_t buflen);
static off_t smartfs_seek(FAR struct file *filep, off_t offset, int whence); static off_t smartfs_seek(FAR struct file *filep, off_t offset,
static int smartfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg); int whence);
static int smartfs_ioctl(FAR struct file *filep, int cmd,
unsigned long arg);
static int smartfs_sync(FAR struct file *filep); static int smartfs_sync(FAR struct file *filep);
static int smartfs_dup(FAR const struct file *oldp, FAR struct file *newp); static int smartfs_dup(FAR const struct file *oldp,
FAR struct file *newp);
static int smartfs_fstat(FAR const struct file *filep,
FAR struct stat *buf);
static int smartfs_opendir(struct inode *mountpt, const char *relpath, static int smartfs_opendir(FAR struct inode *mountpt,
struct fs_dirent_s *dir); FAR const char *relpath,
static int smartfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir); FAR struct fs_dirent_s *dir);
static int smartfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir); static int smartfs_readdir(FAR struct inode *mountpt,
FAR struct fs_dirent_s *dir);
static int smartfs_rewinddir(FAR struct inode *mountpt,
FAR struct fs_dirent_s *dir);
static int smartfs_bind(FAR struct inode *blkdriver, const void *data, static int smartfs_bind(FAR struct inode *blkdriver,
void **handle); FAR const void *data,
FAR void **handle);
static int smartfs_unbind(void *handle, FAR struct inode **blkdriver, static int smartfs_unbind(void *handle, FAR struct inode **blkdriver,
unsigned int flags); unsigned int flags);
static int smartfs_statfs(struct inode *mountpt, struct statfs *buf); static int smartfs_statfs(FAR struct inode *mountpt,
FAR struct statfs *buf);
static int smartfs_unlink(struct inode *mountpt, const char *relpath); static int smartfs_unlink(FAR struct inode *mountpt,
static int smartfs_mkdir(struct inode *mountpt, const char *relpath, FAR const char *relpath);
static int smartfs_mkdir(FAR struct inode *mountpt,
FAR const char *relpath,
mode_t mode); mode_t mode);
static int smartfs_rmdir(struct inode *mountpt, const char *relpath); static int smartfs_rmdir(FAR struct inode *mountpt,
static int smartfs_rename(struct inode *mountpt, const char *oldrelpath, FAR const char *relpath);
static int smartfs_rename(FAR struct inode *mountpt,
FAR const char *oldrelpath,
const char *newrelpath); const char *newrelpath);
static int smartfs_stat(struct inode *mountpt, const char *relpath, struct stat *buf); static int smartfs_stat(FAR struct inode *mountpt,
FAR const char *relpath,
FAR struct stat *buf);
static off_t smartfs_seek_internal(struct smartfs_mountpt_s *fs, static off_t smartfs_seek_internal(struct smartfs_mountpt_s *fs,
struct smartfs_ofile_s *sf, struct smartfs_ofile_s *sf,
@@ -128,6 +145,7 @@ const struct mountpt_operations smartfs_operations =
smartfs_sync, /* sync */ smartfs_sync, /* sync */
smartfs_dup, /* dup */ smartfs_dup, /* dup */
smartfs_fstat, /* fstat */
smartfs_opendir, /* opendir */ smartfs_opendir, /* opendir */
NULL, /* closedir */ NULL, /* closedir */
@@ -1249,6 +1267,21 @@ static int smartfs_dup(FAR const struct file *oldp, FAR struct file *newp)
return OK; return OK;
} }
/****************************************************************************
* Name: smartfs_fstat
*
* Description:
* Obtain information about an open file associated with the file
* descriptor 'fd', and will write it to the area pointed to by 'buf'.
*
****************************************************************************/
static int smartfs_fstat(FAR const struct file *filep, FAR struct stat *buf)
{
#warning Missing logic
return -ENOSYS;
}
/**************************************************************************** /****************************************************************************
* Name: smartfs_opendir * Name: smartfs_opendir
* *
@@ -1256,7 +1289,8 @@ static int smartfs_dup(FAR const struct file *oldp, FAR struct file *newp)
* *
****************************************************************************/ ****************************************************************************/
static int smartfs_opendir(struct inode *mountpt, const char *relpath, struct fs_dirent_s *dir) static int smartfs_opendir(FAR struct inode *mountpt, FAR const char *relpath,
FAR struct fs_dirent_s *dir)
{ {
struct smartfs_mountpt_s *fs; struct smartfs_mountpt_s *fs;
int ret; int ret;
+78 -60
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* fs/tmpfs/fs_tmpfs.c * fs/tmpfs/fs_tmpfs.c
* *
* Copyright (C) 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -91,75 +91,77 @@ static void tmpfs_unlock_reentrant(FAR struct tmpfs_sem_s *sem);
static void tmpfs_unlock(FAR struct tmpfs_s *fs); static void tmpfs_unlock(FAR struct tmpfs_s *fs);
static void tmpfs_lock_object(FAR struct tmpfs_object_s *to); static void tmpfs_lock_object(FAR struct tmpfs_object_s *to);
static void tmpfs_unlock_object(FAR struct tmpfs_object_s *to); static void tmpfs_unlock_object(FAR struct tmpfs_object_s *to);
static int tmpfs_realloc_directory(FAR struct tmpfs_directory_s **tdo, static int tmpfs_realloc_directory(FAR struct tmpfs_directory_s **tdo,
unsigned int nentries); unsigned int nentries);
static int tmpfs_realloc_file(FAR struct tmpfs_file_s **tfo, static int tmpfs_realloc_file(FAR struct tmpfs_file_s **tfo,
size_t newsize); size_t newsize);
static void tmpfs_release_lockedobject(FAR struct tmpfs_object_s *to); static void tmpfs_release_lockedobject(FAR struct tmpfs_object_s *to);
static void tmpfs_release_lockedfile(FAR struct tmpfs_file_s *tfo); static void tmpfs_release_lockedfile(FAR struct tmpfs_file_s *tfo);
static int tmpfs_find_dirent(FAR struct tmpfs_directory_s *tdo, static int tmpfs_find_dirent(FAR struct tmpfs_directory_s *tdo,
FAR const char *name); FAR const char *name);
static int tmpfs_remove_dirent(FAR struct tmpfs_directory_s *tdo, static int tmpfs_remove_dirent(FAR struct tmpfs_directory_s *tdo,
FAR const char *name); FAR const char *name);
static int tmpfs_add_dirent(FAR struct tmpfs_directory_s **tdo, static int tmpfs_add_dirent(FAR struct tmpfs_directory_s **tdo,
FAR struct tmpfs_object_s *to, FAR const char *name); FAR struct tmpfs_object_s *to, FAR const char *name);
static FAR struct tmpfs_file_s *tmpfs_alloc_file(void); static FAR struct tmpfs_file_s *tmpfs_alloc_file(void);
static int tmpfs_create_file(FAR struct tmpfs_s *fs, static int tmpfs_create_file(FAR struct tmpfs_s *fs,
FAR const char *relpath, FAR struct tmpfs_file_s **tfo); FAR const char *relpath, FAR struct tmpfs_file_s **tfo);
static FAR struct tmpfs_directory_s *tmpfs_alloc_directory(void); static FAR struct tmpfs_directory_s *tmpfs_alloc_directory(void);
static int tmpfs_create_directory(FAR struct tmpfs_s *fs, static int tmpfs_create_directory(FAR struct tmpfs_s *fs,
FAR const char *relpath, FAR struct tmpfs_directory_s **tdo); FAR const char *relpath, FAR struct tmpfs_directory_s **tdo);
static int tmpfs_find_object(FAR struct tmpfs_s *fs, static int tmpfs_find_object(FAR struct tmpfs_s *fs,
FAR const char *relpath, FAR struct tmpfs_object_s **object, FAR const char *relpath, FAR struct tmpfs_object_s **object,
FAR struct tmpfs_directory_s **parent); FAR struct tmpfs_directory_s **parent);
static int tmpfs_find_file(FAR struct tmpfs_s *fs, static int tmpfs_find_file(FAR struct tmpfs_s *fs,
FAR const char *relpath, FAR const char *relpath,
FAR struct tmpfs_file_s **tfo, FAR struct tmpfs_file_s **tfo,
FAR struct tmpfs_directory_s **parent); FAR struct tmpfs_directory_s **parent);
static int tmpfs_find_directory(FAR struct tmpfs_s *fs, static int tmpfs_find_directory(FAR struct tmpfs_s *fs,
FAR const char *relpath, FAR const char *relpath,
FAR struct tmpfs_directory_s **tdo, FAR struct tmpfs_directory_s **tdo,
FAR struct tmpfs_directory_s **parent); FAR struct tmpfs_directory_s **parent);
static int tmpfs_statfs_callout(FAR struct tmpfs_directory_s *tdo, static int tmpfs_statfs_callout(FAR struct tmpfs_directory_s *tdo,
unsigned int index, FAR void *arg); unsigned int index, FAR void *arg);
static int tmpfs_free_callout(FAR struct tmpfs_directory_s *tdo, static int tmpfs_free_callout(FAR struct tmpfs_directory_s *tdo,
unsigned int index, FAR void *arg); unsigned int index, FAR void *arg);
static int tmpfs_foreach(FAR struct tmpfs_directory_s *tdo, static int tmpfs_foreach(FAR struct tmpfs_directory_s *tdo,
tmpfs_foreach_t callout, FAR void *arg); tmpfs_foreach_t callout, FAR void *arg);
/* File system operations */ /* File system operations */
static int tmpfs_open(FAR struct file *filep, FAR const char *relpath, static int tmpfs_open(FAR struct file *filep, FAR const char *relpath,
int oflags, mode_t mode); int oflags, mode_t mode);
static int tmpfs_close(FAR struct file *filep); static int tmpfs_close(FAR struct file *filep);
static ssize_t tmpfs_read(FAR struct file *filep, FAR char *buffer, static ssize_t tmpfs_read(FAR struct file *filep, FAR char *buffer,
size_t buflen); size_t buflen);
static ssize_t tmpfs_write(FAR struct file *filep, FAR const char *buffer, static ssize_t tmpfs_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen); size_t buflen);
static off_t tmpfs_seek(FAR struct file *filep, off_t offset, int whence); static off_t tmpfs_seek(FAR struct file *filep, off_t offset, int whence);
static int tmpfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg); static int tmpfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
static int tmpfs_dup(FAR const struct file *oldp, FAR struct file *newp); static int tmpfs_dup(FAR const struct file *oldp, FAR struct file *newp);
static int tmpfs_opendir(FAR struct inode *mountpt, FAR const char *relpath, static int tmpfs_fstat(FAR const struct file *filep, FAR struct stat *buf);
FAR struct fs_dirent_s *dir);
static int tmpfs_closedir(FAR struct inode *mountpt, static int tmpfs_opendir(FAR struct inode *mountpt, FAR const char *relpath,
FAR struct fs_dirent_s *dir); FAR struct fs_dirent_s *dir);
static int tmpfs_readdir(FAR struct inode *mountpt, static int tmpfs_closedir(FAR struct inode *mountpt,
FAR struct fs_dirent_s *dir); FAR struct fs_dirent_s *dir);
static int tmpfs_rewinddir(FAR struct inode *mountpt, static int tmpfs_readdir(FAR struct inode *mountpt,
FAR struct fs_dirent_s *dir); FAR struct fs_dirent_s *dir);
static int tmpfs_bind(FAR struct inode *blkdriver, FAR const void *data, static int tmpfs_rewinddir(FAR struct inode *mountpt,
FAR void **handle); FAR struct fs_dirent_s *dir);
static int tmpfs_unbind(FAR void *handle, FAR struct inode **blkdriver, static int tmpfs_bind(FAR struct inode *blkdriver, FAR const void *data,
unsigned int flags); FAR void **handle);
static int tmpfs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf); static int tmpfs_unbind(FAR void *handle, FAR struct inode **blkdriver,
static int tmpfs_unlink(FAR struct inode *mountpt, FAR const char *relpath); unsigned int flags);
static int tmpfs_mkdir(FAR struct inode *mountpt, FAR const char *relpath, static int tmpfs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf);
mode_t mode); static int tmpfs_unlink(FAR struct inode *mountpt, FAR const char *relpath);
static int tmpfs_rmdir(FAR struct inode *mountpt, FAR const char *relpath); static int tmpfs_mkdir(FAR struct inode *mountpt, FAR const char *relpath,
static int tmpfs_rename(FAR struct inode *mountpt, FAR const char *oldrelpath, mode_t mode);
FAR const char *newrelpath); static int tmpfs_rmdir(FAR struct inode *mountpt, FAR const char *relpath);
static int tmpfs_stat(FAR struct inode *mountpt, FAR const char *relpath, static int tmpfs_rename(FAR struct inode *mountpt, FAR const char *oldrelpath,
FAR struct stat *buf); FAR const char *newrelpath);
static int tmpfs_stat(FAR struct inode *mountpt, FAR const char *relpath,
FAR struct stat *buf);
/**************************************************************************** /****************************************************************************
* Public Data * Public Data
@@ -175,6 +177,7 @@ const struct mountpt_operations tmpfs_operations =
tmpfs_ioctl, /* ioctl */ tmpfs_ioctl, /* ioctl */
NULL, /* sync */ NULL, /* sync */
tmpfs_dup, /* dup */ tmpfs_dup, /* dup */
tmpfs_fstat, /* fstat */
tmpfs_opendir, /* opendir */ tmpfs_opendir, /* opendir */
tmpfs_closedir, /* closedir */ tmpfs_closedir, /* closedir */
tmpfs_readdir, /* readdir */ tmpfs_readdir, /* readdir */
@@ -1769,6 +1772,21 @@ static int tmpfs_dup(FAR const struct file *oldp, FAR struct file *newp)
return OK; return OK;
} }
/****************************************************************************
* Name: tmpfs_fstat
*
* Description:
* Obtain information about an open file associated with the file
* descriptor 'fd', and will write it to the area pointed to by 'buf'.
*
****************************************************************************/
static int tmpfs_fstat(FAR const struct file *filep, FAR struct stat *buf)
{
#warning Missing logic
return -ENOSYS;
}
/**************************************************************************** /****************************************************************************
* Name: tmpfs_opendir * Name: tmpfs_opendir
****************************************************************************/ ****************************************************************************/
+18
View File
@@ -160,6 +160,8 @@ static int unionfs_ioctl(FAR struct file *filep, int cmd,
static int unionfs_sync(FAR struct file *filep); static int unionfs_sync(FAR struct file *filep);
static int unionfs_dup(FAR const struct file *oldp, static int unionfs_dup(FAR const struct file *oldp,
FAR struct file *newp); FAR struct file *newp);
static int unionfs_fstat(FAR const struct file *filep,
FAR struct stat *buf);
/* Operations on directories */ /* Operations on directories */
@@ -215,6 +217,7 @@ static const struct mountpt_operations g_unionfs_mops =
unionfs_sync, /* sync */ unionfs_sync, /* sync */
unionfs_dup, /* dup */ unionfs_dup, /* dup */
unionfs_fstat, /* fstat */
unionfs_opendir, /* opendir */ unionfs_opendir, /* opendir */
unionfs_closedir, /* closedir */ unionfs_closedir, /* closedir */
@@ -1309,6 +1312,21 @@ static int unionfs_dup(FAR const struct file *oldp, FAR struct file *newp)
return ret; return ret;
} }
/****************************************************************************
* Name: unionfs_fstat
*
* Description:
* Obtain information about an open file associated with the file
* descriptor 'fd', and will write it to the area pointed to by 'buf'.
*
****************************************************************************/
static int unionfs_fstat(FAR const struct file *filep, FAR struct stat *buf)
{
#warning Missing logic
return -ENOSYS;
}
/**************************************************************************** /****************************************************************************
* Name: unionfs_opendir * Name: unionfs_opendir
****************************************************************************/ ****************************************************************************/
+1 -1
View File
@@ -265,7 +265,7 @@ struct mountpt_operations
int (*sync)(FAR struct file *filep); int (*sync)(FAR struct file *filep);
int (*dup)(FAR const struct file *oldp, FAR struct file *newp); int (*dup)(FAR const struct file *oldp, FAR struct file *newp);
int (*fstat)(FAR const struct file *filep, FAR struct stat *buf); int (*fstat)(FAR const struct file *filep, FAR struct stat *buf);
/* Directory operations */ /* Directory operations */