fs: Store the path in struct filep
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
59f91ec6c0
commit
4f7a18cdb5
5
fs/fs.c
5
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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue