summaryrefslogtreecommitdiff
path: root/apps/builtin/binfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/builtin/binfs.c')
-rw-r--r--apps/builtin/binfs.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/apps/builtin/binfs.c b/apps/builtin/binfs.c
index 4159c9663..365021c7f 100644
--- a/apps/builtin/binfs.c
+++ b/apps/builtin/binfs.c
@@ -85,6 +85,8 @@ static int binfs_close(FAR struct file *filep);
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_opendir(struct inode *mountpt, const char *relpath,
struct fs_dirent_s *dir);
static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir);
@@ -120,7 +122,7 @@ const struct mountpt_operations binfs_operations =
binfs_ioctl, /* ioctl */
NULL, /* sync */
- NULL, /* dup */
+ binfs_dup, /* dup */
binfs_opendir, /* opendir */
NULL, /* closedir */
@@ -297,6 +299,39 @@ static int binfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
}
/****************************************************************************
+ * Name: binfs_dup
+ *
+ * Description:
+ * Duplicate open file data in the new file structure.
+ *
+ ****************************************************************************/
+
+static int binfs_dup(FAR const struct file *oldp, FAR struct file *newp)
+{
+ struct binfs_state_s *bm;
+ int ret = -ENOSYS;
+
+ fvdbg("Dup %p->%p\n", oldp, newp);
+
+ /* Sanity checks */
+
+ DEBUGASSERT(oldp->f_priv == NULL && oldp->f_inode != NULL);
+
+ /* mountpoint private data from the inode reference from the file
+ * structure
+ */
+
+ bm = (struct binfs_state_s*)oldp->f_inode->i_private;
+ DEBUGASSERT(bm != NULL);
+
+ /* Opening of elements within the pseudo-file system is not yet supported
+ * and, hence, neither is dup'ing the opened file.
+ */
+
+ return ret;
+}
+
+/****************************************************************************
* Name: binfs_opendir
*
* Description: