I have a semi-functional (getting ntfs device name eludes me) implementation of 
blkid that I would be willing to toybox if there is any interest (Its not on 
the list AFAICT, so I will be brief)

The implementation is as follows:
1.  read 65k buffer from file (reiserfs and others have superblock starting at 
64k)
2.  perform switch cases @ 0 offset to compare to many magics (0 is a fairly 
common offset)
**Note: the switch case really provides no benefit over if-else in this 
situation since the Magic values are too far apart to be optimized into a jump 
table.  I can change this for uniformity if desired.
3. Then go through the rest of the fs types and check for #defined magic @ 
#defined offset(s)
4. If a match is found it returns the result of print_fsinfo(char *fstype, int 
UUID_offset, int UUID_type, int name_offset, int name_len) where the 
UUID_offset, UUID_type, name_offset, name_len are also #defined in the header 
for that fs type.

I know many people only want to get the fs type (for mount) instead of the full 
blkid output.  Does toybox have some kind of facility for setting function 
pointers based on the name it is called with or a way to get the current 
toy-command name to use for conditional code?

R,
Brad Conroy
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to