Skip to contentSkip to conversation

make pipefs do lazy i_ino assignment and hashing

PATCH Bodo Eggert 1 participant 1 message Jan 30, 2007 1 message not in the archive VFS

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 10 lines · Jeff Layton

This patch updates pipefs to do defer assigning an i_ino value to its inodes until someone actually tries to stat it. This allows us to have unique i_ino values for the inodes here, without the performance impact for anyone who doesn't actually care about it.

Since we don't have an i_ino value at pipe creation time, we need something else to stuff into the dentry name. Here, I'm using the pointer address of the inode xor'ed with a random value. There are certainly better hashing schemes, so if someone wants to propose a better way to do this, then I'm open to looking at it (maybe halfmd4?).

Why XOR? To pretend a non-existent level of security?
Either you can't use the address, or you can read the obfusicator value, too.

OTOH, if sizeof(void*) <= sieof(ino_t), using the address will result in a unique inode number without need for expensive hashing algorithms.

Signature · 4 lines
Why did the hacker cross the road? To get to the other side.
Why did the cracker cross the road? To get what was on the other side.
The difference is small, but important.
        -- Gandalf Parker