From: Sascha Hauer <s.hauer@pengutronix.de>
To: "Loïc Minier" <lool@dooz.org>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 5/5] Use size_t for memory offsets
Date: Fri, 14 Oct 2011 14:11:58 +0200 [thread overview]
Message-ID: <20111014121158.GF13898@pengutronix.de> (raw)
In-Reply-To: <20111014085903.GA26536@bee.dooz.org>
On Fri, Oct 14, 2011 at 10:59:03AM +0200, Loïc Minier wrote:
> On Fri, Oct 14, 2011, Sascha Hauer wrote:
> > You should change the prototypes in include/driver.h aswell.
>
> Ah thanks, now it strikes me that the very same constructs are present
> in many file_operations implementations; e.g. imx_iim_cdev_read and
> imx_iim_cdev_write also use an ulong offset, as well as
> ubi_volume_cdev_read/ubi_volume_cdev_write (unsigned long), lp_read,
> miidev_read/_write etc.
>
> I had a look at file_operations in linux now, and it uses
> size_t/ssize_t and a loff_t type for regular read/write:
> struct file_operations {
> loff_t (*llseek) (struct file *, loff_t, int);
> ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
> ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
>
> however for aio:
> ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
> ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
>
> loff_t is defined as long long on 32-bits and 64-bits arches, which I
> believe are both 8 bytes.
>
> So perhaps it's better to switch from ulong to unsigned long long for
> offsets? This isn't important for mem_read/mem_write, but it would be
> for e.g. MMC accesses as it's of course valid to seek after the first
> 4 G of a MMC on a 32-bits system.
Yes, an 8 byte type would be definitely better for file offsets. It
would be a first step to support SD cards > 4G. I have looked into
this several times before and ended up with huge patches everytime
I tried.
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
prev parent reply other threads:[~2011-10-14 12:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-13 22:06 [RFC] Fix misc warnings when building sandbox on 64-bits Loïc Minier
2011-10-13 22:06 ` [PATCH 1/5] Only pass -P to cpp when generating ld scripts Loïc Minier
2011-10-13 22:06 ` [PATCH 2/5] Avoid warnings by using format(__printf__) Loïc Minier
2011-10-14 6:50 ` Sascha Hauer
2011-10-13 22:06 ` [PATCH 3/5] fprintf() returns an int Loïc Minier
2011-10-14 7:04 ` Sascha Hauer
2011-10-13 22:06 ` [PATCH 4/5] Use %p in format for pointers Loïc Minier
2011-10-14 7:18 ` Sascha Hauer
2011-10-14 7:22 ` Sascha Hauer
2011-10-13 22:06 ` [PATCH 5/5] Use size_t for memory offsets Loïc Minier
2011-10-14 7:20 ` Sascha Hauer
2011-10-14 8:59 ` Loïc Minier
2011-10-14 12:11 ` Sascha Hauer [this message]
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=20111014121158.GF13898@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=lool@dooz.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