ntfs3.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] fs/ntfs3: Add system.ntfs_attrib_be extended attribute
@ 2022-10-10 11:41 Daniel Pinto
  2022-10-10 11:44 ` [PATCH v2 1/2] fs/ntfs3: add " Daniel Pinto
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Daniel Pinto @ 2022-10-10 11:41 UTC (permalink / raw)
  To: Konstantin Komarov, ntfs3, linux-fsdevel, linux-kernel

Changes v1->v2:
- Add documentation for the system.ntfs_attrib_be extended attribute

Improves compatibility with NTFS-3G by adding the system.ntfs_attrib_be
extended attribute.

Daniel Pinto (2):
  fs/ntfs3: add system.ntfs_attrib_be extended attribute
  fs/ntfs3: document system.ntfs_attrib_be extended attribute

 Documentation/filesystems/ntfs3.rst |  5 +++++
 fs/ntfs3/xattr.c                    | 20 ++++++++++++++------
 2 files changed, 19 insertions(+), 6 deletions(-)

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

* [PATCH v2 1/2] fs/ntfs3: add system.ntfs_attrib_be extended attribute
  2022-10-10 11:41 [PATCH v2 0/2] fs/ntfs3: Add system.ntfs_attrib_be extended attribute Daniel Pinto
@ 2022-10-10 11:44 ` Daniel Pinto
  2022-10-10 11:46 ` [PATCH v2 2/2] fs/ntfs3: document " Daniel Pinto
  2022-11-12 18:19 ` [PATCH v2 0/2] fs/ntfs3: Add " Konstantin Komarov
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Pinto @ 2022-10-10 11:44 UTC (permalink / raw)
  To: Konstantin Komarov, ntfs3, linux-fsdevel, linux-kernel

NTFS-3G provides the system.ntfs_attrib_be extended attribute, which
has the same value as system.ntfs_attrib but represented in big-endian.
Some utilities rely on the existence of this extended attribute.

Improves compatibility with NTFS-3G by adding the system.ntfs_attrib_be
extended attribute.

Signed-off-by: Daniel Pinto <danielpinto52@gmail.com>
---
 fs/ntfs3/xattr.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
index aeee5fb12092..8620a7b4b3e6 100644
--- a/fs/ntfs3/xattr.c
+++ b/fs/ntfs3/xattr.c
@@ -15,9 +15,10 @@
 #include "ntfs_fs.h"
 
 // clang-format off
-#define SYSTEM_DOS_ATTRIB    "system.dos_attrib"
-#define SYSTEM_NTFS_ATTRIB   "system.ntfs_attrib"
-#define SYSTEM_NTFS_SECURITY "system.ntfs_security"
+#define SYSTEM_DOS_ATTRIB     "system.dos_attrib"
+#define SYSTEM_NTFS_ATTRIB    "system.ntfs_attrib"
+#define SYSTEM_NTFS_ATTRIB_BE "system.ntfs_attrib_be"
+#define SYSTEM_NTFS_SECURITY  "system.ntfs_security"
 // clang-format on
 
 static inline size_t unpacked_ea_size(const struct EA_FULL *ea)
@@ -796,7 +797,8 @@ static int ntfs_getxattr(const struct xattr_handler *handler, struct dentry *de,
 		goto out;
 	}
 
