From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Machek Date: Wed, 8 Oct 2014 23:45:16 +0200 Subject: [U-Boot] [PATCH v1 1/1] fs: fat/ext4/sandbox: Deal with files > 2GB in ls and size commands In-Reply-To: References: <1412799828-3412-1-git-send-email-suriyan.r@gmail.com> <20141008203554.GA9751@amd> Message-ID: <20141008214516.GB9751@amd> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed 2014-10-08 14:08:45, Suriyan Ramasami wrote: > On Wed, Oct 8, 2014 at 1:35 PM, Pavel Machek wrote: > > On Wed 2014-10-08 13:23:48, Suriyan Ramasami wrote: > >> The commands fatls/ext4ls give -ve values when dealing with files > 2GB. > >> The commands fatsize/ext4size do not update the variable filesize for > >> these files. > >> > >> To deal with this, the functions *_size have been modified to take a second > >> parameter of type "* off_t" which is then populated. The return value of the > >> *_size function is then only used to determine error conditions. > > > > Would not it be better to simply change return type of affected > > functions to off_t? > > > > (If off_t is unsigned, invent signed off_t. It is still nicer than > > extra parameter.) > >> > > off_t is 32 bits in 32 bit architectures. So, signed or unsigned it > shall always have a case where it will be impossible to detect a valid > file size vs an error condition, right? > For example if we return 0xFFFFFFFF, is that an error condition or the > actual file size? > Another approach would be to make the return value off64_t, but then > in sandbox cases we will hit the same issue of differentiating a valid > file size vs an error condition (although we possibly would never have > such a huge file) I'd just make it off64_t. Because otherwise you fixed files in 2GB..4GB range, but still have problems for >4GB files. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html