mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/4] ntfs: add named data stream support
@ 2026-10-06 22:40 Namjae Jeon
  2026-10-06 22:40 ` [PATCH v2 1/4] ntfs: add named stream ioctls support Namjae Jeon
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Namjae Jeon @ 2026-10-06 22:40 UTC (permalink / raw)
  To: hyc.lee
  Cc: ntfs, linux-fsdevel, linux-kernel, sebastian.n.feld,
	cedric.blancher, Lionelcons1972, Namjae Jeon

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-10-07  5:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-06 22:40 [PATCH v2 0/4] ntfs: add named data stream support Namjae Jeon
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

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®