[RFC] experimental NTFS streams implementation

James Peach jpeach at samba.org
Mon Oct 15 22:13:20 GMT 2007

Hi all,

I have merged my experimental implementation of NTFS alternate data  
stream support for Samba 3 to the "3-0-25c/ntfs-streams" branch of  

This code is an implementation of NTFS data streams with minimal  
perturbation of the core file serving code. It allows VFS modules to  
completely implement streams support in an opaque manner. The cost of  
this opacity is some ugliness and complexity in the VFS module.

There's a bunch of changes that are not directly necessary for stream  
support, but are included to that I could publish the VFS module in  
its entirety. Some of these can be merged independently, but my  
immediate goal is to get code published so people can look at it.

Please take some time to review the approach and suggest improvements  
or alternatives. If there is a consensus that this is a valid/ 
desirable approach, I'll work on tidying and refactoring the code to  
make it suitable for inclusion in the v3-2-test branch.

The list of patches included in the branch is:

free-fsp-extension-on-close -p0
     Samba maintains a fsp structure for each open file. There is a
     fsp extension mechanism that allows VFS modules to attach private
     data. this patch corrects the fsp destructor so that the extension
     data is fred correctly.

fetch-fsp-extension-talloc-context -p0
     This patch supplements the fsp extension API with an operation
     to retrieve the malloc zone pointer for that fsp.

vfs-add-statfs-capabilities -p0
     This patch adds Darwin support for the Samba statfs VFS call.
     It also adds a filesystem capabilities bitmask to the information
     returned by the call.

support-case-sensitive-filesystems -p0
     This patch alters the Samba connection code to cache the
     filesystem capabilities when a new client connects. It then
     uses this information in the filename lookup path to determine
     whether it should search for case variations of the requested
     name, which is only necessary if the filesystem is case sensitive.

add-streams-support-parameter -p0
     This patch adda a configuration option to allow the administrator
     to turn NTFS alternate data streams support on or off.

pass-ntfs-stream-paths-to-vfs -p0
     This patch enhances the filename lookup path to be aware of
     NTFS stream names. It refactors the handling of the special
     quota streams to be more extensible. It also passes paths
     referring to NTFS streams to the VFS if the underlying filesystem
     claims that capability.

vfs-add-stream-info-operation -p0
     This patch adds a "streaminfo" call to the Samba VFS layer.
     Streaminfo is used to query the names and sizes of all the
     alternate data streams that may be present on a file.

vfs-add-setcreatetime-operation -p0
     This patch adds a Samba VFS call to support altering the file
     creation time.

vfs-add-get-preserved-name-operation -p0
     This patch adds a Samba VFS call to support getting the real
     on-disk case variant of a file name. This is needed to support
     case sensitive filesystems, where a lookup using a case variation
     may succeed, but we need to report the real case to the client
     for presentation reasons.

add-server-streams-support -p0
     This patch implements the SMB protocol support for the streaminfo
     call. It also alters the SMB filesystem capabilities call to
     correctly report whether NTFS streams are supported.

add-sendfile-capability-bit-to-fsp -p0
     This patch adds a bit to the fsp structure to tell the network
     send path whether this file data can safely be sent using the
     sendfile(2) system call. Sometimes in our VFS module we are
     presenting extended attributes as files, and we can't use
     sendfile for these.

add-leopard-sendfile-support -p0
     This patch adds support for the Leopard variation of the BSD-style
     sendfile(2) system call.

map-createtime-to-birthtime -p0
     This patch adds support for using the BSD st_birthtimespec
     information to publish the file ctration time.

trans2-support-set-create-time -p0
     This patch adds support for the protocol calls that sre used
     to set the file creation time.

support-case-perserving-filenames -p0
     This patch adds support for retrieving the case-preserved
     filename from the VFS layer and passing it back to the client
     in the SMB protocol response.

support-rename-case-insensitive-filenames -p0
     This patch corrects the support for renaming a file to a case
     variation of the same name, when the underlying filesystem is
     case insensitive.

vfs-module-darwin-streams -p0
     This is a VFS module that implements NTFS streams support on
     HFS-like filesystems, using the resource fork, the Finder info
     attribute and Darwin extended attributes to store the stream

James Peach | jpeach at samba.org

More information about the samba-technical mailing list