mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namjae Jeon <linkinjeon@kernel.org>
To: hyc.lee@gmail.com
Cc: ntfs@lists.linux.dev, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, sebastian.n.feld@gmail.com,
	cedric.blancher@gmail.com, Lionelcons1972@gmail.com,
	Namjae Jeon <linkinjeon@kernel.org>
Subject: [PATCH v2 0/4] ntfs: add named data stream support
Date: Wed,  7 Oct 2026 07:40:20 +0900	[thread overview]
Message-ID: <20261006224024.14535-1-linkinjeon@kernel.org> (raw)

NTFS supports multiple named $DATA attributes, commonly known as
alternate data streams. This series adds support for accessing these
streams in the ntfs driver through a new ioctl interface and an
optional Windows-style pathname interface.

v2:
  - Add the optional Windows-style pathname interface, exposing streams as
    regular files with the operations needed by Wine.
  - Document both interfaces and add MAINTAINERS coverage for the UAPI.

The ioctl interface provides stream enumeration, reading, writing, and
removal through an opened base file. Read and write requests specify a
stream name and byte range. Names use the mounted NLS by default, with
raw UTF-16LE available for lossless access. These ioctls remain available
regardless of the pathname mount option.

For example, a userspace program can enumerate streams on an opened base
file as follows. Usual headers are assumed. Error handling and retrying
with a larger buffer after ENOSPC are omitted:

  int fd = open("/mnt/file", O_RDONLY);
  size_t size = 8192;
  struct ntfs_list_streams *req =
          calloc(1, sizeof(*req) + size);

  req->buffer_size = size;
  ioctl(fd, NTFS_IOC_LIST_STREAMS, req);
  printf("Total named streams: %llu\n",
         (unsigned long long)req->stream_count);
  free(req);
  close(fd);

The pathname interface is disabled by default and can be enabled with
streams_interface=windows. In this mode, file:stream opens a
named $DATA stream as a regular file descriptor, allowing ordinary file
operations to be used:

  $ mount -t ntfs /dev/sdb1 /mnt -o streams_interface=windows
  $ printf 'This is a secret note\n' > /mnt/file:Note
  $ cat /mnt/file:Note
  This is a secret note

A stream can be created only for an existing file or directory. Only the
final path component's file:stream form is supported. The pathname
interface accepts a base file name and stream name only. It rejects paths
that also specify an NTFS attribute type such as $DATA. In windows mode,
ordinary filenames containing ':' are hidden from directory listings.

Namjae Jeon (4):
  ntfs: add named stream ioctls support
  ntfs: add pathname access for named streams
  MAINTAINERS: ntfs: add UAPI header
  ntfs: document named streams

 Documentation/filesystems/ntfs.rst            |   34 +
 .../userspace-api/ioctl/ioctl-number.rst      |    1 +
 MAINTAINERS                                   |    1 +
 fs/ntfs/Makefile                              |    2 +-
 fs/ntfs/attrib.c                              |  168 +-
 fs/ntfs/attrib.h                              |    2 +-
 fs/ntfs/attrlist.c                            |    3 +-
 fs/ntfs/dir.c                                 |    7 +-
 fs/ntfs/ea.c                                  |   21 +-
 fs/ntfs/file.c                                |  253 ++-
 fs/ntfs/inode.c                               |  206 +-
 fs/ntfs/inode.h                               |   19 +
 fs/ntfs/iomap.c                               |   62 +-
 fs/ntfs/named_stream.c                        | 1812 +++++++++++++++++
 fs/ntfs/namei.c                               |  175 +-
 fs/ntfs/stream.h                              |   81 +
 fs/ntfs/super.c                               |   23 +
 fs/ntfs/volume.h                              |    3 +
 fs/ntfs/wof.c                                 |    6 +-
 include/uapi/linux/ntfs.h                     |  123 ++
 20 files changed, 2792 insertions(+), 210 deletions(-)
 create mode 100644 fs/ntfs/named_stream.c
 create mode 100644 fs/ntfs/stream.h
 create mode 100644 include/uapi/linux/ntfs.h

-- 
2.25.1


             reply	other threads:[~2026-10-06 22:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 22:40 Namjae Jeon [this message]
2026-10-06 22:40 ` [PATCH v2 1/4] ntfs: add named stream ioctls support Namjae Jeon
2026-10-07  2:07   ` CharSyam
2026-10-07  2:24     ` Namjae Jeon
2026-10-06 22:40 ` [PATCH v2 2/4] ntfs: add pathname access for named streams Namjae Jeon
2026-10-07  3:38   ` CharSyam
2026-10-07  5:05     ` Namjae Jeon
2026-10-06 22:40 ` [PATCH v2 3/4] MAINTAINERS: ntfs: add UAPI header Namjae Jeon
2026-10-06 22:40 ` [PATCH v2 4/4] ntfs: document named streams Namjae Jeon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261006224024.14535-1-linkinjeon@kernel.org \
    --to=linkinjeon@kernel.org \
    --cc=Lionelcons1972@gmail.com \
    --cc=cedric.blancher@gmail.com \
    --cc=hyc.lee@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs@lists.linux.dev \
    --cc=sebastian.n.feld@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®