9
0
Fork 0

fs: Store the path in struct filep

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2014-10-08 14:01:37 +02:00
parent 59f91ec6c0
commit 4f7a18cdb5
2 changed files with 6 additions and 0 deletions

View File

@ -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;

View File

@ -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 */