12 #include <linux/module.h>
14 #include <linux/slab.h>
15 #include <linux/sched.h>
24 static int afs_deliver_cb_init_call_back_state(
struct afs_call *,
26 static int afs_deliver_cb_init_call_back_state3(
struct afs_call *,
28 static int afs_deliver_cb_probe(
struct afs_call *,
struct sk_buff *,
bool);
29 static int afs_deliver_cb_callback(
struct afs_call *,
struct sk_buff *,
bool);
30 static int afs_deliver_cb_probe_uuid(
struct afs_call *,
struct sk_buff *,
bool);
31 static int afs_deliver_cb_tell_me_about_yourself(
struct afs_call *,
33 static void afs_cm_destructor(
struct afs_call *);
39 .name =
"CB.CallBack",
40 .deliver = afs_deliver_cb_callback,
42 .destructor = afs_cm_destructor,
48 static const struct afs_call_type afs_SRXCBInitCallBackState = {
49 .name =
"CB.InitCallBackState",
50 .deliver = afs_deliver_cb_init_call_back_state,
52 .destructor = afs_cm_destructor,
58 static const struct afs_call_type afs_SRXCBInitCallBackState3 = {
59 .name =
"CB.InitCallBackState3",
60 .deliver = afs_deliver_cb_init_call_back_state3,
62 .destructor = afs_cm_destructor,
70 .deliver = afs_deliver_cb_probe,
72 .destructor = afs_cm_destructor,
79 .name =
"CB.ProbeUuid",
80 .deliver = afs_deliver_cb_probe_uuid,
82 .destructor = afs_cm_destructor,
88 static const struct afs_call_type afs_SRXCBTellMeAboutYourself = {
89 .name =
"CB.TellMeAboutYourself",
90 .deliver = afs_deliver_cb_tell_me_about_yourself,
92 .destructor = afs_cm_destructor,
103 _enter(
"{CB.OP %u}", operation_id);
105 switch (operation_id) {
107 call->
type = &afs_SRXCBCallBack;
110 call->
type = &afs_SRXCBInitCallBackState;
113 call->
type = &afs_SRXCBInitCallBackState3;
116 call->
type = &afs_SRXCBProbe;
119 call->
type = &afs_SRXCBTellMeAboutYourself;
129 static void afs_cm_destructor(
struct afs_call *call)
181 _debug(
"extract FID count");
201 _debug(
"extract FID array");
203 call->
count * 3 * 4);
210 _debug(
"unmarshall FID array");
219 for (loop = call->
count; loop > 0; loop--, cb++) {
231 _debug(
"extract CB count");
240 _debug(
"CB count: %u", tmp);
241 if (tmp != call->
count && tmp != 0)
249 _debug(
"extract CB array");
251 call->
count * 3 * 4);
258 _debug(
"unmarshall CB array");
261 for (loop = call->
count; loop > 0; loop--, cb++) {
281 call->
state = AFS_CALL_REPLYING;
313 static int afs_deliver_cb_init_call_back_state(
struct afs_call *call,
328 call->
state = AFS_CALL_REPLYING;
346 static int afs_deliver_cb_init_call_back_state3(
struct afs_call *call,
359 call->
state = AFS_CALL_REPLYING;
389 static int afs_deliver_cb_probe(
struct afs_call *call,
struct sk_buff *skb,
423 reply.match =
htonl(0);
425 reply.match =
htonl(1);
434 static int afs_deliver_cb_probe_uuid(
struct afs_call *call,
struct sk_buff *skb,
467 _debug(
"unmarshall UUID");
480 for (loop = 0; loop < 6; loop++)
496 call->
state = AFS_CALL_REPLYING;
506 static void SRXAFSCB_TellMeAboutYourself(
struct work_struct *work)
539 memset(&reply, 0,
sizeof(reply));
540 reply.ia.nifs =
htonl(nifs);
547 for (loop = 0; loop < 6; loop++)
551 for (loop = 0; loop < nifs; loop++) {
552 reply.ia.ifaddr[loop] = ifs[loop].
address.s_addr;
553 reply.ia.netmask[loop] = ifs[loop].
netmask.s_addr;
554 reply.ia.mtu[loop] =
htonl(ifs[loop].mtu);
559 reply.cap.capcount =
htonl(1);
569 static int afs_deliver_cb_tell_me_about_yourself(
struct afs_call *call,
570 struct sk_buff *skb,
bool last)
580 call->
state = AFS_CALL_REPLYING;