Skip to content

Commit

Permalink
fstat: Add skeleton implmentations of fstat() in all file systems.
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory-nutt committed Feb 12, 2017
1 parent c5a8e96 commit 7d91fab
Show file tree
Hide file tree
Showing 13 changed files with 285 additions and 90 deletions.
19 changes: 18 additions & 1 deletion fs/binfs/fs_binfs.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -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_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,
struct fs_dirent_s *dir);
Expand Down Expand Up @@ -108,6 +109,7 @@ const struct mountpt_operations binfs_operations =

NULL, /* sync */
binfs_dup, /* dup */
binfs_fstat, /* fstat */

binfs_opendir, /* opendir */
NULL, /* closedir */
Expand Down Expand Up @@ -245,6 +247,21 @@ static int binfs_dup(FAR const struct file *oldp, FAR struct file *newp)
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
*
Expand Down
20 changes: 19 additions & 1 deletion fs/fat/fs_fat32.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* References:
Expand Down Expand Up @@ -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_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,
FAR const char *relpath, FAR struct fs_dirent_s *dir);
Expand Down Expand Up @@ -129,6 +131,7 @@ const struct mountpt_operations fat_operations =

fat_sync, /* sync */
fat_dup, /* dup */
fat_fstat, /* fstat */

fat_opendir, /* opendir */
NULL, /* closedir */
Expand Down Expand Up @@ -1606,6 +1609,21 @@ static int fat_opendir(FAR struct inode *mountpt, FAR const char *relpath,
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
*
Expand Down
18 changes: 18 additions & 0 deletions fs/hostfs/hostfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_dup(FAR const struct file *oldp,
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,
FAR const char *relpath,
Expand Down Expand Up @@ -136,6 +138,7 @@ const struct mountpt_operations hostfs_operations =

hostfs_sync, /* sync */
hostfs_dup, /* dup */
hostfs_fstat, /* fstat */

hostfs_opendir, /* opendir */
hostfs_closedir, /* closedir */
Expand Down Expand Up @@ -644,6 +647,21 @@ static int hostfs_dup(FAR const struct file *oldp, FAR struct file *newp)
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
*
Expand Down
21 changes: 19 additions & 2 deletions fs/nfs/nfs_vfsops.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/****************************************************************************
* 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.
* Author: Jose Pablo Rojas Vargas <jrojas@nx-engineering.com>
* Gregory Nutt <gnutt@nuttx.org>
Expand Down Expand Up @@ -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,
size_t buflen);
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,
struct fs_dirent_s *dir);
static int nfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir);
Expand Down Expand Up @@ -168,6 +169,7 @@ const struct mountpt_operations nfs_operations =

NULL, /* sync */
nfs_dup, /* dup */
nfs_fstat, /* fstat */

nfs_opendir, /* opendir */
NULL, /* closedir */
Expand Down Expand Up @@ -1114,7 +1116,7 @@ static ssize_t nfs_write(FAR struct file *filep, const char *buffer,
}

/****************************************************************************
* Name: binfs_dup
* Name: nfs_dup
*
* Description:
* Duplicate open file data in the new file structure.
Expand Down Expand Up @@ -1173,6 +1175,21 @@ static int nfs_dup(FAR const struct file *oldp, FAR struct file *newp)
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
*
Expand Down
3 changes: 2 additions & 1 deletion fs/nxffs/nxffs.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* References: Linux/Documentation/filesystems/romfs.txt
Expand Down Expand Up @@ -1092,6 +1092,7 @@ ssize_t nxffs_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen);
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_fstat(FAR const struct file *filep, FAR struct stat *buf);
int nxffs_opendir(FAR struct inode *mountpt, FAR const char *relpath,
FAR struct fs_dirent_s *dir);
int nxffs_readdir(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir);
Expand Down
3 changes: 2 additions & 1 deletion fs/nxffs/nxffs_initialize.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* References: Linux/Documentation/filesystems/romfs.txt
Expand Down Expand Up @@ -73,6 +73,7 @@ const struct mountpt_operations nxffs_operations =

NULL, /* sync -- No buffered data */
nxffs_dup, /* dup */
nxffs_fstat, /* fstat */

nxffs_opendir, /* opendir */
NULL, /* closedir */
Expand Down
18 changes: 17 additions & 1 deletion fs/nxffs/nxffs_stat.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* References: Linux/Documentation/filesystems/romfs.txt
Expand Down Expand Up @@ -175,3 +175,19 @@ int nxffs_stat(FAR struct inode *mountpt, FAR const char *relpath,
errout:
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;
}

20 changes: 19 additions & 1 deletion fs/procfs/fs_procfs.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -183,6 +183,8 @@ static int procfs_ioctl(FAR struct file *filep, int cmd,

static int procfs_dup(FAR const struct file *oldp,
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,
FAR struct fs_dirent_s *dir);
Expand Down Expand Up @@ -235,6 +237,7 @@ const struct mountpt_operations procfs_operations =

NULL, /* sync */
procfs_dup, /* dup */
procfs_fstat, /* fstat */

procfs_opendir, /* opendir */
procfs_closedir, /* closedir */
Expand Down Expand Up @@ -460,6 +463,21 @@ static int procfs_dup(FAR const struct file *oldp, FAR struct file *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
*
Expand Down
23 changes: 21 additions & 2 deletions fs/romfs/fs_romfs.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* References: Linux/Documentation/filesystems/romfs.txt
Expand Down Expand Up @@ -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,
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,
FAR const char *relpath,
Expand Down Expand Up @@ -116,6 +119,7 @@ const struct mountpt_operations romfs_operations =

NULL, /* sync */
romfs_dup, /* dup */
romfs_fstat, /* fstat */

romfs_opendir, /* opendir */
NULL, /* closedir */
Expand Down Expand Up @@ -676,6 +680,21 @@ static int romfs_dup(FAR const struct file *oldp, FAR struct file *newp)
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
*
Expand Down
Loading

0 comments on commit 7d91fab

Please sign in to comment.