Le lundi 01 juin 2009 à 12:11 +0200, Vladimir 'phcoder' Serbinenko a écrit : > On Sun, May 3, 2009 at 7:19 PM, Michael Scherer <m...@mandriva.org> wrote: > > > > Le 7 févr. 09 à 22:02, Robert Millan a écrit : > > > >> On Mon, Jan 12, 2009 at 10:52:48PM +0100, Michael Scherer wrote: > >>> > >>> Hi, > >>> > >>> Here is the second patch, for hfsx support. This patch replace the > >>> precedent. > >>> > >>> It is slightly more complex, and I didn't tested it on hfsx as I do > >>> not have a proper partition. > >>> But so far, it detect correctly config file on hfsplus. > >> > >> Hi, > >> > >> Thanks for your contribution. Would you be willing to assign copyright to > >> the FSF for this? If you're fine with it, please let the FSF copyright > >> clerk (CCed) know so he can send you the form. > > > > > > Thanks to some postal problems, it took some months to get the copyright > > assignement > > to me. So, now it is over and I think you can apply the patch, I have > > rediffed against latest svn. > > > > I tried to test it again, just in case, but grub is failling with "menuentry > > , command not found." I will investigate a little > > bit more. > > > Hello, thank you for your contribution
Well, thanks for taking time to review :) > static int > +grub_hfsplus_is_case_insentive (struct grub_hfsplus_data *data) > +{ > You can declare this function as inline. This way you also doesn't > need to temporarily save its result for performance Indeed, here is a new patch. Just for my own curiosity, isn't the inlining of function automatic with gcc and recent compiler ? > @@ -218,6 +228,7 @@ struct grub_hfsplus_data > /* This is the offset into the physical disk for an embedded HFS+ > filesystem (one inside a plain HFS wrapper). */ > int embedded_offset; > + int catalog_cmp_key; > Where is this used? I see that you set it to a value but don't see you > actually using it in grub_hfsplus_is_case_insentive, in the case of GRUB_HFSPLUSX_MAGIC : + case GRUB_HFSPLUSX_MAGIC: + return data->catalog_cmp_key == GRUB_HFSPLUSX_CASEFOLDING; -- Michael Scherer
diff --git a/ChangeLog b/ChangeLog index 893a21c..58c544c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-06-03 Michael Scherer <m...@mandriva.org> + + * fs/hfsplus.c: Complete support of hfs+ and hfsx, by doing + case insensitive comparaison when needed ( ie for hfsplus, and depending + on some settings for hfsx, found in the header ) + 2009-05-26 Pavel Roskin <pro...@gnu.org> * genmk.rb: Avoid shadowing variable `s', rename the outer `s' @@ -3106,7 +3112,6 @@ (freetype_libs): Likewise. * util/grub-mkfont.c: New file. - 2009-01-12 Christian Franke <fra...@computer.org> * disk/ata.c (grub_ata_pciinit): Fix bit numbers of compatibility diff --git a/fs/hfsplus.c b/fs/hfsplus.c index 69794c9..4e3a32a 100644 --- a/fs/hfsplus.c +++ b/fs/hfsplus.c @@ -99,6 +99,13 @@ struct grub_hfsplus_btheader grub_uint32_t last_leaf_node; grub_uint16_t nodesize; grub_uint16_t keysize; + grub_uint32_t total_nodes; + grub_uint32_t free_nodes; + grub_uint16_t reserved1; + grub_uint32_t clump_size; // ignored + grub_uint8_t btree_type; + grub_uint8_t key_compare; + grub_uint32_t attributes; } __attribute__ ((packed)); /* The on disk layout of a catalog key. */ @@ -164,6 +171,9 @@ enum grub_hfsplus_filetype GRUB_HFSPLUS_FILETYPE_REG_THREAD = 4 }; +#define GRUB_HFSPLUSX_BINARYCOMPARE 0xCF +#define GRUB_HFSPLUSX_CASEFOLDING 0xBC + /* Internal representation of a catalog key. */ struct grub_hfsplus_catkey_internal { @@ -224,6 +234,7 @@ struct grub_hfsplus_data /* This is the offset into the physical disk for an embedded HFS+ filesystem (one inside a plain HFS wrapper). */ int embedded_offset; + int catalog_cmp_key; }; static grub_dl_t my_mod; @@ -464,6 +475,7 @@ grub_hfsplus_mount (grub_disk_t disk) data->catalog_tree.root = grub_be_to_cpu32 (header.root); data->catalog_tree.nodesize = grub_be_to_cpu16 (header.nodesize); + data->catalog_cmp_key = header.key_compare; if (! grub_hfsplus_read_file (&data->extoverflow_tree.file, 0, sizeof (struct grub_hfsplus_btnode), @@ -694,6 +706,20 @@ grub_hfsplus_btree_search (struct grub_hfsplus_btree *btree, } } +static inline int +grub_hfsplus_is_case_insentive (struct grub_hfsplus_data *data) +{ + switch (grub_be_to_cpu16 (data->volheader.magic)) + { + case GRUB_HFSPLUS_MAGIC: + return 1; + case GRUB_HFSPLUSX_MAGIC: + return data->catalog_cmp_key == GRUB_HFSPLUSX_CASEFOLDING; + default: + return 0; + } +} + static int grub_hfsplus_iterate_dir (grub_fshelp_node_t dir, int NESTED_FUNC_ATTR @@ -772,7 +798,8 @@ grub_hfsplus_iterate_dir (grub_fshelp_node_t dir, catkey->name[i] = grub_be_to_cpu16 (catkey->name[i]); /* hfs+ is case insensitive. */ - type |= GRUB_FSHELP_CASE_INSENSITIVE; + if (grub_hfsplus_is_case_insentive (dir->data)) + type |= GRUB_FSHELP_CASE_INSENSITIVE; /* Only accept valid nodes. */ if (grub_strlen (filename) == grub_be_to_cpu16 (catkey->namelen))
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel