[PATCH 3/6] fs: Store the path in struct filep
Sascha Hauer
s.hauer at pengutronix.de
Wed Oct 8 07:24:12 PDT 2014
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
fs/fs.c | 5 +++++
include/fs.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/fs/fs.c b/fs/fs.c
index 04b6408..436f5cb 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -251,6 +251,8 @@ static FILE *get_file(void)
static void put_file(FILE *f)
{
+ free(f->path);
+ f->path = NULL;
f->in_use = 0;
}
@@ -670,6 +672,9 @@ int open(const char *pathname, int flags, ...)
if (ret)
goto out;
}
+
+ f->path = xstrdup(path);
+
ret = fsdrv->open(&fsdev->dev, f, path);
if (ret)
goto out;
diff --git a/include/fs.h b/include/fs.h
index c3ce81a..6eddb23 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -24,6 +24,7 @@ typedef struct dir {
typedef struct filep {
struct fs_device_d *fsdev; /* The device this FILE belongs to */
+ char *path;
loff_t pos; /* current position in stream */
#define FILE_SIZE_STREAM ((loff_t) -1)
loff_t size; /* The size of this inode */
--
2.1.0
More information about the barebox
mailing list