Skip to contentSkip to conversation

Help with posix_types.h

parisc-linux Paul Bame 3 participants 5 messages Nov 15, 2000

lore
Share & tools
lore

Paul Bame

author
#0 lore raw

I'm reviewing the posix_types.h to figure out what's right for 64-bit linux. I know others may have thought through this before so I'm hoping for guidance. For those unfamiliar, the type names in posix_types.h are like __kernel_dev_t and usually are used to define the corresponding "normal" type (dev_t). These should be settled before the 32/64 syscall wrappers can be completed.

__kernel_ino_t: often 32 bits, currently 32 bits for parisc and som3
64-bit kernels (mips64 and ia64). 64 bits on alpha and sparc64.

Seems to me this ought to be 32 bits on parisc and parisc64, or 64 bits on both, since it's a function of file system sizes not processor width. HPUX kernel seems to always use 32 bits, but 64-bit userspace uses 64 bits. I propose 32 bits on both, but willy had selected 64 bits in parisc64 for some reason.

__kernel_off_t: seems to be 32 bits on 32-bit cpus, 64 on 64-bit ones.
This is supposedly the offset from a beginning of a file. HPUX appears to use 64-bits *in the kernel* for both 32 and 64-bit kernels.

The obvious pattern is to make ours 32 on narrow, and 64 on wide palinux so I guess I propose that, and that's the way it was before I hacked on it too.
Should we consider switching to 64 bits on narrow palinux since this is related to file systems, not CPUs.

Note there's also a __kernel_loff_t -> loff_t which appears to be defined as 64 bits. I'm not sure how this does/should interact with off_t (lseek vs lseek64 for example).

__kernel_suseconds_t: which becomes suseconds_t which is used in
struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* microseconds */
};

I'm confused why hpux, and other systems,
like for this to be 'long' (e.g., 64 bits on 64-bit processors) since it seems like values over a million are probably rare and 32 bits seems to be enough for most implementations. sparc64 chose 32 bits for this and I want to do the same for parisc64 because it will reduce the amount of syscall structure repackings. Comments?

__kernel_daddr_t: which is used indirectly in struct solaris_x86_vtoc and
solaris_x86_slice which *might* be an on-disk data structures (used with CONFIG_SOLARIS_X86_PARTITION). So this needs to be 32 bits if that's the case (definition from sparc) and several archs have it 64 bits!

On the other hand, HPUX's man page says 'daddr_t used for disk addresses except in an inode [and partition table I would think] on disk'. So it should probably be the same
type as off_t. FYI the only other place it's used is in 'struct mtio' -- used to talk to magnetic tape units.

I'm guessing the sparc struct should not be using this type, and that we should define it the same as off_t. Comments?

#1 lore raw

The largest disk currently available I believe is the 180GB Seagate Baracuda. The size of drives is increasing about a factor of 2 per year. The __kernel_off_t definitely needs to be 64 bits to handle large drives in both 32 and 64 bit systems. Disk blocks are typically 512 or 1024 bytes. Thus, drives may exceed 4GB disk blocks in 3-4 years. Inodes are variable in size (8KB average). Thus, we are a little further away from exceeding the 32 bit inode limit.

Dave

Signature · 2 lines
J. David Anglin                                  [email protected]
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)
author
#2 lore raw
In reply to Paul Bame

FYI I just heard some pretty good reasons why both ino_t and off_t should be 64 bits even on 32-bit kernels. Keep those cards and letters coming!

	-P
#3 lore raw
Quoted 3 lines · Paul Bame

FYI I just heard some pretty good reasons why both ino_t and off_t should be 64 bits even on 32-bit kernels. Keep those cards and letters coming!

Any new port which does *not* do this is broken from the beginning. Copying existing files is not what you have to do. Instead look at today's needs. The numbers of the x86 port are those the kernel people told me are needs, multiplied by 2 or 4. Do the same.

Signature · 3 lines
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------
#4 lore raw

This reminds me of something I talked to Cary Coutant about before.

You have certainly reserved a thread register in the ABI, right? If not, do it ASAP.

Signature · 3 lines
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------