guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

22/24: gnu: linux-libre: Add support for gnu.* namespace.


From: guix-commits
Subject: 22/24: gnu: linux-libre: Add support for gnu.* namespace.
Date: Sun, 17 May 2020 06:00:55 -0400 (EDT)

janneke pushed a commit to branch wip-hurd-vm
in repository guix.

commit 5ca2d754a580316642cabfb52618f23fd7bc155c
Author: Jan (janneke) Nieuwenhuizen <address@hidden>
AuthorDate: Mon May 11 12:38:34 2020 +0200

    gnu: linux-libre: Add support for gnu.* namespace.
    
    * gnu/packages/patches/linux-libre-support-for-the-Hurd.patch: New file.
    * gnu/packages/linux.scm (linux-libre-5.4-source, linux-libre-5.6-source): 
Use
    it.
    (%default-extra-linux-options): Enable it.
---
 gnu/local.mk                                       |   1 +
 gnu/packages/linux.scm                             |  13 +-
 .../patches/linux-libre-support-for-the-Hurd.patch | 177 +++++++++++++++++++++
 3 files changed, 188 insertions(+), 3 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index c7d7e17..902e44e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1222,6 +1222,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/linkchecker-tests-require-network.patch \
   %D%/packages/patches/linphoneqt-tabbutton.patch              \
   %D%/packages/patches/linux-libre-support-for-Pinebook-Pro.patch \
