17.3 DOS Attributes, Extended File Attributes, Long Filenames, and SuchlikeThese all present the same problem. The CIFS protocol suite is designed, in its heart and soul, to work with DOS, OS/2, and Windows systems. As a result, the protocols that make up the CIFS suite have a tendency to reflect the behavior of those operating systems. DOS, of course, is the oldest and simplest of the IBM/Microsoft family of PC OSes. The filesystem used with DOS is the venerable F ile A llocation T able (FAT) filesystem which, according to legend, was originally coded up by Bill Gates himself. The characteristics of the FAT filesystem should be familiar to anyone who has spent any time working with DOS. Consider, for example, the following FAT features: Case-insensitive filenames
8.3 filename format
No users or groups
Six attribute bits
It's a fairly spartan system. There are improvements and extensions that have appeared over the years . The FAT32 filesystem, for example, is a modified version of FAT that uses disk space more efficiently and also supports much larger disk sizes than the original FAT. There is also VFAT, which keeps track of both 8.3 format filenames and longer secondary filenames that may contain a wider variety of characters than the 8.3 format allows. VFAT long filenames are case- preserving (but not case sensitive) so, overall, VFAT allows a lot more creativity with file and directory names. [1]
Even with these extensions, the semantics of the FAT filesystem are not sufficient to meet the needs of more powerful OSes such as OS/2 and Windows NT. These OSes have newer , more complex filesystems which they support in addition to FAT. Specifically, OS/2 has HPFS ( H igh P erformance F ile S ystem), and Windows NT and W2K can make use of NTFS ( N ew T echnology F ile S ystem). These newer filesystems have lots and lots of features which, in turn , have to be supported by CIFS. Problems arise when the server semantics (made available via CIFS) do not match those expected by the client. Consider, for instance, Samba running on a Unix system. Unix filesystems typically have these general characteristics: Case-sensitive filenames
Longer, more complex filenames
Users and groups
More, and different, attribute bits
Now consider a Windows application that requires the old 8.3 name format. (Such applications do exist. They make calls to older, 16-bit OS functions that assume 8.3 format.) Unlike VFAT, Unix filesystems do not normally keep track of both long and short names. That causes a problem, and Samba has to compensate by generating 8.3 format names on the fly. The process is called "Name Mangling." There are other gotchas too. Indeed, name mangling is just the tip of the proverbial iceberg. One solution that some CIFS vendors have been able to implement is to develop a whole new filesystem for their server platform, one that maintains all of the required attributes and maps between them as necessary. This is a pain, but it works in situations in which the server vendor has control over the deployment of their product. One such filesystem is Microsoft's NTFS, which can handle a very wide variety of attributes and map them to the semantics required by Apple Macintosh clients, Unix clients, DOS clients, OS/2 clients ... You've got the basic idea. Let's run through some of the trouble spots to give you a sense of what you're up against. Long filenames
DOS attributes
Extended File Attributes
Extended Attributes
CIFS offers facilities to support all of these features and more. That's good news if you are writing client code, because you can pick and choose the sets of attributes you want to support. It's bad for server systems, which may need to offer various levels of compatibility in order to contend with client expectations. |