Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Feb 2011 08:09:09 +1100
From:      Peter Jeremy <peterjeremy@acm.org>
To:        Jeremy Chadwick <freebsd@jdc.parodius.com>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: ext2fs crash in -current (r218056)
Message-ID:  <20110203210909.GA28604@server.vk2pj.dyndns.org>
In-Reply-To: <20110203151318.GA9986@icarus.home.lan>
References:  <4D47B954.3010600@FreeBSD.org> <201102021704.04274.jhb@freebsd.org> <20110202222023.GA45401@icarus.home.lan> <201102030753.55820.jhb@freebsd.org> <20110203140142.GH78089@deviant.kiev.zoral.com.ua> <20110203151318.GA9986@icarus.home.lan>

next in thread | previous in thread | raw e-mail | index | archive | help

--k+w/mQv8wyuph6w0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2011-Feb-03 07:13:18 -0800, Jeremy Chadwick <freebsd@jdc.parodius.com> w=
rote:
>The offset and the length are both explicitly casted and printed as
>signed numbers here.
>
>For me anyway, the next question is "what are bio_offset and bio_length
>defined as?" (indirectly, "why the explicit cast?").  They're both
>declared as part of struct bio in src/sys/sys/bio.h as shown:
>
> 71 struct bio {
>...
> 78         off_t   bio_offset;             /* Offset into file. */
>...
> 92         off_t   bio_length;             /* Like bio_bcount */
>...

off_t is always a 64-bit signed int and there's no printf(9) length
modifier to handle this particular situation (it's typically 'long' on
64-bit archs and 'long long' on 32-bit archs).  Instead it's cast to a
signed int which is at least as large that does have a suitable length
modifier (intmax_t can be printed using %jd).

--=20
Peter Jeremy

--k+w/mQv8wyuph6w0
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (FreeBSD)

iEYEARECAAYFAk1LGXUACgkQ/opHv/APuIfMugCeO07MLbXR438w/Cadukt6L8G8
9LwAoIsx9enpFWLkEPV+hlc63xoOybS1
=ig5f
-----END PGP SIGNATURE-----

--k+w/mQv8wyuph6w0--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110203210909.GA28604>