mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/6] fs: Store the path in struct filep
Date: Wed,  8 Oct 2014 16:24:12 +0200	[thread overview]
Message-ID: <1412778255-4153-3-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1412778255-4153-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2014-10-08 14:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-08 14:24 [PATCH 1/6] fs: store pointer to fsdev instead of dev " Sascha Hauer
2014-10-08 14:24 ` [PATCH 2/6] fs: do not lookup global FILE * when the file is already available Sascha Hauer
2014-10-08 14:24 ` Sascha Hauer [this message]
2014-10-08 14:24 ` [PATCH 4/6] fs: implement fstat Sascha Hauer
2014-10-08 14:24 ` [PATCH 5/6] libfile: add diff_file function Sascha Hauer
2014-10-08 14:24 ` [PATCH 6/6] commands: implement 'diff' command Sascha Hauer
2014-10-08 15:32   ` Antony Pavlov
2014-10-09  6:50     ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1412778255-4153-3-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox