★ wanayoo — archive 1999 http://www.kernelnotes.org/patch/21-p0740.htmlNouvelle recherche | Portail wanayoo

MS-DOS Name alias patch for 2.1.48

Alain Knaff (alknaff@innet.lu)
Wed Aug 6 22:19:00 1997

[Home] [Linux 2.0] [Linux 2.1] [Information] [Software] [Distributions] [Links]

21-aliased-name-fix-2.patch
The following patch is another attempt to fix name aliases. It is done against 2.1.48. The name aliasing problem can be shown as follows:

# mount -t msdos /dev/fd0 /mnt
# echo xyz >/mnt/abc
# cat /mnt/Abc
xyz
# rm /mnt/abc
# cat /mnt/Abc
xyz

The solution that I tried this time involves a scheme similar to the one outlined by the original xlate_name_char code. However, it is also combined with a filesystem specific name comparison function. By default (i.e. non-msdos), the name comparison function is memcmp; and for msdos it is a new function which formats names using msdos_format_name before comparing them.

I notices that with the original xlate_name_char code, the presence of a filesystem specific translation function would have to be checked for each character of the name. I optimized this by introducing a function which calculates the hash of the whole name at once. As a side effect, this also allows for more flexibility.

All calls to msdos_format_name use strings allocated on the stack, hence no unclean calls to kmalloc are needed. The customized name comparison function is only called when the hash value of the names to be compared is equal, and hence it is not on the critical path.




[Home] [Up] [Search] [FeedBack]

Copyleft © The LinuxHQ Project. Licensed under the GNU Public License.