cregit-Linux how code gets into the kernel

Release 4.7 fs/gfs2/acl.c

Directory: fs/gfs2
/*
 * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
 * Copyright (C) 2004-2006 Red Hat, Inc.  All rights reserved.
 *
 * This copyrighted material is made available to anyone wishing to use,
 * modify, copy, or redistribute it subject to the terms and conditions
 * of the GNU General Public License version 2.
 */

#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/completion.h>
#include <linux/buffer_head.h>
#include <linux/xattr.h>
#include <linux/posix_acl.h>
#include <linux/posix_acl_xattr.h>
#include <linux/gfs2_ondisk.h>

#include "gfs2.h"
#include "incore.h"
#include "acl.h"
#include "xattr.h"
#include "glock.h"
#include "inode.h"
#include "meta_io.h"
#include "rgrp.h"
#include "trans.h"
#include "util.h"


static const char *gfs2_acl_name(int type) { switch (type) { case ACL_TYPE_ACCESS: return XATTR_POSIX_ACL_ACCESS; case ACL_TYPE_DEFAULT: return XATTR_POSIX_ACL_DEFAULT; } return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
steven whitehousesteven whitehouse2887.50%133.33%
david teiglanddavid teigland26.25%133.33%
andreas gruenbacherandreas gruenbacher26.25%133.33%
Total32100.00%3100.00%


static struct posix_acl *__gfs2_get_acl(struct inode *inode, int type) { struct gfs2_inode *ip = GFS2_I(inode); struct posix_acl *acl; const char *name; char *data; int len; if (!ip->i_eattr) return NULL; name = gfs2_acl_name(type); len = gfs2_xattr_acl_get(ip, name, &data); if (len <= 0) return ERR_PTR(len); acl = posix_acl_from_xattr(&init_user_ns, data, len); kfree(data); return acl; }

Contributors

PersonTokensPropCommitsCommitProp
steven whitehousesteven whitehouse5048.08%457.14%
david teiglanddavid teigland4846.15%114.29%
eric w. biedermaneric w. biederman32.88%114.29%
al viroal viro32.88%114.29%
Total104100.00%7100.00%


struct posix_acl *gfs2_get_acl(struct inode *inode, int type) { struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_holder gh; bool need_unlock = false; struct posix_acl *acl; if (!gfs2_glock_is_locked_by_me(ip->i_gl)) { int ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &gh); if (ret) return ERR_PTR(ret); need_unlock = true; } acl = __gfs2_get_acl(inode, type); if (need_unlock) gfs2_glock_dq_uninit(&gh); return acl; }

Contributors

PersonTokensPropCommitsCommitProp
al viroal viro10399.04%150.00%
steven whitehousesteven whitehouse10.96%150.00%
Total104100.00%2100.00%


int __gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type) { int error; int len; char *data; const char *name = gfs2_acl_name(type); if (acl && acl->a_count > GFS2_ACL_MAX_ENTRIES(GFS2_SB(inode))) return -E2BIG; if (type == ACL_TYPE_ACCESS) { umode_t mode = inode->i_mode; error = posix_acl_equiv_mode(acl, &mode); if (error < 0) return error; if (error == 0) acl = NULL; if (mode != inode->i_mode) { inode->i_mode = mode; mark_inode_dirty(inode); } } if (acl) { len = posix_acl_to_xattr(&init_user_ns, acl, NULL, 0); if (len == 0) return 0; data = kmalloc(len, GFP_NOFS); if (data == NULL) return -ENOMEM; error = posix_acl_to_xattr(&init_user_ns, acl, data, len); if (error < 0) goto out; } else { data = NULL; len = 0; } error = __gfs2_xattr_set(inode, name, data, len, 0, GFS2_EATYPE_SYS); if (error) goto out; set_cached_acl(inode, type, acl); out: kfree(data); return error; }

Contributors

PersonTokensPropCommitsCommitProp
steven whitehousesteven whitehouse12650.81%325.00%
christoph hellwigchristoph hellwig8634.68%216.67%
robert s. petersonrobert s. peterson228.87%216.67%
eric w. biedermaneric w. biederman62.42%18.33%
david teiglanddavid teigland31.21%18.33%
andrew elbleandrew elble20.81%18.33%
al viroal viro20.81%18.33%
jeff liujeff liu10.40%18.33%
Total248100.00%12100.00%


int gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type) { struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_holder gh; bool need_unlock = false; int ret; ret = gfs2_rsqa_alloc(ip); if (ret) return ret; if (!gfs2_glock_is_locked_by_me(ip->i_gl)) { ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); if (ret) return ret; need_unlock = true; } ret = __gfs2_set_acl(inode, acl, type); if (need_unlock) gfs2_glock_dq_uninit(&gh); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
al viroal viro117100.00%1100.00%
Total117100.00%1100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
al viroal viro22834.39%14.76%
steven whitehousesteven whitehouse22133.33%1047.62%
david teiglanddavid teigland9113.73%14.76%
christoph hellwigchristoph hellwig8612.97%29.52%
robert s. petersonrobert s. peterson223.32%29.52%
eric w. biedermaneric w. biederman91.36%14.76%
andrew elbleandrew elble20.30%14.76%
andreas gruenbacherandreas gruenbacher20.30%14.76%
fabio massimo di nittofabio massimo di nitto10.15%14.76%
jeff liujeff liu10.15%14.76%
Total663100.00%21100.00%
Directory: fs/gfs2
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}