-	if (!strcmp(name, SYSTEM_NTFS_ATTRIB)) {
+	if (!strcmp(name, SYSTEM_NTFS_ATTRIB) ||
+	    !strcmp(name, SYSTEM_NTFS_ATTRIB_BE)) {
 		/* system.ntfs_attrib */
 		if (!buffer) {
 			err = sizeof(u32);
@@ -805,6 +807,8 @@ static int ntfs_getxattr(const struct xattr_handler *handler, struct dentry *de,
 		} else {
 			err = sizeof(u32);
 			*(u32 *)buffer = le32_to_cpu(ni->std_fa);
+			if (!strcmp(name, SYSTEM_NTFS_ATTRIB_BE))
+				*(u32 *)buffer = cpu_to_be32(*(u32 *)buffer);
 		}
 		goto out;
 	}
@@ -889,10 +893,14 @@ static noinline int ntfs_setxattr(const struct xattr_handler *handler,
 		goto set_new_fa;
 	}
 
-	if (!strcmp(name, SYSTEM_NTFS_ATTRIB)) {
+	if (!strcmp(name, SYSTEM_NTFS_ATTRIB) ||
+	    !strcmp(name, SYSTEM_NTFS_ATTRIB_BE)) {
 		if (size != sizeof(u32))
 			goto out;
-		new_fa = cpu_to_le32(*(u32 *)value);
+		if (!strcmp(name, SYSTEM_NTFS_ATTRIB_BE))
+			new_fa = cpu_to_le32(be32_to_cpu(*(u32 *)value));
+		else
+			new_fa = cpu_to_le32(*(u32 *)value);
 
 		if (S_ISREG(inode->i_mode)) {
 			/* Process compressed/sparsed in special way. */

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

* [PATCH v2 2/2] fs/ntfs3: document system.ntfs_attrib_be extended attribute
  2022-10-10 11:41 [PATCH v2 0/2] fs/ntfs3: Add system.ntfs_attrib_be extended attribute Daniel Pinto
  2022-10-10 11:44 ` [PATCH v2 1/2] fs/ntfs3: add " Daniel Pinto
@ 2022-10-10 11:46 ` Daniel Pinto
  2022-11-12 18:19 ` [PATCH v2 0/2] fs/ntfs3: Add " Konstantin Komarov
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Pinto @ 2022-10-10 11:46 UTC (permalink / raw)
  To: Konstantin Komarov, ntfs3, linux-fsdevel, linux-kernel

Add documentation for system.ntfs_attrib_be extended attribute.

Signed-off-by: Daniel Pinto <danielpinto52@gmail.com>
---
 Documentation/filesystems/ntfs3.rst | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/filesystems/ntfs3.rst b/Documentation/filesystems/ntfs3.rst
index d67ccd22c63b..fa6ca1babc60 100644
--- a/Documentation/filesystems/ntfs3.rst
+++ b/Documentation/filesystems/ntfs3.rst
@@ -25,6 +25,11 @@ versions up to 3.1. File system type to use on mount is *ntfs3*.
 	  Note: Applied to empty files, this allows to switch type between
 	  sparse(0x200), compressed(0x800) and normal.
 
+	- *system.ntfs_attrib_be* gets/sets ntfs file/dir attributes.
+
+	  Same value as system.ntfs_attrib but always represent as big-endian
+	  (endianness of system.ntfs_attrib is the same as of the CPU).
+
 Mount Options
 =============

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

* Re: [PATCH v2 0/2] fs/ntfs3: Add system.ntfs_attrib_be extended attribute
  2022-10-10 11:41 [PATCH v2 0/2] fs/ntfs3: Add system.ntfs_attrib_be extended attribute Daniel Pinto
  2022-10-10 11:44 ` [PATCH v2 1/2] fs/ntfs3: add " Daniel Pinto
  2022-10-10 11:46 ` [PATCH v2 2/2] fs/ntfs3: document " Daniel Pinto
@ 2022-11-12 18:19 ` Konstantin Komarov
  2 siblings, 0 replies; 4+ messages in thread
From: Konstantin Komarov @ 2022-11-12 18:19 UTC (permalink / raw)
  To: Daniel Pinto, ntfs3, linux-fsdevel, linux-kernel



On 10/10/22 14:41, Daniel Pinto wrote:
> Changes v1->v2:
> - Add documentation for the system.ntfs_attrib_be extended attribute
> 
> Improves compatibility with NTFS-3G by adding the system.ntfs_attrib_be
> extended attribute.
> 
> Daniel Pinto (2):
>    fs/ntfs3: add system.ntfs_attrib_be extended attribute
>    fs/ntfs3: document system.ntfs_attrib_be extended attribute
> 
>   Documentation/filesystems/ntfs3.rst |  5 +++++
>   fs/ntfs3/xattr.c                    | 20 ++++++++++++++------
>   2 files changed, 19 insertions(+), 6 deletions(-)

Thank you for your work, applied!

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

end of thread, other threads:[~2022-11-12 18:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-10 11:41 [PATCH v2 0/2] fs/ntfs3: Add system.ntfs_attrib_be extended attribute Daniel Pinto
2022-10-10 11:44 ` [PATCH v2 1/2] fs/ntfs3: add " Daniel Pinto
2022-10-10 11:46 ` [PATCH v2 2/2] fs/ntfs3: document " Daniel Pinto
2022-11-12 18:19 ` [PATCH v2 0/2] fs/ntfs3: Add " Konstantin Komarov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).