Re: Rationale for aligning data on even bytes in a Unix shell file?

Liste des GroupesRevenir à cl c 
Sujet : Re: Rationale for aligning data on even bytes in a Unix shell file?
De : cr88192 (at) *nospam* gmail.com (BGB)
Groupes : comp.lang.c
Date : 08. May 2025, 07:57:05
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vvhktl$1k0km$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Mozilla Thunderbird
On 5/7/2025 8:07 PM, Lawrence D'Oliveiro wrote:
On Wed, 7 May 2025 05:08:03 -0500, BGB wrote:
 
Ideally, filesystems should be case sensitive by default;
If someone wants case insensitivity, this can be better handled at the
application or file-browser level.
 Even Linux has given in on this. The widely-used ext4 filesystem has an
option for case-insensitivity, which, once enabled for a volume, can be
activated on a per-directory basis.
Ironically, Windows and NTFS went the other way, adding an option for case-sensitive directories (though, one needs to use special commands in PowerShell to enable it on a per-directory basis).
...
Either way, case-insensitivity at the FS level adds complexity.
I guess, one intermediate option could be to keep the FS proper as case sensitive, but then fake case insensitivity at the level of the OS APIs (based on a system-level locale setting).
Say, program tries to open "Foo.txt";
Kernel sees that no "Foo.txt" exists, but "foo.txt" does, and the directory was flagged as case-insensitive, and so the kernel does a case-folded open.
Granted, how to implement this semi-efficiently is its own issue.
Externally doing a directory walk and seeing if any of the files match the requested name is possible, if albeit inefficient. Building a case-folding hash of a directory could be possible, but only makes sense if one expects this to happen repeatedly in a given directory (if it is one-off, it is little better than a linear walk and match).
One intermediate option could be to have a hidden metadata file, such as case-folded names table. This merely lists all the files in a directory, but with all the filenames normalized to all lower case or similar (with a bitmap of which characters were case-folded).
Ironically, this isn't too far off from how one might support Unix style metadata on FAT32. Say, one has a hidden file, "$_TKMETA.DAT" which isn't shown in directory listings, but may be used by the FS driver for extended metadata (say, in this case keyed using the 8.3 name).
It is kind of a crap option, but (mostly) survives Windows intrusions (but will still break on directory copy, as modern Windows versions do not preserve the original 8.3 names). This variant using the LFN's for the user-visible name, unlike "UMSDOS" which provided its own filenames and didn't use the VFAT LFN scheme.
Though. if doing a natively case-insensitive filesystem, I guess one option could be to fold all names to lower case, and then store a bitmask of which bytes to flip back to upper case.
Assuming a 64 byte dirent, and a similar AVL-like directory structure:
   {
   u32 ino;              //00, inode number (low 32 bits)
   u16 lsn;              //04, left child node
   u16 psn;              //06, parent node
   u16 rsn;              //08, right child node
   u16 hsn;              //0A, node high bits
   u16 ino_hi;           //0C, inode high bits
   byte zdepth;          //0E, Z height of node (0=Leaf)
   byte etype;           //0F, dirent type
   byte name[40]; //10, name
   u32  ncase1;          //38, case fold (first 32 bytes)
   byte ncase2;          //3C, case fold (next 8 bytes)
   byte pad1;            //3D, MBZ
   u16 hsn2;             //3E, more node high bits
   }
