Handling the 7 reserved characters when mounted to Mac

Steve French smfrench at gmail.com
Wed Sep 17 19:03:27 MDT 2014


There are seven reserved characters that need to be remapped when
mounting to Windows, Mac (or any server without Unix Extensions) which
are valid in POSIX but not in the other OS.

: \ < > ? * |

We use the normal UCS-2 remap range for this in order to convert this
to/from UTF8 as did Windows Services for Unix (basically add 0xF000 to
any of the 7 reserved characters).

Mac used a very slightly different "Services for Mac" remap range
0xF021 through 0xF027.  The attached patch allows cifs.ko (the kernel
client) to read directories on macs containing files with these
characters and display their names properly.  In theory this even
might be useful on mounts to Samba when the vfs_catia module is loaded
and we are mounted with smb3.

Currently the 7 reserved characters look very strange in directory
listings from cifs.ko to Mac server.  This patch allows these file
name characters to be read (requires specifying mapchars on mount).

Two additional changes are needed:
1) Make it more automatic: a way of detecting that we are mounted to a
Mac so we know to try to always remap these characters (at least for
smb2.1 mounts to them and eventually smb3 when they support that)

2) A deterministic way of deciding when to use the normal mapchars
approach vs. the mac mappings when creating a file with any of the
seven characters in its name.  It may be ok in some cases to be able
to translate file names in both formats properly when listing
directories - but when creating files we have to use the same
mechanism and decide when to use which, especially on SMB3 mounts
(which do not have an option for posix pathnames).  Will need to
decouple turning mac character mapping on/off from mapchars mount
option.

-- 
Thanks,

Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mac-remap-chars.patch
Type: text/x-patch
Size: 8182 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140917/639152ee/attachment.bin>


More information about the samba-technical mailing list