summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_acl_nfs4.c
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2011-03-22 17:44:07 +0000
committertrasz <trasz@FreeBSD.org>2011-03-22 17:44:07 +0000
commiteb401e64c176dc676c855607e4a01265f652284e (patch)
tree30276839728661eb968d3996ae79efd3e82389f2 /sys/kern/subr_acl_nfs4.c
parent6db2fedb23fb657d8722d216c63d055c7e232d49 (diff)
downloadFreeBSD-src-eb401e64c176dc676c855607e4a01265f652284e.zip
FreeBSD-src-eb401e64c176dc676c855607e4a01265f652284e.tar.gz
Move the code around so that libc behaviour does not depend on a variable
that was supposed to be kernel-only. There should be no functional changes.
Diffstat (limited to 'sys/kern/subr_acl_nfs4.c')
-rw-r--r--sys/kern/subr_acl_nfs4.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/sys/kern/subr_acl_nfs4.c b/sys/kern/subr_acl_nfs4.c
index 9b758a1..f3eebf9 100644
--- a/sys/kern/subr_acl_nfs4.c
+++ b/sys/kern/subr_acl_nfs4.c
@@ -51,14 +51,14 @@ __FBSDID("$FreeBSD$");
#define KASSERT(a, b) assert(a)
#define CTASSERT(a)
-void acl_nfs4_trivial_from_mode(struct acl *aclp, mode_t mode);
-
#endif /* !_KERNEL */
-static int acl_nfs4_old_semantics = 1;
-
#ifdef _KERNEL
+static void acl_nfs4_trivial_from_mode(struct acl *aclp, mode_t mode);
+
+static int acl_nfs4_old_semantics = 1;
+
SYSCTL_INT(_vfs, OID_AUTO, acl_nfs4_old_semantics, CTLFLAG_RW,
&acl_nfs4_old_semantics, 1, "Use pre-PSARC/2010/029 NFSv4 ACL semantics");
@@ -703,6 +703,7 @@ acl_nfs4_sync_acl_from_mode_draft(struct acl *aclp, mode_t mode,
a5->ae_perm |= ACL_EXECUTE;
}
+#ifdef _KERNEL
void
acl_nfs4_sync_acl_from_mode(struct acl *aclp, mode_t mode,
int file_owner_id)
@@ -713,6 +714,7 @@ acl_nfs4_sync_acl_from_mode(struct acl *aclp, mode_t mode,
else
acl_nfs4_trivial_from_mode(aclp, mode);
}
+#endif /* _KERNEL */
void
acl_nfs4_sync_mode_from_acl(mode_t *_mode, const struct acl *aclp)
@@ -837,6 +839,7 @@ acl_nfs4_sync_mode_from_acl(mode_t *_mode, const struct acl *aclp)
*_mode = mode | (old_mode & ACL_PRESERVE_MASK);
}
+#ifdef _KERNEL
/*
* Calculate inherited ACL in a manner compatible with NFSv4 Minor Version 1,
* draft-ietf-nfsv4-minorversion1-03.txt.
@@ -1000,6 +1003,7 @@ acl_nfs4_compute_inherited_acl_draft(const struct acl *parent_aclp,
*/
acl_nfs4_sync_acl_from_mode(child_aclp, mode, file_owner_id);
}
+#endif /* _KERNEL */
/*
* Populate the ACL with entries inherited from parent_aclp.
@@ -1182,6 +1186,7 @@ acl_nfs4_compute_inherited_acl_psarc(const struct acl *parent_aclp,
_acl_append(aclp, ACL_EVERYONE, everyone_allow, ACL_ENTRY_TYPE_ALLOW);
}
+#ifdef _KERNEL
void
acl_nfs4_compute_inherited_acl(const struct acl *parent_aclp,
struct acl *child_aclp, mode_t mode, int file_owner_id,
@@ -1195,17 +1200,15 @@ acl_nfs4_compute_inherited_acl(const struct acl *parent_aclp,
acl_nfs4_compute_inherited_acl_psarc(parent_aclp, child_aclp,
mode, file_owner_id, is_directory);
}
+#endif /* _KERNEL */
/*
* Calculate trivial ACL in a manner compatible with PSARC/2010/029.
* Note that this results in an ACL different from (but semantically
* equal to) the "canonical six" trivial ACL computed using algorithm
* described in draft-ietf-nfsv4-minorversion1-03.txt, 3.16.6.2.
- *
- * This routine is not static only because the code is being used in libc.
- * Kernel code should call acl_nfs4_sync_acl_from_mode() instead.
*/
-void
+static void
acl_nfs4_trivial_from_mode(struct acl *aclp, mode_t mode)
{
@@ -1213,6 +1216,23 @@ acl_nfs4_trivial_from_mode(struct acl *aclp, mode_t mode)
acl_nfs4_compute_inherited_acl_psarc(NULL, aclp, mode, -1, -1);
}
+#ifndef _KERNEL
+/*
+ * This routine is used by libc to implement acl_strip_np(3)
+ * and acl_is_trivial_np(3).
+ */
+void
+acl_nfs4_trivial_from_mode_libc(struct acl *aclp, int mode, int canonical_six)
+{
+
+ aclp->acl_cnt = 0;
+ if (canonical_six)
+ acl_nfs4_sync_acl_from_mode_draft(aclp, mode, -1);
+ else
+ acl_nfs4_trivial_from_mode(aclp, mode);
+}
+#endif /* !_KERNEL */
+
#ifdef _KERNEL
static int
_acls_are_equal(const struct acl *a, const struct acl *b)
OpenPOWER on IntegriCloud