linux/fs/nfsd/nfs4acl.c

/*
 *  Common NFSv4 ACL handling code.
 *
 *  Copyright (c) 2002, 2003 The Regents of the University of Michigan.
 *  All rights reserved.
 *
 *  Marius Aamodt Eriksen <[email protected]>
 *  Jeff Sedlak <[email protected]>
 *  J. Bruce Fields <[email protected]>
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions
 *  are met:
 *
 *  1. Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *  2. Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *  3. Neither the name of the University nor the names of its
 *     contributors may be used to endorse or promote products derived
 *     from this software without specific prior written permission.
 *
 *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
 *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 *  DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 *  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/posix_acl.h>

#include "nfsfh.h"
#include "nfsd.h"
#include "acl.h"
#include "vfs.h"

#define NFS4_ACL_TYPE_DEFAULT
#define NFS4_ACL_DIR
#define NFS4_ACL_OWNER

/* mode bit translations: */
#define NFS4_READ_MODE
#define NFS4_WRITE_MODE
#define NFS4_EXECUTE_MODE
#define NFS4_ANYONE_MODE
#define NFS4_OWNER_MODE

/* flags used to simulate posix default ACLs */
#define NFS4_INHERITANCE_FLAGS

#define NFS4_SUPPORTED_FLAGS

static u32
mask_from_posix(unsigned short perm, unsigned int flags)
{}

static u32
deny_mask_from_posix(unsigned short perm, u32 flags)
{}

/* XXX: modify functions to return NFS errors; they're only ever
 * used by nfs code, after all.... */

/* We only map from NFSv4 to POSIX ACLs when setting ACLs, when we err on the
 * side of being more restrictive, so the mode bit mapping below is
 * pessimistic.  An optimistic version would be needed to handle DENY's,
 * but we expect to coalesce all ALLOWs and DENYs before mapping to mode
 * bits. */

static void
low_mode_from_nfs4(u32 perm, unsigned short *mode, unsigned int flags)
{}

static short ace2type(struct nfs4_ace *);
static void _posix_to_nfsv4_one(struct posix_acl *, struct nfs4_acl *,
				unsigned int);

int
nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry,
		struct nfs4_acl **acl)
{}

struct posix_acl_summary {};

static void
summarize_posix_acl(struct posix_acl *acl, struct posix_acl_summary *pas)
{}

/* We assume the acl has been verified with posix_acl_valid. */
static void
_posix_to_nfsv4_one(struct posix_acl *pacl, struct nfs4_acl *acl,
						unsigned int flags)
{}

static bool
pace_gt(struct posix_acl_entry *pace1, struct posix_acl_entry *pace2)
{}

static void
sort_pacl_range(struct posix_acl *pacl, int start, int end) {}

static void
sort_pacl(struct posix_acl *pacl)
{}

/*
 * While processing the NFSv4 ACE, this maintains bitmasks representing
 * which permission bits have been allowed and which denied to a given
 * entity: */
struct posix_ace_state {};

struct posix_user_ace_state {};

struct posix_ace_state_array {};

/*
 * While processing the NFSv4 ACE, this maintains the partial permissions
 * calculated so far: */

struct posix_acl_state {};

static int
init_state(struct posix_acl_state *state, int cnt)
{}

static void
free_state(struct posix_acl_state *state) {}

static inline void add_to_mask(struct posix_acl_state *state, struct posix_ace_state *astate)
{}

static struct posix_acl *
posix_state_to_acl(struct posix_acl_state *state, unsigned int flags)
{}

static inline void allow_bits(struct posix_ace_state *astate, u32 mask)
{}

static inline void deny_bits(struct posix_ace_state *astate, u32 mask)
{}

static int find_uid(struct posix_acl_state *state, kuid_t uid)
{}

static int find_gid(struct posix_acl_state *state, kgid_t gid)
{}

static void deny_bits_array(struct posix_ace_state_array *a, u32 mask)
{}

static void allow_bits_array(struct posix_ace_state_array *a, u32 mask)
{}

static void process_one_v4_ace(struct posix_acl_state *state,
				struct nfs4_ace *ace)
{}

static int nfs4_acl_nfsv4_to_posix(struct nfs4_acl *acl,
		struct posix_acl **pacl, struct posix_acl **dpacl,
		unsigned int flags)
{}

__be32 nfsd4_acl_to_attr(enum nfs_ftype4 type, struct nfs4_acl *acl,
			 struct nfsd_attrs *attr)
{}

static short
ace2type(struct nfs4_ace *ace)
{}

/*
 * return the size of the struct nfs4_acl required to represent an acl
 * with @entries entries.
 */
int nfs4_acl_bytes(int entries)
{}

static struct {} s2t_map[] =;

int
nfs4_acl_get_whotype(char *p, u32 len)
{}

__be32 nfs4_acl_write_who(struct xdr_stream *xdr, int who)
{}