* [PATCH 1/2] fs: rename inode member of struct filep to priv
@ 2015-03-04 7:49 Sascha Hauer
2015-03-04 7:49 ` [PATCH 2/2] fs: remove unnecessary device pointer argument Sascha Hauer
0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2015-03-04 7:49 UTC (permalink / raw)
To: Barebox List
Because that's what it is. 'inode' will become confusing
once we support real inodes.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/bpkfs.c | 8 ++++----
fs/cramfs/cramfs.c | 6 +++---
fs/devfs.c | 20 ++++++++++----------
fs/efi.c | 14 +++++++-------
fs/ext4/ext_barebox.c | 6 +++---
fs/fat/fat.c | 12 ++++++------
fs/nfs.c | 8 ++++----
fs/omap4_usbbootfs.c | 6 +++---
fs/ramfs.c | 8 ++++----
fs/tftp.c | 8 ++++----
fs/ubifs/ubifs.c | 6 +++---
fs/uimagefs.c | 8 ++++----
include/fs.h | 2 +-
13 files changed, 56 insertions(+), 56 deletions(-)
diff --git a/fs/bpkfs.c b/fs/bpkfs.c
index 8352307..1e2619e 100644
--- a/fs/bpkfs.c
+++ b/fs/bpkfs.c
@@ -161,7 +161,7 @@ static int bpkfs_open(struct device_d *dev, FILE *f, const char *filename)
}
f->size = d->size;
- f->inode = d;
+ f->priv = d;
ret = 0;
out:
@@ -172,7 +172,7 @@ out:
static int bpkfs_close(struct device_d *dev, FILE *file)
{
- struct bpkfs_handle_data *d = file->inode;
+ struct bpkfs_handle_data *d = file->priv;
close(d->fd);
@@ -181,7 +181,7 @@ static int bpkfs_close(struct device_d *dev, FILE *file)
static int bpkfs_read(struct device_d *dev, FILE *file, void *buf, size_t insize)
{
- struct bpkfs_handle_data *d = file->inode;
+ struct bpkfs_handle_data *d = file->priv;
if (bpkfs_is_crc_file(d)) {
memcpy(buf, &d->data[d->pos], insize);
@@ -193,7 +193,7 @@ static int bpkfs_read(struct device_d *dev, FILE *file, void *buf, size_t insize
static loff_t bpkfs_lseek(struct device_d *dev, FILE *file, loff_t pos)
{
- struct bpkfs_handle_data *d = file->inode;
+ struct bpkfs_handle_data *d = file->priv;
if (!bpkfs_is_crc_file(d))
lseek(d->fd, d->offset + pos, SEEK_SET);
diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c
index 8218fcf..fb92714 100644
--- a/fs/cramfs/cramfs.c
+++ b/fs/cramfs/cramfs.c
@@ -290,7 +290,7 @@ static int cramfs_open(struct device_d *_dev, FILE *file, const char *filename)
if (!inodei)
return -ENOENT;
- file->inode = inodei;
+ file->priv = inodei;
file->size = inodei->inode.size;
inodei->block_ptrs = xzalloc(4096);
@@ -301,7 +301,7 @@ static int cramfs_open(struct device_d *_dev, FILE *file, const char *filename)
static int cramfs_close(struct device_d *dev, FILE *file)
{
- struct cramfs_inode_info *inodei = file->inode;
+ struct cramfs_inode_info *inodei = file->priv;
free(inodei->block_ptrs);
free(inodei);
@@ -312,7 +312,7 @@ static int cramfs_close(struct device_d *dev, FILE *file)
static int cramfs_read(struct device_d *_dev, FILE *f, void *buf, size_t size)
{
struct cramfs_priv *priv = _dev->priv;
- struct cramfs_inode_info *inodei = f->inode;
+ struct cramfs_inode_info *inodei = f->priv;
struct cramfs_inode *inode = &inodei->inode;
unsigned int blocknr;
int outsize = 0;
diff --git a/fs/devfs.c b/fs/devfs.c
index 872e19b..c6db25c 100644
--- a/fs/devfs.c
+++ b/fs/devfs.c
@@ -37,14 +37,14 @@ extern struct list_head cdev_list;
static int devfs_read(struct device_d *_dev, FILE *f, void *buf, size_t size)
{
- struct cdev *cdev = f->inode;
+ struct cdev *cdev = f->priv;
return cdev_read(cdev, buf, size, f->pos, f->flags);
}
static int devfs_write(struct device_d *_dev, FILE *f, const void *buf, size_t size)
{
- struct cdev *cdev = f->inode;
+ struct cdev *cdev = f->priv;
if (cdev->flags & DEVFS_PARTITION_READONLY)
return -EPERM;
@@ -54,7 +54,7 @@ static int devfs_write(struct device_d *_dev, FILE *f, const void *buf, size_t s
static loff_t devfs_lseek(struct device_d *_dev, FILE *f, loff_t pos)
{
- struct cdev *cdev = f->inode;
+ struct cdev *cdev = f->priv;
loff_t ret = -1;
if (cdev->ops->lseek)
@@ -68,7 +68,7 @@ static loff_t devfs_lseek(struct device_d *_dev, FILE *f, loff_t pos)
static int devfs_erase(struct device_d *_dev, FILE *f, size_t count, loff_t offset)
{
- struct cdev *cdev = f->inode;
+ struct cdev *cdev = f->priv;
if (cdev->flags & DEVFS_PARTITION_READONLY)
return -EPERM;
@@ -84,7 +84,7 @@ static int devfs_erase(struct device_d *_dev, FILE *f, size_t count, loff_t offs
static int devfs_protect(struct device_d *_dev, FILE *f, size_t count, loff_t offset, int prot)
{
- struct cdev *cdev = f->inode;
+ struct cdev *cdev = f->priv;
if (!cdev->ops->protect)
return -ENOSYS;
@@ -94,7 +94,7 @@ static int devfs_protect(struct device_d *_dev, FILE *f, size_t count, loff_t of
static int devfs_memmap(struct device_d *_dev, FILE *f, void **map, int flags)
{
- struct cdev *cdev = f->inode;
+ struct cdev *cdev = f->priv;
int ret = -ENOSYS;
if (!cdev->ops->memmap)
@@ -120,7 +120,7 @@ static int devfs_open(struct device_d *_dev, FILE *f, const char *filename)
f->size = cdev->flags & DEVFS_IS_CHARACTER_DEV ?
FILE_SIZE_STREAM : cdev->size;
- f->inode = cdev;
+ f->priv = cdev;
if (cdev->ops->open) {
ret = cdev->ops->open(cdev, f->flags);
@@ -135,7 +135,7 @@ static int devfs_open(struct device_d *_dev, FILE *f, const char *filename)
static int devfs_close(struct device_d *_dev, FILE *f)
{
- struct cdev *cdev = f->inode;
+ struct cdev *cdev = f->priv;
int ret;
if (cdev->ops->close) {
@@ -151,7 +151,7 @@ static int devfs_close(struct device_d *_dev, FILE *f)
static int devfs_flush(struct device_d *_dev, FILE *f)
{
- struct cdev *cdev = f->inode;
+ struct cdev *cdev = f->priv;
if (cdev->ops->flush)
return cdev->ops->flush(cdev);
@@ -161,7 +161,7 @@ static int devfs_flush(struct device_d *_dev, FILE *f)
static int devfs_ioctl(struct device_d *_dev, FILE *f, int request, void *buf)
{
- struct cdev *cdev = f->inode;
+ struct cdev *cdev = f->priv;
return cdev_ioctl(cdev, request, buf);
}
diff --git a/fs/efi.c b/fs/efi.c
index f096f91..d64b15b 100644
--- a/fs/efi.c
+++ b/fs/efi.c
@@ -206,7 +206,7 @@ static int efifs_rmdir(struct device_d *dev, const char *pathname)
static int efifs_open(struct device_d *dev, FILE *f, const char *filename)
{
- struct efifs_priv *priv = dev->priv;
+ struct efifs_priv *priv = fs_driver_priv(f);
efi_status_t efiret;
struct efifs_file *ufile;
wchar_t *efi_path = path_to_efi(filename);
@@ -243,7 +243,7 @@ static int efifs_open(struct device_d *dev, FILE *f, const char *filename)
f->size = info->FileSize;
free(info);
- f->inode = ufile;
+ f->priv = ufile;
return 0;
out:
@@ -254,7 +254,7 @@ out:
static int efifs_close(struct device_d *dev, FILE *f)
{
- struct efifs_file *ufile = f->inode;
+ struct efifs_file *ufile = f->priv;
ufile->entry->close(ufile->entry);
@@ -265,7 +265,7 @@ static int efifs_close(struct device_d *dev, FILE *f)
static int efifs_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
{
- struct efifs_file *ufile = f->inode;
+ struct efifs_file *ufile = f->priv;
efi_status_t efiret;
unsigned long bufsize = insize;
@@ -279,7 +279,7 @@ static int efifs_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
static int efifs_write(struct device_d *_dev, FILE *f, const void *buf, size_t insize)
{
- struct efifs_file *ufile = f->inode;
+ struct efifs_file *ufile = f->priv;
efi_status_t efiret;
unsigned long bufsize = insize;
@@ -294,7 +294,7 @@ static int efifs_write(struct device_d *_dev, FILE *f, const void *buf, size_t i
static loff_t efifs_lseek(struct device_d *dev, FILE *f, loff_t pos)
{
- struct efifs_file *ufile = f->inode;
+ struct efifs_file *ufile = f->priv;
efi_status_t efiret;
f->pos = pos;
@@ -309,7 +309,7 @@ static loff_t efifs_lseek(struct device_d *dev, FILE *f, loff_t pos)
static int efifs_truncate(struct device_d *dev, FILE *f, unsigned long size)
{
- struct efifs_file *ufile = f->inode;
+ struct efifs_file *ufile = f->priv;
efi_status_t efiret;
struct efi_file_info *info;
unsigned long bufsize = 1024;
diff --git a/fs/ext4/ext_barebox.c b/fs/ext4/ext_barebox.c
index 69a7723..5ec7ecd 100644
--- a/fs/ext4/ext_barebox.c
+++ b/fs/ext4/ext_barebox.c
@@ -57,7 +57,7 @@ static int ext_open(struct device_d *dev, FILE *file, const char *filename)
return ret;
file->size = __le32_to_cpu(inode->inode.size);
- file->inode = inode;
+ file->priv = inode;
return 0;
}
@@ -66,14 +66,14 @@ static int ext_close(struct device_d *dev, FILE *f)
{
struct ext_filesystem *fs = dev->priv;
- ext4fs_free_node(f->inode, &fs->data->diropen);
+ ext4fs_free_node(f->priv, &fs->data->diropen);
return 0;
}
static int ext_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
{
- return ext4fs_read_file(f->inode, f->pos, insize, buf);
+ return ext4fs_read_file(f->priv, f->pos, insize, buf);
}
static loff_t ext_lseek(struct device_d *dev, FILE *f, loff_t pos)
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index f8094d0..6d7d262 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -161,7 +161,7 @@ static int fat_rmdir(struct device_d *dev, const char *pathname)
static int fat_write(struct device_d *_dev, FILE *f, const void *buf, size_t insize)
{
- FIL *f_file = f->inode;
+ FIL *f_file = f->priv;
int outsize;
int ret;
@@ -179,7 +179,7 @@ static int fat_write(struct device_d *_dev, FILE *f, const void *buf, size_t ins
static int fat_truncate(struct device_d *dev, FILE *f, ulong size)
{
- FIL *f_file = f->inode;
+ FIL *f_file = f->priv;
unsigned long lastofs;
int ret;
@@ -232,7 +232,7 @@ static int fat_open(struct device_d *dev, FILE *file, const char *filename)
ret = f_lseek(f_file, f_file->fsize);
}
- file->inode = f_file;
+ file->priv = f_file;
file->size = f_file->fsize;
return 0;
@@ -241,7 +241,7 @@ static int fat_open(struct device_d *dev, FILE *file, const char *filename)
static int fat_close(struct device_d *dev, FILE *f)
{
struct fat_priv *priv = dev->priv;
- FIL *f_file = f->inode;
+ FIL *f_file = f->priv;
f_close(f_file);
@@ -255,7 +255,7 @@ static int fat_close(struct device_d *dev, FILE *f)
static int fat_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
{
int ret;
- FIL *f_file = f->inode;
+ FIL *f_file = f->priv;
int outsize;
ret = f_read(f_file, buf, insize, &outsize);
@@ -270,7 +270,7 @@ static int fat_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
static loff_t fat_lseek(struct device_d *dev, FILE *f, loff_t pos)
{
- FIL *f_file = f->inode;
+ FIL *f_file = f->priv;
int ret;
ret = f_lseek(f_file, pos);
diff --git a/fs/nfs.c b/fs/nfs.c
index f1abd0b..2738c78 100644
--- a/fs/nfs.c
+++ b/fs/nfs.c
@@ -1144,7 +1144,7 @@ static int nfs_open(struct device_d *dev, FILE *file, const char *filename)
if (IS_ERR(priv))
return PTR_ERR(priv);
- file->inode = priv;
+ file->priv = priv;
file->size = s.st_size;
priv->fifo = kfifo_alloc(1024);
@@ -1158,7 +1158,7 @@ static int nfs_open(struct device_d *dev, FILE *file, const char *filename)
static int nfs_close(struct device_d *dev, FILE *file)
{
- struct file_priv *priv = file->inode;
+ struct file_priv *priv = file->priv;
nfs_do_close(priv);
@@ -1173,7 +1173,7 @@ static int nfs_write(struct device_d *_dev, FILE *file, const void *inbuf,
static int nfs_read(struct device_d *dev, FILE *file, void *buf, size_t insize)
{
- struct file_priv *priv = file->inode;
+ struct file_priv *priv = file->priv;
if (insize > 1024)
insize = 1024;
@@ -1189,7 +1189,7 @@ static int nfs_read(struct device_d *dev, FILE *file, void *buf, size_t insize)
static loff_t nfs_lseek(struct device_d *dev, FILE *file, loff_t pos)
{
- struct file_priv *priv = file->inode;
+ struct file_priv *priv = file->priv;
file->pos = pos;
kfifo_reset(priv->fifo);
diff --git a/fs/omap4_usbbootfs.c b/fs/omap4_usbbootfs.c
index 0dc7682..6085bca 100644
--- a/fs/omap4_usbbootfs.c
+++ b/fs/omap4_usbbootfs.c
@@ -104,7 +104,7 @@ static int omap4_usbbootfs_open(
if (IS_ERR(priv))
return PTR_ERR(priv);
- file->inode = priv;
+ file->priv = priv;
file->size = priv->size;
return 0;
@@ -123,14 +123,14 @@ static int omap4_usbbootfs_do_close(struct file_priv *priv)
static int omap4_usbbootfs_close(struct device_d *dev, FILE *f)
{
- struct file_priv *priv = f->inode;
+ struct file_priv *priv = f->priv;
return omap4_usbbootfs_do_close(priv);
}
static int omap4_usbbootfs_read(
struct device_d *dev, FILE *f, void *buf, size_t size)
{
- struct file_priv *priv = f->inode;
+ struct file_priv *priv = f->priv;
u32 data;
if (size > priv->size - f->pos)
diff --git a/fs/ramfs.c b/fs/ramfs.c
index f45a454..fe5eb89 100644
--- a/fs/ramfs.c
+++ b/fs/ramfs.c
@@ -311,7 +311,7 @@ static int ramfs_open(struct device_d *dev, FILE *file, const char *filename)
return -ENOENT;
file->size = node->size;
- file->inode = node;
+ file->priv = node;
return 0;
}
@@ -351,7 +351,7 @@ static struct ramfs_chunk *ramfs_find_chunk(struct ramfs_inode *node, int chunk)
static int ramfs_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
{
- struct ramfs_inode *node = (struct ramfs_inode *)f->inode;
+ struct ramfs_inode *node = f->priv;
int chunk;
struct ramfs_chunk *data;
int ofs;
@@ -400,7 +400,7 @@ static int ramfs_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
static int ramfs_write(struct device_d *_dev, FILE *f, const void *buf, size_t insize)
{
- struct ramfs_inode *node = (struct ramfs_inode *)f->inode;
+ struct ramfs_inode *node = f->priv;
int chunk;
struct ramfs_chunk *data;
int ofs;
@@ -455,7 +455,7 @@ static loff_t ramfs_lseek(struct device_d *dev, FILE *f, loff_t pos)
static int ramfs_truncate(struct device_d *dev, FILE *f, ulong size)
{
- struct ramfs_inode *node = (struct ramfs_inode *)f->inode;
+ struct ramfs_inode *node = f->priv;
int oldchunks, newchunks;
struct ramfs_chunk *data = node->data;
diff --git a/fs/tftp.c b/fs/tftp.c
index 3643619..72e4983 100644
--- a/fs/tftp.c
+++ b/fs/tftp.c
@@ -469,7 +469,7 @@ static int tftp_open(struct device_d *dev, FILE *file, const char *filename)
if (IS_ERR(priv))
return PTR_ERR(priv);
- file->inode = priv;
+ file->priv = priv;
file->size = SZ_2G;
return 0;
@@ -515,7 +515,7 @@ static int tftp_do_close(struct file_priv *priv)
static int tftp_close(struct device_d *dev, FILE *f)
{
- struct file_priv *priv = f->inode;
+ struct file_priv *priv = f->priv;
return tftp_do_close(priv);
}
@@ -523,7 +523,7 @@ static int tftp_close(struct device_d *dev, FILE *f)
static int tftp_write(struct device_d *_dev, FILE *f, const void *inbuf,
size_t insize)
{
- struct file_priv *priv = f->inode;
+ struct file_priv *priv = f->priv;
size_t size, now;
int ret;
@@ -558,7 +558,7 @@ static int tftp_write(struct device_d *_dev, FILE *f, const void *inbuf,
static int tftp_read(struct device_d *dev, FILE *f, void *buf, size_t insize)
{
- struct file_priv *priv = f->inode;
+ struct file_priv *priv = f->priv;
size_t outsize = 0, now;
int ret;
diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
index 49d5583..68d90b3 100644
--- a/fs/ubifs/ubifs.c
+++ b/fs/ubifs/ubifs.c
@@ -350,14 +350,14 @@ static int ubifs_open(struct device_d *dev, FILE *file, const char *filename)
uf->block = -1;
file->size = inode->i_size;
- file->inode = uf;
+ file->priv = uf;
return 0;
}
static int ubifs_close(struct device_d *dev, FILE *f)
{
- struct ubifs_file *uf = f->inode;
+ struct ubifs_file *uf = f->priv;
struct inode *inode = uf->inode;
ubifs_iput(inode);
@@ -386,7 +386,7 @@ static int ubifs_get_block(struct ubifs_file *uf, unsigned int pos)
static int ubifs_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
{
- struct ubifs_file *uf = f->inode;
+ struct ubifs_file *uf = f->priv;
unsigned int pos = f->pos;
unsigned int ofs;
unsigned int now;
diff --git a/fs/uimagefs.c b/fs/uimagefs.c
index 63931c2..3fdc5bd 100644
--- a/fs/uimagefs.c
+++ b/fs/uimagefs.c
@@ -89,14 +89,14 @@ static int uimagefs_open(struct device_d *dev, FILE *file, const char *filename)
}
file->size = d->size;
- file->inode = d;
+ file->priv = d;
return 0;
}
static int uimagefs_close(struct device_d *dev, FILE *file)
{
- struct uimagefs_handle_data *d = file->inode;
+ struct uimagefs_handle_data *d = file->priv;
close(d->fd);
@@ -105,7 +105,7 @@ static int uimagefs_close(struct device_d *dev, FILE *file)
static int uimagefs_read(struct device_d *dev, FILE *file, void *buf, size_t insize)
{
- struct uimagefs_handle_data *d = file->inode;
+ struct uimagefs_handle_data *d = file->priv;
if (!uimagefs_is_data_file(d)) {
memcpy(buf, &d->data[d->pos], insize);
@@ -117,7 +117,7 @@ static int uimagefs_read(struct device_d *dev, FILE *file, void *buf, size_t ins
static loff_t uimagefs_lseek(struct device_d *dev, FILE *file, loff_t pos)
{
- struct uimagefs_handle_data *d = file->inode;
+ struct uimagefs_handle_data *d = file->priv;
if (uimagefs_is_data_file(d))
lseek(d->fd, d->offset + pos, SEEK_SET);
diff --git a/include/fs.h b/include/fs.h
index 63e35ca..61d7439 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -30,7 +30,7 @@ typedef struct filep {
loff_t size; /* The size of this inode */
ulong flags; /* the O_* flags from open */
- void *inode; /* private to the filesystem driver */
+ void *priv; /* private to the filesystem driver */
/* private fields. Mapping between FILE and filedescriptor number */
int no;
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] fs: remove unnecessary device pointer argument
2015-03-04 7:49 [PATCH 1/2] fs: rename inode member of struct filep to priv Sascha Hauer
@ 2015-03-04 7:49 ` Sascha Hauer
2015-03-04 8:43 ` [PATCH 2/2] " Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2015-03-04 7:49 UTC (permalink / raw)
To: Barebox List
The struct device_d * argument is not necessary, it can be retrieved from
the FILE *. This adds a convenience function for doing this and removes
the struct device_d * argument from the the filesystem drivers functions.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/bpkfs.c | 10 +++++-----
fs/cramfs/cramfs.c | 12 ++++++------
fs/devfs.c | 22 +++++++++++-----------
fs/efi.c | 12 ++++++------
fs/ext4/ext_barebox.c | 12 ++++++------
fs/fat/fat.c | 16 ++++++++--------
fs/fs.c | 24 ++++++++++++------------
fs/nfs.c | 31 +++++++++++++++++--------------
fs/omap4_usbbootfs.c | 17 +++++++----------
fs/ramfs.c | 14 +++++++-------
fs/tftp.c | 21 +++++++++++----------
fs/ubifs/ubifs.c | 10 +++++-----
fs/uimagefs.c | 14 +++++++-------
include/fs.h | 27 ++++++++++++++++-----------
14 files changed, 124 insertions(+), 118 deletions(-)
diff --git a/fs/bpkfs.c b/fs/bpkfs.c
index 1e2619e..94b5379 100644
--- a/fs/bpkfs.c
+++ b/fs/bpkfs.c
@@ -126,9 +126,9 @@ static struct bpkfs_handle_data *bpkfs_get_by_type(
return NULL;
}
-static int bpkfs_open(struct device_d *dev, FILE *f, const char *filename)
+static int bpkfs_open(FILE *f, const char *filename)
{
- struct bpkfs_handle *priv = dev->priv;
+ struct bpkfs_handle *priv = fs_driver_priv(f);
struct bpkfs_handle_data *d;
struct bpkfs_handle_hw *h;
char *dir, *file;
@@ -170,7 +170,7 @@ out:
return ret;
}
-static int bpkfs_close(struct device_d *dev, FILE *file)
+static int bpkfs_close(FILE *file)
{
struct bpkfs_handle_data *d = file->priv;
@@ -179,7 +179,7 @@ static int bpkfs_close(struct device_d *dev, FILE *file)
return 0;
}
-static int bpkfs_read(struct device_d *dev, FILE *file, void *buf, size_t insize)
+static int bpkfs_read(FILE *file, void *buf, size_t insize)
{
struct bpkfs_handle_data *d = file->priv;
@@ -191,7 +191,7 @@ static int bpkfs_read(struct device_d *dev, FILE *file, void *buf, size_t insize
}
}
-static loff_t bpkfs_lseek(struct device_d *dev, FILE *file, loff_t pos)
+static loff_t bpkfs_lseek(FILE *file, loff_t pos)
{
struct bpkfs_handle_data *d = file->priv;
diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c
index fb92714..d53421b 100644
--- a/fs/cramfs/cramfs.c
+++ b/fs/cramfs/cramfs.c
@@ -274,9 +274,9 @@ static int cramfs_closedir(struct device_d *dev, DIR *_dir)
return 0;
}
-static int cramfs_open(struct device_d *_dev, FILE *file, const char *filename)
+static int cramfs_open(FILE *file, const char *filename)
{
- struct cramfs_priv *priv = _dev->priv;
+ struct cramfs_priv *priv = fs_driver_priv(file);
struct cramfs_inode_info *inodei;
char *f;
@@ -299,7 +299,7 @@ static int cramfs_open(struct device_d *_dev, FILE *file, const char *filename)
return 0;
}
-static int cramfs_close(struct device_d *dev, FILE *file)
+static int cramfs_close(FILE *file)
{
struct cramfs_inode_info *inodei = file->priv;
@@ -309,9 +309,9 @@ static int cramfs_close(struct device_d *dev, FILE *file)
return 0;
}
-static int cramfs_read(struct device_d *_dev, FILE *f, void *buf, size_t size)
+static int cramfs_read(FILE *f, void *buf, size_t size)
{
- struct cramfs_priv *priv = _dev->priv;
+ struct cramfs_priv *priv = fs_driver_priv(f);
struct cramfs_inode_info *inodei = f->priv;
struct cramfs_inode *inode = &inodei->inode;
unsigned int blocknr;
@@ -358,7 +358,7 @@ static int cramfs_read(struct device_d *_dev, FILE *f, void *buf, size_t size)
return outsize;
}
-static loff_t cramfs_lseek(struct device_d *dev, FILE *f, loff_t pos)
+static loff_t cramfs_lseek(FILE *f, loff_t pos)
{
f->pos = pos;
return f->pos;
diff --git a/fs/devfs.c b/fs/devfs.c
index c6db25c..4da21d4 100644
--- a/fs/devfs.c
+++ b/fs/devfs.c
@@ -35,14 +35,14 @@
extern struct list_head cdev_list;
-static int devfs_read(struct device_d *_dev, FILE *f, void *buf, size_t size)
+static int devfs_read(FILE *f, void *buf, size_t size)
{
struct cdev *cdev = f->priv;
return cdev_read(cdev, buf, size, f->pos, f->flags);
}
-static int devfs_write(struct device_d *_dev, FILE *f, const void *buf, size_t size)
+static int devfs_write(FILE *f, const void *buf, size_t size)
{
struct cdev *cdev = f->priv;
@@ -52,7 +52,7 @@ static int devfs_write(struct device_d *_dev, FILE *f, const void *buf, size_t s
return cdev_write(cdev, buf, size, f->pos, f->flags);
}
-static loff_t devfs_lseek(struct device_d *_dev, FILE *f, loff_t pos)
+static loff_t devfs_lseek(FILE *f, loff_t pos)
{
struct cdev *cdev = f->priv;
loff_t ret = -1;
@@ -66,7 +66,7 @@ static loff_t devfs_lseek(struct device_d *_dev, FILE *f, loff_t pos)
return ret - cdev->offset;
}
-static int devfs_erase(struct device_d *_dev, FILE *f, size_t count, loff_t offset)
+static int devfs_erase(FILE *f, size_t count, loff_t offset)
{
struct cdev *cdev = f->priv;
@@ -82,7 +82,7 @@ static int devfs_erase(struct device_d *_dev, FILE *f, size_t count, loff_t offs
return cdev->ops->erase(cdev, count, offset + cdev->offset);
}
-static int devfs_protect(struct device_d *_dev, FILE *f, size_t count, loff_t offset, int prot)
+static int devfs_protect(FILE *f, size_t count, loff_t offset, int prot)
{
struct cdev *cdev = f->priv;
@@ -92,7 +92,7 @@ static int devfs_protect(struct device_d *_dev, FILE *f, size_t count, loff_t of
return cdev->ops->protect(cdev, count, offset + cdev->offset, prot);
}
-static int devfs_memmap(struct device_d *_dev, FILE *f, void **map, int flags)
+static int devfs_memmap(FILE *f, void **map, int flags)
{
struct cdev *cdev = f->priv;
int ret = -ENOSYS;
@@ -108,7 +108,7 @@ static int devfs_memmap(struct device_d *_dev, FILE *f, void **map, int flags)
return ret;
}
-static int devfs_open(struct device_d *_dev, FILE *f, const char *filename)
+static int devfs_open(FILE *f, const char *filename)
{
struct cdev *cdev;
int ret;
@@ -133,7 +133,7 @@ static int devfs_open(struct device_d *_dev, FILE *f, const char *filename)
return 0;
}
-static int devfs_close(struct device_d *_dev, FILE *f)
+static int devfs_close(FILE *f)
{
struct cdev *cdev = f->priv;
int ret;
@@ -149,7 +149,7 @@ static int devfs_close(struct device_d *_dev, FILE *f)
return 0;
}
-static int devfs_flush(struct device_d *_dev, FILE *f)
+static int devfs_flush(FILE *f)
{
struct cdev *cdev = f->priv;
@@ -159,14 +159,14 @@ static int devfs_flush(struct device_d *_dev, FILE *f)
return 0;
}
-static int devfs_ioctl(struct device_d *_dev, FILE *f, int request, void *buf)
+static int devfs_ioctl(FILE *f, int request, void *buf)
{
struct cdev *cdev = f->priv;
return cdev_ioctl(cdev, request, buf);
}
-static int devfs_truncate(struct device_d *dev, FILE *f, ulong size)
+static int devfs_truncate(FILE *f, ulong size)
{
if (f->fsdev->dev.num_resources < 1)
return -ENOSPC;
diff --git a/fs/efi.c b/fs/efi.c
index d64b15b..ae44f43 100644
--- a/fs/efi.c
+++ b/fs/efi.c
@@ -204,7 +204,7 @@ static int efifs_rmdir(struct device_d *dev, const char *pathname)
return efifs_unlink(dev, pathname);
}
-static int efifs_open(struct device_d *dev, FILE *f, const char *filename)
+static int efifs_open(FILE *f, const char *filename)
{
struct efifs_priv *priv = fs_driver_priv(f);
efi_status_t efiret;
@@ -252,7 +252,7 @@ out:
return ret;
}
-static int efifs_close(struct device_d *dev, FILE *f)
+static int efifs_close(FILE *f)
{
struct efifs_file *ufile = f->priv;
@@ -263,7 +263,7 @@ static int efifs_close(struct device_d *dev, FILE *f)
return 0;
}
-static int efifs_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
+static int efifs_read(FILE *f, void *buf, size_t insize)
{
struct efifs_file *ufile = f->priv;
efi_status_t efiret;
@@ -277,7 +277,7 @@ static int efifs_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
return bufsize;
}
-static int efifs_write(struct device_d *_dev, FILE *f, const void *buf, size_t insize)
+static int efifs_write(FILE *f, const void *buf, size_t insize)
{
struct efifs_file *ufile = f->priv;
efi_status_t efiret;
@@ -292,7 +292,7 @@ static int efifs_write(struct device_d *_dev, FILE *f, const void *buf, size_t i
return bufsize;
}
-static loff_t efifs_lseek(struct device_d *dev, FILE *f, loff_t pos)
+static loff_t efifs_lseek(FILE *f, loff_t pos)
{
struct efifs_file *ufile = f->priv;
efi_status_t efiret;
@@ -307,7 +307,7 @@ static loff_t efifs_lseek(struct device_d *dev, FILE *f, loff_t pos)
return f->pos;
}
-static int efifs_truncate(struct device_d *dev, FILE *f, unsigned long size)
+static int efifs_truncate(FILE *f, unsigned long size)
{
struct efifs_file *ufile = f->priv;
efi_status_t efiret;
diff --git a/fs/ext4/ext_barebox.c b/fs/ext4/ext_barebox.c
index 5ec7ecd..3ffb634 100644
--- a/fs/ext4/ext_barebox.c
+++ b/fs/ext4/ext_barebox.c
@@ -46,9 +46,9 @@ int ext4fs_devread(struct ext_filesystem *fs, int __sector, int byte_offset,
return 0;
}
-static int ext_open(struct device_d *dev, FILE *file, const char *filename)
+static int ext_open(FILE *file, const char *filename)
{
- struct ext_filesystem *fs = dev->priv;
+ struct ext_filesystem *fs = fs_driver_priv(file);
struct ext2fs_node *inode;
int ret;
@@ -62,21 +62,21 @@ static int ext_open(struct device_d *dev, FILE *file, const char *filename)
return 0;
}
-static int ext_close(struct device_d *dev, FILE *f)
+static int ext_close(FILE *f)
{
- struct ext_filesystem *fs = dev->priv;
+ struct ext_filesystem *fs = fs_driver_priv(f);
ext4fs_free_node(f->priv, &fs->data->diropen);
return 0;
}
-static int ext_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
+static int ext_read(FILE *f, void *buf, size_t insize)
{
return ext4fs_read_file(f->priv, f->pos, insize, buf);
}
-static loff_t ext_lseek(struct device_d *dev, FILE *f, loff_t pos)
+static loff_t ext_lseek(FILE *f, loff_t pos)
{
f->pos = pos;
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 6d7d262..abe44dd 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -159,7 +159,7 @@ static int fat_rmdir(struct device_d *dev, const char *pathname)
return 0;
}
-static int fat_write(struct device_d *_dev, FILE *f, const void *buf, size_t insize)
+static int fat_write(FILE *f, const void *buf, size_t insize)
{
FIL *f_file = f->priv;
int outsize;
@@ -177,7 +177,7 @@ static int fat_write(struct device_d *_dev, FILE *f, const void *buf, size_t ins
return outsize;
}
-static int fat_truncate(struct device_d *dev, FILE *f, ulong size)
+static int fat_truncate(FILE *f, ulong size)
{
FIL *f_file = f->priv;
unsigned long lastofs;
@@ -201,9 +201,9 @@ static int fat_truncate(struct device_d *dev, FILE *f, ulong size)
}
#endif /* CONFIG_FS_FAT_WRITE */
-static int fat_open(struct device_d *dev, FILE *file, const char *filename)
+static int fat_open(FILE *file, const char *filename)
{
- struct fat_priv *priv = dev->priv;
+ struct fat_priv *priv = fs_driver_priv(file);
FIL *f_file;
int ret;
unsigned long flags = 0;
@@ -238,9 +238,9 @@ static int fat_open(struct device_d *dev, FILE *file, const char *filename)
return 0;
}
-static int fat_close(struct device_d *dev, FILE *f)
+static int fat_close(FILE *f)
{
- struct fat_priv *priv = dev->priv;
+ struct fat_priv *priv = fs_driver_priv(f);
FIL *f_file = f->priv;
f_close(f_file);
@@ -252,7 +252,7 @@ static int fat_close(struct device_d *dev, FILE *f)
return 0;
}
-static int fat_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
+static int fat_read(FILE *f, void *buf, size_t insize)
{
int ret;
FIL *f_file = f->priv;
@@ -268,7 +268,7 @@ static int fat_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
return outsize;
}
-static loff_t fat_lseek(struct device_d *dev, FILE *f, loff_t pos)
+static loff_t fat_lseek(FILE *f, loff_t pos)
{
FIL *f_file = f->priv;
int ret;
diff --git a/fs/fs.c b/fs/fs.c
index ffdfa2c..7d057ed 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -675,12 +675,12 @@ int open(const char *pathname, int flags, ...)
f->path = xstrdup(path);
- ret = fsdrv->open(&fsdev->dev, f, path);
+ ret = fsdrv->open(f, path);
if (ret)
goto out;
if (!(s.st_mode & S_IFCHR) && (flags & O_TRUNC)) {
- ret = fsdrv->truncate(&fsdev->dev, f, 0);
+ ret = fsdrv->truncate(f, 0);
f->size = 0;
if (ret)
goto out;
@@ -722,7 +722,7 @@ int ioctl(int fd, int request, void *buf)
fsdrv = f->fsdev->driver;
if (fsdrv->ioctl)
- ret = fsdrv->ioctl(&f->fsdev->dev, f, request, buf);
+ ret = fsdrv->ioctl(f, request, buf);
else
ret = -ENOSYS;
if (ret)
@@ -743,7 +743,7 @@ static ssize_t __read(FILE *f, void *buf, size_t count)
if (!count)
return 0;
- ret = fsdrv->read(&f->fsdev->dev, f, buf, count);
+ ret = fsdrv->read(f, buf, count);
if (ret < 0)
errno = -ret;
@@ -795,7 +795,7 @@ static ssize_t __write(FILE *f, const void *buf, size_t count)
fsdrv = f->fsdev->driver;
if (f->size != FILE_SIZE_STREAM && f->pos + count > f->size) {
- ret = fsdrv->truncate(&f->fsdev->dev, f, f->pos + count);
+ ret = fsdrv->truncate(f, f->pos + count);
if (ret) {
if (ret != -ENOSPC)
goto out;
@@ -806,7 +806,7 @@ static ssize_t __write(FILE *f, const void *buf, size_t count)
f->size = f->pos + count;
}
}
- ret = fsdrv->write(&f->fsdev->dev, f, buf, count);
+ ret = fsdrv->write(f, buf, count);
out:
if (ret < 0)
errno = -ret;
@@ -864,7 +864,7 @@ int flush(int fd)
fsdrv = f->fsdev->driver;
if (fsdrv->flush)
- ret = fsdrv->flush(&f->fsdev->dev, f);
+ ret = fsdrv->flush(f);
else
ret = 0;
@@ -913,7 +913,7 @@ loff_t lseek(int fildes, loff_t offset, int whence)
goto out;
}
- return fsdrv->lseek(&f->fsdev->dev, f, pos);
+ return fsdrv->lseek(f, pos);
out:
if (ret)
@@ -939,7 +939,7 @@ int erase(int fd, size_t count, unsigned long offset)
fsdrv = f->fsdev->driver;
if (fsdrv->erase)
- ret = fsdrv->erase(&f->fsdev->dev, f, count, offset);
+ ret = fsdrv->erase(f, count, offset);
else
ret = -ENOSYS;
@@ -966,7 +966,7 @@ int protect(int fd, size_t count, unsigned long offset, int prot)
fsdrv = f->fsdev->driver;
if (fsdrv->protect)
- ret = fsdrv->protect(&f->fsdev->dev, f, count, offset, prot);
+ ret = fsdrv->protect(f, count, offset, prot);
else
ret = -ENOSYS;
@@ -1007,7 +1007,7 @@ void *memmap(int fd, int flags)
fsdrv = f->fsdev->driver;
if (fsdrv->memmap)
- ret = fsdrv->memmap(&f->fsdev->dev, f, &retp, flags);
+ ret = fsdrv->memmap(f, &retp, flags);
else
ret = -EINVAL;
@@ -1030,7 +1030,7 @@ int close(int fd)
f = &files[fd];
fsdrv = f->fsdev->driver;
- ret = fsdrv->close(&f->fsdev->dev, f);
+ ret = fsdrv->close(f);
put_file(f);
diff --git a/fs/nfs.c b/fs/nfs.c
index 2738c78..d6da791 100644
--- a/fs/nfs.c
+++ b/fs/nfs.c
@@ -971,16 +971,15 @@ static int nfs_rmdir(struct device_d *dev, const char *pathname)
return -ENOSYS;
}
-static int nfs_truncate(struct device_d *dev, FILE *f, ulong size)
+static int nfs_truncate(FILE *f, ulong size)
{
return -ENOSYS;
}
-static struct file_priv *nfs_do_open(struct device_d *dev,
+static struct file_priv *nfs_do_open(struct nfs_priv *npriv,
const char *filename, struct stat **s)
{
struct file_priv *priv;
- struct nfs_priv *npriv = dev->priv;
int ret;
const char *tok;
@@ -1035,7 +1034,7 @@ static void nfs_do_close(struct file_priv *priv)
free(priv);
}
-static struct file_priv *nfs_do_stat(struct device_d *dev,
+static struct file_priv *nfs_do_stat(struct nfs_priv *npriv,
const char *filename, struct stat *s)
{
struct file_priv *priv;
@@ -1043,7 +1042,7 @@ static struct file_priv *nfs_do_stat(struct device_d *dev,
struct stat **sptr = &s;
debug("%s: filename = %s\n", __func__, filename);
- priv = nfs_do_open(dev, filename, sptr);
+ priv = nfs_do_open(npriv, filename, sptr);
if (IS_ERR(priv))
return priv;
@@ -1119,10 +1118,11 @@ static int nfs_readlink_req(struct file_priv *priv, char* buf, size_t size)
static int nfs_readlink(struct device_d *dev, const char *filename,
char *realname, size_t size)
{
+ struct nfs_priv *npriv = dev->priv;
struct file_priv *priv;
int ret;
- priv = nfs_do_open(dev, filename, NULL);
+ priv = nfs_do_open(npriv, filename, NULL);
if (IS_ERR(priv))
return PTR_ERR(priv);
@@ -1135,12 +1135,13 @@ static int nfs_readlink(struct device_d *dev, const char *filename,
return 0;
}
-static int nfs_open(struct device_d *dev, FILE *file, const char *filename)
+static int nfs_open(FILE *file, const char *filename)
{
+ struct nfs_priv *npriv = fs_driver_priv(file);
struct file_priv *priv;
struct stat s;
- priv = nfs_do_stat(dev, filename, &s);
+ priv = nfs_do_stat(npriv, filename, &s);
if (IS_ERR(priv))
return PTR_ERR(priv);
@@ -1156,7 +1157,7 @@ static int nfs_open(struct device_d *dev, FILE *file, const char *filename)
return 0;
}
-static int nfs_close(struct device_d *dev, FILE *file)
+static int nfs_close(FILE *file)
{
struct file_priv *priv = file->priv;
@@ -1165,13 +1166,13 @@ static int nfs_close(struct device_d *dev, FILE *file)
return 0;
}
-static int nfs_write(struct device_d *_dev, FILE *file, const void *inbuf,
+static int nfs_write(FILE *file, const void *inbuf,
size_t insize)
{
return -ENOSYS;
}
-static int nfs_read(struct device_d *dev, FILE *file, void *buf, size_t insize)
+static int nfs_read(FILE *file, void *buf, size_t insize)
{
struct file_priv *priv = file->priv;
@@ -1187,7 +1188,7 @@ static int nfs_read(struct device_d *dev, FILE *file, void *buf, size_t insize)
return kfifo_get(priv->fifo, buf, insize);
}
-static loff_t nfs_lseek(struct device_d *dev, FILE *file, loff_t pos)
+static loff_t nfs_lseek(FILE *file, loff_t pos)
{
struct file_priv *priv = file->priv;
@@ -1199,11 +1200,12 @@ static loff_t nfs_lseek(struct device_d *dev, FILE *file, loff_t pos)
static DIR *nfs_opendir(struct device_d *dev, const char *pathname)
{
+ struct nfs_priv *npriv = dev->priv;
struct file_priv *priv;
void *buf = NULL;
struct nfs_dir *dir;
- priv = nfs_do_open(dev, pathname, NULL);
+ priv = nfs_do_open(npriv, pathname, NULL);
if (IS_ERR(priv))
return NULL;
@@ -1295,9 +1297,10 @@ static int nfs_closedir(struct device_d *dev, DIR *dir)
static int nfs_stat(struct device_d *dev, const char *filename, struct stat *s)
{
+ struct nfs_priv *npriv = dev->priv;
struct file_priv *priv;
- priv = nfs_do_stat(dev, filename, s);
+ priv = nfs_do_stat(npriv, filename, s);
if (IS_ERR(priv)) {
return PTR_ERR(priv);
} else {
diff --git a/fs/omap4_usbbootfs.c b/fs/omap4_usbbootfs.c
index 6085bca..7dba0c5 100644
--- a/fs/omap4_usbbootfs.c
+++ b/fs/omap4_usbbootfs.c
@@ -63,8 +63,7 @@ static int omap4_usbbootfs_truncate(struct device_d *dev, FILE *f, ulong size)
}
*/
-static struct file_priv *omap4_usbbootfs_do_open(
- struct device_d *dev, int accmode, const char *filename)
+static struct file_priv *omap4_usbbootfs_do_open(int accmode, const char *filename)
{
struct file_priv *priv;
u32 data;
@@ -95,12 +94,11 @@ static struct file_priv *omap4_usbbootfs_do_open(
return priv;
}
-static int omap4_usbbootfs_open(
- struct device_d *dev, FILE *file, const char *filename)
+static int omap4_usbbootfs_open(FILE *file, const char *filename)
{
struct file_priv *priv;
- priv = omap4_usbbootfs_do_open(dev, file->flags, filename);
+ priv = omap4_usbbootfs_do_open(file->flags, filename);
if (IS_ERR(priv))
return PTR_ERR(priv);
@@ -121,14 +119,13 @@ static int omap4_usbbootfs_do_close(struct file_priv *priv)
return 0;
}
-static int omap4_usbbootfs_close(struct device_d *dev, FILE *f)
+static int omap4_usbbootfs_close(FILE *f)
{
struct file_priv *priv = f->priv;
return omap4_usbbootfs_do_close(priv);
}
-static int omap4_usbbootfs_read(
- struct device_d *dev, FILE *f, void *buf, size_t size)
+static int omap4_usbbootfs_read(FILE *f, void *buf, size_t size)
{
struct file_priv *priv = f->priv;
u32 data;
@@ -151,7 +148,7 @@ static int omap4_usbbootfs_read(
return size;
}
-static loff_t omap4_usbbootfs_lseek(struct device_d *dev, FILE *f, loff_t pos)
+static loff_t omap4_usbbootfs_lseek(FILE *f, loff_t pos)
{
f->pos = pos;
return pos;
@@ -167,7 +164,7 @@ static int omap4_usbbootfs_stat(
{
struct file_priv *priv;
- priv = omap4_usbbootfs_do_open(dev, O_RDONLY, filename);
+ priv = omap4_usbbootfs_do_open(O_RDONLY, filename);
if (IS_ERR(priv))
return PTR_ERR(priv);
diff --git a/fs/ramfs.c b/fs/ramfs.c
index fe5eb89..995b517 100644
--- a/fs/ramfs.c
+++ b/fs/ramfs.c
@@ -302,9 +302,9 @@ static int ramfs_rmdir(struct device_d *dev, const char *pathname)
return -ENOENT;
}
-static int ramfs_open(struct device_d *dev, FILE *file, const char *filename)
+static int ramfs_open(FILE *file, const char *filename)
{
- struct ramfs_priv *priv = dev->priv;
+ struct ramfs_priv *priv = fs_driver_priv(file);
struct ramfs_inode *node = rlookup(priv, filename);
if (!node)
@@ -315,7 +315,7 @@ static int ramfs_open(struct device_d *dev, FILE *file, const char *filename)
return 0;
}
-static int ramfs_close(struct device_d *dev, FILE *f)
+static int ramfs_close(FILE *f)
{
return 0;
}
@@ -349,7 +349,7 @@ static struct ramfs_chunk *ramfs_find_chunk(struct ramfs_inode *node, int chunk)
return data;
}
-static int ramfs_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
+static int ramfs_read(FILE *f, void *buf, size_t insize)
{
struct ramfs_inode *node = f->priv;
int chunk;
@@ -398,7 +398,7 @@ static int ramfs_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
return insize;
}
-static int ramfs_write(struct device_d *_dev, FILE *f, const void *buf, size_t insize)
+static int ramfs_write(FILE *f, const void *buf, size_t insize)
{
struct ramfs_inode *node = f->priv;
int chunk;
@@ -447,13 +447,13 @@ static int ramfs_write(struct device_d *_dev, FILE *f, const void *buf, size_t i
return insize;
}
-static loff_t ramfs_lseek(struct device_d *dev, FILE *f, loff_t pos)
+static loff_t ramfs_lseek(FILE *f, loff_t pos)
{
f->pos = pos;
return f->pos;
}
-static int ramfs_truncate(struct device_d *dev, FILE *f, ulong size)
+static int ramfs_truncate(FILE *f, ulong size)
{
struct ramfs_inode *node = f->priv;
int oldchunks, newchunks;
diff --git a/fs/tftp.c b/fs/tftp.c
index 72e4983..6b6d1bd 100644
--- a/fs/tftp.c
+++ b/fs/tftp.c
@@ -110,7 +110,7 @@ static int tftp_rmdir(struct device_d *dev, const char *pathname)
return -ENOSYS;
}
-static int tftp_truncate(struct device_d *dev, FILE *f, ulong size)
+static int tftp_truncate(FILE *f, ulong size)
{
return 0;
}
@@ -376,11 +376,10 @@ static void tftp_handler(void *ctx, char *packet, unsigned len)
}
}
-static struct file_priv *tftp_do_open(struct device_d *dev,
+static struct file_priv *tftp_do_open(struct tftp_priv *tpriv,
int accmode, const char *filename)
{
struct file_priv *priv;
- struct tftp_priv *tpriv = dev->priv;
int ret;
priv = xzalloc(sizeof(*priv));
@@ -461,11 +460,12 @@ out:
return ERR_PTR(ret);
}
-static int tftp_open(struct device_d *dev, FILE *file, const char *filename)
+static int tftp_open(FILE *file, const char *filename)
{
struct file_priv *priv;
+ struct tftp_priv *tpriv = fs_driver_priv(file);
- priv = tftp_do_open(dev, file->flags, filename);
+ priv = tftp_do_open(tpriv, file->flags, filename);
if (IS_ERR(priv))
return PTR_ERR(priv);
@@ -513,14 +513,14 @@ static int tftp_do_close(struct file_priv *priv)
return 0;
}
-static int tftp_close(struct device_d *dev, FILE *f)
+static int tftp_close(FILE *f)
{
struct file_priv *priv = f->priv;
return tftp_do_close(priv);
}
-static int tftp_write(struct device_d *_dev, FILE *f, const void *inbuf,
+static int tftp_write(FILE *f, const void *inbuf,
size_t insize)
{
struct file_priv *priv = f->priv;
@@ -556,7 +556,7 @@ static int tftp_write(struct device_d *_dev, FILE *f, const void *inbuf,
return insize;
}
-static int tftp_read(struct device_d *dev, FILE *f, void *buf, size_t insize)
+static int tftp_read(FILE *f, void *buf, size_t insize)
{
struct file_priv *priv = f->priv;
size_t outsize = 0, now;
@@ -587,7 +587,7 @@ static int tftp_read(struct device_d *dev, FILE *f, void *buf, size_t insize)
return outsize;
}
-static loff_t tftp_lseek(struct device_d *dev, FILE *f, loff_t pos)
+static loff_t tftp_lseek(FILE *f, loff_t pos)
{
/* not implemented in tftp protocol */
return -ENOSYS;
@@ -602,8 +602,9 @@ static DIR* tftp_opendir(struct device_d *dev, const char *pathname)
static int tftp_stat(struct device_d *dev, const char *filename, struct stat *s)
{
struct file_priv *priv;
+ struct tftp_priv *tpriv = dev->priv;
- priv = tftp_do_open(dev, O_RDONLY, filename);
+ priv = tftp_do_open(tpriv, O_RDONLY, filename);
if (IS_ERR(priv))
return PTR_ERR(priv);
diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
index 68d90b3..7c143d7 100644
--- a/fs/ubifs/ubifs.c
+++ b/fs/ubifs/ubifs.c
@@ -332,9 +332,9 @@ struct ubifs_file {
struct ubifs_data_node *dn;
};
-static int ubifs_open(struct device_d *dev, FILE *file, const char *filename)
+static int ubifs_open(FILE *file, const char *filename)
{
- struct ubifs_priv *priv = dev->priv;
+ struct ubifs_priv *priv = fs_driver_priv(file);
struct inode *inode;
struct ubifs_file *uf;
@@ -355,7 +355,7 @@ static int ubifs_open(struct device_d *dev, FILE *file, const char *filename)
return 0;
}
-static int ubifs_close(struct device_d *dev, FILE *f)
+static int ubifs_close(FILE *f)
{
struct ubifs_file *uf = f->priv;
struct inode *inode = uf->inode;
@@ -384,7 +384,7 @@ static int ubifs_get_block(struct ubifs_file *uf, unsigned int pos)
return 0;
}
-static int ubifs_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
+static int ubifs_read(FILE *f, void *buf, size_t insize)
{
struct ubifs_file *uf = f->priv;
unsigned int pos = f->pos;
@@ -431,7 +431,7 @@ static int ubifs_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
return insize;
}
-static loff_t ubifs_lseek(struct device_d *dev, FILE *f, loff_t pos)
+static loff_t ubifs_lseek(FILE *f, loff_t pos)
{
f->pos = pos;
diff --git a/fs/uimagefs.c b/fs/uimagefs.c
index 3fdc5bd..a796e62 100644
--- a/fs/uimagefs.c
+++ b/fs/uimagefs.c
@@ -68,9 +68,9 @@ static struct uimagefs_handle_data *uimagefs_get_by_name(
return NULL;
}
-static int uimagefs_open(struct device_d *dev, FILE *file, const char *filename)
+static int uimagefs_open(FILE *file, const char *filename)
{
- struct uimagefs_handle *priv = dev->priv;
+ struct uimagefs_handle *priv = fs_driver_priv(file);
struct uimagefs_handle_data *d;
if (filename[0] == '/')
@@ -94,7 +94,7 @@ static int uimagefs_open(struct device_d *dev, FILE *file, const char *filename)
return 0;
}
-static int uimagefs_close(struct device_d *dev, FILE *file)
+static int uimagefs_close(FILE *file)
{
struct uimagefs_handle_data *d = file->priv;
@@ -103,7 +103,7 @@ static int uimagefs_close(struct device_d *dev, FILE *file)
return 0;
}
-static int uimagefs_read(struct device_d *dev, FILE *file, void *buf, size_t insize)
+static int uimagefs_read(FILE *file, void *buf, size_t insize)
{
struct uimagefs_handle_data *d = file->priv;
@@ -115,7 +115,7 @@ static int uimagefs_read(struct device_d *dev, FILE *file, void *buf, size_t ins
}
}
-static loff_t uimagefs_lseek(struct device_d *dev, FILE *file, loff_t pos)
+static loff_t uimagefs_lseek(FILE *file, loff_t pos)
{
struct uimagefs_handle_data *d = file->priv;
@@ -179,9 +179,9 @@ static int uimagefs_stat(struct device_d *dev, const char *filename, struct stat
return 0;
}
-static int uimagefs_ioctl(struct device_d *dev, FILE *f, int request, void *buf)
+static int uimagefs_ioctl(FILE *f, int request, void *buf)
{
- struct uimagefs_handle *priv = dev->priv;
+ struct uimagefs_handle *priv = fs_driver_priv(f);
if (request != UIMAGEFS_METADATA)
return -EINVAL;
diff --git a/include/fs.h b/include/fs.h
index 61d7439..a25d674 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -49,32 +49,32 @@ struct fs_driver_d {
int (*unlink)(struct device_d *dev, const char *pathname);
/* Truncate a file to given size */
- int (*truncate)(struct device_d *dev, FILE *f, ulong size);
+ int (*truncate)(FILE *f, ulong size);
int (*symlink)(struct device_d *dev, const char *pathname,
const char *newpath);
int (*readlink)(struct device_d *dev, const char *pathname, char *name,
size_t size);
- int (*open)(struct device_d *dev, FILE *f, const char *pathname);
- int (*close)(struct device_d *dev, FILE *f);
- int (*read)(struct device_d *dev, FILE *f, void *buf, size_t size);
- int (*write)(struct device_d *dev, FILE *f, const void *buf, size_t size);
- int (*flush)(struct device_d *dev, FILE *f);
- loff_t (*lseek)(struct device_d *dev, FILE *f, loff_t pos);
+ int (*open)(FILE *f, const char *pathname);
+ int (*close)(FILE *f);
+ int (*read)(FILE *f, void *buf, size_t size);
+ int (*write)(FILE *f, const void *buf, size_t size);
+ int (*flush)(FILE *f);
+ loff_t (*lseek)(FILE *f, loff_t pos);
struct dir* (*opendir)(struct device_d *dev, const char *pathname);
struct dirent* (*readdir)(struct device_d *dev, struct dir *dir);
int (*closedir)(struct device_d *dev, DIR *dir);
int (*stat)(struct device_d *dev, const char *file, struct stat *stat);
- int (*ioctl)(struct device_d *dev, FILE *f, int request, void *buf);
- int (*erase)(struct device_d *dev, FILE *f, size_t count,
+ int (*ioctl)(FILE *f, int request, void *buf);
+ int (*erase)(FILE *f, size_t count,
loff_t offset);
- int (*protect)(struct device_d *dev, FILE *f, size_t count,
+ int (*protect)(FILE *f, size_t count,
loff_t offset, int prot);
- int (*memmap)(struct device_d *dev, FILE *f, void **map, int flags);
+ int (*memmap)(FILE *f, void **map, int flags);
struct driver_d drv;
@@ -102,6 +102,11 @@ struct fs_device_d {
char *options;
};
+static inline void *fs_driver_priv(struct filep *f)
+{
+ return f->fsdev->dev.priv;
+}
+
#define drv_to_fs_driver(d) container_of(d, struct fs_driver_d, drv)
/*
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] remove unnecessary device pointer argument
2015-03-04 7:49 ` [PATCH 2/2] fs: remove unnecessary device pointer argument Sascha Hauer
@ 2015-03-04 8:43 ` Jean-Christophe PLAGNIOL-VILLARD
2015-03-04 10:45 ` Sascha Hauer
0 siblings, 1 reply; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2015-03-04 8:43 UTC (permalink / raw)
To: Sascha Hauer; +Cc: Barebox List
> On Mar 4, 2015, at 3:49 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
>
> The struct device_d * argument is not necessary, it can be retrieved from
> the FILE *. This adds a convenience function for doing this and removes
> the struct device_d * argument from the the filesystem drivers functions.
if you do so you should introduce fs_warn/info & co too
so we de not use dev_xxx version in fs
Best Regards,
J.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> fs/bpkfs.c | 10 +++++-----
> fs/cramfs/cramfs.c | 12 ++++++------
> fs/devfs.c | 22 +++++++++++-----------
> fs/efi.c | 12 ++++++------
> fs/ext4/ext_barebox.c | 12 ++++++------
> fs/fat/fat.c | 16 ++++++++--------
> fs/fs.c | 24 ++++++++++++------------
> fs/nfs.c | 31 +++++++++++++++++--------------
> fs/omap4_usbbootfs.c | 17 +++++++----------
> fs/ramfs.c | 14 +++++++-------
> fs/tftp.c | 21 +++++++++++----------
> fs/ubifs/ubifs.c | 10 +++++-----
> fs/uimagefs.c | 14 +++++++-------
> include/fs.h | 27 ++++++++++++++++-----------
> 14 files changed, 124 insertions(+), 118 deletions(-)
>
> diff --git a/fs/bpkfs.c b/fs/bpkfs.c
> index 1e2619e..94b5379 100644
> --- a/fs/bpkfs.c
> +++ b/fs/bpkfs.c
> @@ -126,9 +126,9 @@ static struct bpkfs_handle_data *bpkfs_get_by_type(
> return NULL;
> }
>
> -static int bpkfs_open(struct device_d *dev, FILE *f, const char *filename)
> +static int bpkfs_open(FILE *f, const char *filename)
> {
> - struct bpkfs_handle *priv = dev->priv;
> + struct bpkfs_handle *priv = fs_driver_priv(f);
> struct bpkfs_handle_data *d;
> struct bpkfs_handle_hw *h;
> char *dir, *file;
> @@ -170,7 +170,7 @@ out:
> return ret;
> }
>
> -static int bpkfs_close(struct device_d *dev, FILE *file)
> +static int bpkfs_close(FILE *file)
> {
> struct bpkfs_handle_data *d = file->priv;
>
> @@ -179,7 +179,7 @@ static int bpkfs_close(struct device_d *dev, FILE *file)
> return 0;
> }
>
> -static int bpkfs_read(struct device_d *dev, FILE *file, void *buf, size_t insize)
> +static int bpkfs_read(FILE *file, void *buf, size_t insize)
> {
> struct bpkfs_handle_data *d = file->priv;
>
> @@ -191,7 +191,7 @@ static int bpkfs_read(struct device_d *dev, FILE *file, void *buf, size_t insize
> }
> }
>
> -static loff_t bpkfs_lseek(struct device_d *dev, FILE *file, loff_t pos)
> +static loff_t bpkfs_lseek(FILE *file, loff_t pos)
> {
> struct bpkfs_handle_data *d = file->priv;
>
> diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c
> index fb92714..d53421b 100644
> --- a/fs/cramfs/cramfs.c
> +++ b/fs/cramfs/cramfs.c
> @@ -274,9 +274,9 @@ static int cramfs_closedir(struct device_d *dev, DIR *_dir)
> return 0;
> }
>
> -static int cramfs_open(struct device_d *_dev, FILE *file, const char *filename)
> +static int cramfs_open(FILE *file, const char *filename)
> {
> - struct cramfs_priv *priv = _dev->priv;
> + struct cramfs_priv *priv = fs_driver_priv(file);
> struct cramfs_inode_info *inodei;
> char *f;
>
> @@ -299,7 +299,7 @@ static int cramfs_open(struct device_d *_dev, FILE *file, const char *filename)
> return 0;
> }
>
> -static int cramfs_close(struct device_d *dev, FILE *file)
> +static int cramfs_close(FILE *file)
> {
> struct cramfs_inode_info *inodei = file->priv;
>
> @@ -309,9 +309,9 @@ static int cramfs_close(struct device_d *dev, FILE *file)
> return 0;
> }
>
> -static int cramfs_read(struct device_d *_dev, FILE *f, void *buf, size_t size)
> +static int cramfs_read(FILE *f, void *buf, size_t size)
> {
> - struct cramfs_priv *priv = _dev->priv;
> + struct cramfs_priv *priv = fs_driver_priv(f);
> struct cramfs_inode_info *inodei = f->priv;
> struct cramfs_inode *inode = &inodei->inode;
> unsigned int blocknr;
> @@ -358,7 +358,7 @@ static int cramfs_read(struct device_d *_dev, FILE *f, void *buf, size_t size)
> return outsize;
> }
>
> -static loff_t cramfs_lseek(struct device_d *dev, FILE *f, loff_t pos)
> +static loff_t cramfs_lseek(FILE *f, loff_t pos)
> {
> f->pos = pos;
> return f->pos;
> diff --git a/fs/devfs.c b/fs/devfs.c
> index c6db25c..4da21d4 100644
> --- a/fs/devfs.c
> +++ b/fs/devfs.c
> @@ -35,14 +35,14 @@
>
> extern struct list_head cdev_list;
>
> -static int devfs_read(struct device_d *_dev, FILE *f, void *buf, size_t size)
> +static int devfs_read(FILE *f, void *buf, size_t size)
> {
> struct cdev *cdev = f->priv;
>
> return cdev_read(cdev, buf, size, f->pos, f->flags);
> }
>
> -static int devfs_write(struct device_d *_dev, FILE *f, const void *buf, size_t size)
> +static int devfs_write(FILE *f, const void *buf, size_t size)
> {
> struct cdev *cdev = f->priv;
>
> @@ -52,7 +52,7 @@ static int devfs_write(struct device_d *_dev, FILE *f, const void *buf, size_t s
> return cdev_write(cdev, buf, size, f->pos, f->flags);
> }
>
> -static loff_t devfs_lseek(struct device_d *_dev, FILE *f, loff_t pos)
> +static loff_t devfs_lseek(FILE *f, loff_t pos)
> {
> struct cdev *cdev = f->priv;
> loff_t ret = -1;
> @@ -66,7 +66,7 @@ static loff_t devfs_lseek(struct device_d *_dev, FILE *f, loff_t pos)
> return ret - cdev->offset;
> }
>
> -static int devfs_erase(struct device_d *_dev, FILE *f, size_t count, loff_t offset)
> +static int devfs_erase(FILE *f, size_t count, loff_t offset)
> {
> struct cdev *cdev = f->priv;
>
> @@ -82,7 +82,7 @@ static int devfs_erase(struct device_d *_dev, FILE *f, size_t count, loff_t offs
> return cdev->ops->erase(cdev, count, offset + cdev->offset);
> }
>
> -static int devfs_protect(struct device_d *_dev, FILE *f, size_t count, loff_t offset, int prot)
> +static int devfs_protect(FILE *f, size_t count, loff_t offset, int prot)
> {
> struct cdev *cdev = f->priv;
>
> @@ -92,7 +92,7 @@ static int devfs_protect(struct device_d *_dev, FILE *f, size_t count, loff_t of
> return cdev->ops->protect(cdev, count, offset + cdev->offset, prot);
> }
>
> -static int devfs_memmap(struct device_d *_dev, FILE *f, void **map, int flags)
> +static int devfs_memmap(FILE *f, void **map, int flags)
> {
> struct cdev *cdev = f->priv;
> int ret = -ENOSYS;
> @@ -108,7 +108,7 @@ static int devfs_memmap(struct device_d *_dev, FILE *f, void **map, int flags)
> return ret;
> }
>
> -static int devfs_open(struct device_d *_dev, FILE *f, const char *filename)
> +static int devfs_open(FILE *f, const char *filename)
> {
> struct cdev *cdev;
> int ret;
> @@ -133,7 +133,7 @@ static int devfs_open(struct device_d *_dev, FILE *f, const char *filename)
> return 0;
> }
>
> -static int devfs_close(struct device_d *_dev, FILE *f)
> +static int devfs_close(FILE *f)
> {
> struct cdev *cdev = f->priv;
> int ret;
> @@ -149,7 +149,7 @@ static int devfs_close(struct device_d *_dev, FILE *f)
> return 0;
> }
>
> -static int devfs_flush(struct device_d *_dev, FILE *f)
> +static int devfs_flush(FILE *f)
> {
> struct cdev *cdev = f->priv;
>
> @@ -159,14 +159,14 @@ static int devfs_flush(struct device_d *_dev, FILE *f)
> return 0;
> }
>
> -static int devfs_ioctl(struct device_d *_dev, FILE *f, int request, void *buf)
> +static int devfs_ioctl(FILE *f, int request, void *buf)
> {
> struct cdev *cdev = f->priv;
>
> return cdev_ioctl(cdev, request, buf);
> }
>
> -static int devfs_truncate(struct device_d *dev, FILE *f, ulong size)
> +static int devfs_truncate(FILE *f, ulong size)
> {
> if (f->fsdev->dev.num_resources < 1)
> return -ENOSPC;
> diff --git a/fs/efi.c b/fs/efi.c
> index d64b15b..ae44f43 100644
> --- a/fs/efi.c
> +++ b/fs/efi.c
> @@ -204,7 +204,7 @@ static int efifs_rmdir(struct device_d *dev, const char *pathname)
> return efifs_unlink(dev, pathname);
> }
>
> -static int efifs_open(struct device_d *dev, FILE *f, const char *filename)
> +static int efifs_open(FILE *f, const char *filename)
> {
> struct efifs_priv *priv = fs_driver_priv(f);
> efi_status_t efiret;
> @@ -252,7 +252,7 @@ out:
> return ret;
> }
>
> -static int efifs_close(struct device_d *dev, FILE *f)
> +static int efifs_close(FILE *f)
> {
> struct efifs_file *ufile = f->priv;
>
> @@ -263,7 +263,7 @@ static int efifs_close(struct device_d *dev, FILE *f)
> return 0;
> }
>
> -static int efifs_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
> +static int efifs_read(FILE *f, void *buf, size_t insize)
> {
> struct efifs_file *ufile = f->priv;
> efi_status_t efiret;
> @@ -277,7 +277,7 @@ static int efifs_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
> return bufsize;
> }
>
> -static int efifs_write(struct device_d *_dev, FILE *f, const void *buf, size_t insize)
> +static int efifs_write(FILE *f, const void *buf, size_t insize)
> {
> struct efifs_file *ufile = f->priv;
> efi_status_t efiret;
> @@ -292,7 +292,7 @@ static int efifs_write(struct device_d *_dev, FILE *f, const void *buf, size_t i
> return bufsize;
> }
>
> -static loff_t efifs_lseek(struct device_d *dev, FILE *f, loff_t pos)
> +static loff_t efifs_lseek(FILE *f, loff_t pos)
> {
> struct efifs_file *ufile = f->priv;
> efi_status_t efiret;
> @@ -307,7 +307,7 @@ static loff_t efifs_lseek(struct device_d *dev, FILE *f, loff_t pos)
> return f->pos;
> }
>
> -static int efifs_truncate(struct device_d *dev, FILE *f, unsigned long size)
> +static int efifs_truncate(FILE *f, unsigned long size)
> {
> struct efifs_file *ufile = f->priv;
> efi_status_t efiret;
> diff --git a/fs/ext4/ext_barebox.c b/fs/ext4/ext_barebox.c
> index 5ec7ecd..3ffb634 100644
> --- a/fs/ext4/ext_barebox.c
> +++ b/fs/ext4/ext_barebox.c
> @@ -46,9 +46,9 @@ int ext4fs_devread(struct ext_filesystem *fs, int __sector, int byte_offset,
> return 0;
> }
>
> -static int ext_open(struct device_d *dev, FILE *file, const char *filename)
> +static int ext_open(FILE *file, const char *filename)
> {
> - struct ext_filesystem *fs = dev->priv;
> + struct ext_filesystem *fs = fs_driver_priv(file);
> struct ext2fs_node *inode;
> int ret;
>
> @@ -62,21 +62,21 @@ static int ext_open(struct device_d *dev, FILE *file, const char *filename)
> return 0;
> }
>
> -static int ext_close(struct device_d *dev, FILE *f)
> +static int ext_close(FILE *f)
> {
> - struct ext_filesystem *fs = dev->priv;
> + struct ext_filesystem *fs = fs_driver_priv(f);
>
> ext4fs_free_node(f->priv, &fs->data->diropen);
>
> return 0;
> }
>
> -static int ext_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
> +static int ext_read(FILE *f, void *buf, size_t insize)
> {
> return ext4fs_read_file(f->priv, f->pos, insize, buf);
> }
>
> -static loff_t ext_lseek(struct device_d *dev, FILE *f, loff_t pos)
> +static loff_t ext_lseek(FILE *f, loff_t pos)
> {
> f->pos = pos;
>
> diff --git a/fs/fat/fat.c b/fs/fat/fat.c
> index 6d7d262..abe44dd 100644
> --- a/fs/fat/fat.c
> +++ b/fs/fat/fat.c
> @@ -159,7 +159,7 @@ static int fat_rmdir(struct device_d *dev, const char *pathname)
> return 0;
> }
>
> -static int fat_write(struct device_d *_dev, FILE *f, const void *buf, size_t insize)
> +static int fat_write(FILE *f, const void *buf, size_t insize)
> {
> FIL *f_file = f->priv;
> int outsize;
> @@ -177,7 +177,7 @@ static int fat_write(struct device_d *_dev, FILE *f, const void *buf, size_t ins
> return outsize;
> }
>
> -static int fat_truncate(struct device_d *dev, FILE *f, ulong size)
> +static int fat_truncate(FILE *f, ulong size)
> {
> FIL *f_file = f->priv;
> unsigned long lastofs;
> @@ -201,9 +201,9 @@ static int fat_truncate(struct device_d *dev, FILE *f, ulong size)
> }
> #endif /* CONFIG_FS_FAT_WRITE */
>
> -static int fat_open(struct device_d *dev, FILE *file, const char *filename)
> +static int fat_open(FILE *file, const char *filename)
> {
> - struct fat_priv *priv = dev->priv;
> + struct fat_priv *priv = fs_driver_priv(file);
> FIL *f_file;
> int ret;
> unsigned long flags = 0;
> @@ -238,9 +238,9 @@ static int fat_open(struct device_d *dev, FILE *file, const char *filename)
> return 0;
> }
>
> -static int fat_close(struct device_d *dev, FILE *f)
> +static int fat_close(FILE *f)
> {
> - struct fat_priv *priv = dev->priv;
> + struct fat_priv *priv = fs_driver_priv(f);
> FIL *f_file = f->priv;
>
> f_close(f_file);
> @@ -252,7 +252,7 @@ static int fat_close(struct device_d *dev, FILE *f)
> return 0;
> }
>
> -static int fat_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
> +static int fat_read(FILE *f, void *buf, size_t insize)
> {
> int ret;
> FIL *f_file = f->priv;
> @@ -268,7 +268,7 @@ static int fat_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
> return outsize;
> }
>
> -static loff_t fat_lseek(struct device_d *dev, FILE *f, loff_t pos)
> +static loff_t fat_lseek(FILE *f, loff_t pos)
> {
> FIL *f_file = f->priv;
> int ret;
> diff --git a/fs/fs.c b/fs/fs.c
> index ffdfa2c..7d057ed 100644
> --- a/fs/fs.c
> +++ b/fs/fs.c
> @@ -675,12 +675,12 @@ int open(const char *pathname, int flags, ...)
>
> f->path = xstrdup(path);
>
> - ret = fsdrv->open(&fsdev->dev, f, path);
> + ret = fsdrv->open(f, path);
> if (ret)
> goto out;
>
> if (!(s.st_mode & S_IFCHR) && (flags & O_TRUNC)) {
> - ret = fsdrv->truncate(&fsdev->dev, f, 0);
> + ret = fsdrv->truncate(f, 0);
> f->size = 0;
> if (ret)
> goto out;
> @@ -722,7 +722,7 @@ int ioctl(int fd, int request, void *buf)
> fsdrv = f->fsdev->driver;
>
> if (fsdrv->ioctl)
> - ret = fsdrv->ioctl(&f->fsdev->dev, f, request, buf);
> + ret = fsdrv->ioctl(f, request, buf);
> else
> ret = -ENOSYS;
> if (ret)
> @@ -743,7 +743,7 @@ static ssize_t __read(FILE *f, void *buf, size_t count)
> if (!count)
> return 0;
>
> - ret = fsdrv->read(&f->fsdev->dev, f, buf, count);
> + ret = fsdrv->read(f, buf, count);
>
> if (ret < 0)
> errno = -ret;
> @@ -795,7 +795,7 @@ static ssize_t __write(FILE *f, const void *buf, size_t count)
>
> fsdrv = f->fsdev->driver;
> if (f->size != FILE_SIZE_STREAM && f->pos + count > f->size) {
> - ret = fsdrv->truncate(&f->fsdev->dev, f, f->pos + count);
> + ret = fsdrv->truncate(f, f->pos + count);
> if (ret) {
> if (ret != -ENOSPC)
> goto out;
> @@ -806,7 +806,7 @@ static ssize_t __write(FILE *f, const void *buf, size_t count)
> f->size = f->pos + count;
> }
> }
> - ret = fsdrv->write(&f->fsdev->dev, f, buf, count);
> + ret = fsdrv->write(f, buf, count);
> out:
> if (ret < 0)
> errno = -ret;
> @@ -864,7 +864,7 @@ int flush(int fd)
>
> fsdrv = f->fsdev->driver;
> if (fsdrv->flush)
> - ret = fsdrv->flush(&f->fsdev->dev, f);
> + ret = fsdrv->flush(f);
> else
> ret = 0;
>
> @@ -913,7 +913,7 @@ loff_t lseek(int fildes, loff_t offset, int whence)
> goto out;
> }
>
> - return fsdrv->lseek(&f->fsdev->dev, f, pos);
> + return fsdrv->lseek(f, pos);
>
> out:
> if (ret)
> @@ -939,7 +939,7 @@ int erase(int fd, size_t count, unsigned long offset)
>
> fsdrv = f->fsdev->driver;
> if (fsdrv->erase)
> - ret = fsdrv->erase(&f->fsdev->dev, f, count, offset);
> + ret = fsdrv->erase(f, count, offset);
> else
> ret = -ENOSYS;
>
> @@ -966,7 +966,7 @@ int protect(int fd, size_t count, unsigned long offset, int prot)
>
> fsdrv = f->fsdev->driver;
> if (fsdrv->protect)
> - ret = fsdrv->protect(&f->fsdev->dev, f, count, offset, prot);
> + ret = fsdrv->protect(f, count, offset, prot);
> else
> ret = -ENOSYS;
>
> @@ -1007,7 +1007,7 @@ void *memmap(int fd, int flags)
> fsdrv = f->fsdev->driver;
>
> if (fsdrv->memmap)
> - ret = fsdrv->memmap(&f->fsdev->dev, f, &retp, flags);
> + ret = fsdrv->memmap(f, &retp, flags);
> else
> ret = -EINVAL;
>
> @@ -1030,7 +1030,7 @@ int close(int fd)
> f = &files[fd];
>
> fsdrv = f->fsdev->driver;
> - ret = fsdrv->close(&f->fsdev->dev, f);
> + ret = fsdrv->close(f);
>
> put_file(f);
>
> diff --git a/fs/nfs.c b/fs/nfs.c
> index 2738c78..d6da791 100644
> --- a/fs/nfs.c
> +++ b/fs/nfs.c
> @@ -971,16 +971,15 @@ static int nfs_rmdir(struct device_d *dev, const char *pathname)
> return -ENOSYS;
> }
>
> -static int nfs_truncate(struct device_d *dev, FILE *f, ulong size)
> +static int nfs_truncate(FILE *f, ulong size)
> {
> return -ENOSYS;
> }
>
> -static struct file_priv *nfs_do_open(struct device_d *dev,
> +static struct file_priv *nfs_do_open(struct nfs_priv *npriv,
> const char *filename, struct stat **s)
> {
> struct file_priv *priv;
> - struct nfs_priv *npriv = dev->priv;
> int ret;
> const char *tok;
>
> @@ -1035,7 +1034,7 @@ static void nfs_do_close(struct file_priv *priv)
> free(priv);
> }
>
> -static struct file_priv *nfs_do_stat(struct device_d *dev,
> +static struct file_priv *nfs_do_stat(struct nfs_priv *npriv,
> const char *filename, struct stat *s)
> {
> struct file_priv *priv;
> @@ -1043,7 +1042,7 @@ static struct file_priv *nfs_do_stat(struct device_d *dev,
> struct stat **sptr = &s;
>
> debug("%s: filename = %s\n", __func__, filename);
> - priv = nfs_do_open(dev, filename, sptr);
> + priv = nfs_do_open(npriv, filename, sptr);
> if (IS_ERR(priv))
> return priv;
>
> @@ -1119,10 +1118,11 @@ static int nfs_readlink_req(struct file_priv *priv, char* buf, size_t size)
> static int nfs_readlink(struct device_d *dev, const char *filename,
> char *realname, size_t size)
> {
> + struct nfs_priv *npriv = dev->priv;
> struct file_priv *priv;
> int ret;
>
> - priv = nfs_do_open(dev, filename, NULL);
> + priv = nfs_do_open(npriv, filename, NULL);
> if (IS_ERR(priv))
> return PTR_ERR(priv);
>
> @@ -1135,12 +1135,13 @@ static int nfs_readlink(struct device_d *dev, const char *filename,
> return 0;
> }
>
> -static int nfs_open(struct device_d *dev, FILE *file, const char *filename)
> +static int nfs_open(FILE *file, const char *filename)
> {
> + struct nfs_priv *npriv = fs_driver_priv(file);
> struct file_priv *priv;
> struct stat s;
>
> - priv = nfs_do_stat(dev, filename, &s);
> + priv = nfs_do_stat(npriv, filename, &s);
> if (IS_ERR(priv))
> return PTR_ERR(priv);
>
> @@ -1156,7 +1157,7 @@ static int nfs_open(struct device_d *dev, FILE *file, const char *filename)
> return 0;
> }
>
> -static int nfs_close(struct device_d *dev, FILE *file)
> +static int nfs_close(FILE *file)
> {
> struct file_priv *priv = file->priv;
>
> @@ -1165,13 +1166,13 @@ static int nfs_close(struct device_d *dev, FILE *file)
> return 0;
> }
>
> -static int nfs_write(struct device_d *_dev, FILE *file, const void *inbuf,
> +static int nfs_write(FILE *file, const void *inbuf,
> size_t insize)
> {
> return -ENOSYS;
> }
>
> -static int nfs_read(struct device_d *dev, FILE *file, void *buf, size_t insize)
> +static int nfs_read(FILE *file, void *buf, size_t insize)
> {
> struct file_priv *priv = file->priv;
>
> @@ -1187,7 +1188,7 @@ static int nfs_read(struct device_d *dev, FILE *file, void *buf, size_t insize)
> return kfifo_get(priv->fifo, buf, insize);
> }
>
> -static loff_t nfs_lseek(struct device_d *dev, FILE *file, loff_t pos)
> +static loff_t nfs_lseek(FILE *file, loff_t pos)
> {
> struct file_priv *priv = file->priv;
>
> @@ -1199,11 +1200,12 @@ static loff_t nfs_lseek(struct device_d *dev, FILE *file, loff_t pos)
>
> static DIR *nfs_opendir(struct device_d *dev, const char *pathname)
> {
> + struct nfs_priv *npriv = dev->priv;
> struct file_priv *priv;
> void *buf = NULL;
> struct nfs_dir *dir;
>
> - priv = nfs_do_open(dev, pathname, NULL);
> + priv = nfs_do_open(npriv, pathname, NULL);
> if (IS_ERR(priv))
> return NULL;
>
> @@ -1295,9 +1297,10 @@ static int nfs_closedir(struct device_d *dev, DIR *dir)
>
> static int nfs_stat(struct device_d *dev, const char *filename, struct stat *s)
> {
> + struct nfs_priv *npriv = dev->priv;
> struct file_priv *priv;
>
> - priv = nfs_do_stat(dev, filename, s);
> + priv = nfs_do_stat(npriv, filename, s);
> if (IS_ERR(priv)) {
> return PTR_ERR(priv);
> } else {
> diff --git a/fs/omap4_usbbootfs.c b/fs/omap4_usbbootfs.c
> index 6085bca..7dba0c5 100644
> --- a/fs/omap4_usbbootfs.c
> +++ b/fs/omap4_usbbootfs.c
> @@ -63,8 +63,7 @@ static int omap4_usbbootfs_truncate(struct device_d *dev, FILE *f, ulong size)
> }
> */
>
> -static struct file_priv *omap4_usbbootfs_do_open(
> - struct device_d *dev, int accmode, const char *filename)
> +static struct file_priv *omap4_usbbootfs_do_open(int accmode, const char *filename)
> {
> struct file_priv *priv;
> u32 data;
> @@ -95,12 +94,11 @@ static struct file_priv *omap4_usbbootfs_do_open(
> return priv;
> }
>
> -static int omap4_usbbootfs_open(
> - struct device_d *dev, FILE *file, const char *filename)
> +static int omap4_usbbootfs_open(FILE *file, const char *filename)
> {
> struct file_priv *priv;
>
> - priv = omap4_usbbootfs_do_open(dev, file->flags, filename);
> + priv = omap4_usbbootfs_do_open(file->flags, filename);
> if (IS_ERR(priv))
> return PTR_ERR(priv);
>
> @@ -121,14 +119,13 @@ static int omap4_usbbootfs_do_close(struct file_priv *priv)
> return 0;
> }
>
> -static int omap4_usbbootfs_close(struct device_d *dev, FILE *f)
> +static int omap4_usbbootfs_close(FILE *f)
> {
> struct file_priv *priv = f->priv;
> return omap4_usbbootfs_do_close(priv);
> }
>
> -static int omap4_usbbootfs_read(
> - struct device_d *dev, FILE *f, void *buf, size_t size)
> +static int omap4_usbbootfs_read(FILE *f, void *buf, size_t size)
> {
> struct file_priv *priv = f->priv;
> u32 data;
> @@ -151,7 +148,7 @@ static int omap4_usbbootfs_read(
> return size;
> }
>
> -static loff_t omap4_usbbootfs_lseek(struct device_d *dev, FILE *f, loff_t pos)
> +static loff_t omap4_usbbootfs_lseek(FILE *f, loff_t pos)
> {
> f->pos = pos;
> return pos;
> @@ -167,7 +164,7 @@ static int omap4_usbbootfs_stat(
> {
> struct file_priv *priv;
>
> - priv = omap4_usbbootfs_do_open(dev, O_RDONLY, filename);
> + priv = omap4_usbbootfs_do_open(O_RDONLY, filename);
> if (IS_ERR(priv))
> return PTR_ERR(priv);
>
> diff --git a/fs/ramfs.c b/fs/ramfs.c
> index fe5eb89..995b517 100644
> --- a/fs/ramfs.c
> +++ b/fs/ramfs.c
> @@ -302,9 +302,9 @@ static int ramfs_rmdir(struct device_d *dev, const char *pathname)
> return -ENOENT;
> }
>
> -static int ramfs_open(struct device_d *dev, FILE *file, const char *filename)
> +static int ramfs_open(FILE *file, const char *filename)
> {
> - struct ramfs_priv *priv = dev->priv;
> + struct ramfs_priv *priv = fs_driver_priv(file);
> struct ramfs_inode *node = rlookup(priv, filename);
>
> if (!node)
> @@ -315,7 +315,7 @@ static int ramfs_open(struct device_d *dev, FILE *file, const char *filename)
> return 0;
> }
>
> -static int ramfs_close(struct device_d *dev, FILE *f)
> +static int ramfs_close(FILE *f)
> {
> return 0;
> }
> @@ -349,7 +349,7 @@ static struct ramfs_chunk *ramfs_find_chunk(struct ramfs_inode *node, int chunk)
> return data;
> }
>
> -static int ramfs_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
> +static int ramfs_read(FILE *f, void *buf, size_t insize)
> {
> struct ramfs_inode *node = f->priv;
> int chunk;
> @@ -398,7 +398,7 @@ static int ramfs_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
> return insize;
> }
>
> -static int ramfs_write(struct device_d *_dev, FILE *f, const void *buf, size_t insize)
> +static int ramfs_write(FILE *f, const void *buf, size_t insize)
> {
> struct ramfs_inode *node = f->priv;
> int chunk;
> @@ -447,13 +447,13 @@ static int ramfs_write(struct device_d *_dev, FILE *f, const void *buf, size_t i
> return insize;
> }
>
> -static loff_t ramfs_lseek(struct device_d *dev, FILE *f, loff_t pos)
> +static loff_t ramfs_lseek(FILE *f, loff_t pos)
> {
> f->pos = pos;
> return f->pos;
> }
>
> -static int ramfs_truncate(struct device_d *dev, FILE *f, ulong size)
> +static int ramfs_truncate(FILE *f, ulong size)
> {
> struct ramfs_inode *node = f->priv;
> int oldchunks, newchunks;
> diff --git a/fs/tftp.c b/fs/tftp.c
> index 72e4983..6b6d1bd 100644
> --- a/fs/tftp.c
> +++ b/fs/tftp.c
> @@ -110,7 +110,7 @@ static int tftp_rmdir(struct device_d *dev, const char *pathname)
> return -ENOSYS;
> }
>
> -static int tftp_truncate(struct device_d *dev, FILE *f, ulong size)
> +static int tftp_truncate(FILE *f, ulong size)
> {
> return 0;
> }
> @@ -376,11 +376,10 @@ static void tftp_handler(void *ctx, char *packet, unsigned len)
> }
> }
>
> -static struct file_priv *tftp_do_open(struct device_d *dev,
> +static struct file_priv *tftp_do_open(struct tftp_priv *tpriv,
> int accmode, const char *filename)
> {
> struct file_priv *priv;
> - struct tftp_priv *tpriv = dev->priv;
> int ret;
>
> priv = xzalloc(sizeof(*priv));
> @@ -461,11 +460,12 @@ out:
> return ERR_PTR(ret);
> }
>
> -static int tftp_open(struct device_d *dev, FILE *file, const char *filename)
> +static int tftp_open(FILE *file, const char *filename)
> {
> struct file_priv *priv;
> + struct tftp_priv *tpriv = fs_driver_priv(file);
>
> - priv = tftp_do_open(dev, file->flags, filename);
> + priv = tftp_do_open(tpriv, file->flags, filename);
> if (IS_ERR(priv))
> return PTR_ERR(priv);
>
> @@ -513,14 +513,14 @@ static int tftp_do_close(struct file_priv *priv)
> return 0;
> }
>
> -static int tftp_close(struct device_d *dev, FILE *f)
> +static int tftp_close(FILE *f)
> {
> struct file_priv *priv = f->priv;
>
> return tftp_do_close(priv);
> }
>
> -static int tftp_write(struct device_d *_dev, FILE *f, const void *inbuf,
> +static int tftp_write(FILE *f, const void *inbuf,
> size_t insize)
> {
> struct file_priv *priv = f->priv;
> @@ -556,7 +556,7 @@ static int tftp_write(struct device_d *_dev, FILE *f, const void *inbuf,
> return insize;
> }
>
> -static int tftp_read(struct device_d *dev, FILE *f, void *buf, size_t insize)
> +static int tftp_read(FILE *f, void *buf, size_t insize)
> {
> struct file_priv *priv = f->priv;
> size_t outsize = 0, now;
> @@ -587,7 +587,7 @@ static int tftp_read(struct device_d *dev, FILE *f, void *buf, size_t insize)
> return outsize;
> }
>
> -static loff_t tftp_lseek(struct device_d *dev, FILE *f, loff_t pos)
> +static loff_t tftp_lseek(FILE *f, loff_t pos)
> {
> /* not implemented in tftp protocol */
> return -ENOSYS;
> @@ -602,8 +602,9 @@ static DIR* tftp_opendir(struct device_d *dev, const char *pathname)
> static int tftp_stat(struct device_d *dev, const char *filename, struct stat *s)
> {
> struct file_priv *priv;
> + struct tftp_priv *tpriv = dev->priv;
>
> - priv = tftp_do_open(dev, O_RDONLY, filename);
> + priv = tftp_do_open(tpriv, O_RDONLY, filename);
> if (IS_ERR(priv))
> return PTR_ERR(priv);
>
> diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
> index 68d90b3..7c143d7 100644
> --- a/fs/ubifs/ubifs.c
> +++ b/fs/ubifs/ubifs.c
> @@ -332,9 +332,9 @@ struct ubifs_file {
> struct ubifs_data_node *dn;
> };
>
> -static int ubifs_open(struct device_d *dev, FILE *file, const char *filename)
> +static int ubifs_open(FILE *file, const char *filename)
> {
> - struct ubifs_priv *priv = dev->priv;
> + struct ubifs_priv *priv = fs_driver_priv(file);
> struct inode *inode;
> struct ubifs_file *uf;
>
> @@ -355,7 +355,7 @@ static int ubifs_open(struct device_d *dev, FILE *file, const char *filename)
> return 0;
> }
>
> -static int ubifs_close(struct device_d *dev, FILE *f)
> +static int ubifs_close(FILE *f)
> {
> struct ubifs_file *uf = f->priv;
> struct inode *inode = uf->inode;
> @@ -384,7 +384,7 @@ static int ubifs_get_block(struct ubifs_file *uf, unsigned int pos)
> return 0;
> }
>
> -static int ubifs_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
> +static int ubifs_read(FILE *f, void *buf, size_t insize)
> {
> struct ubifs_file *uf = f->priv;
> unsigned int pos = f->pos;
> @@ -431,7 +431,7 @@ static int ubifs_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
> return insize;
> }
>
> -static loff_t ubifs_lseek(struct device_d *dev, FILE *f, loff_t pos)
> +static loff_t ubifs_lseek(FILE *f, loff_t pos)
> {
> f->pos = pos;
>
> diff --git a/fs/uimagefs.c b/fs/uimagefs.c
> index 3fdc5bd..a796e62 100644
> --- a/fs/uimagefs.c
> +++ b/fs/uimagefs.c
> @@ -68,9 +68,9 @@ static struct uimagefs_handle_data *uimagefs_get_by_name(
> return NULL;
> }
>
> -static int uimagefs_open(struct device_d *dev, FILE *file, const char *filename)
> +static int uimagefs_open(FILE *file, const char *filename)
> {
> - struct uimagefs_handle *priv = dev->priv;
> + struct uimagefs_handle *priv = fs_driver_priv(file);
> struct uimagefs_handle_data *d;
>
> if (filename[0] == '/')
> @@ -94,7 +94,7 @@ static int uimagefs_open(struct device_d *dev, FILE *file, const char *filename)
> return 0;
> }
>
> -static int uimagefs_close(struct device_d *dev, FILE *file)
> +static int uimagefs_close(FILE *file)
> {
> struct uimagefs_handle_data *d = file->priv;
>
> @@ -103,7 +103,7 @@ static int uimagefs_close(struct device_d *dev, FILE *file)
> return 0;
> }
>
> -static int uimagefs_read(struct device_d *dev, FILE *file, void *buf, size_t insize)
> +static int uimagefs_read(FILE *file, void *buf, size_t insize)
> {
> struct uimagefs_handle_data *d = file->priv;
>
> @@ -115,7 +115,7 @@ static int uimagefs_read(struct device_d *dev, FILE *file, void *buf, size_t ins
> }
> }
>
> -static loff_t uimagefs_lseek(struct device_d *dev, FILE *file, loff_t pos)
> +static loff_t uimagefs_lseek(FILE *file, loff_t pos)
> {
> struct uimagefs_handle_data *d = file->priv;
>
> @@ -179,9 +179,9 @@ static int uimagefs_stat(struct device_d *dev, const char *filename, struct stat
> return 0;
> }
>
> -static int uimagefs_ioctl(struct device_d *dev, FILE *f, int request, void *buf)
> +static int uimagefs_ioctl(FILE *f, int request, void *buf)
> {
> - struct uimagefs_handle *priv = dev->priv;
> + struct uimagefs_handle *priv = fs_driver_priv(f);
>
> if (request != UIMAGEFS_METADATA)
> return -EINVAL;
> diff --git a/include/fs.h b/include/fs.h
> index 61d7439..a25d674 100644
> --- a/include/fs.h
> +++ b/include/fs.h
> @@ -49,32 +49,32 @@ struct fs_driver_d {
> int (*unlink)(struct device_d *dev, const char *pathname);
>
> /* Truncate a file to given size */
> - int (*truncate)(struct device_d *dev, FILE *f, ulong size);
> + int (*truncate)(FILE *f, ulong size);
>
> int (*symlink)(struct device_d *dev, const char *pathname,
> const char *newpath);
> int (*readlink)(struct device_d *dev, const char *pathname, char *name,
> size_t size);
>
> - int (*open)(struct device_d *dev, FILE *f, const char *pathname);
> - int (*close)(struct device_d *dev, FILE *f);
> - int (*read)(struct device_d *dev, FILE *f, void *buf, size_t size);
> - int (*write)(struct device_d *dev, FILE *f, const void *buf, size_t size);
> - int (*flush)(struct device_d *dev, FILE *f);
> - loff_t (*lseek)(struct device_d *dev, FILE *f, loff_t pos);
> + int (*open)(FILE *f, const char *pathname);
> + int (*close)(FILE *f);
> + int (*read)(FILE *f, void *buf, size_t size);
> + int (*write)(FILE *f, const void *buf, size_t size);
> + int (*flush)(FILE *f);
> + loff_t (*lseek)(FILE *f, loff_t pos);
>
> struct dir* (*opendir)(struct device_d *dev, const char *pathname);
> struct dirent* (*readdir)(struct device_d *dev, struct dir *dir);
> int (*closedir)(struct device_d *dev, DIR *dir);
> int (*stat)(struct device_d *dev, const char *file, struct stat *stat);
>
> - int (*ioctl)(struct device_d *dev, FILE *f, int request, void *buf);
> - int (*erase)(struct device_d *dev, FILE *f, size_t count,
> + int (*ioctl)(FILE *f, int request, void *buf);
> + int (*erase)(FILE *f, size_t count,
> loff_t offset);
> - int (*protect)(struct device_d *dev, FILE *f, size_t count,
> + int (*protect)(FILE *f, size_t count,
> loff_t offset, int prot);
>
> - int (*memmap)(struct device_d *dev, FILE *f, void **map, int flags);
> + int (*memmap)(FILE *f, void **map, int flags);
>
> struct driver_d drv;
>
> @@ -102,6 +102,11 @@ struct fs_device_d {
> char *options;
> };
>
> +static inline void *fs_driver_priv(struct filep *f)
> +{
> + return f->fsdev->dev.priv;
> +}
> +
> #define drv_to_fs_driver(d) container_of(d, struct fs_driver_d, drv)
>
> /*
> --
> 2.1.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] remove unnecessary device pointer argument
2015-03-04 8:43 ` [PATCH 2/2] " Jean-Christophe PLAGNIOL-VILLARD
@ 2015-03-04 10:45 ` Sascha Hauer
2015-03-04 16:24 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2015-03-04 10:45 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: Barebox List
On Wed, Mar 04, 2015 at 04:43:13PM +0800, Jean-Christophe PLAGNIOL-VILLARD wrote:
>
> > On Mar 4, 2015, at 3:49 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> >
> > The struct device_d * argument is not necessary, it can be retrieved from
> > the FILE *. This adds a convenience function for doing this and removes
> > the struct device_d * argument from the the filesystem drivers functions.
>
> if you do so you should introduce fs_warn/info & co too
>
> so we de not use dev_xxx version in fs
We can do that, but it's independent of these patches, right?
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] remove unnecessary device pointer argument
2015-03-04 10:45 ` Sascha Hauer
@ 2015-03-04 16:24 ` Jean-Christophe PLAGNIOL-VILLARD
2015-03-05 8:42 ` Sascha Hauer
0 siblings, 1 reply; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2015-03-04 16:24 UTC (permalink / raw)
To: Sascha Hauer; +Cc: Barebox List
> On Mar 4, 2015, at 6:45 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
>
> On Wed, Mar 04, 2015 at 04:43:13PM +0800, Jean-Christophe PLAGNIOL-VILLARD wrote:
>>
>>> On Mar 4, 2015, at 3:49 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
>>>
>>> The struct device_d * argument is not necessary, it can be retrieved from
>>> the FILE *. This adds a convenience function for doing this and removes
>>> the struct device_d * argument from the the filesystem drivers functions.
>>
>> if you do so you should introduce fs_warn/info & co too
>>
>> so we de not use dev_xxx version in fs
>
> We can do that, but it's independent of these patches, right?
I’d said no as we drop the device_d we need drop dev_xxx too
to be logic
Best Regards,
J.
>
> Sascha
>
> --
> Pengutronix e.K. | |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] remove unnecessary device pointer argument
2015-03-04 16:24 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2015-03-05 8:42 ` Sascha Hauer
0 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2015-03-05 8:42 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: Barebox List
On Thu, Mar 05, 2015 at 12:24:57AM +0800, Jean-Christophe PLAGNIOL-VILLARD wrote:
>
> > On Mar 4, 2015, at 6:45 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> >
> > On Wed, Mar 04, 2015 at 04:43:13PM +0800, Jean-Christophe PLAGNIOL-VILLARD wrote:
> >>
> >>> On Mar 4, 2015, at 3:49 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> >>>
> >>> The struct device_d * argument is not necessary, it can be retrieved from
> >>> the FILE *. This adds a convenience function for doing this and removes
> >>> the struct device_d * argument from the the filesystem drivers functions.
> >>
> >> if you do so you should introduce fs_warn/info & co too
> >>
> >> so we de not use dev_xxx version in fs
> >
> > We can do that, but it's independent of these patches, right?
> I’d said no as we drop the device_d we need drop dev_xxx too
> to be logic
I don't understand why this is releated but if you wish I just drop this
patch.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-03-05 8:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-04 7:49 [PATCH 1/2] fs: rename inode member of struct filep to priv Sascha Hauer
2015-03-04 7:49 ` [PATCH 2/2] fs: remove unnecessary device pointer argument Sascha Hauer
2015-03-04 8:43 ` [PATCH 2/2] " Jean-Christophe PLAGNIOL-VILLARD
2015-03-04 10:45 ` Sascha Hauer
2015-03-04 16:24 ` Jean-Christophe PLAGNIOL-VILLARD
2015-03-05 8:42 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox