diff mbox

[1/3] statxat: Provide IOC flags for Windows fs attributes

Message ID 20131112173526.25813.85546.stgit@warthog.procyon.org.uk (mailing list archive)
State New, archived
Headers show

Commit Message

David Howells Nov. 12, 2013, 5:35 p.m. UTC
Provide IOC flags for Windows fs attributes so that they can be retrieved (or
even altered) using the FS_IOC_[GS]ETFLAGS ioctl and read using statxat().

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/uapi/linux/fs.h |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Steve French Nov. 12, 2013, 6:06 p.m. UTC | #1
I was experimenting with these flags when adding the per-file
compression support for cifs and smb2/smb3, and noticed that it would
be helpful to be able to display the FILE_ATTRIBUTE_ENCRYPTED flag
here too on get (ie to show that the file is encrypted at rest on the
server).   I am unsure whether displaying the "FILE_ATTRIBUTE_SPARSE"
is useful or not here but that is another obvious one.

And the other obvious flag to display would be
"FILE_ATTRIBUTE_INTEGRITY_STREAM" or equivalent (to indicate that this
file is protected by data and metadata checksums, perhaps btrfs and
other local file systems may even eventually allow you to configure
additional extra data/metadata integrity checks someday as well, not
just SMB3).

On Tue, Nov 12, 2013 at 11:35 AM, David Howells <dhowells@redhat.com> wrote:
> Provide IOC flags for Windows fs attributes so that they can be retrieved (or
> even altered) using the FS_IOC_[GS]ETFLAGS ioctl and read using statxat().
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> ---
>
>  include/uapi/linux/fs.h |    7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
> index 6c28b61bb690..8b966f48dd41 100644
> --- a/include/uapi/linux/fs.h
> +++ b/include/uapi/linux/fs.h
> @@ -191,10 +191,13 @@ struct inodes_stat_t {
>  #define FS_EXTENT_FL                   0x00080000 /* Extents */
>  #define FS_DIRECTIO_FL                 0x00100000 /* Use direct i/o */
>  #define FS_NOCOW_FL                    0x00800000 /* Do not cow file */
> +#define FS_HIDDEN_FL                   0x10000000 /* Windows hidden file attribute */
> +#define FS_SYSTEM_FL                   0x20000000 /* Windows system file attribute */
> +#define FS_ARCHIVE_FL                  0x40000000 /* Windows archive file attribute */
>  #define FS_RESERVED_FL                 0x80000000 /* reserved for ext2 lib */
>
> -#define FS_FL_USER_VISIBLE             0x0003DFFF /* User visible flags */
> -#define FS_FL_USER_MODIFIABLE          0x000380FF /* User modifiable flags */
> +#define FS_FL_USER_VISIBLE             0x7003DFFF /* User visible flags */
> +#define FS_FL_USER_MODIFIABLE          0x700380FF /* User modifiable flags */
>
>
>  #define SYNC_FILE_RANGE_WAIT_BEFORE    1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andreas Dilger Nov. 12, 2013, 10:25 p.m. UTC | #2
On Nov 12, 2013, at 10:35 AM, David Howells <dhowells@redhat.com> wrote:
> Provide IOC flags for Windows fs attributes so that they can be retrieved (or
> even altered) using the FS_IOC_[GS]ETFLAGS ioctl and read using statxat().
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> ---
> 
> include/uapi/linux/fs.h |    7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
> index 6c28b61bb690..8b966f48dd41 100644
> --- a/include/uapi/linux/fs.h
> +++ b/include/uapi/linux/fs.h
> @@ -191,10 +191,13 @@ struct inodes_stat_t {
> #define FS_EXTENT_FL			0x00080000 /* Extents */
> #define FS_DIRECTIO_FL			0x00100000 /* Use direct i/o */
> #define FS_NOCOW_FL			0x00800000 /* Do not cow file */
> +#define FS_HIDDEN_FL			0x10000000 /* Windows hidden file attribute */

The 0x10000000 flag is used by ext4 as EXT4_INLINE_DATA_FL.  This would basically fill
up all of the inode flags for ext2/3/4, and while there isn’t a guarantee that there
will not be any conflicts between FS_*_FL and EXT4_*_FL, it is a lot easier if they
are the same.

One option is to move FS_HIDDEN_FL over to use 0x04000000, which is currently used as
EXT4_SNAPFILE_DELETED_FL, but that is IMHO an ext4-internal flag that it isn’t in
common use anywhere, and isn’t so bad to have a conflict with.

Ted, any thoughts on this?

Cheers, Andreas

> +#define FS_SYSTEM_FL			0x20000000 /* Windows system file attribute */
> +#define FS_ARCHIVE_FL			0x40000000 /* Windows archive file attribute */
> #define FS_RESERVED_FL			0x80000000 /* reserved for ext2 lib */
> 
> -#define FS_FL_USER_VISIBLE		0x0003DFFF /* User visible flags */
> -#define FS_FL_USER_MODIFIABLE		0x000380FF /* User modifiable flags */
> +#define FS_FL_USER_VISIBLE		0x7003DFFF /* User visible flags */
> +#define FS_FL_USER_MODIFIABLE		0x700380FF /* User modifiable flags */
> 
> 
> #define SYNC_FILE_RANGE_WAIT_BEFORE	1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cheers, Andreas
Christoph Hellwig Nov. 27, 2013, 11:40 a.m. UTC | #3
On Tue, Nov 12, 2013 at 05:35:26PM +0000, David Howells wrote:
> Provide IOC flags for Windows fs attributes so that they can be retrieved (or
> even altered) using the FS_IOC_[GS]ETFLAGS ioctl and read using statxat().

As mentioned before we're running out of these flags and we already have
a horrible mash up between filesystem specific implementation details
an generally useful ones, so if you want to add them to a stat-like
call you better define an entirely new namespaces.

Also each of the added ones needs a good justification either way.

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index 6c28b61bb690..8b966f48dd41 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -191,10 +191,13 @@  struct inodes_stat_t {
 #define FS_EXTENT_FL			0x00080000 /* Extents */
 #define FS_DIRECTIO_FL			0x00100000 /* Use direct i/o */
 #define FS_NOCOW_FL			0x00800000 /* Do not cow file */
+#define FS_HIDDEN_FL			0x10000000 /* Windows hidden file attribute */
+#define FS_SYSTEM_FL			0x20000000 /* Windows system file attribute */
+#define FS_ARCHIVE_FL			0x40000000 /* Windows archive file attribute */
 #define FS_RESERVED_FL			0x80000000 /* reserved for ext2 lib */
 
-#define FS_FL_USER_VISIBLE		0x0003DFFF /* User visible flags */
-#define FS_FL_USER_MODIFIABLE		0x000380FF /* User modifiable flags */
+#define FS_FL_USER_VISIBLE		0x7003DFFF /* User visible flags */
+#define FS_FL_USER_MODIFIABLE		0x700380FF /* User modifiable flags */
 
 
 #define SYNC_FILE_RANGE_WAIT_BEFORE	1