当前位置: 首页>>代码示例>>C++>>正文


C++ REISERFS_I函数代码示例

本文整理汇总了C++中REISERFS_I函数的典型用法代码示例。如果您正苦于以下问题:C++ REISERFS_I函数的具体用法?C++ REISERFS_I怎么用?C++ REISERFS_I使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了REISERFS_I函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: allocate_without_wrapping_disk

/* XXX I know it could be merged with upper-level function;
   but may be result function would be too complex. */
static inline int allocate_without_wrapping_disk (reiserfs_blocknr_hint_t * hint,
					 b_blocknr_t * new_blocknrs,
					 b_blocknr_t start, b_blocknr_t finish,
					 int amount_needed, int prealloc_size)
{
    int rest = amount_needed;
    int nr_allocated;
  
    while (rest > 0 && start <= finish) {
	nr_allocated = scan_bitmap (hint->th, &start, finish, 1,
				    rest + prealloc_size, !hint->formatted_node,
				    hint->block);

	if (nr_allocated == 0)	/* no new blocks allocated, return */
	    break;
	
	/* fill free_blocknrs array first */
	while (rest > 0 && nr_allocated > 0) {
	    * new_blocknrs ++ = start ++;
	    rest --; nr_allocated --;
	}

	/* do we have something to fill prealloc. array also ? */
	if (nr_allocated > 0) {
	    /* it means prealloc_size was greater that 0 and we do preallocation */
	    list_add(&REISERFS_I(hint->inode)->i_prealloc_list,
		     &SB_JOURNAL(hint->th->t_super)->j_prealloc_list);
	    REISERFS_I(hint->inode)->i_prealloc_block = start;
	    REISERFS_I(hint->inode)->i_prealloc_count = nr_allocated;
	    break;
	}
    }

    return (amount_needed - rest);
}
开发者ID:xricson,项目名称:knoppix,代码行数:37,代码来源:bitmap.c

示例2: reiserfs_unpack

/*
** reiserfs_unpack
** Function try to convert tail from direct item into indirect.
** It set up nopack attribute in the REISERFS_I(inode)->nopack
*/
int reiserfs_unpack(struct inode *inode, struct file *filp)
{
	int retval = 0;
	int depth;
	int index;
	struct page *page;
	struct address_space *mapping;
	unsigned long write_from;
	unsigned long blocksize = inode->i_sb->s_blocksize;

	if (inode->i_size == 0) {
		REISERFS_I(inode)->i_flags |= i_nopack_mask;
		return 0;
	}
	/* ioctl already done */
	if (REISERFS_I(inode)->i_flags & i_nopack_mask) {
		return 0;
	}

	depth = reiserfs_write_lock_once(inode->i_sb);

	/* we need to make sure nobody is changing the file size beneath us */
	reiserfs_mutex_lock_safe(&inode->i_mutex, inode->i_sb);

	write_from = inode->i_size & (blocksize - 1);
	/* if we are on a block boundary, we are already unpacked.  */
	if (write_from == 0) {
		REISERFS_I(inode)->i_flags |= i_nopack_mask;
		goto out;
	}

	/* we unpack by finding the page with the tail, and calling
	 ** __reiserfs_write_begin on that page.  This will force a
	 ** reiserfs_get_block to unpack the tail for us.
	 */
	index = inode->i_size >> PAGE_CACHE_SHIFT;
	mapping = inode->i_mapping;
	page = grab_cache_page(mapping, index);
	retval = -ENOMEM;
	if (!page) {
		goto out;
	}
	retval = __reiserfs_write_begin(page, write_from, 0);
	if (retval)
		goto out_unlock;

	/* conversion can change page contents, must flush */
	flush_dcache_page(page);
	retval = reiserfs_commit_write(NULL, page, write_from, write_from);
	REISERFS_I(inode)->i_flags |= i_nopack_mask;

      out_unlock:
	unlock_page(page);
	page_cache_release(page);

      out:
	mutex_unlock(&inode->i_mutex);
	reiserfs_write_unlock_once(inode->i_sb, depth);
	return retval;
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:65,代码来源:ioctl.c

示例3: reiserfs_cache_default_acl

/* This is used to cache the default acl before a new object is created.
 * The biggest reason for this is to get an idea of how many blocks will
 * actually be required for the create operation if we must inherit an ACL.
 * An ACL write can add up to 3 object creations and an additional file write
 * so we'd prefer not to reserve that many blocks in the journal if we can.
 * It also has the advantage of not loading the ACL with a transaction open,
 * this may seem silly, but if the owner of the directory is doing the
 * creation, the ACL may not be loaded since the permissions wouldn't require
 * it.
 * We return the number of blocks required for the transaction.
 */
int reiserfs_cache_default_acl(struct inode *inode)
{
	struct posix_acl *acl;
	int nblocks = 0;

	if (IS_PRIVATE(inode))
		return 0;

	acl = reiserfs_get_acl(inode, ACL_TYPE_DEFAULT);

	if (acl && !IS_ERR(acl)) {
		int size = reiserfs_acl_size(acl->a_count);

		/* Other xattrs can be created during inode creation. We don't
		 * want to claim too many blocks, so we check to see if we
		 * we need to create the tree to the xattrs, and then we
		 * just want two files. */
		nblocks = reiserfs_xattr_jcreate_nblocks(inode);
		nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);

		REISERFS_I(inode)->i_flags |= i_has_xattr_dir;

		/* We need to account for writes + bitmaps for two files */
		nblocks += reiserfs_xattr_nblocks(inode, size) * 4;
		posix_acl_release(acl);
	}

	return nblocks;
}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:40,代码来源:xattr_acl.c

