cmservice.c (b908fe6b2d1294d93b0d0badf6bf4f9a2cd7d729) cmservice.c (c35eccb1f614954b10cba3f74b7c301993b2f42e)
1/* AFS Cache Manager Service
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

--- 6 unchanged lines hidden (view full) ---

15#include <linux/ip.h>
16#include "internal.h"
17#include "afs_cm.h"
18
19struct workqueue_struct *afs_cm_workqueue;
20
21static int afs_deliver_cb_init_call_back_state(struct afs_call *,
22 struct sk_buff *, bool);
1/* AFS Cache Manager Service
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

--- 6 unchanged lines hidden (view full) ---

15#include <linux/ip.h>
16#include "internal.h"
17#include "afs_cm.h"
18
19struct workqueue_struct *afs_cm_workqueue;
20
21static int afs_deliver_cb_init_call_back_state(struct afs_call *,
22 struct sk_buff *, bool);
23static int afs_deliver_cb_init_call_back_state3(struct afs_call *,
24 struct sk_buff *, bool);
23static int afs_deliver_cb_probe(struct afs_call *, struct sk_buff *, bool);
24static int afs_deliver_cb_callback(struct afs_call *, struct sk_buff *, bool);
25static int afs_deliver_cb_get_capabilities(struct afs_call *, struct sk_buff *,
26 bool);
27static void afs_cm_destructor(struct afs_call *);
28
29/*
30 * CB.CallBack operation type

--- 11 unchanged lines hidden (view full) ---

42static const struct afs_call_type afs_SRXCBInitCallBackState = {
43 .name = "CB.InitCallBackState",
44 .deliver = afs_deliver_cb_init_call_back_state,
45 .abort_to_error = afs_abort_to_error,
46 .destructor = afs_cm_destructor,
47};
48
49/*
25static int afs_deliver_cb_probe(struct afs_call *, struct sk_buff *, bool);
26static int afs_deliver_cb_callback(struct afs_call *, struct sk_buff *, bool);
27static int afs_deliver_cb_get_capabilities(struct afs_call *, struct sk_buff *,
28 bool);
29static void afs_cm_destructor(struct afs_call *);
30
31/*
32 * CB.CallBack operation type

--- 11 unchanged lines hidden (view full) ---

44static const struct afs_call_type afs_SRXCBInitCallBackState = {
45 .name = "CB.InitCallBackState",
46 .deliver = afs_deliver_cb_init_call_back_state,
47 .abort_to_error = afs_abort_to_error,
48 .destructor = afs_cm_destructor,
49};
50
51/*
52 * CB.InitCallBackState3 operation type
53 */
54static const struct afs_call_type afs_SRXCBInitCallBackState3 = {
55 .name = "CB.InitCallBackState3",
56 .deliver = afs_deliver_cb_init_call_back_state3,
57 .abort_to_error = afs_abort_to_error,
58 .destructor = afs_cm_destructor,
59};
60
61/*
50 * CB.Probe operation type
51 */
52static const struct afs_call_type afs_SRXCBProbe = {
53 .name = "CB.Probe",
54 .deliver = afs_deliver_cb_probe,
55 .abort_to_error = afs_abort_to_error,
56 .destructor = afs_cm_destructor,
57};

--- 20 unchanged lines hidden (view full) ---

78
79 switch (operation_id) {
80 case CBCallBack:
81 call->type = &afs_SRXCBCallBack;
82 return true;
83 case CBInitCallBackState:
84 call->type = &afs_SRXCBInitCallBackState;
85 return true;
62 * CB.Probe operation type
63 */
64static const struct afs_call_type afs_SRXCBProbe = {
65 .name = "CB.Probe",
66 .deliver = afs_deliver_cb_probe,
67 .abort_to_error = afs_abort_to_error,
68 .destructor = afs_cm_destructor,
69};

--- 20 unchanged lines hidden (view full) ---

90
91 switch (operation_id) {
92 case CBCallBack:
93 call->type = &afs_SRXCBCallBack;
94 return true;
95 case CBInitCallBackState:
96 call->type = &afs_SRXCBInitCallBackState;
97 return true;
98 case CBInitCallBackState3:
99 call->type = &afs_SRXCBInitCallBackState3;
100 return true;
86 case CBProbe:
87 call->type = &afs_SRXCBProbe;
88 return true;
89 case CBGetCapabilities:
90 call->type = &afs_SRXCBGetCapabilites;
91 return true;
92 default:
93 return false;

--- 213 unchanged lines hidden (view full) ---

307 call->server = server;
308
309 INIT_WORK(&call->work, SRXAFSCB_InitCallBackState);
310 schedule_work(&call->work);
311 return 0;
312}
313
314/*
101 case CBProbe:
102 call->type = &afs_SRXCBProbe;
103 return true;
104 case CBGetCapabilities:
105 call->type = &afs_SRXCBGetCapabilites;
106 return true;
107 default:
108 return false;

--- 213 unchanged lines hidden (view full) ---

322 call->server = server;
323
324 INIT_WORK(&call->work, SRXAFSCB_InitCallBackState);
325 schedule_work(&call->work);
326 return 0;
327}
328
329/*
330 * deliver request data to a CB.InitCallBackState3 call
331 */
332static int afs_deliver_cb_init_call_back_state3(struct afs_call *call,
333 struct sk_buff *skb,
334 bool last)
335{
336 struct afs_server *server;
337 struct in_addr addr;
338
339 _enter(",{%u},%d", skb->len, last);
340
341 if (!last)
342 return 0;
343
344 /* no unmarshalling required */
345 call->state = AFS_CALL_REPLYING;
346
347 /* we'll need the file server record as that tells us which set of
348 * vnodes to operate upon */
349 memcpy(&addr, &ip_hdr(skb)->saddr, 4);
350 server = afs_find_server(&addr);
351 if (!server)
352 return -ENOTCONN;
353 call->server = server;
354
355 INIT_WORK(&call->work, SRXAFSCB_InitCallBackState);
356 schedule_work(&call->work);
357 return 0;
358}
359
360/*
315 * allow the fileserver to see if the cache manager is still alive
316 */
317static void SRXAFSCB_Probe(struct work_struct *work)
318{
319 struct afs_call *call = container_of(work, struct afs_call, work);
320
321 _enter("");
322 afs_send_empty_reply(call);

--- 106 unchanged lines hidden ---
361 * allow the fileserver to see if the cache manager is still alive
362 */
363static void SRXAFSCB_Probe(struct work_struct *work)
364{
365 struct afs_call *call = container_of(work, struct afs_call, work);
366
367 _enter("");
368 afs_send_empty_reply(call);

--- 106 unchanged lines hidden ---