[Pvfs2-cvs] commit by vilayann in pvfs2-1/src/proto:
PINT-le-bytefield.c endecode-funcs.h pvfs2-attr.h pvfs2-req-proto.h
CVS commit program
cvs at parl.clemson.edu
Wed Aug 9 16:17:53 EDT 2006
Update of /projects/cvsroot/pvfs2-1/src/proto
In directory parlweb1:/tmp/cvs-serv7687/src/proto
Modified Files:
Tag: posix-extensions-branch
PINT-le-bytefield.c endecode-funcs.h pvfs2-attr.h
pvfs2-req-proto.h
Log Message:
Reverse merge changes from HEAD to posix-extensions-branch.
Index: PINT-le-bytefield.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/proto/PINT-le-bytefield.c,v
diff -p -u -r1.40.6.1 -r1.40.6.2
--- PINT-le-bytefield.c 9 May 2006 23:10:14 -0000 1.40.6.1
+++ PINT-le-bytefield.c 9 Aug 2006 20:17:52 -0000 1.40.6.2
@@ -667,7 +667,8 @@ static int lebf_decode_resp(
#undef CASE
if (ptr != (char *)input_buffer + input_size) {
- gossip_lerr("%s: improper input buffer size", __func__);
+ gossip_lerr("%s: improper input buffer size [%p + %d != %p]\n", __func__,
+ input_buffer, input_size, ptr);
ret = -PVFS_EPROTO;
}
Index: endecode-funcs.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/proto/endecode-funcs.h,v
diff -p -u -r1.16.2.3 -r1.16.2.4
--- endecode-funcs.h 7 Jun 2006 03:21:05 -0000 1.16.2.3
+++ endecode-funcs.h 9 Aug 2006 20:17:53 -0000 1.16.2.4
@@ -69,10 +69,13 @@
} while (0)
/* strings; decoding just points into existing character data */
+/* now handles NULL strings as well */
#define encode_string(pptr,pbuf) do { \
- u_int32_t len = strlen(*pbuf); \
+ u_int32_t len; \
+ if(*pbuf) {len = strlen(*pbuf);} \
+ else {len = 0;} \
*(u_int32_t *) *(pptr) = htobmi32(len); \
- memcpy(*(pptr)+4, *pbuf, len+1); \
+ if(len) {memcpy(*(pptr)+4, *pbuf, len+1);} \
*(pptr) += roundup8(4 + len + 1); \
} while (0)
#define decode_string(pptr,pbuf) do { \
@@ -229,6 +232,26 @@ static inline void decode_##name(char **
#define endecode_fields_5_struct(name, t1, x1, t2, x2, t3, x3, t4, x4, t5, x5) \
endecode_fields_5_generic(name, struct name, t1, x1, t2, x2, t3, x3, t4, x4, t5, x5)
+#define endecode_fields_7(name,t1,x1,t2,x2,t3,x3,t4,x4,t5,x5,t6,x6,t7,x7) \
+static inline void encode_##name(char **pptr, const name *x) { \
+ encode_##t1(pptr, &x->x1); \
+ encode_##t2(pptr, &x->x2); \
+ encode_##t3(pptr, &x->x3); \
+ encode_##t4(pptr, &x->x4); \
+ encode_##t5(pptr, &x->x5); \
+ encode_##t6(pptr, &x->x6); \
+ encode_##t7(pptr, &x->x7); \
+} \
+static inline void decode_##name(char **pptr, name *x) { \
+ decode_##t1(pptr, &x->x1); \
+ decode_##t2(pptr, &x->x2); \
+ decode_##t3(pptr, &x->x3); \
+ decode_##t4(pptr, &x->x4); \
+ decode_##t5(pptr, &x->x5); \
+ decode_##t6(pptr, &x->x6); \
+ decode_##t7(pptr, &x->x7); \
+}
+
#define endecode_fields_7_struct(name,t1,x1,t2,x2,t3,x3,t4,x4,t5,x5,t6,x6,t7,x7) \
static inline void encode_##name(char **pptr, const struct name *x) { \
encode_##t1(pptr, &x->x1); \
@@ -397,11 +420,38 @@ static inline void decode_##name(char **
decode_##ta1(pptr, &(x)->a1[i]); \
}
+/* one field then two arrays */
+#define endecode_fields_1aa_generic(name, sname, t1, x1, tn1, n1, ta1, a1, ta2, a2) \
+static inline void encode_##name(char **pptr, const sname *x) { typeof(tn1) i; \
+ encode_##t1(pptr, &x->x1); \
+ encode_##tn1(pptr, &x->n1); \
+ for (i=0; i<x->n1; i++) \
+ encode_##ta1(pptr, &(x)->a1[i]); \
+ for (i=0; i<x->n1; i++) \
+ encode_##ta2(pptr, &(x)->a2[i]); \
+} \
+static inline void decode_##name(char **pptr, sname *x) { typeof(tn1) i; \
+ decode_##t1(pptr, &x->x1); \
+ decode_##tn1(pptr, &x->n1); \
+ x->a1 = decode_malloc(x->n1 * sizeof(*x->a1)); \
+ for (i=0; i<x->n1; i++) \
+ decode_##ta1(pptr, &(x)->a1[i]); \
+ x->a2 = decode_malloc(x->n1 * sizeof(*x->a2)); \
+ for (i=0; i<x->n1; i++) \
+ decode_##ta2(pptr, &(x)->a2[i]); \
+}
+
+
#define endecode_fields_1a(name, t1, x1, tn1, n1, ta1, a1) \
endecode_fields_1a_generic(name, name, t1, x1, tn1, n1, ta1, a1)
#define endecode_fields_1a_struct(name, t1, x1, tn1, n1, ta1, a1) \
endecode_fields_1a_generic(name, struct name, t1, x1, tn1, n1, ta1, a1)
+#define endecode_fields_1aa(name, t1, x1, tn1, n1, ta1, a1, ta2, a2) \
+ endecode_fields_1aa_generic(name, name, t1, x1, tn1, n1, ta1, a1, ta2, a2)
+#define endecode_fields_1aa_struct(name, t1, x1, tn1, n1, ta1, a1, ta2, a2) \
+ endecode_fields_1aa_generic(name, struct name, t1, x1, tn1, n1, ta1, a1, ta2, a2)
+
/* one field, and array, another field, another array - a special case */
#define endecode_fields_1a_1a_struct(name, t1,x1, tn1, n1, ta1, a1, t2,x2, tn2, n2, ta2, a2) \
static inline void encode_##name(char **pptr, const struct name *x) { int i; \
@@ -449,27 +499,6 @@ static inline void decode_##name(char **
endecode_fields_2a_generic(name, name, t1, x1, t2, x2, tn1, n1, ta1, a1)
#define endecode_fields_2a_struct(name, t1, x1, t2, x2, tn1, n1, ta1, a1) \
endecode_fields_2a_generic(name, struct name, t1, x1, t2, x2, tn1, n1, ta1, a1)
-
-/* special case where we have two arrays of the same size after 1 field */
-#define endecode_fields_1aa_struct(name, t1, x1, tn1, n1, ta1, a1, ta2, a2) \
-static inline void encode_##name(char **pptr, const struct name *x) { int i; \
- encode_##t1(pptr, &x->x1); \
- encode_##tn1(pptr, &x->n1); \
- for (i=0; i<x->n1; i++) \
- encode_##ta1(pptr, &(x)->a1[i]); \
- for (i=0; i<x->n1; i++) \
- encode_##ta2(pptr, &(x)->a2[i]); \
-} \
-static inline void decode_##name(char **pptr, struct name *x) { int i; \
- decode_##t1(pptr, &x->x1); \
- decode_##tn1(pptr, &x->n1); \
- x->a1 = decode_malloc(x->n1 * sizeof(*x->a1)); \
- for (i=0; i<x->n1; i++) \
- decode_##ta1(pptr, &(x)->a1[i]); \
- x->a2 = decode_malloc(x->n1 * sizeof(*x->a2)); \
- for (i=0; i<x->n1; i++) \
- decode_##ta2(pptr, &(x)->a2[i]); \
-}
/* special case where we have two arrays of the same size after 2 fields */
#define endecode_fields_2aa_struct(name, t1, x1, t2, x2, tn1, n1, ta1, a1, ta2, a2) \
Index: pvfs2-attr.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/proto/pvfs2-attr.h,v
diff -p -u -r1.37 -r1.37.12.1
--- pvfs2-attr.h 6 Oct 2005 13:43:04 -0000 1.37
+++ pvfs2-attr.h 9 Aug 2006 20:17:53 -0000 1.37.12.1
@@ -22,6 +22,8 @@
#define PVFS_ATTR_COMMON_CTIME (1 << 4)
#define PVFS_ATTR_COMMON_MTIME (1 << 5)
#define PVFS_ATTR_COMMON_TYPE (1 << 6)
+#define PVFS_ATTR_COMMON_ATIME_SET (1 << 7)
+#define PVFS_ATTR_COMMON_MTIME_SET (1 << 8)
#define PVFS_ATTR_COMMON_ALL \
(PVFS_ATTR_COMMON_UID | PVFS_ATTR_COMMON_GID | \
PVFS_ATTR_COMMON_PERM | PVFS_ATTR_COMMON_ATIME | \
@@ -44,7 +46,9 @@
/* internal attribute masks for directory objects */
#define PVFS_ATTR_DIR_DIRENT_COUNT (1 << 19)
-#define PVFS_ATTR_DIR_ALL PVFS_ATTR_DIR_DIRENT_COUNT
+#define PVFS_ATTR_DIR_HINT (1 << 20)
+#define PVFS_ATTR_DIR_ALL \
+(PVFS_ATTR_DIR_DIRENT_COUNT | PVFS_ATTR_DIR_HINT)
/* attributes specific to metadata objects */
struct PVFS_metafile_attr_s
@@ -90,13 +94,49 @@ struct PVFS_datafile_attr_s
typedef struct PVFS_datafile_attr_s PVFS_datafile_attr;
endecode_fields_1(PVFS_datafile_attr, PVFS_size, size)
+/* extended hint attributes for a directory object */
+struct PVFS_directory_hint_s
+{
+ uint32_t dist_name_len;
+ /* what is the distribution name? */
+ char *dist_name;
+ /* what are the distribution parameters? */
+ uint32_t dist_params_len;
+ char *dist_params;
+ /* how many dfiles ought to be used */
+ uint32_t dfile_count;
+};
+typedef struct PVFS_directory_hint_s PVFS_directory_hint;
+
+#ifdef __PINT_REQPROTO_ENCODE_FUNCS_C
+endecode_fields_7(PVFS_directory_hint,
+ uint32_t, dist_name_len,
+ skip4,,
+ string, dist_name,
+ uint32_t, dist_params_len,
+ skip4,,
+ string, dist_params,
+ uint32_t, dfile_count)
+#endif
+
/* attributes specific to directory objects */
struct PVFS_directory_attr_s
{
PVFS_size dirent_count;
+ PVFS_directory_hint hint;
};
typedef struct PVFS_directory_attr_s PVFS_directory_attr;
-endecode_fields_1(PVFS_directory_attr, PVFS_size, dirent_count)
+
+#ifdef __PINT_REQPROTO_ENCODE_FUNCS_C
+#define encode_PVFS_directory_attr(pptr, x) do { \
+ encode_PVFS_size(pptr, &(x)->dirent_count);\
+ encode_PVFS_directory_hint(pptr, &(x)->hint);\
+} while(0)
+#define decode_PVFS_directory_attr(pptr, x) do { \
+ decode_PVFS_size(pptr, &(x)->dirent_count);\
+ decode_PVFS_directory_hint(pptr, &(x)->hint);\
+} while(0)
+#endif
/* attributes specific to symlinks */
struct PVFS_symlink_attr_s
@@ -151,7 +191,7 @@ typedef struct PVFS_object_attr PVFS_obj
encode_PVFS_datafile_attr(pptr, &(x)->u.data); \
if ((x)->mask & PVFS_ATTR_SYMLNK_TARGET) \
encode_PVFS_symlink_attr(pptr, &(x)->u.sym); \
- if ((x)->mask & PVFS_ATTR_DIR_DIRENT_COUNT) \
+ if (((x)->mask & PVFS_ATTR_DIR_DIRENT_COUNT) || ((x)->mask & PVFS_ATTR_DIR_HINT)) \
encode_PVFS_directory_attr(pptr, &(x)->u.dir); \
} while (0)
#define decode_PVFS_object_attr(pptr,x) do { \
@@ -172,18 +212,26 @@ typedef struct PVFS_object_attr PVFS_obj
decode_PVFS_datafile_attr(pptr, &(x)->u.data); \
if ((x)->mask & PVFS_ATTR_SYMLNK_TARGET) \
decode_PVFS_symlink_attr(pptr, &(x)->u.sym); \
- if ((x)->mask & PVFS_ATTR_DIR_DIRENT_COUNT) \
+ if (((x)->mask & PVFS_ATTR_DIR_DIRENT_COUNT) || ((x)->mask & PVFS_ATTR_DIR_HINT)) \
decode_PVFS_directory_attr(pptr, &(x)->u.dir); \
} while (0)
#endif
-/* attr buffer needs room for larger of symlink path or meta fields: an attrib
- * structure can never hold information for both a symlink and a metafile */
+/* attr buffer needs room for larger of symlink path, meta fields or dir hints: an attrib
+ * structure can never hold information for not more than a symlink or a metafile or a dir object */
+#define extra_size_PVFS_object_attr_dir (PVFS_REQ_LIMIT_DIST_BYTES + \
+ PVFS_REQ_LIMIT_DIST_NAME + roundup8(sizeof(PVFS_directory_attr)))
+
#define extra_size_PVFS_object_attr_meta (PVFS_REQ_LIMIT_DIST_BYTES + \
PVFS_REQ_LIMIT_DFILE_COUNT * sizeof(PVFS_handle))
+
#define extra_size_PVFS_object_attr_symlink (PVFS_REQ_LIMIT_PATH_NAME_BYTES)
-#define extra_size_PVFS_object_attr ((extra_size_PVFS_object_attr_meta > \
- extra_size_PVFS_object_attr_symlink) ? extra_size_PVFS_object_attr_meta : \
- extra_size_PVFS_object_attr_symlink)
+
+#ifndef max3
+#define max3(a, b, c) (a) < (b) ? (b) < (c) ? (c) : (b) : (a) < (c) ? (c) : (a)
+#endif
+
+#define extra_size_PVFS_object_attr \
+ max3(extra_size_PVFS_object_attr_meta, extra_size_PVFS_object_attr_symlink, extra_size_PVFS_object_attr_dir)
#endif /* __PVFS2_ATTR_H */
Index: pvfs2-req-proto.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/proto/pvfs2-req-proto.h,v
diff -p -u -r1.138.6.3 -r1.138.6.4
--- pvfs2-req-proto.h 7 Jun 2006 03:21:05 -0000 1.138.6.3
+++ pvfs2-req-proto.h 9 Aug 2006 20:17:53 -0000 1.138.6.4
@@ -22,7 +22,7 @@
* compatibility (such as changing the semantics or protocol fields for an
* existing request type)
*/
-#define PVFS2_PROTO_MAJOR 1
+#define PVFS2_PROTO_MAJOR 2
/* update PVFS2_PROTO_MINOR on wire protocol changes that preserve backwards
* compatibility (such as adding a new request type)
*/
@@ -109,6 +109,8 @@ typedef struct
#define PVFS_REQ_LIMIT_SEGMENT_BYTES PVFS_SEGMENT_MAX
/* max total size of I/O request descriptions */
#define PVFS_REQ_LIMIT_IOREQ_BYTES 8192
+/* maximum size of distribution name used for the hints */
+#define PVFS_REQ_LIMIT_DIST_NAME 128
/* max count of segments allowed per path lookup (note that this governs
* the number of handles and attributes returned in lookup_path responses)
*/
@@ -199,7 +201,7 @@ endecode_fields_1_struct(
struct PVFS_servreq_remove
{
PVFS_handle handle;
- PVFS_fs_id fs_id;
+ PVFS_fs_id fs_id;
};
endecode_fields_2_struct(
PVFS_servreq_remove,
@@ -396,17 +398,16 @@ endecode_fields_4_struct(
__handle, \
__objtype, \
__attr, \
- __amask) \
+ __extra_amask) \
do { \
memset(&(__req), 0, sizeof(__req)); \
(__req).op = PVFS_SERV_SETATTR; \
(__req).credentials = (__creds); \
(__req).u.setattr.fs_id = (__fsid); \
(__req).u.setattr.handle = (__handle); \
- PINT_CONVERT_ATTR(&(__req).u.setattr.attr, \
- &(__attr), PVFS_ATTR_COMMON_ALL); \
- (__req).u.setattr.attr.objtype = (__objtype);\
- (__req).u.setattr.attr.mask |= (__amask); \
+ (__attr).objtype = (__objtype); \
+ (__attr).mask |= PVFS_ATTR_SYS_TYPE; \
+ PINT_CONVERT_ATTR(&(__req).u.setattr.attr, &(__attr), __extra_amask);\
} while (0)
/* lookup path ************************************************/
@@ -497,8 +498,7 @@ endecode_fields_4_struct(
__creds, \
__fs_id, \
__ext_array, \
- __attr, \
- __amask) \
+ __attr) \
do { \
memset(&(__req), 0, sizeof(__req)); \
(__req).op = PVFS_SERV_MKDIR; \
@@ -508,11 +508,9 @@ do {
(__ext_array).extent_count; \
(__req).u.mkdir.handle_extent_array.extent_array = \
(__ext_array).extent_array; \
- PINT_CONVERT_ATTR(&(__req).u.mkdir.attr, \
- &(__attr), PVFS_ATTR_COMMON_ALL); \
- (__req).u.mkdir.attr.mask &= (__amask); \
- (__req).u.mkdir.attr.mask |= PVFS_ATTR_COMMON_TYPE;\
- (__req).u.mkdir.attr.objtype = PVFS_TYPE_DIRECTORY;\
+ (__attr).objtype = PVFS_TYPE_DIRECTORY; \
+ (__attr).mask |= PVFS_ATTR_SYS_TYPE; \
+ PINT_CONVERT_ATTR(&(__req).u.mkdir.attr, &(__attr), 0);\
} while (0)
struct PVFS_servresp_mkdir
@@ -532,20 +530,13 @@ struct PVFS_servreq_crdirent
PVFS_handle new_handle; /* handle of new entry */
PVFS_handle parent_handle; /* handle of directory */
PVFS_fs_id fs_id; /* file system */
- PVFS_time parent_atime;
- PVFS_time parent_mtime;
- PVFS_time parent_ctime;
};
-endecode_fields_8_struct(
+endecode_fields_4_struct(
PVFS_servreq_crdirent,
string, name,
PVFS_handle, new_handle,
PVFS_handle, parent_handle,
- PVFS_fs_id, fs_id,
- skip4,,
- PVFS_time, parent_atime,
- PVFS_time, parent_mtime,
- PVFS_time, parent_ctime)
+ PVFS_fs_id, fs_id)
#define extra_size_PVFS_servreq_crdirent \
roundup8(PVFS_REQ_LIMIT_SEGMENT_BYTES+1)
@@ -554,10 +545,7 @@ endecode_fields_8_struct(
__name, \
__new_handle, \
__parent_handle, \
- __fs_id, \
- __parent_atime, \
- __parent_mtime, \
- __parent_ctime) \
+ __fs_id) \
do { \
memset(&(__req), 0, sizeof(__req)); \
(__req).op = PVFS_SERV_CRDIRENT; \
@@ -567,12 +555,6 @@ do {
(__req).u.crdirent.parent_handle = \
(__parent_handle); \
(__req).u.crdirent.fs_id = (__fs_id); \
- (__req).u.crdirent.parent_atime = \
- (__parent_atime); \
- (__req).u.crdirent.parent_mtime = \
- (__parent_mtime); \
- (__req).u.crdirent.parent_ctime = \
- (__parent_ctime); \
} while (0)
/* rmdirent ****************************************************/
@@ -583,19 +565,12 @@ struct PVFS_servreq_rmdirent
char *entry; /* name of entry to remove */
PVFS_handle parent_handle; /* handle of directory */
PVFS_fs_id fs_id; /* file system */
- PVFS_time parent_atime;
- PVFS_time parent_mtime;
- PVFS_time parent_ctime;
};
-endecode_fields_7_struct(
+endecode_fields_3_struct(
PVFS_servreq_rmdirent,
string, entry,
PVFS_handle, parent_handle,
- PVFS_fs_id, fs_id,
- skip4,,
- PVFS_time, parent_atime,
- PVFS_time, parent_mtime,
- PVFS_time, parent_ctime)
+ PVFS_fs_id, fs_id)
#define extra_size_PVFS_servreq_rmdirent \
roundup8(PVFS_REQ_LIMIT_SEGMENT_BYTES+1)
@@ -603,10 +578,7 @@ endecode_fields_7_struct(
__creds, \
__fsid, \
__handle, \
- __entry, \
- __parent_atime,\
- __parent_mtime,\
- __parent_ctime)\
+ __entry) \
do { \
memset(&(__req), 0, sizeof(__req)); \
(__req).op = PVFS_SERV_RMDIRENT; \
@@ -614,17 +586,11 @@ do {
(__req).u.rmdirent.fs_id = (__fsid); \
(__req).u.rmdirent.parent_handle = (__handle);\
(__req).u.rmdirent.entry = (__entry); \
- (__req).u.rmdirent.parent_atime = \
- (__parent_atime); \
- (__req).u.rmdirent.parent_mtime = \
- (__parent_mtime); \
- (__req).u.rmdirent.parent_ctime = \
- (__parent_ctime); \
} while (0);
struct PVFS_servresp_rmdirent
{
- PVFS_handle entry_handle; /* handle of removed entry */
+ PVFS_handle entry_handle; /* handle of removed entry */
};
endecode_fields_1_struct(
PVFS_servresp_rmdirent,
@@ -639,20 +605,13 @@ struct PVFS_servreq_chdirent
PVFS_handle new_dirent_handle; /* handle of directory */
PVFS_handle parent_handle; /* handle of directory */
PVFS_fs_id fs_id; /* file system */
- PVFS_time parent_atime;
- PVFS_time parent_mtime;
- PVFS_time parent_ctime;
};
-endecode_fields_8_struct(
+endecode_fields_4_struct(
PVFS_servreq_chdirent,
string, entry,
PVFS_handle, new_dirent_handle,
PVFS_handle, parent_handle,
- PVFS_fs_id, fs_id,
- skip4,,
- PVFS_time, parent_atime,
- PVFS_time, parent_mtime,
- PVFS_time, parent_ctime)
+ PVFS_fs_id, fs_id)
#define extra_size_PVFS_servreq_chdirent \
roundup8(PVFS_REQ_LIMIT_SEGMENT_BYTES+1)
@@ -661,10 +620,7 @@ endecode_fields_8_struct(
__fsid, \
__parent_handle,\
__new_dirent, \
- __entry, \
- __parent_atime, \
- __parent_mtime, \
- __parent_ctime) \
+ __entry) \
do { \
memset(&(__req), 0, sizeof(__req)); \
(__req).op = PVFS_SERV_CHDIRENT; \
@@ -675,12 +631,6 @@ do {
(__req).u.chdirent.new_dirent_handle = \
(__new_dirent); \
(__req).u.chdirent.entry = (__entry); \
- (__req).u.chdirent.parent_atime = \
- (__parent_atime); \
- (__req).u.chdirent.parent_mtime = \
- (__parent_mtime); \
- (__req).u.chdirent.parent_ctime = \
- (__parent_ctime); \
} while (0);
struct PVFS_servresp_chdirent
@@ -1405,14 +1355,17 @@ struct PVFS_servresp_geteattr
{
int32_t nkey; /* number of values returned */
PVFS_ds_keyval *val; /* array of values returned */
+ PVFS_error *err; /* array of error codes */
};
-endecode_fields_1a_struct(
+endecode_fields_1aa_struct(
PVFS_servresp_geteattr,
skip4,,
int32_t, nkey,
- PVFS_ds_keyval, val)
+ PVFS_ds_keyval, val,
+ PVFS_error, err);
#define extra_size_PVFS_servresp_geteattr \
- (PVFS_REQ_LIMIT_VAL_LEN * PVFS_REQ_LIMIT_KEYVAL_LIST)
+ (PVFS_REQ_LIMIT_VAL_LEN * PVFS_REQ_LIMIT_KEYVAL_LIST + \
+ PVFS_REQ_LIMIT_KEYVAL_LIST * sizeof(PVFS_error))
/* seteattr ****************************************************/
/* - sets list of extended attributes */
More information about the Pvfs2-cvs
mailing list