X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9302F3858299
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1705035868;
	bh=gBS//skpAxdyGdchZlMv+reyoin5Ry4jTpITagNKuto=;
	h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
	 From;
	b=PTkrgFcZiaddIcMBNlfncq2AR9EV9ZazEmPL/3yihIGBYr3dRwtR93ANmbr7otIcm
	 bqkCbmjBkYKayYh0AbyulkkdAjWByYH8Nj/diQLj7MUKnq3UH0KP3+qnEMgehQ++HL
	 q2YHk5OJeqC3e2PkQ1TrYbCptELH35KCpspd5Org=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8F1853858D32
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8F1853858D32
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705035843; cv=none;
 b=EW2mSw44aSvJ6QEl5aoW6Kyy2CNbt7F5pvO0V7rL32yGjDeTUOgvMSNeMTaMZ6ngM2kse2wu5gX1auwdcn1e16zpolpK7TT3L5rPY1EqCwwO9/fkWMMnrFBovGd9Tgb3yZ5TH5ClC3HPirMW2rpz9xxhF/PIXVQEoZ2r8UB3mEE=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1705035843; c=relaxed/simple;
 bh=Wuct7e0I3Kjr7un+k0vej57Nq7/cLodQc4eqGuvLxfQ=;
 h=MIME-Version:From:Date:Message-ID:Subject:To;
 b=CocXrkOZxSMw3JkYDifYKjW2n8PyiyIeX1qhsrTnDT1c0IlkMcgy77N9EuN2+iAMHIxR94yLd4JW7PyEfsTGCmI4umvu6tI0CWB1e/t2YadkXovfOzRQh9Ngs5KFi74rJAffrJFm4E6C6xAlQpo4drZsTDraGhEmqPWISQjx2q0=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1705035838; x=1705640638;
 h=content-transfer-encoding:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=4Lt2JYnQuaAhXELBGH9kBEgwRZLMDhYTTG9K5Ybi5e0=;
 b=nfdvbg2n5/wXLTwcl1VWQ7So6+tgCxcZ6DeVyaQxb7Bvey6UxKldSJHM1L4OpgOaXM
 rXp48HBE8H8ndd8yEHcd98UO4l32mKfgPDXJ/Ir/9v5puCwf4sfcLlmAHryIn+sif7EL
 FL9X/u5m0EN8e3fxs9A+uV6bvxTmUZ7VyY29Fxy3F7svJQaEArk+mZMCcrTGcZ8MYsU6
 eoY8aMsMomz6b5lFohoFz2xHdm5PHj9nbrfXNDwTJVBF1vbeNT1jrNwdXFIm+BODyxZN
 KDD+0nIvD3a190EnqiZ6F4iP1ucvVn+T3Au+hWmXLDIhiF30ASxKSPUkZbhb2RU5/nky
 nqRA==
X-Gm-Message-State: AOJu0Yw7FaSPrNodkMzEWLdcRKrx9uSEgHOQakyD8KERMDnfnfSWg1Em
 rWO4dp03piT6b0TRIRP840ZRY7vWLvDzM7gZCmgYeYuT1Gg=
X-Google-Smtp-Source: AGHT+IEy8rQm2bQLAzBlwo1F9tFJuAP+aaENLlvRTXCtA+zkKTQFQ+91hDpVz+dEBMjQiRTHfaiJ8txgPvdiDHITKv0=
X-Received: by 2002:a6b:f317:0:b0:7be:ff7f:b02c with SMTP id
 m23-20020a6bf317000000b007beff7fb02cmr1050313ioh.30.1705035838450; Thu, 11
 Jan 2024 21:03:58 -0800 (PST)
MIME-Version: 1.0
References: <CANH4o6N7UONfYy1ir7WZXpOnthSxF=fcqaPe37dPsdU_AoPoLw@mail.gmail.com>
 <ZWmsvW0bmko_9Qcc@calimero.vinschen.de>
 <CANH4o6M7s1h8+atQVdr+uAOgUHKPyomP4zoobvvbW97ebSR=sw@mail.gmail.com>
 <ZZwCIjfdP6Qh-y5d@calimero.vinschen.de>
 <CANH4o6NPjo1d-KBxZUo1+tVrZJNcT5ieYX0Hc42ZV0pXLoUtgw@mail.gmail.com>
In-Reply-To: <CANH4o6NPjo1d-KBxZUo1+tVrZJNcT5ieYX0Hc42ZV0pXLoUtgw@mail.gmail.com>
Date: Fri, 12 Jan 2024 06:03:00 +0100
Message-ID: <CAKAoaQmaKYJfeaE-9Q1tT040UHqydD329UWE-TARuOcSdYwC7w@mail.gmail.com>
Subject: Re: Cygwin tools to read/write NTFS alternate data streams?
To: cygwin@cygwin.com
X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,
 FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,
 KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,
 SPF_PASS, TXREP,
 T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Roland Mainz via Cygwin <cygwin@cygwin.com>
Reply-To: Roland Mainz <roland.mainz@nrubsig.org>
Content-Type: text/plain; charset="utf-8"
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 40C54V72032719

On Thu, Jan 11, 2024 at 3:00 PM Martin Wege via Cygwin
<cygwin@cygwin.com> wrote:
> On Mon, Jan 8, 2024 at 3:11 PM Corinna Vinschen via Cygwin
> <cygwin@cygwin.com> wrote:
> > On Dec 18 18:47, Martin Wege via Cygwin wrote:
> > > On Fri, Dec 1, 2023 at 10:52 AM Corinna Vinschen via Cygwin
> > > <cygwin@cygwin.com> wrote:
[snip]
> > Apart from that, this sounds like a nice idea for Cygwin 3.6,
> > provided somebody implements it, https://cygwin.com/acronyms/#SHTDI
> >
> > Assuming we can live without actually having a subdir and just
> > allowing to open and create a file with the O_XATTR flag, it might be
> > pretty simple to implement.  The path handling code would just have to
> > drop the colon from the list of characters converted to the private-use
> > Unicode area.
> >
> > Implementing the subdir is a bit more complicated, especially when
> > taking opendir/readdir of that virtual subdir into account, but it
> > would certainly be doable.
>
> How do other OSes implement the O_XATTR subdir?

Basically you open a random file or dir with |openat(filename,
O_XATTR)| and get a fd to that (virtual) attribute directory.
The "." in that dir is virtual, but the ".." refers to the underlying
file, so a |open("..", ...)| will return a fd to a file/dir to which
the attributes belong to.

https://illumos.org/man/7/fsattr has the whole API description.

A Windows implementation should be therefore quite easy, as alternate
data streams show up as "foo:stream1", "foo:stream2" etc., so just the
directory lookup needs to be modified to skip the files with ':' in
general, and only show the streams for an O_XATTR subdir, e.g.
|openat("foo", O_XATTR)| would give a dir which lists only Windows
file names which match "foo:*"

I can support such an effort with testing, and a cleanroom
implementation of https://illumos.org/man/1/runat (see
https://github.com/illumos/illumos-gate/blob/master/usr/src/cmd/runat/runat.c
for the Solaris/Illumos code)

----

Bye,
Roland
-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz@nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

