Pai, Ankur G wrote:
Hi Phil, Thanks a lot for replying. So here is the deal. I am working
on an enhanced PVFS with an entirely new set of state machines added
to create a new struct called ecreate. Its working fine (all state
machines and everything). Unfortunately, the guy who made these
changes is not around. I need to pass some extra parameters through
sm_p(client) to s_op (server). So I enhanced the client side to
include the new attribute, malloced it, initialized it and sent it
(state machine post, BMI, blah blah). Now, on the server side, I want
to assign it to s_op->req->u.ecreate.NEW ARG. I followed the path
that does the assignment. It ends up in a really complicated macro.
Also, I am using PVFS-2.6.3 which does not have pvfs2-proto.h. It
starts with pvfs2-req-proto.c. And then I lose track of whats going
on in an array of complicated macros. Any help would be greatly
appreciated!

Ok great- so this is a unique request type, but the state machine work is already done.

The s_op->req data on the server side is populated automatically when the server receives a request and decodes it. If I understand correctly you just need to tell PVFS how to encode and decode the new field.

If you look in src/proto/pvfs2-req-proto.h at the definition of ecreate (probably called PVFS_servreq_ecreate if it follows the normal naming convention), you should see it followed immediately by a macro called "endecode_fields....". That second macro is responsible for telling PVFS how to encode the ecreate structure for transmission on the network. If I understand correctly, you have already added your new field to the PVFS_servreq_ecreate structure, but the macro needs to be updated for it to be encoded and arrive on the server.

You can look around in that header for examples of how other structs are encoded, or you are welcome to cut and paste your struct definition and the macro following it for some help from the list. The general nomenclature is that you use a macro called "endecode_fields_3_struct" to encode a structure with three fields in it. For example if you added a field to a struct that had three originally you would need to switch to use "endecode_fields_4_struct" to pick up the new field. There are variations with "a" and "aa" in the macro name to encode structures that include arrays.

Now that I know there are people to help, let me chip in an
additional quick question :). In some situations in my code, I do not
want some clients to access some file (some ACL stuff). For now, I
detect untrusted clients in final_response.c and set an
js_p->error_code and return 1. This causes the client to just hang.
Is there a way to prematurely return a clean error to the client?
(This problem is low priority though)

That shouldn't cause the client to hang. What exactly are you setting the error code to?

Most of the permission checking occurs in prelude.sm, which is the initial nested state machine that every PVFS request triggers on the server side. You might want to look and see if that is a better place to add your test. If the prelude.sm results in an error code, then a response is sent back immediately without processing the remainder of the main state machine.

-Phil
_______________________________________________
Pvfs2-developers mailing list
[email protected]
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers

Reply via email to