loff_t / long long and printk()?

loff_t / long long and printk()?

Post by Felix Opa » Mon, 26 Nov 2001 01:42:23



I want to printk a loff_t from the read-method of a char-device and
gcc tells me, that %l won't work. I saw in the header, that loff_t is
a long long, and the userspace-printf can printf those with %ll, but
printk doesn't know %ll. Is there any method of printing a long long
with printk, or will I have to split them into two longs? Or is it OK
for testing to assume that my device won't handle large amounts of
data and there won't be a caller who wants to read more than 4 GB?
And: if I want to printk the lower 32 bit of my long long - will I
have to cast it on long or will I also need to &0xffffffff it?

aTdHvAaNnKcSe,
Felix

 
 
 

loff_t / long long and printk()?

Post by Norm Dresne » Mon, 26 Nov 2001 02:45:34



Quote:> I want to printk a loff_t from the read-method of a char-device and
> gcc tells me, that %l won't work. I saw in the header, that loff_t is
> a long long, and the userspace-printf can printf those with %ll, but
> printk doesn't know %ll. Is there any method of printing a long long
> with printk, or will I have to split them into two longs? Or is it OK
> for testing to assume that my device won't handle large amounts of
> data and there won't be a caller who wants to read more than 4 GB?
> And: if I want to printk the lower 32 bit of my long long - will I
> have to cast it on long or will I also need to &0xffffffff it?

    When I have to print ll-type from the kernel, I either fake it with a
pseudo array of longs or test the MSW and, if it's zero, use a %ld/%lu on
the lower 32-bits.

    If you're willing to extract the module _divdi3.o from the gcc-library
and link it with your program -- which I've been doing with no problems for
years now -- you can do ll-division in your own function and create your own
lltoascii-function.

    Norm

 
 
 

1. How do I debug printk a long long?

While debugging a kernel module I have to printk a loff_t, which
is defined as a long long (64 bit). How do I print out such a
thing?

Kristian

--
Kristian Koehntopp, Wassilystrasse 30, 24113 Kiel, +49 431 688897
Fachbegriffe der Informatik einfach erklaert, Teil 6:
"Globale Variable" == "Parameteruebergabemechanismus in 4GLs"

2. Linux Support for Megahertz PCMIA Modems?

3. long long & long double types in Linux GCC

4. Internet/UNIX Jobs in LA

5. RH7.2 2.4.X off_t: long or long long?

6. Questions concerning Passwords.

7. Linux has a long, long, long way to go

8. FTP Chroot Prolbem

9. Q: about "long long" type..

10. _BSD_OFF_T_ type long long

11. printf(3) long long

12. Large File System and long long datatype (gcc)

13. does tru64 v.4.g support long long int (%lld)?