示例4: reiserfs_security_init

/* Initializes the security context for a new inode and returns the number
 * of blocks needed for the transaction. If successful, reiserfs_security
 * must be released using reiserfs_security_free when the caller is done. */
int reiserfs_security_init(struct inode *dir, struct inode *inode,
			   struct reiserfs_security_handle *sec)
{
	int blocks = 0;
	int error;

	sec->name = NULL;

	/* Don't add selinux attributes on xattrs - they'll never get used */
	if (IS_PRIVATE(dir))
		return 0;

	error = security_inode_init_security(inode, dir, &sec->name,
					     &sec->value, &sec->length);
	if (error) {
		if (error == -EOPNOTSUPP)
			error = 0;

		sec->name = NULL;
		sec->value = NULL;
		sec->length = 0;
		return error;
	}

	if (sec->length) {
		blocks = reiserfs_xattr_jcreate_nblocks(inode) +
			 reiserfs_xattr_nblocks(inode, sec->length);
		/* We don't want to count the directories twice if we have
		 * a default ACL. */
		REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
	}
	return blocks;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:36,代码来源:xattr_security.c

示例5: reiserfs_security_init

int reiserfs_security_init(struct inode *dir, struct inode *inode,
			   const struct qstr *qstr,
			   struct reiserfs_security_handle *sec)
{
	int blocks = 0;
	int error;

	sec->name = NULL;

	
	if (IS_PRIVATE(dir))
		return 0;

	error = security_old_inode_init_security(inode, dir, qstr, &sec->name,
						 &sec->value, &sec->length);
	if (error) {
		if (error == -EOPNOTSUPP)
			error = 0;

		sec->name = NULL;
		sec->value = NULL;
		sec->length = 0;
		return error;
	}

	if (sec->length && reiserfs_xattrs_initialized(inode->i_sb)) {
		blocks = reiserfs_xattr_jcreate_nblocks(inode) +
			 reiserfs_xattr_nblocks(inode, sec->length);
		REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
	}
	return blocks;
}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:32,代码来源:xattr_security.c

示例6: reiserfs_discard_prealloc

/* FIXME: It should be inline function */
void reiserfs_discard_prealloc (struct reiserfs_transaction_handle *th,
                                struct inode *inode)
{
    struct reiserfs_inode_info *ei = REISERFS_I(inode);
    BUG_ON (!th->t_trans_id);
    if (ei->i_prealloc_count)
        __discard_prealloc(th, ei);
}
开发者ID:Dronevery,项目名称:JetsonTK1-kernel,代码行数:9,代码来源:bitmap.c

示例7: reiserfs_get_acl

/*
 * Inode operation get_posix_acl().
 *
 * inode->i_sem: down
 * BKL held [before 2.5.x]
 */
struct posix_acl *
reiserfs_get_acl(struct inode *inode, int type)
{
	char *name, *value;
	struct posix_acl *acl, **p_acl;
	size_t size;
	int retval;
        struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);

