Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: HEADS UP: I will be merging christos-time_t by the end of theweek
On Jan 14, 4:27pm, M.Drochner%fz-juelich.de@localhost (Matthias Drochner)
wrote:
-- Subject: Re: HEADS UP: I will be merging christos-time_t by the end of the
|
| dholland-current%netbsd.org@localhost said:
| > What conclusions did we come to regarding PR 39215? I got behind on
| > the discussion there at the time and haven't caught up on it yet.
|
| It has taken a while for me too to catch up -- I've just dug
| out my old patches introducing devmajor_t/devminor_t and
| built a -current kernel.
| I'll append just the basic kernel patches, didn't look at
| the rest yet. In any case there are no binary compatibility
| issues.
|
| > I think your(?) argument that minor numbers are used for array
| > indexing and whatnot and shouldn't be bigger than machine words was
| > fairly persuasive.
|
| I had to notice that something leaked into device drivers which
| shouldn't: Many drivers use macros like
| #define XXXUNIT(dev) (minor(dev) & 0x0f)
| This even lead to printf format changes to print out 64-bit
| device unit numbers. With minor() returning an "int" as before
| this wouldn't happen, and we'd avoid mixing types at other
| places.
|
| I'd say we should at least change major/minor to return ints
| again. Whether new names are introduced is a matter of
| taste, imo it helps clarity.
I think it is best to ask in tech-kern. Now is the good time to do
it, because we can change the format of the dev_t without killing
binary compatibility (because all the dev_t bearing syscalls have
been versioned and we can ride on the version bump). For example
I think that we can use:
/* Major, minor numbers, dev_t's. */
#define omajor(x) ((uint32_t)((((x) & 0x000fff00) >> 8)))
#define ominor(x) ((uint32_t)((((x) & 0xfff00000) >> 12) | \
(((x) & 0x000000ff) >> 0)))
#define omakedev(x,y) ((dev_t)((((x) << 8) & 0x000fff00) | \
(((y) << 12) & 0xfff00000) | \
(((y) << 0) & 0x000000ff)))
#define major(x) (uint32_t)(((x) >> 32) & 0xffffffffULL)
#define minor(x) (uint32_t)(((x) >> 0) & 0xffffffffULL)
#define makedev(x,y) (((dev_t)(x) << 32) | (y))
and then to convert from old style dev to new we can use:
stat_to_stat50(st50, st) {
st50->st_dev = omakedev(major(st->st_dev), minor(st->st_dev));
}
stat50_to_stat(st, st50) {
st->st_dev = makedev(omajor(st50->st_dev),
ominor(st50->st_dev));
}
Same goes for old on disk formats. We check the version of the fs,
and then we do the conversion depending on the version. I think it
makes sense to keep major and minor 32 bits, I don't see a reason
to split otherwise, like major be 24 and minor be 40.
christos
Home |
Main Index |
Thread Index |
Old Index