svn commit: r219878 - in head: lib/libc/posix1e sys/kern sys/sys
Edward Tomasz Napierala
trasz at FreeBSD.org
Tue Mar 22 17:44:08 UTC 2011
Author: trasz
Date: Tue Mar 22 17:44:07 2011
New Revision: 219878
URL: http://svn.freebsd.org/changeset/base/219878
Log:
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.
Modified:
head/lib/libc/posix1e/acl_strip.c
head/sys/kern/subr_acl_nfs4.c
head/sys/sys/acl.h
Modified: head/lib/libc/posix1e/acl_strip.c
==============================================================================
--- head/lib/libc/posix1e/acl_strip.c Tue Mar 22 17:26:56 2011 (r219877)
+++ head/lib/libc/posix1e/acl_strip.c Tue Mar 22 17:44:07 2011 (r219878)
@@ -36,13 +36,12 @@ __FBSDID("$FreeBSD$");
#include "acl_support.h"
/*
- * These three routines from sys/kern/subr_acl_nfs4.c are used by both kernel
+ * These routines from sys/kern/subr_acl_nfs4.c are used by both kernel
* and libc.
*/
-void acl_nfs4_trivial_from_mode(struct acl *aclp, mode_t mode);
-void acl_nfs4_sync_acl_from_mode(struct acl *aclp, mode_t mode,
- int file_owner_id);
void acl_nfs4_sync_mode_from_acl(mode_t *_mode, const struct acl *aclp);
+void acl_nfs4_trivial_from_mode_libc(struct acl *aclp, int file_owner_id,
+ int canonical_six);
static acl_t
_nfs4_acl_strip_np(const acl_t aclp, int canonical_six)
@@ -59,10 +58,7 @@ _nfs4_acl_strip_np(const acl_t aclp, int
_acl_brand_as(newacl, ACL_BRAND_NFS4);
acl_nfs4_sync_mode_from_acl(&mode, &(aclp->ats_acl));
- if (canonical_six)
- acl_nfs4_sync_acl_from_mode(&(newacl->ats_acl), mode, -1);
- else
- acl_nfs4_trivial_from_mode(&(newacl->ats_acl), mode);
+ acl_nfs4_trivial_from_mode_libc(&(newacl->ats_acl), mode, canonical_six);
return (newacl);
}
Modified: head/sys/kern/subr_acl_nfs4.c
==============================================================================
--- head/sys/kern/subr_acl_nfs4.c Tue Mar 22 17:26:56 2011 (r219877)
+++ head/sys/kern/subr_acl_nfs4.c Tue Mar 22 17:44:07 2011 (r219878)
@@ -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
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 *
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 *_mod
*_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(con
*/
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(con
_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 str
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 *a
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)
Modified: head/sys/sys/acl.h
==============================================================================
--- head/sys/sys/acl.h Tue Mar 22 17:26:56 2011 (r219877)
+++ head/sys/sys/acl.h Tue Mar 22 17:44:07 2011 (r219878)
@@ -285,8 +285,6 @@ mode_t acl_posix1e_newfilemode(mode_t
struct acl *acl_alloc(int flags);
void acl_free(struct acl *aclp);
-void acl_nfs4_trivial_from_mode(struct acl *aclp,
- mode_t mode);
void acl_nfs4_sync_acl_from_mode(struct acl *aclp,
mode_t mode, int file_owner_id);
void acl_nfs4_sync_mode_from_acl(mode_t *mode,
More information about the svn-src-all
mailing list