[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] stat() and blocks
- To: mint@lists.fishpool.fi
- Subject: Re: [MiNT] stat() and blocks
- From: Vincent Rivière <vincent.riviere@freesbee.fr>
- Date: Thu, 10 Sep 2009 10:04:52 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=Eh2PO8ZSkJxu+NYrWcUgW+24yY1elbM4g1Px6IkWLdY=; b=eNvpV5ljio+G7G7CUdya0yl73o0LZ3Zoz6GMGM4gqlkXrhAr99bEy/ZirDDYYI44Y6 YfZ26ugcDr2hGHBJQCEHReRyUfB34Ewihx70ChA9gPxDoDv1gbnXJjDRiapKfvM1P8nH 3bSodGBaG/Oskrfo+w4Rzbh6tbF2HNLg1cvzU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; b=JIC7xLPUgrqlsIB8dPYPpd3M4Uj3QDKbtDCs0kRsAnM6JQSloaEWBruNxaLr5/hJII l5/EK7wxdnACrDDUWIxjiQwCEOLQlhU+vN8ajp4M6bpfRzhcKHFNrWpHlDpdp5e8u0sW ZNMySr5BNS6hqgVGGEq3K+WseGLk+iy4LIQsQ=
- In-reply-to: <alpine.LFD.2.00.0909100111240.3840@localhost>
- List-help: <mailto:ecartis@lists.fishpool.fi?Subject=help>
- List-id: <mint.lists.fishpool.fi>
- List-owner: <mailto:tjhukkan@fishpool.fi>
- List-post: <mailto:mint@lists.fishpool.fi>
- List-subscribe: <mailto:mint-request@lists.fishpool.fi?Subject=subscribe>
- List-unsubscribe: <mailto:mint-request@lists.fishpool.fi?Subject=unsubscribe>
- References: <4A95B430.9080304@freesbee.fr> <8cf5b8cc0908270241p4ebc59d8yc8b2b9380972cf90@mail.gmail.com> <4A969DEF.7000106@freesbee.fr> <1251385614.19057.51.camel@jetpack.demon.co.uk> <4A979AFC.3020405@freesbee.fr> <1251450405.19057.79.camel@jetpack. <4AA82362.4040704@freesbee.fr> <alpine.LFD.2.00.0909100111240.3840@localhost>
- Sender: mint-bounce@lists.fishpool.fi
- User-agent: Thunderbird 2.0.0.23 (Windows/20090812)
Hello, Frank.
Frank Naumann a écrit :
Just to note, you shall difference between the MiNTLib (that try to be
POSIX compatible) and the kernel syscalls (they have a non-POSIX history).
Ok, this is important.
First, the "struct xattr" doesn't have a member st_blocks or st_blksize.
They are called nblocks and blksize!
The member names for this structure are different between FreeMiNT and
the MiNTLib :-(
Question 2: What is the unit used by the st_blocks member of "struct
xattr"? We can see that on ext2, the unit is 1024 (to match the file
size). So where does this 1024 come from ?
The answer is simple as it's documented inside the ATARI Compendium:
---
blksize - blksize specifies the size of blocks (in bytes) in this file
system.
nblocks - nblocks is the actual number of blocks the file is using on
the device. This number may include data storage elements other used to
keep track of the file (aside from the actual data).
---
As you can see anything is correct. The ext2 blocksize is 1024 bytes and
the file use 8 blocks (a 1024 bytes).
Ok, this is clear now.
As the structure definition is not the same in the kernel, the members
don't have the exact same names, but it is actually a "struct xattr".
The comment clearly says that blksize is the block size, and nblocks
is the block count. So the definition of these 2 fields is radically
different than in "struct stat".
Yes. I hope you don't have any problem with that :-)
Absolutely no problem, since it is documented. I plan to provide a patch
to add more comments in the code, to emphasize the fact that the meaning
of the blocks members are different between "struct stat" and "struct
xattr". And since the "struct xattr" definition is private inside the
MiNTLib, I will rename its members to match the reference definition in
the kernel.
Thanks for your precise answer, Frank.
I will continue my quest to get correct values in every case (including
hostfs).
--
Vincent Rivière