        switch (type) {
            case ACL_TYPE_ACCESS:
                name = XATTR_NAME_ACL_ACCESS;
                p_acl = &reiserfs_i->i_acl_access;
                break;
            case ACL_TYPE_DEFAULT:
                name = XATTR_NAME_ACL_DEFAULT;
                p_acl = &reiserfs_i->i_acl_default;
                break;
            default:
                return ERR_PTR (-EINVAL);
        }

        if (IS_ERR (*p_acl)) {
            if (PTR_ERR (*p_acl) == -ENODATA)
                return NULL;
        } else if (*p_acl != NULL)
            return posix_acl_dup (*p_acl);

        size = reiserfs_xattr_get (inode, name, NULL, 0);
        if ((int)size < 0) {
            if (size == -ENODATA || size == -ENOSYS) {
		*p_acl = ERR_PTR (-ENODATA);
		return NULL;
            }
            return ERR_PTR (size);
        }

        value = kmalloc (size, GFP_NOFS);
        if (!value)
            return ERR_PTR (-ENOMEM);

	retval = reiserfs_xattr_get(inode, name, value, size);
	if (retval == -ENODATA || retval == -ENOSYS) {
		/* This shouldn't actually happen as it should have
		   been caught above.. but just in case */
		acl = NULL;
		*p_acl = ERR_PTR (-ENODATA);
        } else if (retval < 0) {
		acl = ERR_PTR(retval);
	} else {
		acl = posix_acl_from_disk(value, retval);
		*p_acl = posix_acl_dup (acl);
        }

	kfree(value);
	return acl;
}
开发者ID:Dronevery,项目名称:JetsonTK1-kernel,代码行数:63,代码来源:xattr_acl.c

示例8: posix_acl_default_del

static int posix_acl_default_del(struct inode *inode, const char *name)
{
    struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
    struct posix_acl **acl = &reiserfs_i->i_acl_default;
    if (strlen(name) != sizeof(POSIX_ACL_XATTR_DEFAULT) - 1)
        return -EINVAL;
    if (!IS_ERR(*acl) && *acl) {
        posix_acl_release(*acl);
        *acl = ERR_PTR(-ENODATA);
    }

    return 0;
}
开发者ID:274914765,项目名称:C,代码行数:13,代码来源:xattr_acl.c

示例9: reiserfs_file_release

/*
** We pack the tails of files on file close, not at the time they are written.
** This implies an unnecessary copy of the tail and an unnecessary indirect item
** insertion/balancing, for files that are written in one write.
** It avoids unnecessary tail packings (balances) for files that are written in
** multiple writes and are small enough to have tails.
** 
** file_release is called by the VFS layer when the file is closed.  If
** this is the last open file descriptor, and the file
** small enough to have a tail, and the tail is currently in an
** unformatted node, the tail is converted back into a direct item.
** 
** We use reiserfs_truncate_file to pack the tail, since it already has
** all the conditions coded.  
*/
static int reiserfs_file_release (struct inode * inode, struct file * filp)
{

    struct reiserfs_transaction_handle th ;

    if (!S_ISREG (inode->i_mode))
	BUG ();

    /* fast out for when nothing needs to be done */
    if ((atomic_read(&inode->i_count) > 1 ||
	!(REISERFS_I(inode)->i_flags & i_pack_on_close_mask) || 
         !tail_has_to_be_packed(inode))       && 
	REISERFS_I(inode)->i_prealloc_count <= 0) {
	return 0;
    }    
    
    reiserfs_write_lock(inode->i_sb);
    down (&inode->i_sem); 
    journal_begin(&th, inode->i_sb, JOURNAL_PER_BALANCE_CNT * 3) ;
    reiserfs_update_inode_transaction(inode) ;

#ifdef REISERFS_PREALLOCATE
    reiserfs_discard_prealloc (&th, inode);
#endif
    journal_end(&th, inode->i_sb, JOURNAL_PER_BALANCE_CNT * 3) ;

    if (atomic_read(&inode->i_count) <= 1 &&
	(REISERFS_I(inode)->i_flags & i_pack_on_close_mask) &&
        tail_has_to_be_packed (inode)) {
	/* if regular file is released by last holder and it has been
	   appended (we append by unformatted node only) or its direct
	   item(s) had to be converted, then it may have to be
	   indirect2direct converted */
	reiserfs_truncate_file(inode, 0) ;
    }
    up (&inode->i_sem); 
    reiserfs_write_unlock(inode->i_sb);
    return 0;
}
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:54,代码来源:file.c