Base name drops from 48 to 40, to accommodate the case-folding bits.
The LFN entries could have a similar modification.
The hsn member adds 5 more bits to lsn, rsn, and psn; extending each from 16 to 21 bits.
Though, hsn2 could potentially extend the size of the node index, increasing maximum directory size from 2 million files to 64 billion files. Granted, a hard limit of 2 million files in a directory is probably fairly reasonable (given the existing upper limit on my actual HDD's is seemingly around 3600 files in a directory).
...

Date Sujet#  Auteur
26 Apr 25 * Rationale for aligning data on even bytes in a Unix shell file?147Janis Papanagnou
26 Apr 25 +* Re: Rationale for aligning data on even bytes in a Unix shell file?2Keith Thompson
27 Apr 25 i`- Re: Rationale for aligning data on even bytes in a Unix shell file?1Janis Papanagnou
27 Apr 25 +* Re: Rationale for aligning data on even bytes in a Unix shell file?2Kaz Kylheku
27 Apr 25 i`- Re: Rationale for aligning data on even bytes in a Unix shell file?1Janis Papanagnou
27 Apr 25 +* Re: Rationale for aligning data on even bytes in a Unix shell file?140Bonita Montero
27 Apr 25 i+* Re: Rationale for aligning data on even bytes in a Unix shell file?127Janis Papanagnou
28 Apr 25 ii`* Re: Rationale for aligning data on even bytes in a Unix shell file?126Bonita Montero
28 Apr 25 ii +* Re: Rationale for aligning data on even bytes in a Unix shell file?124vallor
28 Apr 25 ii i+* Re: Rationale for aligning data on even bytes in a Unix shell file?122Bonita Montero
28 Apr 25 ii ii`* Re: Rationale for aligning data on even bytes in a Unix shell file?121vallor
28 Apr 25 ii ii `* Re: Rationale for aligning data on even bytes in a Unix shell file?120Bonita Montero
28 Apr 25 ii ii  `* Re: Rationale for aligning data on even bytes in a Unix shell file?119Janis Papanagnou
28 Apr 25 ii ii   `* Re: Rationale for aligning data on even bytes in a Unix shell file?118Bonita Montero
28 Apr 25 ii ii    +* Re: Rationale for aligning data on even bytes in a Unix shell file?54Janis Papanagnou
28 Apr 25 ii ii    i`* Re: Rationale for aligning data on even bytes in a Unix shell file?53Bonita Montero
28 Apr 25 ii ii    i +* Re: Rationale for aligning data on even bytes in a Unix shell file?44Bonita Montero
28 Apr 25 ii ii    i i`* Re: Rationale for aligning data on even bytes in a Unix shell file?43Bonita Montero
28 Apr 25 ii ii    i i `* Re: Rationale for aligning data on even bytes in a Unix shell file?42Richard Harnden
28 Apr 25 ii ii    i i  `* Re: Rationale for aligning data on even bytes in a Unix shell file?41Bonita Montero
29 Apr 25 ii ii    i i   +* Re: Rationale for aligning data on even bytes in a Unix shell file?36Richard Heathfield
29 Apr 25 ii ii    i i   i+* Re: Rationale for aligning data on even bytes in a Unix shell file?33Bonita Montero
29 Apr 25 ii ii    i i   ii+* Re: Rationale for aligning data on even bytes in a Unix shell file?31Richard Heathfield
6 May 25 ii ii    i i   iii`* Re: Rationale for aligning data on even bytes in a Unix shell file?30Bonita Montero
7 May 25 ii ii    i i   iii `* Re: Rationale for aligning data on even bytes in a Unix shell file?29BGB
7 May 25 ii ii    i i   iii  +* Re: Rationale for aligning data on even bytes in a Unix shell file?18Janis Papanagnou
7 May 25 ii ii    i i   iii  i+* Re: Rationale for aligning data on even bytes in a Unix shell file?13Michael S
8 May 25 ii ii    i i   iii  ii+* Re: Rationale for aligning data on even bytes in a Unix shell file?11BGB
8 May 25 ii ii    i i   iii  iii`* Re: Rationale for aligning data on even bytes in a Unix shell file?10Janis Papanagnou
8 May 25 ii ii    i i   iii  iii `* Re: Rationale for aligning data on even bytes in a Unix shell file?9BGB
8 May 25 ii ii    i i   iii  iii  `* Re: Rationale for aligning data on even bytes in a Unix shell file?8Keith Thompson
9 May 25 ii ii    i i   iii  iii   `* Re: Rationale for aligning data on even bytes in a Unix shell file?7BGB
9 May 25 ii ii    i i   iii  iii    +* Re: Rationale for aligning data on even bytes in a Unix shell file?2Keith Thompson
9 May 25 ii ii    i i   iii  iii    i`- Re: Rationale for aligning data on even bytes in a Unix shell file?1Janis Papanagnou
9 May 25 ii ii    i i   iii  iii    `* Re: Rationale for aligning data on even bytes in a Unix shell file?4Lawrence D'Oliveiro
9 May 25 ii ii    i i   iii  iii     `* Re: Rationale for aligning data on even bytes in a Unix shell file?3BGB
15 May 25 ii ii    i i   iii  iii      `* Re: Rationale for aligning data on even bytes in a Unix shell file?2Lawrence D'Oliveiro
15 May 25 ii ii    i i   iii  iii       `- Re: Rationale for aligning data on even bytes in a Unix shell file?1BGB
9 May 25 ii ii    i i   iii  ii`- Re: Rationale for aligning data on even bytes in a Unix shell file?1Lawrence D'Oliveiro
7 May 25 ii ii    i i   iii  i`* Re: Rationale for aligning data on even bytes in a Unix shell file?4BGB
7 May 25 ii ii    i i   iii  i +* Re: Rationale for aligning data on even bytes in a Unix shell file?2David Brown
8 May 25 ii ii    i i   iii  i i`- Re: Rationale for aligning data on even bytes in a Unix shell file?1Janis Papanagnou
8 May 25 ii ii    i i   iii  i `- Re: Rationale for aligning data on even bytes in a Unix shell file?1Lawrence D'Oliveiro
8 May 25 ii ii    i i   iii  +* Re: Rationale for aligning data on even bytes in a Unix shell file?5Lawrence D'Oliveiro
8 May 25 ii ii    i i   iii  i`* Re: Rationale for aligning data on even bytes in a Unix shell file?4BGB
9 May 25 ii ii    i i   iii  i `* Re: Rationale for aligning data on even bytes in a Unix shell file?3Lawrence D'Oliveiro
9 May 25 ii ii    i i   iii  i  +- Re: Rationale for aligning data on even bytes in a Unix shell file?1BGB
9 May 25 ii ii    i i   iii  i  `- Re: Rationale for aligning data on even bytes in a Unix shell file?1Janis Papanagnou
9 May 25 ii ii    i i   iii  `* Re: Rationale for aligning data on even bytes in a Unix shell file?5Bonita Montero
9 May 25 ii ii    i i   iii   +* Re: Rationale for aligning data on even bytes in a Unix shell file?3BGB
9 May 25 ii ii    i i   iii   i`* Re: Rationale for aligning data on even bytes in a Unix shell file?2Keith Thompson
9 May 25 ii ii    i i   iii   i `- Re: Rationale for aligning data on even bytes in a Unix shell file?1BGB
14 May 25 ii ii    i i   iii   `- Re: Rationale for aligning data on even bytes in a Unix shell file?1Lawrence D'Oliveiro
29 Apr 25 ii ii    i i   ii`- Locales [was: Re: Rationale for aligning data on even bytes in a Unix shell file?]1Alexis
29 Apr 25 ii ii    i i   i`* Re: Rationale for aligning data on even bytes in a Unix shell file?2David Brown
29 Apr 25 ii ii    i i   i `- Re: Rationale for aligning data on even bytes in a Unix shell file?1Richard Heathfield
29 Apr 25 ii ii    i i   +- Re: Rationale for aligning data on even bytes in a Unix shell file?1James Kuyper
29 Apr 25 ii ii    i i   +* Re: Rationale for aligning data on even bytes in a Unix shell file?2Bonita Montero
5 May 25 ii ii    i i   i`- Re: Rationale for aligning data on even bytes in a Unix shell file?1Tim Rentsch
29 Apr 25 ii ii    i i   `- Re: Rationale for aligning data on even bytes in a Unix shell file?1Michael S
28 Apr 25 ii ii    i `* Re: Rationale for aligning data on even bytes in a Unix shell file?8Janis Papanagnou
28 Apr 25 ii ii    i  +- Re: Rationale for aligning data on even bytes in a Unix shell file?1Kaz Kylheku
28 Apr 25 ii ii    i  `* Re: Rationale for aligning data on even bytes in a Unix shell file?6Bonita Montero
29 Apr 25 ii ii    i   `* Re: Rationale for aligning data on even bytes in a Unix shell file?5Janis Papanagnou
29 Apr 25 ii ii    i    `* Re: Rationale for aligning data on even bytes in a Unix shell file?4David Brown
29 Apr 25 ii ii    i     `* Re: Rationale for aligning data on even bytes in a Unix shell file?3Muttley
29 Apr 25 ii ii    i      +- Re: Rationale for aligning data on even bytes in a Unix shell file?1David Brown
30 Apr 25 ii ii    i      `- Re: Rationale for aligning data on even bytes in a Unix shell file?1Lawrence D'Oliveiro
28 Apr 25 ii ii    +* Re: Rationale for aligning data on even bytes in a Unix shell file?54Muttley
28 Apr 25 ii ii    i`* Re: Rationale for aligning data on even bytes in a Unix shell file?53Bonita Montero
28 Apr 25 ii ii    i +* Re: Rationale for aligning data on even bytes in a Unix shell file?41Bonita Montero
28 Apr 25 ii ii    i i`* Re: Rationale for aligning data on even bytes in a Unix shell file?40Bonita Montero
28 Apr 25 ii ii    i i +* Re: Rationale for aligning data on even bytes in a Unix shell file?37Michael S
28 Apr 25 ii ii    i i i+* Re: Rationale for aligning data on even bytes in a Unix shell file?11Kaz Kylheku
28 Apr 25 ii ii    i i ii`* Re: Rationale for aligning data on even bytes in a Unix shell file?10Michael S
28 Apr 25 ii ii    i i ii +- Re: Rationale for aligning data on even bytes in a Unix shell file?1Kaz Kylheku
29 Apr 25 ii ii    i i ii `* Re: Rationale for aligning data on even bytes in a Unix shell file?8Lawrence D'Oliveiro
29 Apr 25 ii ii    i i ii  `* Re: Rationale for aligning data on even bytes in a Unix shell file?7Janis Papanagnou
29 Apr 25 ii ii    i i ii   `* Re: Rationale for aligning data on even bytes in a Unix shell file?6Michael S
30 Apr 25 ii ii    i i ii    `* Re: Rationale for aligning data on even bytes in a Unix shell file?5Lawrence D'Oliveiro
30 Apr 25 ii ii    i i ii     `* Re: Rationale for aligning data on even bytes in a Unix shell file?4Janis Papanagnou
30 Apr 25 ii ii    i i ii      `* Re: Rationale for aligning data on even bytes in a Unix shell file?3Janis Papanagnou
1 May 25 ii ii    i i ii       `* Re: Rationale for aligning data on even bytes in a Unix shell file?2Lew Pitcher
2 May 25 ii ii    i i ii        `- Re: Rationale for aligning data on even bytes in a Unix shell file?1Janis Papanagnou
28 Apr 25 ii ii    i i i+- Re: Rationale for aligning data on even bytes in a Unix shell file?1Michael S
29 Apr 25 ii ii    i i i`* Re: Rationale for aligning data on even bytes in a Unix shell file?24Muttley
30 Apr 25 ii ii    i i i `* Re: Rationale for aligning data on even bytes in a Unix shell file?23Lawrence D'Oliveiro
30 Apr 25 ii ii    i i i  `* Re: Rationale for aligning data on even bytes in a Unix shell file?22Muttley
30 Apr 25 ii ii    i i i   +* Re: Rationale for aligning data on even bytes in a Unix shell file?20David Brown
30 Apr 25 ii ii    i i i   i+* Re: Rationale for aligning data on even bytes in a Unix shell file?18Muttley
30 Apr 25 ii ii    i i i   ii+* Re: Rationale for aligning data on even bytes in a Unix shell file?4Janis Papanagnou
30 Apr 25 ii ii    i i i   iii+* Re: Rationale for aligning data on even bytes in a Unix shell file?2David Brown
30 Apr 25 ii ii    i i i   iiii`- Re: Rationale for aligning data on even bytes in a Unix shell file?1Janis Papanagnou
30 Apr 25 ii ii    i i i   iii`- Re: Rationale for aligning data on even bytes in a Unix shell file?1Muttley
30 Apr 25 ii ii    i i i   ii`* Re: Rationale for aligning data on even bytes in a Unix shell file?13David Brown
30 Apr 25 ii ii    i i i   ii +- Re: Rationale for aligning data on even bytes in a Unix shell file?1Janis Papanagnou
30 Apr 25 ii ii    i i i   ii `* Re: Rationale for aligning data on even bytes in a Unix shell file?11Muttley
1 May 25 ii ii    i i i   ii  `* Re: Rationale for aligning data on even bytes in a Unix shell file?10Lawrence D'Oliveiro
1 May 25 ii ii    i i i   ii   +- Re: Rationale for aligning data on even bytes in a Unix shell file?1vallor
1 May 25 ii ii    i i i   ii   +* Re: Rationale for aligning data on even bytes in a Unix shell file?7David Brown
6 May 25 ii ii    i i i   ii   i`* Re: Rationale for aligning data on even bytes in a Unix shell file?6BGB
2 May 25 ii ii    i i i   ii   `- Re: Rationale for aligning data on even bytes in a Unix shell file?1Janis Papanagnou
30 Apr 25 ii ii    i i i   i`- Re: Rationale for aligning data on even bytes in a Unix shell file?1Janis Papanagnou
30 Apr 25 ii ii    i i i   `- Re: Rationale for aligning data on even bytes in a Unix shell file?1Lawrence D'Oliveiro
28 Apr 25 ii ii    i i `* Re: Rationale for aligning data on even bytes in a Unix shell file?2Bonita Montero
28 Apr 25 ii ii    i `* Re: Rationale for aligning data on even bytes in a Unix shell file?11Muttley
29 Apr 25 ii ii    `* Re: Rationale for aligning data on even bytes in a Unix shell file?9Lawrence D'Oliveiro
28 Apr 25 ii i`- Re: Rationale for aligning data on even bytes in a Unix shell file?1vallor
28 Apr 25 ii `- Re: Rationale for aligning data on even bytes in a Unix shell file?1Janis Papanagnou
27 Apr 25 i+* Re: Rationale for aligning data on even bytes in a Unix shell file?2Kaz Kylheku
28 Apr 25 i+- Re: Rationale for aligning data on even bytes in a Unix shell file?1Kenny McCormack
28 Apr 25 i+- Re: Rationale for aligning data on even bytes in a Unix shell file?1Bonita Montero
28 Apr 25 i`* Re: Rationale for aligning data on even bytes in a Unix shell file?8Lawrence D'Oliveiro
9 May 25 `* Re: Rationale for aligning data on even bytes in a Unix shell file?2Keith Thompson

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal