According to my understandign, in sdt_subr.c, the following argument 
translation rule:
{ "nfsv3", "op-setattr-start", 1, 1, "nfsv3oparg_t *", "nfsv3opinfo_t *" },

will trigger the following translator:

translator nfsv3opinfo_t < nfsv3oparg_t *P > {
        noi_xid = ((struct svc_req *)arg0)->rq_xprt->xp_xid;
        noi_cred = (cred_t *)arg1;
        noi_curpath = (arg2 == 0 || ((vnode_t *)arg2)->v_path == NULL) ?
            "<unknown>" : ((vnode_t *)arg2)->v_path;
};

So the first three arguments in the DTRACE_NFSV3() macros will be accessed to 
construct a nfsv3opinfo_t value.

Is it right?

Regards,

Danhua


Adam Leventhal wrote:
> On Tue, Sep 09, 2008 at 02:56:45PM -0500, Danhua Shao wrote:
>   
>> In lib/libdtrace/common/nfs.d, the following piece of code defines a 
>> type translation in sdt.
>>
>> typedef struct nfsv3oparg nfsv3oparg_t;
>>
>> #pragma D binding "1.5" translator
>> translator nfsv3opinfo_t < nfsv3oparg_t *P > {
>>         noi_xid = ((struct svc_req *)arg0)->rq_xprt->xp_xid;
>>         noi_cred = (cred_t *)arg1;
>>         noi_curpath = (arg2 == 0 || ((vnode_t *)arg2)->v_path == NULL) ?
>>             "<unknown>" : ((vnode_t *)arg2)->v_path;
>> };
>>
>> However, I can not find the definition of "struct nfsv3oparg" in usr/src.
>>
>> 1) Does this type is just a dummy type that has not been really defined?
>>
>> 2) Inside the translator, arg0, arg1, arg2 are refer to the first 3 
>> arguments defined in macro DTRACE_NFSV3_3() or DTRACE_NFSV3_4() ?
>>     
>
> You've stumbled onto something of a hack that we used to make interacting with
> the provider a bit nicer. The nfsv3oparg_t is a synthetic type that you can
> see at work in sdt_subr.c in the kernel. For both the 3 and 4 arguments
> versions of the macros, the first three arguments are the same (struct
> svc_req *, cred_t *, vnode_t *).
>
> Adam
>
>   


Reply via email to