Subject: Alias storage of dir/file ID's

From: "Richard Goldman" <[email-masked]>
Date: Fri, 8 Jun 2001 00:34:30 -0400

Jeff -- 

Sorry if this is your second receipt of my message (having trouble with my email system). 

Also, a note here... I recompiled today's CVS (June 7), and tried it out with a well-formed afpd.mtab in the sysconfdir (/usr/local/atalk/etc for me).  As I've mentioned before, I'm looking for a change in the 8 more-significant-bits of the 32-bit identifier in the alias. 

Here's an example and an illustration that might assist in verifying the implementation of mtab code (decimal inodes returned by "ls -i filename" converted to hex): 

To start, the old, non-mtab pattern is: 
bit 1 (1 bit for file vs. directory) 
bits 2-5 (4 bits for device major number) 
bits 6-8 (3 bits for device minor number) 
bits 9-32 (24 bits for inode) 

I have a file (not a directory) 
-- Therefore bit 1 is set to value 1 

This file resides on... 
device 9 major 
-- Therefore bits 2-5 are set to 1001 
device 0 minor 
-- Therefore bits 6-8 are set to 000 

This file exists at inode 073695h 
-- Therefore bits 9-32 are set to... 
0    7    3    6    9    5 
0000 0111 0011 0110 1001 0101 

Append these all together and you get (dot separators for emphasis): 

F Maj  Min Inode 
1.1001.000.000001110011011010010101 

Now compact them together, and take the hex of each block of 4 bits (nibble?)... 
11001000000001110011011010010101 = 
1100 1000 0000 0111 0011 0110 1001 0101 = 
C    8    0    7    3    6    9    5 

So here's the payoff:  If you open this alias with Apple's resedit utility (check the "Use alias instead of original" box), you'll find that starting at byte position 000072 you have the digits: 
C807 3695 (as above!) 

So, using this analysis, it appears that mtab code isn't applying here, as the result with mtab active would be: 
2007 3695 (coming from a run of test_parse_mtab where my drive is listed as "1 /dev/md0 /" in the mtab). 

A note:  test_parse_mtab likes to have an afpd.mtab file in the same directory (so I copied it from /usr/local/atalk/etc). 

I hope this helps! 

---------- Original Message ---------------------------------- 
From: "Richard Goldman" <[email-masked]> 
Reply-To: <[email-masked]> 
Date: Thu,  7 Jun 2001 12:52:44 -0400 

>Jeff -- 
> 
>Yes, I did compile with "--with-did=mtab" (on CVS tree taken at 10am PDT yesterday).  The reason I'm not sure if it's working is that I had created an alias using an older version of netatalk.  I then compiled the new tree with the above option, created a valid afpd.mtab (in atalk/etc) and made a fresh alias.  When I compared the contents of these pre and post mtab aliases, there was no difference between the two in the vicinity of byte 70 (as seen in resedit). 
> 
>I'm just guessing that the leading bits prior to byte 73 (start of 24 bit inode) would be different if mtab were active because mtab promises a greater number of bits dedicated to inode only. 
> 
>Apologies in advance for any incorrect assumptions, including my assumption that afpd.mtab should be in /usr/local/atalk/etc (that was my "--prefix=" location given during ./configure). 
> 
>BTW I'm thrilled that we're moving along in this area and I truly appreciate the focus you and others give to this and all other aspects of netatalk.  Thank you for taking the time to oversee its continuing improvement. 
> 
>-- Richard 
>