示例10: use_preallocated_list_if_available

/* return amount still needed after using them */
static int use_preallocated_list_if_available (reiserfs_blocknr_hint_t *hint,
        b_blocknr_t *new_blocknrs, int amount_needed)
{
    struct inode * inode = hint->inode;

    if (REISERFS_I(inode)->i_prealloc_count > 0) {
        while (amount_needed) {

            *new_blocknrs ++ = REISERFS_I(inode)->i_prealloc_block ++;
            REISERFS_I(inode)->i_prealloc_count --;

            amount_needed --;

            if (REISERFS_I(inode)->i_prealloc_count <= 0) {
                list_del(&REISERFS_I(inode)->i_prealloc_list);
                break;
            }
        }
    }
    /* return amount still needed after using preallocated blocks */
    return amount_needed;
}
开发者ID:Dronevery,项目名称:JetsonTK1-kernel,代码行数:23,代码来源:bitmap.c

示例11: posix_acl_access_del

static int
posix_acl_access_del (struct inode *inode, const char *name)
{
    struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
    struct posix_acl **acl = &reiserfs_i->i_acl_access;
    if (strlen(name) != sizeof(XATTR_NAME_ACL_ACCESS)-1)
	return -EINVAL;
    if (!IS_ERR (*acl) && *acl) {
        posix_acl_release (*acl);
        *acl = ERR_PTR (-ENODATA);
    }

    return 0;
}
开发者ID:Dronevery,项目名称:JetsonTK1-kernel,代码行数:14,代码来源:xattr_acl.c

示例12: reiserfs_lookup

static struct dentry * reiserfs_lookup (struct inode * dir, struct dentry * dentry, struct nameidata *nd)
{
    int retval;
    struct inode * inode = NULL;
    struct reiserfs_dir_entry de;
    INITIALIZE_PATH (path_to_entry);

    if (REISERFS_MAX_NAME (dir->i_sb->s_blocksize) < dentry->d_name.len)
	return ERR_PTR(-ENAMETOOLONG);

    reiserfs_write_lock(dir->i_sb);
    de.de_gen_number_bit_string = 0;
    retval = reiserfs_find_entry (dir, dentry->d_name.name, dentry->d_name.len, &path_to_entry, &de);
    pathrelse (&path_to_entry);
    if (retval == NAME_FOUND) {
        /* Hide the .reiserfs_priv directory */
	if (reiserfs_xattrs (dir->i_sb) &&
	    !old_format_only(dir->i_sb) &&
            REISERFS_SB(dir->i_sb)->priv_root &&
            REISERFS_SB(dir->i_sb)->priv_root->d_inode &&
	    de.de_objectid == le32_to_cpu (INODE_PKEY(REISERFS_SB(dir->i_sb)->priv_root->d_inode)->k_objectid)) {
	  return ERR_PTR (-EACCES);
	}

	inode = reiserfs_iget (dir->i_sb, (struct cpu_key *)&(de.de_dir_id));
	if (!inode || IS_ERR(inode)) {
	    reiserfs_write_unlock(dir->i_sb);
	    return ERR_PTR(-EACCES);
        }

	/* Propogate the priv_object flag so we know we're in the priv tree */
	if (is_reiserfs_priv_object (dir))
	    REISERFS_I(inode)->i_flags |= i_priv_object;
    }
    reiserfs_write_unlock(dir->i_sb);
    if ( retval == IO_ERROR ) {
	return ERR_PTR(-EIO);
    }

    if (inode)
	    return d_splice_alias(inode, dentry);
    
    d_add(dentry, inode);
    return NULL;
}
开发者ID:iPodLinux,项目名称:linux-2.6.7-ipod,代码行数:45,代码来源:namei.c

示例13: determine_search_start

