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.
This commit is contained in:
parent
a8e852babc
commit
cdec385674
@ -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 canonical_six)
|
||||
_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);
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -285,8 +285,6 @@ mode_t acl_posix1e_newfilemode(mode_t cmode,
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user