FreeBSD kernel kern code
subr_acl_nfs4.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/systm.h>
#include <sys/mount.h>
#include <sys/priv.h>
#include <sys/vnode.h>
#include <sys/errno.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
#include <sys/acl.h>
Include dependency graph for subr_acl_nfs4.c:

Go to the source code of this file.

Functions

 __FBSDID ("$FreeBSD$")
 
static void acl_nfs4_trivial_from_mode (struct acl *aclp, mode_t mode)
 
 SYSCTL_INT (_vfs, OID_AUTO, acl_nfs4_old_semantics, CTLFLAG_RW, &acl_nfs4_old_semantics, 0, "Use pre-PSARC/2010/029 NFSv4 ACL semantics")
 
static int _access_mask_from_accmode (accmode_t accmode)
 
static int _acl_denies (const struct acl *aclp, int access_mask, struct ucred *cred, int file_uid, int file_gid, int *denied_explicitly)
 
int vaccess_acl_nfs4 (enum vtype type, uid_t file_uid, gid_t file_gid, struct acl *aclp, accmode_t accmode, struct ucred *cred)
 
static int _acl_entry_matches (struct acl_entry *entry, acl_tag_t tag, acl_perm_t perm, acl_entry_type_t entry_type)
 
static struct acl_entry * _acl_append (struct acl *aclp, acl_tag_t tag, acl_perm_t perm, acl_entry_type_t entry_type)
 
static struct acl_entry * _acl_duplicate_entry (struct acl *aclp, unsigned entry_index)
 
static void acl_nfs4_sync_acl_from_mode_draft (struct acl *aclp, mode_t mode, int file_owner_id)
 
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)
 
static void acl_nfs4_compute_inherited_acl_draft (const struct acl *parent_aclp, struct acl *child_aclp, mode_t mode, int file_owner_id, int is_directory)
 
static void acl_nfs4_inherit_entries (const struct acl *parent_aclp, struct acl *child_aclp, mode_t mode, int file_owner_id, int is_directory)
 
static void acl_nfs4_compute_inherited_acl_psarc (const struct acl *parent_aclp, struct acl *aclp, mode_t mode, int file_owner_id, int is_directory)
 
void acl_nfs4_compute_inherited_acl (const struct acl *parent_aclp, struct acl *child_aclp, mode_t mode, int file_owner_id, int is_directory)
 
static int _acls_are_equal (const struct acl *a, const struct acl *b)
 
int acl_nfs4_is_trivial (const struct acl *aclp, int file_owner_id)
 
int acl_nfs4_check (const struct acl *aclp, int is_directory)
 
static int acl_nfs4_modload (module_t module, int what, void *arg)
 
 DECLARE_MODULE (acl_nfs4, acl_nfs4_mod, SI_SUB_VFS, SI_ORDER_FIRST)
 
 MODULE_VERSION (acl_nfs4, 1)
 

Variables

static int acl_nfs4_old_semantics = 0
 
struct {
   accmode_t   accmode
 
