major/minor split
Quoted 2 lines
There is a point I'd like to get clear: where should the 16bit<->32bit
dev_tconversion happen?
I am not sure I understand the question, but if I do the answer is "nowhere", there is no conversion (other than the lengthening that happens when one casts an unsigned short to an unsigned int).
For dev_t (8,1) is 0x00000801, but (8,256) is 0x00080100. (In case of a 16+16 split. Not that I advocate that, it is just easy talking.)
For kdev_t (8,1) is 0x00080001 and (8,256) is 0x00080100. So kdev_t allows simple fast composition and decomposition, but is restricted to the kernel.
While dev_t requires a conditional, since it has to remain compatible with the old 8+8 userspace.
Quoted 1 line
how can software create nodes for a specific device?
You do not mean using mknod?
Andries
Hi,
Quoted 7 lines · On Thu, 20 Mar 2003 [email protected] wrote:
Quoted 2 lines
There is a point I'd like to get clear: where should the 16bit<->32bit
dev_tconversion happen?I am not sure I understand the question, but if I do the answer is "nowhere", there is no conversion (other than the lengthening that happens when one casts an unsigned short to an unsigned int).
Let's look at ext2:
if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) raw_inode->i_block[0] = cpu_to_le32(kdev_t_to_nr(inode->i_rdev));
Should the saved device number be a 16bit or a 32bit device number? Has the user any control over it?
Quoted 3 lines
Quoted 1 line
how can software create nodes for a specific device?
You do not mean using mknod?
I mean via mknod, e.g. if the user has a major/minor number, how should it be converted to a dev_t number?
bye, Roman
Followup to: <Pine.LNX.4.44.0303210016360.5042-100000@serv> By author: Roman Zippel <[email protected]> In newsgroup: linux.dev.kernel
Quoted 4 lines
I mean via mknod, e.g. if the user has a major/minor number, how should it be converted to a
dev_tnumber?
Using MKDEV(). Basically, use the old format if it fits (for compatibility), otherwise the new format.
-hpa
Signature · 3 lines
<[email protected]> at work, <[email protected]> in private! "Unix gives you enough rope to shoot yourself in the foot." Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64
Followup to: <[email protected]> By author: [email protected] In newsgroup: linux.dev.kernel
Quoted 7 lines
For
kdev_t(8,1) is0x00080001and (8,256) is0x00080100. Sokdev_tallows simple fast composition and decomposition, but is restricted to the kernel.
Whiledev_trequires a conditional, since it has to remain compatible with the old 8+8 userspace.
I would suggest, instead:
typedef struct kdev {
u32 major, minor;
} kdev_t;-hpa
Signature · 3 lines
<[email protected]> at work, <[email protected]> in private! "Unix gives you enough rope to shoot yourself in the foot." Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64