X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=fs%2Fgfs2%2Feattr.h;h=c82dbe01d7137f07d7bc1a90b59bb2ac22f5dd30;hb=301bb4e1433b8b8d8bd084af57c491f0358b4e2b;hp=e5a42abf68a352563dd202bfb8ee1e3db5f12c61;hpb=d35462b4bb847b68321c55e95c926aa485aecce2;p=linux-2.6-omap-h63xx.git diff --git a/fs/gfs2/eattr.h b/fs/gfs2/eattr.h index e5a42abf68a..c82dbe01d71 100644 --- a/fs/gfs2/eattr.h +++ b/fs/gfs2/eattr.h @@ -1,25 +1,25 @@ /* * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. - * Copyright (C) 2004-2005 Red Hat, Inc. 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 v.2. + * of the GNU General Public License version 2. */ #ifndef __EATTR_DOT_H__ #define __EATTR_DOT_H__ +struct gfs2_inode; +struct iattr; + #define GFS2_EA_REC_LEN(ea) be32_to_cpu((ea)->ea_rec_len) #define GFS2_EA_DATA_LEN(ea) be32_to_cpu((ea)->ea_data_len) #define GFS2_EA_SIZE(ea) \ ALIGN(sizeof(struct gfs2_ea_header) + (ea)->ea_name_len + \ ((GFS2_EA_IS_STUFFED(ea)) ? GFS2_EA_DATA_LEN(ea) : \ - (sizeof(uint64_t) * (ea)->ea_num_ptrs)), 8) - -#define GFS2_EA_STRLEN(ea) \ -((((ea)->ea_type == GFS2_EATYPE_USR) ? 5 : 7) + (ea)->ea_name_len + 1) + (sizeof(__be64) * (ea)->ea_num_ptrs)), 8) #define GFS2_EA_IS_STUFFED(ea) (!(ea)->ea_num_ptrs) #define GFS2_EA_IS_LAST(ea) ((ea)->ea_flags & GFS2_EAFLAG_LAST) @@ -29,13 +29,13 @@ ALIGN(sizeof(struct gfs2_ea_header) + (er)->er_name_len + (er)->er_data_len, 8) #define GFS2_EAREQ_SIZE_UNSTUFFED(sdp, er) \ ALIGN(sizeof(struct gfs2_ea_header) + (er)->er_name_len + \ - sizeof(uint64_t) * DIV_RU((er)->er_data_len, (sdp)->sd_jbsize), 8) + sizeof(__be64) * DIV_ROUND_UP((er)->er_data_len, (sdp)->sd_jbsize), 8) #define GFS2_EA2NAME(ea) ((char *)((struct gfs2_ea_header *)(ea) + 1)) #define GFS2_EA2DATA(ea) (GFS2_EA2NAME(ea) + (ea)->ea_name_len) #define GFS2_EA2DATAPTRS(ea) \ -((uint64_t *)(GFS2_EA2NAME(ea) + ALIGN((ea)->ea_name_len, 8))) +((__be64 *)(GFS2_EA2NAME(ea) + ALIGN((ea)->ea_name_len, 8))) #define GFS2_EA2NEXT(ea) \ ((struct gfs2_ea_header *)((char *)(ea) + GFS2_EA_REC_LEN(ea))) @@ -46,7 +46,7 @@ ALIGN(sizeof(struct gfs2_ea_header) + (er)->er_name_len + \ #define GFS2_ERF_MODE 0x80000000 struct gfs2_ea_request { - char *er_name; + const char *er_name; char *er_data; unsigned int er_name_len; unsigned int er_data_len; @@ -61,8 +61,6 @@ struct gfs2_ea_location { struct gfs2_ea_header *el_prev; }; -int gfs2_ea_repack(struct gfs2_inode *ip); - int gfs2_ea_get_i(struct gfs2_inode *ip, struct gfs2_ea_request *er); int gfs2_ea_set_i(struct gfs2_inode *ip, struct gfs2_ea_request *er); int gfs2_ea_remove_i(struct gfs2_inode *ip, struct gfs2_ea_request *er); @@ -85,4 +83,18 @@ int gfs2_ea_get_copy(struct gfs2_inode *ip, int gfs2_ea_acl_chmod(struct gfs2_inode *ip, struct gfs2_ea_location *el, struct iattr *attr, char *data); +static inline unsigned int gfs2_ea_strlen(struct gfs2_ea_header *ea) +{ + switch (ea->ea_type) { + case GFS2_EATYPE_USR: + return 5 + ea->ea_name_len + 1; + case GFS2_EATYPE_SYS: + return 7 + ea->ea_name_len + 1; + case GFS2_EATYPE_SECURITY: + return 9 + ea->ea_name_len + 1; + default: + return 0; + } +} + #endif /* __EATTR_DOT_H__ */