[PVFS2-CVS] commit by slang in pvfs2/src/proto: PINT-le-bytefield.c
PINT-reqproto-encode.c endecode-funcs.h pvfs2-attr.h
pvfs2-req-proto.h
CVS commit program
cvs at parl.clemson.edu
Thu Aug 25 17:38:36 EDT 2005
Update of /projects/cvsroot/pvfs2/src/proto
In directory parlweb:/tmp/cvs-serv7520/src/proto
Modified Files:
Tag: slang-event-changes-branch
PINT-le-bytefield.c PINT-reqproto-encode.c endecode-funcs.h
pvfs2-attr.h pvfs2-req-proto.h
Log Message:
updates to my event changes to bring them inline with trunk
Index: PINT-le-bytefield.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/proto/PINT-le-bytefield.c,v
diff -p -u -r1.33 -r1.33.2.1
--- PINT-le-bytefield.c 31 Mar 2005 19:14:35 -0000 1.33
+++ PINT-le-bytefield.c 25 Aug 2005 20:38:34 -0000 1.33.2.1
@@ -57,6 +57,7 @@ static void lebf_initialize(void)
char *tmp_name = strdup("foo");
const int init_big_size = 1024 * 1024;
+ gossip_debug(GOSSIP_ENDECODE_DEBUG,"lebf_initialize\n");
/*
* Some messages have extra structures, and even indeterminate sizes
* which are hand-calculated here. Also some fields must be initialized
@@ -185,6 +186,20 @@ static void lebf_initialize(void)
case PVFS_SERV_PROTO_ERROR:
/* nothing special */
break;
+ case PVFS_SERV_GETEATTR:
+ req.u.geteattr.nkey = 0;
+ resp.u.geteattr.nkey = 0;
+ reqsize = extra_size_PVFS_servreq_geteattr;
+ respsize = extra_size_PVFS_servresp_geteattr;
+ break;
+ case PVFS_SERV_SETEATTR:
+ req.u.seteattr.nkey = 0;
+ reqsize = extra_size_PVFS_servreq_seteattr;
+ break;
+ case PVFS_SERV_DELEATTR:
+ req.u.deleattr.key.buffer_sz = 0;
+ reqsize = extra_size_PVFS_servreq_deleattr;
+ break;
}
/* since these take the max size when mallocing in the encode,
* give them a huge number, then later fix it. */
@@ -241,6 +256,7 @@ encode_common(struct PINT_encoded_msg *t
int ret = 0;
void *buf = NULL;
+ gossip_debug(GOSSIP_ENDECODE_DEBUG,"encode_common\n");
/* this encoder always uses just one buffer */
target_msg->buffer_list = &target_msg->buffer_stub;
target_msg->size_list = &target_msg->size_stub;
@@ -286,6 +302,7 @@ static int lebf_encode_req(
ret = encode_common(target_msg, max_size_array[req->op].req);
if (ret)
goto out;
+ gossip_debug(GOSSIP_ENDECODE_DEBUG,"lebf_encode_req\n");
/* every request has these fields */
p = &target_msg->ptr_current;
@@ -319,6 +336,9 @@ static int lebf_encode_req(
CASE(PVFS_SERV_MGMT_ITERATE_HANDLES, mgmt_iterate_handles);
CASE(PVFS_SERV_MGMT_DSPACE_INFO_LIST, mgmt_dspace_info_list);
CASE(PVFS_SERV_MGMT_EVENT_MON, mgmt_event_mon);
+ CASE(PVFS_SERV_GETEATTR, geteattr);
+ CASE(PVFS_SERV_SETEATTR, seteattr);
+ CASE(PVFS_SERV_DELEATTR, deleattr);
case PVFS_SERV_GETCONFIG:
case PVFS_SERV_MGMT_NOOP:
@@ -371,11 +391,12 @@ static int lebf_encode_resp(
ret = encode_common(target_msg, max_size_array[resp->op].resp);
if (ret)
goto out;
+ gossip_debug(GOSSIP_ENDECODE_DEBUG,"lebf_encode_resp\n");
/* every response has these fields */
p = &target_msg->ptr_current;
encode_PVFS_server_resp(p, resp);
-
+
#define CASE(tag,var) \
case tag: encode_PVFS_servresp_##var(p,&resp->u.var); break
@@ -404,13 +425,16 @@ static int lebf_encode_resp(
CASE(PVFS_SERV_MGMT_ITERATE_HANDLES, mgmt_iterate_handles);
CASE(PVFS_SERV_MGMT_DSPACE_INFO_LIST, mgmt_dspace_info_list);
CASE(PVFS_SERV_MGMT_EVENT_MON, mgmt_event_mon);
- CASE(PVFS_SERV_WRITE_COMPLETION, write_completion);
+ CASE(PVFS_SERV_WRITE_COMPLETION, write_completion);
CASE(PVFS_SERV_MGMT_GET_DIRDATA_HANDLE, mgmt_get_dirdata_handle);
+ CASE(PVFS_SERV_GETEATTR, geteattr);
case PVFS_SERV_REMOVE:
case PVFS_SERV_MGMT_REMOVE_OBJECT:
case PVFS_SERV_MGMT_REMOVE_DIRENT:
case PVFS_SERV_SETATTR:
+ case PVFS_SERV_SETEATTR:
+ case PVFS_SERV_DELEATTR:
case PVFS_SERV_CRDIRENT:
case PVFS_SERV_TRUNCATE:
case PVFS_SERV_FLUSH:
@@ -470,6 +494,7 @@ static int lebf_decode_req(
/* decode generic part of request (enough to get op number) */
decode_PVFS_server_req(p, req);
+ gossip_debug(GOSSIP_ENDECODE_DEBUG,"lebf_decode_req\n");
#define CASE(tag,var) \
case tag: decode_PVFS_servreq_##var(p, &req->u.var); break
@@ -499,6 +524,9 @@ static int lebf_decode_req(
CASE(PVFS_SERV_MGMT_ITERATE_HANDLES, mgmt_iterate_handles);
CASE(PVFS_SERV_MGMT_DSPACE_INFO_LIST, mgmt_dspace_info_list);
CASE(PVFS_SERV_MGMT_EVENT_MON, mgmt_event_mon);
+ CASE(PVFS_SERV_GETEATTR, geteattr);
+ CASE(PVFS_SERV_SETEATTR, seteattr);
+ CASE(PVFS_SERV_DELEATTR, deleattr);
case PVFS_SERV_GETCONFIG:
case PVFS_SERV_MGMT_NOOP:
@@ -548,6 +576,7 @@ static int lebf_decode_resp(
/* decode generic part of response (including op number) */
decode_PVFS_server_resp(p, resp);
+ gossip_debug(GOSSIP_ENDECODE_DEBUG,"lebf_decode_resp\n");
if (resp->status == -PVFS_EIO)
goto out;
@@ -575,11 +604,14 @@ static int lebf_decode_resp(
CASE(PVFS_SERV_MGMT_EVENT_MON, mgmt_event_mon);
CASE(PVFS_SERV_MGMT_GET_DIRDATA_HANDLE, mgmt_get_dirdata_handle);
CASE(PVFS_SERV_WRITE_COMPLETION, write_completion);
+ CASE(PVFS_SERV_GETEATTR, geteattr);
case PVFS_SERV_REMOVE:
case PVFS_SERV_MGMT_REMOVE_OBJECT:
case PVFS_SERV_MGMT_REMOVE_DIRENT:
case PVFS_SERV_SETATTR:
+ case PVFS_SERV_SETEATTR:
+ case PVFS_SERV_DELEATTR:
case PVFS_SERV_CRDIRENT:
case PVFS_SERV_TRUNCATE:
case PVFS_SERV_FLUSH:
@@ -617,6 +649,7 @@ static void lebf_encode_rel(
struct PINT_encoded_msg *msg,
enum PINT_encode_msg_type input_type)
{
+ gossip_debug(GOSSIP_ENDECODE_DEBUG,"lebf_encode_rel\n");
/* just a single buffer to free */
if (initializing_sizes)
{
@@ -638,6 +671,7 @@ static void lebf_encode_rel(
static void lebf_decode_rel(struct PINT_decoded_msg *msg,
enum PINT_encode_msg_type input_type)
{
+ gossip_debug(GOSSIP_ENDECODE_DEBUG,"lebf_decode_rel\n");
if (input_type == PINT_DECODE_REQ) {
struct PVFS_server_req *req = &msg->stub_dec.req;
switch (req->op) {
@@ -689,9 +723,11 @@ static void lebf_decode_rel(struct PINT_
case PVFS_SERV_MGMT_ITERATE_HANDLES:
case PVFS_SERV_MGMT_PERF_MON:
case PVFS_SERV_MGMT_EVENT_MON:
+ case PVFS_SERV_GETEATTR:
+ case PVFS_SERV_SETEATTR:
+ case PVFS_SERV_DELEATTR:
/* nothing to free */
break;
-
case PVFS_SERV_INVALID:
case PVFS_SERV_WRITE_COMPLETION:
case PVFS_SERV_PERF_UPDATE:
@@ -741,6 +777,12 @@ static void lebf_decode_rel(struct PINT_
decode_free(resp->u.mgmt_event_mon.event_array);
break;
+ case PVFS_SERV_GETEATTR:
+ /* need a loop here? WBL */
+ if (resp->u.geteattr.val)
+ decode_free(resp->u.geteattr.val);
+ break;
+
case PVFS_SERV_GETCONFIG:
case PVFS_SERV_CREATE:
case PVFS_SERV_REMOVE:
@@ -749,6 +791,8 @@ static void lebf_decode_rel(struct PINT_
case PVFS_SERV_MGMT_GET_DIRDATA_HANDLE:
case PVFS_SERV_IO:
case PVFS_SERV_SETATTR:
+ case PVFS_SERV_SETEATTR:
+ case PVFS_SERV_DELEATTR:
case PVFS_SERV_CRDIRENT:
case PVFS_SERV_RMDIRENT:
case PVFS_SERV_CHDIRENT:
@@ -778,6 +822,7 @@ static int check_req_size(struct PVFS_se
struct PINT_encoded_msg msg;
int size;
+ gossip_debug(GOSSIP_ENDECODE_DEBUG,"check_req_size\n");
lebf_encode_req(req, &msg);
size = msg.total_size;
lebf_encode_rel(&msg, 0);
@@ -789,6 +834,7 @@ static int check_resp_size(struct PVFS_s
struct PINT_encoded_msg msg;
int size;
+ gossip_debug(GOSSIP_ENDECODE_DEBUG,"check_resp_size\n");
lebf_encode_resp(resp, &msg);
size = msg.total_size;
lebf_encode_rel(&msg, 0);
Index: PINT-reqproto-encode.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/proto/PINT-reqproto-encode.c,v
diff -p -u -r1.23.6.2 -r1.23.6.3
--- PINT-reqproto-encode.c 7 Jun 2005 21:59:13 -0000 1.23.6.2
+++ PINT-reqproto-encode.c 25 Aug 2005 20:38:34 -0000 1.23.6.3
@@ -53,6 +53,7 @@ int PINT_encode_initialize(void)
{
int ret = -PVFS_EINVAL;
+ gossip_debug(GOSSIP_ENDECODE_DEBUG,"PINT_encode_initialize\n");
if (ENCODING_IS_SUPPORTED(ENCODING_LE_BFIELD))
{
/* setup little endian bytefield encoding */
@@ -78,6 +79,7 @@ int PINT_encode_initialize(void)
*/
void PINT_encode_finalize(void)
{
+ gossip_debug(GOSSIP_ENDECODE_DEBUG,"PINT_encode_finalize\n");
return;
}
@@ -99,6 +101,7 @@ int PINT_encode(void* input_buffer,
target_msg->dest = target_addr;
target_msg->enc_type = enc_type;
+ gossip_debug(GOSSIP_ENDECODE_DEBUG,"PINT_encode\n");
switch(enc_type)
{
case ENCODING_LE_BFIELD:
@@ -163,6 +166,7 @@ int PINT_decode(void* input_buffer,
int ret;
int32_t enc_type_recved, proto_ver_recved;
+ gossip_debug(GOSSIP_ENDECODE_DEBUG,"PINT_decode\n");
/* compare the header of the incoming buffer against the precalculated
* header associated with each module
*/
@@ -233,7 +237,7 @@ int PINT_decode(void* input_buffer,
"expecting version %d.\n", (int)proto_ver_recved,
PVFS_RELEASE_NR);
gossip_err(" Please verify your PVFS2 installation and make sure "
- "that the version is\n consistent.\n");
+ "that the version is consistent.\n");
}
return(-PVFS_EPROTONOSUPPORT);
@@ -249,6 +253,7 @@ int PINT_decode(void* input_buffer,
void PINT_encode_release(struct PINT_encoded_msg* input_buffer,
enum PINT_encode_msg_type input_type)
{
+ gossip_debug(GOSSIP_ENDECODE_DEBUG,"PINT_encode_release\n");
if (ENCODING_IS_SUPPORTED(input_buffer->enc_type))
{
PINT_encoding_table[input_buffer->enc_type]->op->encode_release(
@@ -271,6 +276,7 @@ void PINT_encode_release(struct PINT_enc
void PINT_decode_release(struct PINT_decoded_msg* input_buffer,
enum PINT_encode_msg_type input_type)
{
+ gossip_debug(GOSSIP_ENDECODE_DEBUG,"PINT_decode_release\n");
if (ENCODING_IS_SUPPORTED(input_buffer->enc_type))
{
PINT_encoding_table[input_buffer->enc_type]->op->decode_release(
@@ -297,6 +303,7 @@ int PINT_encode_calc_max_size(
{
int ret = -PVFS_EINVAL;
+ gossip_debug(GOSSIP_ENDECODE_DEBUG,"PINT_encode_calc_max_size\n");
switch(enc_type)
{
case ENCODING_LE_BFIELD:
Index: endecode-funcs.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/proto/endecode-funcs.h,v
diff -p -u -r1.10.2.1 -r1.10.2.2
--- endecode-funcs.h 3 Jun 2005 15:19:07 -0000 1.10.2.1
+++ endecode-funcs.h 25 Aug 2005 20:38:34 -0000 1.10.2.2
@@ -12,6 +12,11 @@
#include "src/io/bmi/bmi-byteswap.h"
/*
+ * NOTE - Every macro defined here needs to have a stub defined in
+ * include/pvfs2-encode-stubs.h
+ */
+
+/*
* Generic macros to define encoding near target structure declarations.
*/
@@ -72,6 +77,7 @@
*pbuf = *(pptr) + 4; \
*(pptr) += roundup8(4 + len + 1); \
} while (0)
+
/* odd variation, space exists in some structure, must copy-in string */
#define encode_here_string(pptr,pbuf) encode_string(pptr,pbuf)
#define decode_here_string(pptr,pbuf) do { \
@@ -80,6 +86,21 @@
*(pptr) += roundup8(4 + len + 1); \
} while (0)
+/* keyvals; a lot like strings; decoding points existing character data */
+/* BTW we are skipping the read_sz field - keep that in mind */
+#define encode_PVFS_ds_keyval(pptr,pbuf) do { \
+ u_int32_t len = ((PVFS_ds_keyval *)pbuf)->buffer_sz; \
+ *(u_int32_t *) *(pptr) = htobmi32(len); \
+ memcpy(*(pptr)+4, ((PVFS_ds_keyval *)pbuf)->buffer, len); \
+ *(pptr) += roundup8(4 + len); \
+} while (0)
+#define decode_PVFS_ds_keyval(pptr,pbuf) do { \
+ u_int32_t len = bmitoh32(*(u_int32_t *) *(pptr)); \
+ ((PVFS_ds_keyval *)pbuf)->buffer_sz = len; \
+ ((PVFS_ds_keyval *)pbuf)->buffer = *(pptr) + 4; \
+ *(pptr) += roundup8(4 + len); \
+} while (0)
+
/*
* Type maps are put near the type definitions, except for this special one.
*
@@ -90,8 +111,26 @@
#define decode_enum decode_int32_t
/* memory alloc and free, just for decoding */
+#if 0
+/* this is for debugging, if you want to see what is malloc'd */
+static inline void *decode_malloc (int n) {
+ void *p;
+ if (n>0)
+ p = malloc(n);
+ else
+ p = (void *)0;
+ printf("decode malloc %d bytes: %p\n",n,p);
+ return p;
+}
+/* this is for debugging, if you want to see what is free'd */
+static inline void decode_free (void *p) {
+ printf("decode free: %p\n",p);
+ free(p);
+}
+#else
#define decode_malloc(n) ((n) ? malloc(n) : 0)
#define decode_free(n) free(n)
+#endif
/*
* These wrappers define functions to do the encoding of the types or
@@ -274,6 +313,8 @@ static inline void decode_##name(char **
}
/* ones with arrays that are allocated in the decode */
+
+/* one field then one array */
#define endecode_fields_1a_generic(name, sname, t1, x1, tn1, n1, ta1, a1) \
static inline void encode_##name(char **pptr, const sname *x) { int i; \
encode_##t1(pptr, &x->x1); \
@@ -294,6 +335,7 @@ static inline void decode_##name(char **
#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)
+/* 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; \
encode_##t1(pptr, &x->x1); \
@@ -318,6 +360,103 @@ static inline void decode_##name(char **
decode_##ta2(pptr, &(x)->a2[i]); \
}
+/* 2 fields, then an array */
+#define endecode_fields_2a_generic(name, sname, t1, x1, t2, x2, tn1, n1, ta1, a1) \
+static inline void encode_##name(char **pptr, const sname *x) { int i; \
+ encode_##t1(pptr, &x->x1); \
+ encode_##t2(pptr, &x->x2); \
+ encode_##tn1(pptr, &x->n1); \
+ for (i=0; i<x->n1; i++) \
+ encode_##ta1(pptr, &(x)->a1[i]); \
+} \
+static inline void decode_##name(char **pptr, sname *x) { int i; \
+ decode_##t1(pptr, &x->x1); \
+ decode_##t2(pptr, &x->x2); \
+ 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]); \
+}
+
+#define endecode_fields_2a(name, t1, x1, t2, x2, tn1, n1, ta1, a1) \
+ 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)
+
+/* 3 fields, then an array */
+#define endecode_fields_3a_struct(name, t1, x1, t2, x2, t3, x3, tn1, n1, ta1, a1) \
+static inline void encode_##name(char **pptr, const struct name *x) { int i; \
+ encode_##t1(pptr, &x->x1); \
+ encode_##t2(pptr, &x->x2); \
+ encode_##t3(pptr, &x->x3); \
+ encode_##tn1(pptr, &x->n1); \
+ for (i=0; i<x->n1; i++) \
+ encode_##ta1(pptr, &(x)->a1[i]); \
+} \
+static inline void decode_##name(char **pptr, struct name *x) { int i; \
+ decode_##t1(pptr, &x->x1); \
+ decode_##t2(pptr, &x->x2); \
+ decode_##t3(pptr, &x->x3); \
+ 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]); \
+}
+
+/* special case where we have two arrays of the same size after 3 fields */
+#define endecode_fields_3aa_struct(name, t1, x1, t2, x2, t3, x3, 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_##t2(pptr, &x->x2); \
+ encode_##t3(pptr, &x->x3); \
+ 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_##t2(pptr, &x->x2); \
+ decode_##t3(pptr, &x->x3); \
+ 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 4 fields */
+#define endecode_fields_4aa_struct(name, t1, x1, t2, x2, t3, x3, t4, x4, 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_##t2(pptr, &x->x2); \
+ encode_##t3(pptr, &x->x3); \
+ encode_##t4(pptr, &x->x4); \
+ 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_##t2(pptr, &x->x2); \
+ decode_##t3(pptr, &x->x3); \
+ decode_##t4(pptr, &x->x4); \
+ 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]); \
+}
+
+
+/* 4 fields, then an array */
#define endecode_fields_4a_struct(name, t1, x1, t2, x2, t3, x3, t4, x4, tn1,n1,ta1,a1) \
static inline void encode_##name(char **pptr, const struct name *x) { int i; \
encode_##t1(pptr, &x->x1); \
@@ -339,6 +478,7 @@ static inline void decode_##name(char **
decode_##ta1(pptr, &(x)->a1[i]); \
}
+/* 5 fields, then an array */
#define endecode_fields_5a_struct(name, t1, x1, t2, x2, t3, x3, t4, x4, t5, x5, tn1,n1,ta1,a1) \
static inline void encode_##name(char **pptr, const struct name *x) { int i; \
encode_##t1(pptr, &x->x1); \
Index: pvfs2-attr.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/proto/pvfs2-attr.h,v
diff -p -u -r1.33 -r1.33.2.1
--- pvfs2-attr.h 31 Mar 2005 19:14:51 -0000 1.33
+++ pvfs2-attr.h 25 Aug 2005 20:38:34 -0000 1.33.2.1
@@ -11,6 +11,38 @@
#include "pvfs2-storage.h"
#include "pint-distribution.h"
+/* internal attribute masks, common to all obj types */
+#define PVFS_ATTR_COMMON_UID (1 << 0)
+#define PVFS_ATTR_COMMON_GID (1 << 1)
+#define PVFS_ATTR_COMMON_PERM (1 << 2)
+#define PVFS_ATTR_COMMON_ATIME (1 << 3)
+#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_ALL \
+(PVFS_ATTR_COMMON_UID | PVFS_ATTR_COMMON_GID | \
+ PVFS_ATTR_COMMON_PERM | PVFS_ATTR_COMMON_ATIME | \
+ PVFS_ATTR_COMMON_CTIME | PVFS_ATTR_COMMON_MTIME | \
+ PVFS_ATTR_COMMON_TYPE)
+
+/* internal attribute masks for metadata objects */
+#define PVFS_ATTR_META_DIST (1 << 10)
+#define PVFS_ATTR_META_DFILES (1 << 11)
+#define PVFS_ATTR_META_ALL \
+(PVFS_ATTR_META_DIST | PVFS_ATTR_META_DFILES)
+
+/* internal attribute masks for datafile objects */
+#define PVFS_ATTR_DATA_SIZE (1 << 15)
+#define PVFS_ATTR_DATA_ALL PVFS_ATTR_DATA_SIZE
+
+/* internal attribute masks for symlink objects */
+#define PVFS_ATTR_SYMLNK_TARGET (1 << 18)
+#define PVFS_ATTR_SYMLNK_ALL PVFS_ATTR_SYMLNK_TARGET
+
+/* internal attribute masks for directory objects */
+#define PVFS_ATTR_DIR_DIRENT_COUNT (1 << 19)
+#define PVFS_ATTR_DIR_ALL PVFS_ATTR_DIR_DIRENT_COUNT
+
/* attributes specific to metadata objects */
struct PVFS_metafile_attr_s
{
@@ -58,9 +90,10 @@ endecode_fields_1(PVFS_datafile_attr, PV
/* attributes specific to directory objects */
struct PVFS_directory_attr_s
{
- /* undefined */
+ PVFS_size dirent_count;
};
typedef struct PVFS_directory_attr_s PVFS_directory_attr;
+endecode_fields_1(PVFS_directory_attr, PVFS_size, dirent_count)
/* attributes specific to symlinks */
struct PVFS_symlink_attr_s
@@ -115,6 +148,8 @@ 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) \
+ encode_PVFS_directory_attr(pptr, &(x)->u.dir); \
} while (0)
#define decode_PVFS_object_attr(pptr,x) do { \
decode_PVFS_uid(pptr, &(x)->owner); \
@@ -134,12 +169,18 @@ 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) \
+ decode_PVFS_directory_attr(pptr, &(x)->u.dir); \
} while (0)
#endif
-/* could have one each of PVFS_Dist, dfile_array, symlink_target */
-#define extra_size_PVFS_object_attr (PVFS_REQ_LIMIT_DIST_BYTES + \
- PVFS_REQ_LIMIT_DFILE_COUNT * sizeof(PVFS_handle) + \
- PVFS_REQ_LIMIT_PATH_NAME_BYTES)
+/* 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 */
+#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)
#endif /* __PVFS2_ATTR_H */
Index: pvfs2-req-proto.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/proto/pvfs2-req-proto.h,v
diff -p -u -r1.125 -r1.125.2.1
--- pvfs2-req-proto.h 31 Mar 2005 19:16:03 -0000 1.125
+++ pvfs2-req-proto.h 25 Aug 2005 20:38:35 -0000 1.125.2.1
@@ -51,12 +51,15 @@ enum PVFS_server_op
PVFS_SERV_MGMT_REMOVE_DIRENT = 25,
PVFS_SERV_MGMT_GET_DIRDATA_HANDLE = 26,
PVFS_SERV_JOB_TIMER = 27, /* not a real protocol request */
- PVFS_SERV_PROTO_ERROR = 28
+ PVFS_SERV_PROTO_ERROR = 28,
+ PVFS_SERV_GETEATTR = 29,
+ PVFS_SERV_SETEATTR = 30,
+ PVFS_SERV_DELEATTR = 31
/* IMPORTANT: please remember to modify PVFS_MAX_SERVER_OP define
* (below) if you add a new operation to this list
*/
};
-#define PVFS_MAX_SERVER_OP 28
+#define PVFS_MAX_SERVER_OP 31
/*
* These ops must always work, even if the server is in admin mode.
@@ -115,6 +118,12 @@ typedef struct
#define PVFS_REQ_LIMIT_MAX_SYMLINK_RESOLUTION_COUNT 8
/* max depth of a PINT_Request used in anything, just servreq IO now */
#define PVFS_REQ_LIMIT_PINT_REQUEST_NUM 100
+/* max number of bytes in the key of a key/value pair including null term */
+#define PVFS_REQ_LIMIT_KEY_LEN 128
+/* max number of bytes in a value of a key/value/pair */
+#define PVFS_REQ_LIMIT_VAL_LEN 4096
+/* man number of key/value pairs to set or get in a list operation */
+#define PVFS_REQ_LIMIT_KEYVAL_LIST 32
/* create *********************************************************/
/* - used to create new metafile and datafile objects */
@@ -152,9 +161,9 @@ do {
(__req).u.create.fs_id = (__fsid); \
(__req).u.create.object_type = (__objtype); \
(__req).u.create.handle_extent_array.extent_count =\
- (__ext_array.extent_count); \
+ (__ext_array).extent_count; \
(__req).u.create.handle_extent_array.extent_array =\
- (__ext_array.extent_array); \
+ (__ext_array).extent_array; \
} while (0)
struct PVFS_servresp_create
@@ -477,9 +486,9 @@ do {
(__req).credentials = (__creds); \
(__req).u.mkdir.fs_id = __fs_id; \
(__req).u.mkdir.handle_extent_array.extent_count = \
- (__ext_array.extent_count); \
+ (__ext_array).extent_count; \
(__req).u.mkdir.handle_extent_array.extent_array = \
- (__ext_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); \
@@ -847,8 +856,8 @@ struct PVFS_servreq_io
" more than maximum %d\n", __func__, \
(x)->file_req->num_nested_req, PVFS_REQ_LIMIT_PINT_REQUEST_NUM); \
lin = decode_malloc(((x)->file_req->num_nested_req + 1) * sizeof(*lin)); \
- (void) PINT_Request_commit(lin, (x)->file_req); \
- PINT_Request_encode(lin); /* packs the pointers */ \
+ (void) PINT_request_commit(lin, (x)->file_req); \
+ PINT_request_encode(lin); /* packs the pointers */ \
encode_int32_t(pptr, &(x)->file_req->num_nested_req); \
encode_skip4(pptr,); \
encode_PVFS_Request(pptr, lin); \
@@ -871,7 +880,7 @@ struct PVFS_servreq_io
(x)->file_req = decode_malloc((numreq + 1) * sizeof(*(x)->file_req)); \
(x)->file_req->num_nested_req = numreq; \
decode_PVFS_Request(pptr, (x)->file_req); \
- PINT_Request_decode((x)->file_req); /* unpacks the pointers */ \
+ PINT_request_decode((x)->file_req); /* unpacks the pointers */ \
decode_PVFS_offset(pptr, &(x)->file_req_offset); \
decode_PVFS_size(pptr, &(x)->aggregate_size); \
} while (0)
@@ -1142,6 +1151,136 @@ endecode_fields_1a_struct(
(PVFS_REQ_LIMIT_MGMT_EVENT_MON_COUNT * \
roundup8(sizeof(struct PVFS_mgmt_event)))
+/* geteattr ****************************************************/
+/* - retreives list of extended attributes */
+
+struct PVFS_servreq_geteattr
+{
+ PVFS_handle handle; /* handle of target object */
+ PVFS_fs_id fs_id; /* file system */
+ int32_t nkey; /* number of keys to read */
+ PVFS_ds_keyval *key; /* array of keys to read */
+ PVFS_size *valsz; /* array of value buffer sizes */
+};
+endecode_fields_3aa_struct(
+ PVFS_servreq_geteattr,
+ PVFS_handle, handle,
+ PVFS_fs_id, fs_id,
+ skip4,,
+ int32_t, nkey,
+ PVFS_ds_keyval, key,
+ PVFS_size, valsz);
+#define extra_size_PVFS_servreq_geteattr \
+ (PVFS_REQ_LIMIT_KEY_LEN * PVFS_REQ_LIMIT_KEYVAL_LIST)
+
+#define PINT_SERVREQ_GETEATTR_FILL(__req, \
+ __creds, \
+ __fsid, \
+ __handle,\
+ __nkey,\
+ __key_array, \
+ __size_array) \
+do { \
+ memset(&(__req), 0, sizeof(__req)); \
+ (__req).op = PVFS_SERV_GETEATTR; \
+ (__req).credentials = (__creds); \
+ (__req).u.geteattr.fs_id = (__fsid); \
+ (__req).u.geteattr.handle = (__handle); \
+ (__req).u.geteattr.nkey = (__nkey); \
+ (__req).u.geteattr.key = (__key_array);\
+ (__req).u.geteattr.valsz = (__size_array);\
+} while (0)
+
+struct PVFS_servresp_geteattr
+{
+ int32_t nkey; /* number of values returned */
+ PVFS_ds_keyval *val; /* array of values returned */
+};
+endecode_fields_1a_struct(
+ PVFS_servresp_geteattr,
+ skip4,,
+ int32_t, nkey,
+ PVFS_ds_keyval, val)
+#define extra_size_PVFS_servresp_geteattr \
+ (PVFS_REQ_LIMIT_VAL_LEN * PVFS_REQ_LIMIT_KEYVAL_LIST)
+
+/* seteattr ****************************************************/
+/* - sets list of extended attributes */
+
+struct PVFS_servreq_seteattr
+{
+ PVFS_handle handle; /* handle of target object */
+ PVFS_fs_id fs_id; /* file system */
+ int32_t flags; /* flags */
+ int32_t nkey; /* number of keys and vals */
+ PVFS_ds_keyval *key; /* attribute key */
+ PVFS_ds_keyval *val; /* attribute value */
+};
+endecode_fields_4aa_struct(
+ PVFS_servreq_seteattr,
+ PVFS_handle, handle,
+ PVFS_fs_id, fs_id,
+ int32_t, flags,
+ skip4,,
+ int32_t, nkey,
+ PVFS_ds_keyval, key,
+ PVFS_ds_keyval, val);
+#define extra_size_PVFS_servreq_seteattr \
+ ((PVFS_REQ_LIMIT_KEY_LEN + PVFS_REQ_LIMIT_VAL_LEN) \
+ * PVFS_REQ_LIMIT_KEYVAL_LIST)
+
+#define PINT_SERVREQ_SETEATTR_FILL(__req, \
+ __creds, \
+ __fsid, \
+ __handle, \
+ __flags, \
+ __nkey, \
+ __key_array, \
+ __val_array) \
+do { \
+ memset(&(__req), 0, sizeof(__req)); \
+ (__req).op = PVFS_SERV_SETEATTR; \
+ (__req).credentials = (__creds); \
+ (__req).u.seteattr.fs_id = (__fsid); \
+ (__req).u.seteattr.handle = (__handle); \
+ (__req).u.seteattr.flags = (__flags); \
+ (__req).u.seteattr.nkey = (__nkey); \
+ (__req).u.seteattr.key = (__key_array); \
+ (__req).u.seteattr.val = (__val_array); \
+} while (0)
+
+/* deleattr ****************************************************/
+/* - deletes extended attributes */
+
+struct PVFS_servreq_deleattr
+{
+ PVFS_handle handle; /* handle of target object */
+ PVFS_fs_id fs_id; /* file system */
+ PVFS_ds_keyval key; /* key to read */
+};
+endecode_fields_3_struct(
+ PVFS_servreq_deleattr,
+ PVFS_handle, handle,
+ PVFS_fs_id, fs_id,
+ PVFS_ds_keyval, key);
+#define extra_size_PVFS_servreq_deleattr \
+ PVFS_REQ_LIMIT_KEY_LEN
+
+#define PINT_SERVREQ_DELEATTR_FILL(__req, \
+ __creds, \
+ __fsid, \
+ __handle,\
+ __key) \
+do { \
+ memset(&(__req), 0, sizeof(__req)); \
+ (__req).op = PVFS_SERV_DELEATTR; \
+ (__req).credentials = (__creds); \
+ (__req).u.deleattr.fs_id = (__fsid); \
+ (__req).u.deleattr.handle = (__handle); \
+ (__req).u.deleattr.key.buffer_sz = (__key).buffer_sz;\
+ (__req).u.deleattr.key.buffer = (__key).buffer;\
+} while (0)
+
/* server request *********************************************/
/* - generic request with union of all op specific structs */
@@ -1173,6 +1312,9 @@ struct PVFS_server_req
struct PVFS_servreq_mgmt_remove_object mgmt_remove_object;
struct PVFS_servreq_mgmt_remove_dirent mgmt_remove_dirent;
struct PVFS_servreq_mgmt_get_dirdata_handle mgmt_get_dirdata_handle;
+ struct PVFS_servreq_geteattr geteattr;
+ struct PVFS_servreq_seteattr seteattr;
+ struct PVFS_servreq_deleattr deleattr;
} u;
};
#ifdef __PINT_REQPROTO_ENCODE_FUNCS_C
@@ -1216,6 +1358,7 @@ struct PVFS_server_resp
struct PVFS_servresp_mgmt_dspace_info_list mgmt_dspace_info_list;
struct PVFS_servresp_mgmt_event_mon mgmt_event_mon;
struct PVFS_servresp_mgmt_get_dirdata_handle mgmt_get_dirdata_handle;
+ struct PVFS_servresp_geteattr geteattr;
} u;
};
endecode_fields_2_struct(
More information about the PVFS2-CVS
mailing list