[lxc-devel] [lxd/master] shift_linux: vendor posix_acl_xattr.h
brauner on Github
lxc-bot at linuxcontainers.org
Mon Oct 5 16:29:49 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 1130 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201005/f9087fa8/attachment.bin>
-------------- next part --------------
From a5e40f8791afb55d91984a9934c895e261aaa349 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Mon, 5 Oct 2020 18:25:20 +0200
Subject: [PATCH] shift_linux: vendor posix_acl_xattr.h
-bash-4.2$ make
go get -t -v -d ./...
CC=gcc go install -v -tags "libsqlite3" ./...
gopkg.in/lxc/go-lxc.v2
github.com/canonical/go-dqlite/internal/bindings
github.com/lxc/lxd/shared/idmap
# github.com/lxc/lxd/shared/idmap
shared/idmap/shift_linux.go:32:35: fatal error: linux/posix_acl_xattr.h: No such file or directory
#include <linux/posix_acl_xattr.h>
^
compilation terminated.
# github.com/canonical/go-dqlite/internal/bindings
/bin/ld: cannot find -lraft
/bin/ld: cannot find -ldqlite
collect2: error: ld returned 1 exit status
make: *** [default] Error 2
-bash-4.2$
# Steps to reproduce
1. try to build on an older kernel system (e.g., rhel7)
Closes #7982.
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
lxd/include/lxd_posix_acl_xattr.h | 39 +++++++++++++++++++++++++++++++
shared/idmap/shift_linux.go | 8 +++----
2 files changed, 43 insertions(+), 4 deletions(-)
create mode 100644 lxd/include/lxd_posix_acl_xattr.h
diff --git a/lxd/include/lxd_posix_acl_xattr.h b/lxd/include/lxd_posix_acl_xattr.h
new file mode 100644
index 0000000000..506380f0b9
--- /dev/null
+++ b/lxd/include/lxd_posix_acl_xattr.h
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
+/*
+ * Copyright (C) 2002 Andreas Gruenbacher <a.gruenbacher at computer.org>
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ * This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ */
+
+#ifndef __UAPI_POSIX_ACL_XATTR_H
+#define __UAPI_POSIX_ACL_XATTR_H
+
+#include <linux/types.h>
+
+/* Supported ACL a_version fields */
+#define POSIX_ACL_XATTR_VERSION 0x0002
+
+/* An undefined entry e_id value */
+#define ACL_UNDEFINED_ID (-1)
+
+struct posix_acl_xattr_entry {
+ __le16 e_tag;
+ __le16 e_perm;
+ __le32 e_id;
+};
+
+struct posix_acl_xattr_header {
+ __le32 a_version;
+};
+
+#endif /* __UAPI_POSIX_ACL_XATTR_H */
diff --git a/shared/idmap/shift_linux.go b/shared/idmap/shift_linux.go
index 05fdd6cd6f..c61f534ca6 100644
--- a/shared/idmap/shift_linux.go
+++ b/shared/idmap/shift_linux.go
@@ -29,7 +29,6 @@ import (
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
-#include <linux/posix_acl_xattr.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -37,13 +36,14 @@ import (
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <sys/acl.h>
+
+#include "../../lxd/include/lxd_posix_acl_xattr.h"
+#include "../../lxd/include/memory_utils.h"
// Needs to be included at the end
+#include <sys/acl.h>
#include <sys/xattr.h>
-#include "../../lxd/include/memory_utils.h"
-
#ifndef VFS_CAP_REVISION_1
#define VFS_CAP_REVISION_1 0x01000000
#endif
More information about the lxc-devel
mailing list