   int   mask
 
accmode2mask []
 
static moduledata_t acl_nfs4_mod
 

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ _access_mask_from_accmode()

static int _access_mask_from_accmode ( accmode_t  accmode)
static

Definition at line 88 of file subr_acl_nfs4.c.

References accmode, and accmode2mask.

Referenced by vaccess_acl_nfs4().

Here is the caller graph for this function:

◆ _acl_append()

static struct acl_entry * _acl_append ( struct acl *  aclp,
acl_tag_t  tag,
acl_perm_t  perm,
acl_entry_type_t  entry_type 
)
static

Definition at line 323 of file subr_acl_nfs4.c.

Referenced by acl_nfs4_compute_inherited_acl_psarc(), and acl_nfs4_sync_acl_from_mode_draft().

Here is the caller graph for this function:

◆ _acl_denies()

static int _acl_denies ( const struct acl *  aclp,
int  access_mask,
struct ucred *  cred,
int  file_uid,
int  file_gid,
int *  denied_explicitly 
)
static

Definition at line 111 of file subr_acl_nfs4.c.

References groupmember().

Referenced by vaccess_acl_nfs4().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _acl_duplicate_entry()

static struct acl_entry * _acl_duplicate_entry ( struct acl *  aclp,
unsigned  entry_index 
)
static

Definition at line 344 of file subr_acl_nfs4.c.

Referenced by acl_nfs4_compute_inherited_acl_draft(), and acl_nfs4_sync_acl_from_mode_draft().

Here is the caller graph for this function:

◆ _acl_entry_matches()

static int _acl_entry_matches ( struct acl_entry *  entry,
acl_tag_t  tag,
acl_perm_t  perm,
acl_entry_type_t  entry_type 
)
static

Definition at line 301 of file subr_acl_nfs4.c.

Referenced by acl_nfs4_sync_acl_from_mode_draft().

Here is the caller graph for this function:

◆ _acls_are_equal()

static int _acls_are_equal ( const struct acl *  a,
const struct acl *  b 
)
static

Definition at line 1235 of file subr_acl_nfs4.c.

Referenced by acl_nfs4_is_trivial().

Here is the caller graph for this function:

◆ acl_nfs4_check()

int acl_nfs4_check ( const struct acl *  aclp,
int  is_directory 
)

Definition at line 1305 of file subr_acl_nfs4.c.

◆ acl_nfs4_compute_inherited_acl()

void acl_nfs4_compute_inherited_acl ( const struct acl *  parent_aclp,
struct acl *  child_aclp,
mode_t  mode,
int  file_owner_id,
int  is_directory 
)

Definition at line 1188 of file subr_acl_nfs4.c.

References acl_nfs4_compute_inherited_acl_draft(), acl_nfs4_compute_inherited_acl_psarc(), acl_nfs4_old_semantics, and mode.

Here is the call graph for this function:

◆ acl_nfs4_compute_inherited_acl_draft()

static void acl_nfs4_compute_inherited_acl_draft ( const struct acl *  parent_aclp,
struct acl *  child_aclp,
mode_t  mode,
int  file_owner_id,
int  is_directory 
)
static

Definition at line 846 of file subr_acl_nfs4.c.

References _acl_duplicate_entry(), acl_nfs4_sync_acl_from_mode(), flags, and mode.

Referenced by acl_nfs4_compute_inherited_acl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ acl_nfs4_compute_inherited_acl_psarc()

static void acl_nfs4_compute_inherited_acl_psarc ( const struct acl *  parent_aclp,
struct acl *  aclp,
mode_t  mode,
int  file_owner_id,
int  is_directory 
)
static

Definition at line 1129 of file subr_acl_nfs4.c.

References _acl_append(), acl_nfs4_inherit_entries(), and mode.

Referenced by acl_nfs4_compute_inherited_acl(), and acl_nfs4_trivial_from_mode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ acl_nfs4_inherit_entries()

static void acl_nfs4_inherit_entries ( const struct acl *  parent_aclp,
struct acl *  child_aclp,
mode_t  mode,
int  file_owner_id,
int  is_directory 
)
static

Definition at line 1009 of file subr_acl_nfs4.c.

References flags, and mode.

Referenced by acl_nfs4_compute_inherited_acl_psarc().

Here is the caller graph for this function:

◆ acl_nfs4_is_trivial()

int acl_nfs4_is_trivial ( const struct acl *  aclp,
int  file_owner_id 
)

Definition at line 1263 of file subr_acl_nfs4.c.

References _acls_are_equal(), acl_alloc(), acl_free(), acl_nfs4_sync_acl_from_mode_draft(), acl_nfs4_sync_mode_from_acl(), and acl_nfs4_trivial_from_mode().

Here is the call graph for this function:

◆ acl_nfs4_modload()

static int acl_nfs4_modload ( module_t  module,
int  what,
void *  arg 
)
static

Definition at line 1374 of file subr_acl_nfs4.c.

◆ acl_nfs4_sync_acl_from_mode()

void acl_nfs4_sync_acl_from_mode ( struct acl *  aclp,
mode_t  mode,
int  file_owner_id 
)

Definition at line 707 of file subr_acl_nfs4.c.

References acl_nfs4_old_semantics, acl_nfs4_sync_acl_from_mode_draft(), acl_nfs4_trivial_from_mode(), and mode.

Referenced by acl_nfs4_compute_inherited_acl_draft().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ acl_nfs4_sync_acl_from_mode_draft()

static void acl_nfs4_sync_acl_from_mode_draft ( struct acl *  aclp,
mode_t  mode,
int  file_owner_id 
)
static

Definition at line 360 of file subr_acl_nfs4.c.

References _acl_append(), _acl_duplicate_entry(), _acl_entry_matches(), amode, and mode.

Referenced by acl_nfs4_is_trivial(), and acl_nfs4_sync_acl_from_mode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ acl_nfs4_sync_mode_from_acl()

void acl_nfs4_sync_mode_from_acl ( mode_t *  _mode,
const struct acl *  aclp 
)

Definition at line 719 of file subr_acl_nfs4.c.

References mode.

Referenced by acl_nfs4_is_trivial(), and vaccess_acl_nfs4().

Here is the caller graph for this function:

◆ acl_nfs4_trivial_from_mode()

static void acl_nfs4_trivial_from_mode ( struct acl *  aclp,
mode_t  mode 
)
static

Definition at line 1209 of file subr_acl_nfs4.c.

References acl_nfs4_compute_inherited_acl_psarc(), and mode.

Referenced by acl_nfs4_is_trivial(), and acl_nfs4_sync_acl_from_mode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DECLARE_MODULE()

DECLARE_MODULE ( acl_nfs4  ,
acl_nfs4_mod  ,
SI_SUB_VFS  ,
SI_ORDER_FIRST   
)

◆ MODULE_VERSION()

MODULE_VERSION ( acl_nfs4  ,
 
)

◆ SYSCTL_INT()

SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
acl_nfs4_old_semantics  ,
CTLFLAG_RW  ,
acl_nfs4_old_semantics,
,
"Use pre-PSARC/2010/029 NFSv4 ACL semantics"   
)