static void determine_search_start(reiserfs_blocknr_hint_t *hint,
                                   int amount_needed)
{
    struct super_block *s = hint->th->t_super;
    int unfm_hint;

    hint->beg = 0;
    hint->end = SB_BLOCK_COUNT(s) - 1;

    /* This is former border algorithm. Now with tunable border offset */
    if (concentrating_formatted_nodes(s))
        set_border_in_hint(s, hint);

#ifdef DISPLACE_NEW_PACKING_LOCALITIES
    /* whenever we create a new directory, we displace it.  At first we will
       hash for location, later we might look for a moderately empty place for
       it */
    if (displacing_new_packing_localities(s)
            && hint->th->displace_new_blocks) {
        displace_new_packing_locality(hint);

        /* we do not continue determine_search_start,
         * if new packing locality is being displaced */
        return;
    }
#endif

    /* all persons should feel encouraged to add more special cases here and
     * test them */

    if (displacing_large_files(s) && !hint->formatted_node
            && this_blocknr_allocation_would_make_it_a_large_file(hint)) {
        displace_large_file(hint);
        return;
    }

    /* if none of our special cases is relevant, use the left neighbor in the
       tree order of the new node we are allocating for */
    if (hint->formatted_node && TEST_OPTION(hashed_formatted_nodes,s)) {
        hash_formatted_node(hint);
        return;
    }

    unfm_hint = get_left_neighbor(hint);

    /* Mimic old block allocator behaviour, that is if VFS allowed for preallocation,
       new blocks are displaced based on directory ID. Also, if suggested search_start
       is less than last preallocated block, we start searching from it, assuming that
       HDD dataflow is faster in forward direction */
    if ( TEST_OPTION(old_way, s)) {
        if (!hint->formatted_node) {
            if ( !reiserfs_hashed_relocation(s))
                old_way(hint);
            else if (!reiserfs_no_unhashed_relocation(s))
                old_hashed_relocation(hint);

            if ( hint->inode && hint->search_start < REISERFS_I(hint->inode)->i_prealloc_block)
                hint->search_start = REISERFS_I(hint->inode)->i_prealloc_block;
        }
        return;
    }

    /* This is an approach proposed by Hans */
    if ( TEST_OPTION(hundredth_slices, s) && ! (displacing_large_files(s) && !hint->formatted_node)) {
        hundredth_slices(hint);
        return;
    }

    /* old_hashed_relocation only works on unformatted */
    if (!unfm_hint && !hint->formatted_node &&
            TEST_OPTION(old_hashed_relocation, s))
    {
        old_hashed_relocation(hint);
    }
    /* new_hashed_relocation works with both formatted/unformatted nodes */
    if ((!unfm_hint || hint->formatted_node) &&
            TEST_OPTION(new_hashed_relocation, s))
    {
        new_hashed_relocation(hint);
    }
    /* dirid grouping works only on unformatted nodes */
    if (!unfm_hint && !hint->formatted_node && TEST_OPTION(dirid_groups,s))
    {
        dirid_groups(hint);
    }

#ifdef DISPLACE_NEW_PACKING_LOCALITIES
    if (hint->formatted_node && TEST_OPTION(dirid_groups,s))
    {
        dirid_groups(hint);
    }
#endif

    /* oid grouping works only on unformatted nodes */
    if (!unfm_hint && !hint->formatted_node && TEST_OPTION(oid_groups,s))
    {
        oid_groups(hint);
    }
    return;
}
开发者ID:Dronevery,项目名称:JetsonTK1-kernel,代码行数:100,代码来源:bitmap.c

示例14: reiserfs_mkdir

