lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <277F09BF-E793-445D-A520-43E1E0F85EFE@dilger.ca>
Date:	Tue, 21 Feb 2012 15:45:11 -0700
From:	Andreas Dilger <adilger@...ger.ca>
To:	Tao Ma <tm@....ma>
Cc:	linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH V4 02/22] ext4: export inline xattr functions.

On 2012-02-20, at 12:01 AM, Tao Ma wrote:
> From: Tao Ma <boyu.mt@...bao.com>
> 
> Inline data needs some inline xattr functions, so export them
> from fs/ext4/xattr.c so that inline.c can uses them.
> 
> Signed-off-by: Tao Ma <boyu.mt@...bao.com>
> ---
> fs/ext4/xattr.c |   63 ++++++++++++++++++++++++++----------------------------
> fs/ext4/xattr.h |   57 +++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 87 insertions(+), 33 deletions(-)
> 
> diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
> index 93a00d8..07eeaf3 100644
> --- a/fs/ext4/xattr.c
> +++ b/fs/ext4/xattr.c
> @@ -61,11 +61,6 @@
> #include "xattr.h"
> #include "acl.h"
> 
> -#define BHDR(bh) ((struct ext4_xattr_header *)((bh)->b_data))
> -#define ENTRY(ptr) ((struct ext4_xattr_entry *)(ptr))
> -#define BFIRST(bh) ENTRY(BHDR(bh)+1)
> -#define IS_LAST_ENTRY(entry) (*(__u32 *)(entry) == 0)
> -
> #ifdef EXT4_XATTR_DEBUG
> # define ea_idebug(inode, f...) do { \
> 		printk(KERN_DEBUG "inode %s:%lu: ", \
> @@ -255,7 +250,7 @@ cleanup:
> 	return error;
> }
> 
> -static int
> +int
> ext4_xattr_ibody_get(struct inode *inode, int name_index, const char *name,
> 		     void *buffer, size_t buffer_size)
> {
> @@ -522,21 +517,6 @@ static size_t ext4_xattr_free_space(struct ext4_xattr_entry *last,
> 	return (*min_offs - ((void *)last - base) - sizeof(__u32));
> }
> 
> -struct ext4_xattr_info {
> -	int name_index;
> -	const char *name;
> -	const void *value;
> -	size_t value_len;
> -};
> -
> -struct ext4_xattr_search {
> -	struct ext4_xattr_entry *first;
> -	void *base;
> -	void *end;
> -	struct ext4_xattr_entry *here;
> -	int not_found;
> -};
> -
> static int
> ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s)
> {
> @@ -890,14 +870,8 @@ bad_block:
> #undef header
> }
> 
> -struct ext4_xattr_ibody_find {
> -	struct ext4_xattr_search s;
> -	struct ext4_iloc iloc;
> -};
> -
> -static int
> -ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
> -		      struct ext4_xattr_ibody_find *is)
> +int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
> +			  struct ext4_xattr_ibody_find *is)
> {
> 	struct ext4_xattr_ibody_header *header;
> 	struct ext4_inode *raw_inode;
> @@ -925,10 +899,33 @@ ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
> 	return 0;
> }
> 
> -static int
> -ext4_xattr_ibody_set(handle_t *handle, struct inode *inode,
> -		     struct ext4_xattr_info *i,
> -		     struct ext4_xattr_ibody_find *is)
> +int ext4_xattr_ibody_inline_set(handle_t *handle, struct inode *inode,
> +				struct ext4_xattr_info *i,
> +				struct ext4_xattr_ibody_find *is)
> +{

The addition of this function should be moved into [PATCH 03/22], since
there are otherwise no users of this function in this patch.

> +	struct ext4_xattr_ibody_header *header;
> +	struct ext4_xattr_search *s = &is->s;
> +	int error;
> +
> +	if (EXT4_I(inode)->i_extra_isize == 0)
> +		return -ENOSPC;
> +	error = ext4_xattr_set_entry(i, s);
> +	if (error)
> +		return error;
> +	header = IHDR(inode, ext4_raw_inode(&is->iloc));
> +	if (!IS_LAST_ENTRY(s->first)) {
> +		header->h_magic = cpu_to_le32(EXT4_XATTR_MAGIC);
> +		ext4_set_inode_state(inode, EXT4_STATE_XATTR);
> +	} else {
> +		header->h_magic = cpu_to_le32(0);
> +		ext4_clear_inode_state(inode, EXT4_STATE_XATTR);
> +	}
> +	return 0;
> +}
> +
> +int ext4_xattr_ibody_set(handle_t *handle, struct inode *inode,
> +			 struct ext4_xattr_info *i,
> +			 struct ext4_xattr_ibody_find *is)
> {
> 	struct ext4_xattr_ibody_header *header;
> 	struct ext4_xattr_search *s = &is->s;
> diff --git a/fs/ext4/xattr.h b/fs/ext4/xattr.h
> index 25b7387..2879761 100644
> --- a/fs/ext4/xattr.h
> +++ b/fs/ext4/xattr.h
> @@ -63,6 +63,32 @@ struct ext4_xattr_entry {
> 		EXT4_I(inode)->i_extra_isize))
> #define IFIRST(hdr) ((struct ext4_xattr_entry *)((hdr)+1))
> 
> +#define BHDR(bh) ((struct ext4_xattr_header *)((bh)->b_data))
> +#define ENTRY(ptr) ((struct ext4_xattr_entry *)(ptr))
> +#define BFIRST(bh) ENTRY(BHDR(bh)+1)
> +#define IS_LAST_ENTRY(entry) (*(__u32 *)(entry) == 0)
> +
> +
> +struct ext4_xattr_info {
> +	int name_index;
> +	const char *name;
> +	const void *value;
> +	size_t value_len;
> +};
> +
> +struct ext4_xattr_search {
> +	struct ext4_xattr_entry *first;
> +	void *base;
> +	void *end;
> +	struct ext4_xattr_entry *here;
> +	int not_found;
> +};
> +
> +struct ext4_xattr_ibody_find {
> +	struct ext4_xattr_search s;
> +	struct ext4_iloc iloc;
> +};
> +
> # ifdef CONFIG_EXT4_FS_XATTR
> 
> extern const struct xattr_handler ext4_xattr_user_handler;
> @@ -88,6 +114,15 @@ extern void ext4_exit_xattr(void);
> 
> extern const struct xattr_handler *ext4_xattr_handlers[];
> 
> +extern int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
> +				 struct ext4_xattr_ibody_find *is);
> +extern int ext4_xattr_ibody_inline_set(handle_t *handle, struct inode *inode,
> +				       struct ext4_xattr_info *i,
> +				       struct ext4_xattr_ibody_find *is);
> +extern int ext4_xattr_ibody_get(struct inode *inode, int name_index,
> +				const char *name,
> +				void *buffer, size_t buffer_size);
> +
> # else  /* CONFIG_EXT4_FS_XATTR */
> 
> static inline int
> @@ -141,6 +176,28 @@ ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
> 
> #define ext4_xattr_handlers	NULL
> 
> +static inline int
> +ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
> +		      struct ext4_xattr_ibody_find *is)
> +{
> +	return -EOPNOTSUPP;
> +}
> +
> +static inline int
> +ext4_xattr_ibody_set(handle_t *handle, struct inode *inode,
> +		     struct ext4_xattr_info *i,
> +		     struct ext4_xattr_ibody_find *is)
> +{
> +	return -EOPNOTSUPP;
> +}
> +
> +extern int ext4_xattr_ibody_get(struct inode *inode, int name_index,
> +				const char *name,
> +				void *buffer, size_t buffer_size)
> +{
> +	return -EOPNOTSUPP;
> +}
> +
> # endif  /* CONFIG_EXT4_FS_XATTR */
> 
> #ifdef CONFIG_EXT4_FS_SECURITY
> -- 
> 1.7.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cheers, Andreas





--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