◆ vaccess_acl_nfs4()

int vaccess_acl_nfs4 ( enum vtype  type,
uid_t  file_uid,
gid_t  file_gid,
struct acl *  aclp,
accmode_t  accmode,
struct ucred *  cred 
)

Definition at line 173 of file subr_acl_nfs4.c.

References _access_mask_from_accmode(), _acl_denies(), accmode, acl_nfs4_sync_mode_from_acl(), priv_check_cred(), and type.

Here is the call graph for this function:

Variable Documentation

◆ accmode

◆ 

struct { ... } accmode2mask[]
Initial value:
= {{VREAD, ACL_READ_DATA},
{VWRITE, ACL_WRITE_DATA},
{VAPPEND, ACL_APPEND_DATA},
{VEXEC, ACL_EXECUTE},
{VREAD_NAMED_ATTRS, ACL_READ_NAMED_ATTRS},
{VWRITE_NAMED_ATTRS, ACL_WRITE_NAMED_ATTRS},
{VDELETE_CHILD, ACL_DELETE_CHILD},
{VREAD_ATTRIBUTES, ACL_READ_ATTRIBUTES},
{VWRITE_ATTRIBUTES, ACL_WRITE_ATTRIBUTES},
{VDELETE, ACL_DELETE},
{VREAD_ACL, ACL_READ_ACL},
{VWRITE_ACL, ACL_WRITE_ACL},
{VWRITE_OWNER, ACL_WRITE_OWNER},
{VSYNCHRONIZE, ACL_SYNCHRONIZE},
{0, 0}}

Referenced by _access_mask_from_accmode().

◆ acl_nfs4_mod

moduledata_t acl_nfs4_mod
static
Initial value:
= {
"acl_nfs4",
NULL
}
static int acl_nfs4_modload(module_t module, int what, void *arg)

Definition at line 1402 of file subr_acl_nfs4.c.

◆ acl_nfs4_old_semantics

int acl_nfs4_old_semantics = 0
static

Definition at line 63 of file subr_acl_nfs4.c.

Referenced by acl_nfs4_compute_inherited_acl(), and acl_nfs4_sync_acl_from_mode().

◆ mask