+  %D%/packages/patches/linux-libre-support-for-the-Hurd.patch  \
   %D%/packages/patches/linux-pam-no-setfsuid.patch             \
   %D%/packages/patches/lirc-localstatedir.patch                        \
   %D%/packages/patches/lirc-reproducible-build.patch           \
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index aa52068..6ff431f 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -452,7 +452,10 @@ corresponding UPSTREAM-SOURCE (an origin), using the given 
DEBLOB-SCRIPTS."
                              ;; Pinebook Pro patch from linux-next,
                              ;; can be dropped for linux-libre 5.7
                              (search-patch
-                              "linux-libre-support-for-Pinebook-Pro.patch"))))
+                              "linux-libre-support-for-Pinebook-Pro.patch")
+                             ;; Support gnu.* namespace on ext4 file-systems
+                             (search-patch
+                              "linux-libre-support-for-the-Hurd.patch"))))
 
 (define-public linux-libre-5.4-source
   (source-with-patches linux-libre-5.4-pristine-source
@@ -461,7 +464,9 @@ corresponding UPSTREAM-SOURCE (an origin), using the given 
DEBLOB-SCRIPTS."
                              ;; Pinebook Pro patch from linux-next,
                              ;; can be dropped for linux-libre 5.7
                              (search-patch
-                              "linux-libre-support-for-Pinebook-Pro.patch"))))
+                              "linux-libre-support-for-Pinebook-Pro.patch")
+                             (search-patch
+                              "linux-libre-support-for-the-Hurd.patch"))))
 
 (define-public linux-libre-4.19-source
   (source-with-patches linux-libre-4.19-pristine-source
@@ -618,7 +623,9 @@ for ARCH and optionally VARIANT, or #f if there is no such 
configuration."
     ("CONFIG_VIRTIO_MMIO" . m)
     ("CONFIG_FUSE_FS" . m)
     ("CONFIG_CIFS" . m)
-    ("CONFIG_9P_FS" . m)))
+    ("CONFIG_9P_FS" . m)
+    ;; Support the gnu.* translator namespace for the Hurd.
+    ("CONFIG_EXT4_FS_HURD" . #t)))
 
 (define (config->string options)
   (string-join (map (match-lambda
diff --git a/gnu/packages/patches/linux-libre-support-for-the-Hurd.patch 
b/gnu/packages/patches/linux-libre-support-for-the-Hurd.patch
new file mode 100644
index 0000000..ffcb4d2
--- /dev/null
+++ b/gnu/packages/patches/linux-libre-support-for-the-Hurd.patch
@@ -0,0 +1,177 @@
+From 475eb7cfae390d9118a5420df90b979b4ec78aa3 Mon Sep 17 00:00:00 2001
+From: "Jan (janneke) Nieuwenhuizen" <address@hidden>
+Date: Mon, 11 May 2020 18:43:44 +0200
+Subject: [PATCH] ext4: Support gnu.* namespace for Hurd file systems.
+
+The Hurd has experimental code to move the translator and author
+fields out of the inode, into the "gnu.*" xattr namespace.
+
+This patch adds support for reading and writing such attributes.
+
+For more information please see:
+    https://summerofcode.withgoogle.com/projects/#5869799859027968
+---
+ fs/ext4/Kconfig            | 11 ++++++++
+ fs/ext4/Makefile           |  1 +
+ fs/ext4/xattr.c            |  6 ++++
+ fs/ext4/xattr.h            |  1 +
+ fs/ext4/xattr_hurd.c       | 57 ++++++++++++++++++++++++++++++++++++++
+ include/uapi/linux/xattr.h |  4 +++
+ 6 files changed, 80 insertions(+)
+ create mode 100644 fs/ext4/xattr_hurd.c
+
+diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig
+index 2de970cfc33c..324082dec6ee 100644
+--- a/fs/ext4/Kconfig
++++ b/fs/ext4/Kconfig
+@@ -98,6 +98,17 @@ config EXT4_FS_SECURITY
+         If you are not using a security module that requires using
+         extended attributes for file security labels, say N.
+ 
++config EXT4_FS_HURD
++      bool "Ext4 xattr gnu.* namespace support for the Hurd"
++      depends on EXT4_FS
++      help
++        Extended attributes are name:value pairs associated with inodes by
++        the kernel or by users (see the attr(5) manual page for details).
++          This option adds support for the gnu.* namespace ext4 file
++          systems for the Hurd.
++
++        If you don't know what the GNU Hurd is, say N
++
+ config EXT4_DEBUG
+       bool "Ext4 debugging support"
+       depends on EXT4_FS
+diff --git a/fs/ext4/Makefile b/fs/ext4/Makefile
+index 4ccb3c9189d8..3c2c43167dbf 100644
+--- a/fs/ext4/Makefile
++++ b/fs/ext4/Makefile
+@@ -16,3 +16,4 @@ ext4-$(CONFIG_EXT4_FS_SECURITY)              += 
xattr_security.o
+ ext4-inode-test-objs                  += inode-test.o
+ obj-$(CONFIG_EXT4_KUNIT_TESTS)                += ext4-inode-test.o
+ ext4-$(CONFIG_FS_VERITY)              += verity.o
++ext4-$(CONFIG_EXT4_FS_HURD)           += xattr_hurd.o
+diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
+index 8966a5439a22..6353034c5f56 100644
+--- a/fs/ext4/xattr.c
++++ b/fs/ext4/xattr.c
+@@ -93,6 +93,9 @@ static const struct xattr_handler * const 
ext4_xattr_handler_map[] = {
+ #ifdef CONFIG_EXT4_FS_SECURITY
+       [EXT4_XATTR_INDEX_SECURITY]          = &ext4_xattr_security_handler,
+ #endif
++#ifdef CONFIG_EXT4_FS_HURD
++      [EXT4_XATTR_INDEX_HURD]              = &ext4_xattr_hurd_handler,
++#endif
+ };
+ 
+ const struct xattr_handler *ext4_xattr_handlers[] = {
+@@ -104,6 +107,9 @@ const struct xattr_handler *ext4_xattr_handlers[] = {
+ #endif
+ #ifdef CONFIG_EXT4_FS_SECURITY
+       &ext4_xattr_security_handler,
++#endif
++#ifdef CONFIG_EXT4_FS_HURD
++      &ext4_xattr_hurd_handler,
+ #endif
+       NULL
+ };
+diff --git a/fs/ext4/xattr.h b/fs/ext4/xattr.h
+index f39cad2abe2a..c5e865f14133 100644
+--- a/fs/ext4/xattr.h
++++ b/fs/ext4/xattr.h
+@@ -124,6 +124,7 @@ struct ext4_xattr_inode_array {
+ extern const struct xattr_handler ext4_xattr_user_handler;
+ extern const struct xattr_handler ext4_xattr_trusted_handler;
+ extern const struct xattr_handler ext4_xattr_security_handler;
++extern const struct xattr_handler ext4_xattr_hurd_handler;
+ 
+ #define EXT4_XATTR_NAME_ENCRYPTION_CONTEXT "c"
+ 
+diff --git a/fs/ext4/xattr_hurd.c b/fs/ext4/xattr_hurd.c
+new file mode 100644
+index 000000000000..ee31557308a9
+--- /dev/null
++++ b/fs/ext4/xattr_hurd.c
+@@ -0,0 +1,57 @@
++// SPDX-License-Identifier: GPL-2.0
++/*
++ * linux/fs/ext4/xattr_hurd.c
++ * Handler for extended gnu attributes for the Hurd.
++ *
++ * Copyright (C) 2001 by Andreas Gruenbacher, <address@hidden>
++ * Copyright (C) 2020 by Jan (janneke) Nieuwenhuizen, <address@hidden>
++ */
++
++#include <linux/init.h>
++#include <linux/string.h>
++#include "ext4.h"
++#include "xattr.h"
++
++static bool
++ext4_xattr_hurd_list(struct dentry *dentry)
++{
++      return test_opt(dentry->d_sb, XATTR_USER) &&
++              EXT4_SB(dentry->d_sb)->s_es->s_creator_os ==
++              cpu_to_le32(EXT4_OS_HURD);
++}
++
++static int
++ext4_xattr_hurd_get(const struct xattr_handler *handler,
++                    struct dentry *unused, struct inode *inode,
++                    const char *name, void *buffer, size_t size)
++{
++      if (!test_opt(inode->i_sb, XATTR_USER) ||
++            EXT4_SB(inode->i_sb)->s_es->s_creator_os !=
++            cpu_to_le32(EXT4_OS_HURD))
++              return -EOPNOTSUPP;
++
++      return ext4_xattr_get(inode, EXT4_XATTR_INDEX_HURD,
++                            name, buffer, size);
++}
++
++static int
++ext4_xattr_hurd_set(const struct xattr_handler *handler,
++                    struct dentry *unused, struct inode *inode,
++                    const char *name, const void *value,
++                    size_t size, int flags)
++{
++      if (!test_opt(inode->i_sb, XATTR_USER) ||
++            EXT4_SB(inode->i_sb)->s_es->s_creator_os !=
++            cpu_to_le32(EXT4_OS_HURD))
++              return -EOPNOTSUPP;
++
++      return ext4_xattr_set(inode, EXT4_XATTR_INDEX_HURD,
++                            name, value, size, flags);
++}
++
++const struct xattr_handler ext4_xattr_hurd_handler = {
++      .prefix = XATTR_HURD_PREFIX,
++      .list   = ext4_xattr_hurd_list,
++      .get    = ext4_xattr_hurd_get,
++      .set    = ext4_xattr_hurd_set,
++};
+diff --git a/include/uapi/linux/xattr.h b/include/uapi/linux/xattr.h
+index c1395b5bd432..9463db2dfa9d 100644
+--- a/include/uapi/linux/xattr.h
++++ b/include/uapi/linux/xattr.h
+@@ -7,6 +7,7 @@
+   Copyright (C) 2001 by Andreas Gruenbacher <address@hidden>
+   Copyright (c) 2001-2002 Silicon Graphics, Inc.  All Rights Reserved.
+   Copyright (c) 2004 Red Hat, Inc., James Morris <address@hidden>
++  Copyright (c) 2020 Jan (janneke) Nieuwenhuizen <address@hidden>
+ */
+ 
+ #include <linux/libc-compat.h>
+@@ -31,6 +32,9 @@
+ #define XATTR_BTRFS_PREFIX "btrfs."
+ #define XATTR_BTRFS_PREFIX_LEN (sizeof(XATTR_BTRFS_PREFIX) - 1)
+ 
++#define XATTR_HURD_PREFIX "gnu."
++#define XATTR_HURD_PREFIX_LEN (sizeof(XATTR_HURD_PREFIX) - 1)
++
+ #define XATTR_SECURITY_PREFIX "security."
+ #define XATTR_SECURITY_PREFIX_LEN (sizeof(XATTR_SECURITY_PREFIX) - 1)
+ 
+-- 
+2.26.0
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]