From: Vicente <vicencb@gmail.com>
To: barebox@lists.infradead.org
Cc: Vicente <vicencb@gmail.com>
Subject: [PATCH 09/14] fs: improve robustness
Date: Tue, 9 Oct 2012 00:55:19 +0200 [thread overview]
Message-ID: <1349736924-24667-10-git-send-email-vicencb@gmail.com> (raw)
In-Reply-To: <1349736924-24667-1-git-send-email-vicencb@gmail.com>
Signed-off-by: Vicente <vicencb@gmail.com>
---
fs/fs.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/fs/fs.c b/fs/fs.c
index b9a1f17..dc3a6e3 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -715,12 +715,13 @@ int ioctl(int fd, int request, void *buf)
{
struct device_d *dev;
struct fs_driver_d *fsdrv;
- FILE *f = &files[fd];
+ FILE *f;
int ret;
if (check_fd(fd))
return -errno;
+ f = &files[fd];
dev = f->dev;
fsdrv = dev_to_fs_driver(dev);
@@ -738,12 +739,13 @@ int read(int fd, void *buf, size_t count)
{
struct device_d *dev;
struct fs_driver_d *fsdrv;
- FILE *f = &files[fd];
+ FILE *f;
int ret;
if (check_fd(fd))
return -errno;
+ f = &files[fd];
dev = f->dev;
fsdrv = dev_to_fs_driver(dev);
@@ -768,12 +770,13 @@ ssize_t write(int fd, const void *buf, size_t count)
{
struct device_d *dev;
struct fs_driver_d *fsdrv;
- FILE *f = &files[fd];
+ FILE *f;
int ret;
if (check_fd(fd))
return -errno;
+ f = &files[fd];
dev = f->dev;
fsdrv = dev_to_fs_driver(dev);
@@ -803,12 +806,13 @@ int flush(int fd)
{
struct device_d *dev;
struct fs_driver_d *fsdrv;
- FILE *f = &files[fd];
+ FILE *f;
int ret;
if (check_fd(fd))
return -errno;
+ f = &files[fd];
dev = f->dev;
fsdrv = dev_to_fs_driver(dev);
@@ -827,13 +831,14 @@ loff_t lseek(int fildes, loff_t offset, int whence)
{
struct device_d *dev;
struct fs_driver_d *fsdrv;
- FILE *f = &files[fildes];
+ FILE *f;
loff_t pos;
int ret;
if (check_fd(fildes))
return -1;
+ f = &files[fildes];
dev = f->dev;
fsdrv = dev_to_fs_driver(dev);
if (!fsdrv->lseek) {
@@ -877,11 +882,12 @@ int erase(int fd, size_t count, unsigned long offset)
{
struct device_d *dev;
struct fs_driver_d *fsdrv;
- FILE *f = &files[fd];
+ FILE *f;
int ret;
if (check_fd(fd))
return -errno;
+ f = &files[fd];
if (offset >= f->size)
return 0;
if (count > f->size - offset)
@@ -905,11 +911,12 @@ int protect(int fd, size_t count, unsigned long offset, int prot)
{
struct device_d *dev;
struct fs_driver_d *fsdrv;
- FILE *f = &files[fd];
+ FILE *f;
int ret;
if (check_fd(fd))
return -errno;
+ f = &files[fd];
if (offset >= f->size)
return 0;
if (count > f->size - offset)
@@ -948,13 +955,14 @@ void *memmap(int fd, int flags)
{
struct device_d *dev;
struct fs_driver_d *fsdrv;
- FILE *f = &files[fd];
+ FILE *f;
void *retp = (void *)-1;
int ret;
if (check_fd(fd))
return retp;
+ f = &files[fd];
dev = f->dev;
fsdrv = dev_to_fs_driver(dev);
@@ -975,12 +983,13 @@ int close(int fd)
{
struct device_d *dev;
struct fs_driver_d *fsdrv;
- FILE *f = &files[fd];
+ FILE *f;
int ret;
if (check_fd(fd))
return -errno;
+ f = &files[fd];
dev = f->dev;
fsdrv = dev_to_fs_driver(dev);
--
1.7.12.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-10-08 22:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-08 22:55 [PATCH 00/14] archosg9: add support for tablet Vicente
2012-10-08 22:55 ` [PATCH 01/14] twl6030: add debug info Vicente
2012-10-08 22:55 ` [PATCH 02/14] omap4: add rename definitions to match datasheet Vicente
2012-10-08 22:55 ` [PATCH 03/14] ARM: import irq handling from linux Vicente
2012-10-08 22:55 ` [PATCH 04/14] ARM: ensure irqs are disabled Vicente
2012-10-08 22:55 ` [PATCH 05/14] omap: revert gpiolib Vicente
2012-10-08 22:55 ` [PATCH 06/14] omap4: add usb boot source Vicente
2012-10-08 22:55 ` [PATCH 07/14] bootm: close open files Vicente
2012-10-08 22:55 ` [PATCH 08/14] uimage: improve transfer speed Vicente
2012-10-08 22:55 ` Vicente [this message]
2012-10-08 22:55 ` [PATCH 10/14] omap4: add support for booting cpu from usb Vicente
2012-10-08 22:55 ` [PATCH 11/14] omap4: add serial communications over usb boot Vicente
2012-10-08 22:55 ` [PATCH 12/14] omap4: add filesystem support " Vicente
2012-10-08 22:55 ` [PATCH 13/14] omap4: add support for loading second stage from usb Vicente
2012-10-08 22:55 ` [PATCH 14/14] Add support for Archos G9 tablet Vicente
2012-10-19 11:10 ` Jan Weitzel
2012-10-21 1:00 ` vj
2012-10-22 6:50 ` Jan Weitzel
2012-10-10 7:40 ` [PATCH 00/14] archosg9: add support for tablet Sascha Hauer
[not found] ` <CAAMcf8D0Xn6aWztkD=8dnv3P1qxNgxSV-2Q37kGOaRsOQE7xVA@mail.gmail.com>
2012-10-10 9:32 ` Sascha Hauer
2012-10-12 1:12 ` vj
[not found] ` <CAAMcf8CLimKWZddBfctSCct0wOJOk7tgTJpM7m_w8h5dOQRt1Q@mail.gmail.com>
2012-10-12 8:39 ` 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=1349736924-24667-10-git-send-email-vicencb@gmail.com \
--to=vicencb@gmail.com \
--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