static int reiserfs_mkdir (struct inode * dir, struct dentry *dentry, int mode)
{
    int retval;
    struct inode * inode;
    struct reiserfs_transaction_handle th ;
    int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3; 
    int locked;

#ifdef DISPLACE_NEW_PACKING_LOCALITIES
    /* set flag that new packing locality created and new blocks for the content     * of that directory are not displaced yet */
    REISERFS_I(dir)->new_packing_locality = 1;
#endif
    mode = S_IFDIR | mode;
    if (!(inode = new_inode(dir->i_sb))) {
	return -ENOMEM ;
    }
    retval = new_inode_init(inode, dir, mode);
    if (retval)
        return retval;

    locked = reiserfs_cache_default_acl (dir);

    reiserfs_write_lock(dir->i_sb);
    if (locked)
        reiserfs_write_lock_xattrs (dir->i_sb);
    journal_begin(&th, dir->i_sb, jbegin_count) ;

    /* inc the link count now, so another writer doesn't overflow it while
    ** we sleep later on.
    */
    INC_DIR_INODE_NLINK(dir)

    retval = reiserfs_new_inode (&th, dir, mode, 0/*symlink*/,
				old_format_only (dir->i_sb) ? 
				EMPTY_DIR_SIZE_V1 : EMPTY_DIR_SIZE,
				dentry, inode);
    if (locked)
        reiserfs_write_unlock_xattrs (dir->i_sb);

    if (retval) {
	dir->i_nlink-- ;
	goto out_failed;
    }
    reiserfs_update_inode_transaction(inode) ;
    reiserfs_update_inode_transaction(dir) ;

    inode->i_op = &reiserfs_dir_inode_operations;
    inode->i_fop = &reiserfs_dir_operations;

    // note, _this_ add_entry will not update dir's stat data
    retval = reiserfs_add_entry (&th, dir, dentry->d_name.name, dentry->d_name.len, 
				inode, 1/*visible*/);
    if (retval) {
	inode->i_nlink = 0;
	DEC_DIR_INODE_NLINK(dir);
	reiserfs_update_sd (&th, inode);
	journal_end(&th, dir->i_sb, jbegin_count) ;
	iput (inode);
	goto out_failed;
    }

    // the above add_entry did not update dir's stat data
    reiserfs_update_sd (&th, dir);

    d_instantiate(dentry, inode);
    journal_end(&th, dir->i_sb, jbegin_count) ;
out_failed:
    reiserfs_write_unlock(dir->i_sb);
    return retval;
}
开发者ID:iPodLinux,项目名称:linux-2.6.7-ipod,代码行数:70,代码来源:namei.c

示例15: reiserfs_set_acl

/*
 * Inode operation set_posix_acl().
 *
 * inode->i_sem: down
 * BKL held [before 2.5.x]
 */
static int
reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
{
        char *name;
	void *value = NULL;
	struct posix_acl **p_acl;
	size_t size;
	int error;
        struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);

	if (S_ISLNK(inode->i_mode))
		return -EOPNOTSUPP;

        switch (type) {
            case ACL_TYPE_ACCESS:
                name = XATTR_NAME_ACL_ACCESS;
                p_acl = &reiserfs_i->i_acl_access;
                if (acl) {
                    mode_t mode = inode->i_mode;
                    error = posix_acl_equiv_mode (acl, &mode);
                    if (error < 0)
                        return error;
                    else {
                        inode->i_mode = mode;
                        if (error == 0)
                            acl = NULL;
                    }
                }
                break;
            case ACL_TYPE_DEFAULT:
                name = XATTR_NAME_ACL_DEFAULT;
                p_acl = &reiserfs_i->i_acl_default;
                if (!S_ISDIR (inode->i_mode))
                    return acl ? -EACCES : 0;
                break;
            default:
                return -EINVAL;
        }

 	if (acl) {
            value = posix_acl_to_disk(acl, &size);
            if (IS_ERR(value))
                return (int)PTR_ERR(value);
            error = reiserfs_xattr_set(inode, name, value, size, 0);
	} else {
            error = reiserfs_xattr_del (inode, name);
            if (error == -ENODATA) {
                /* This may seem odd here, but it means that the ACL was set
                 * with a value representable with mode bits. If there was
                 * an ACL before, reiserfs_xattr_del already dirtied the inode.
                 */
                mark_inode_dirty (inode);
                error = 0;
            }
        }

	if (value)
		kfree(value);

        if (!error) {
            /* Release the old one */
            if (!IS_ERR (*p_acl) && *p_acl)
                posix_acl_release (*p_acl);

            if (acl == NULL)
                *p_acl = ERR_PTR (-ENODATA);
            else
                *p_acl = posix_acl_dup (acl);
        }

	return error;
}
开发者ID:Dronevery,项目名称:JetsonTK1-kernel,代码行数:78,代码来源:xattr_acl.c


注:本文中的REISERFS_I函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。