xstat: Don't cast returns from malloc()
[openafs.git] / src / xstat / xstat_fs_callback.c
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /*
11  * Description:
12  *      Implementation of the xstat_fs callback routines.  These are the
13  *      server-side functions that the File Server expects to invoke on
14  *      the client machine via the afsint interface.  In this case, the
15  *      client process is acting as a callback listener, so it has to
16  *      be prepared to answer these calls.
17  *
18  * Environment:
19  *      The afsint server stubs expect the functions defined here to
20  *      be provided.  There is no .h file for this code, since the
21  *      linker really does all the work for us, and these don't really
22  *      need to be ``visible'' to anyone else.
23  *------------------------------------------------------------------------*/
24
25 #include <afsconfig.h>
26 #include <afs/param.h>
27
28 #include <roken.h>
29
30 #ifdef AFS_NT40_ENV
31 #include <windows.h>
32 #include <rpc.h>
33 #endif
34
35 #include <afs/afscbint.h>       /*Callback interface defs */
36 #include <afs/afsutil.h>
37
38 int afs_cb_inited = 0;
39 struct interfaceAddr afs_cb_interface;
40
41 #define XSTAT_FS_CALLBACK_VERBOSE 0
42
43 /*
44  * Initialize the callback interface structure
45  */
46 static int
47 init_afs_cb(void)
48 {
49     int count;
50
51 #ifdef AFS_NT40_ENV
52     UuidCreate((UUID *)&afs_cb_interface.uuid);
53 #else
54     afs_uuid_create(&afs_cb_interface.uuid);
55 #endif
56     count = rx_getAllAddr((afs_uint32 *)afs_cb_interface.addr_in, AFS_MAX_INTERFACE_ADDR);
57     if (count <= 0)
58         afs_cb_interface.numberOfInterfaces = 0;
59     else
60         afs_cb_interface.numberOfInterfaces = count;
61     afs_cb_inited = 1;
62     return 0;
63 }
64
65 #if XSTAT_FS_CALLBACK_VERBOSE
66 static char mn[] = "xstat_fs_callback"; /*Module name */
67 #endif
68
69 /*------------------------------------------------------------------------
70  * SRXAFSCB_CallBack
71  *
72  * Description:
73  *      Handle a set of callbacks from the File Server.
74  *
75  * Arguments:
76  *      struct rx_call *rxcall  : Ptr to the associated Rx call structure.
77  *      AFSCBFids *Fids_Array   : Ptr to the set of Fids.
78  *      AFSCBs *CallBacks_Array : Ptr to the set of callbacks.
79  *
80  * Returns:
81  *      0 on success,
82  *      Error value otherwise.
83  *
84  * Environment:
85  *      Nothing interesting.
86  *
87  * Side Effects:
88  *      As advertised.
89  *------------------------------------------------------------------------*/
90
91 afs_int32
92 SRXAFSCB_CallBack(struct rx_call *rxcall, AFSCBFids * Fids_Array,
93                   AFSCBs * CallBack_Array)
94 {                               /*SRXAFSCB_CallBack */
95
96 #if XSTAT_FS_CALLBACK_VERBOSE
97     static char rn[] = "SRXAFSCB_CallBack";     /*Routine name */
98     char hostName[256];         /*Host name buffer */
99     char *hostNameResult;       /*Ptr to static */
100
101     fprintf(stderr, "[%s:%s] Called\n", mn, rn);
102
103     if (rxcall != (struct rx_call *)0) {
104         hostNameResult =
105             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
106         strcpy(hostName, hostNameResult);
107         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
108                 hostName, rxcall->conn->peer->port);
109     }                           /*Valid rxcall param */
110 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
111
112     /*
113      * Return successfully.
114      */
115     return (0);
116
117 }                               /*SRXAFSCB_CallBack */
118
119 /*------------------------------------------------------------------------
120  * SRXAFSCB_InitCallBackState
121  *
122  * Description:
123  *      Initialize callback state on this ``Cache Manager''.
124  *
125  * Arguments:
126  *      struct rx_call *rxcall  : Ptr to the associated Rx call structure.
127  *
128  * Returns:
129  *      0 on success,
130  *      Error value otherwise.
131  *
132  * Environment:
133  *      This will definitely be called by the File Server (exactly once),
134  *      since it will think we are another new ``Cache Manager''.
135  *
136  * Side Effects:
137  *      As advertised.
138  *------------------------------------------------------------------------*/
139
140 afs_int32
141 SRXAFSCB_InitCallBackState(struct rx_call * rxcall)
142 {                               /*SRXAFSCB_InitCallBackState */
143
144 #if XSTAT_FS_CALLBACK_VERBOSE
145     static char rn[] = "SRXAFSCB_InitCallBackState";    /*Routine name */
146     char hostName[256];         /*Host name buffer */
147     char *hostNameResult;       /*Ptr to static */
148
149     fprintf(stderr, "[%s:%s] Called\n", mn, rn);
150
151     if (rxcall != (struct rx_call *)0) {
152         hostNameResult =
153             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
154         strcpy(hostName, hostNameResult);
155         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
156                 hostName, rxcall->conn->peer->port);
157     }                           /*Valid rxcall param */
158 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
159
160     /*
161      * Return successfully.
162      */
163     return (0);
164
165 }                               /*SRXAFSCB_InitCallBackState */
166
167 /*------------------------------------------------------------------------
168  * SRXAFSCB_Probe
169  *
170  * Description:
171  *      Respond to a probe from the File Server.  If a File Server
172  *      doesn't hear from you every so often, it will send you a probe
173  *      to make sure you're there, just like any other ``Cache Manager''
174  *      it's keeping track of.
175  *
176  * Arguments:
177  *      struct rx_call *rxcall  : Ptr to the associated Rx call structure.
178  *
179  * Returns:
180  *      0 on success,
181  *      Error value otherwise.
182  *
183  * Environment:
184  *      This may be called by the File Server if we don't call it often
185  *      enough.
186  *
187  * Side Effects:
188  *      As advertised.
189  *------------------------------------------------------------------------*/
190
191 afs_int32
192 SRXAFSCB_Probe(struct rx_call * rxcall)
193 {                               /*SRXAFSCB_Probe */
194
195 #if XSTAT_FS_CALLBACK_VERBOSE
196     static char rn[] = "SRXAFSCB_Probe";        /*Routine name */
197     char hostName[256];         /*Host name buffer */
198     char *hostNameResult;       /*Ptr to static */
199
200     fprintf(stderr, "[%s:%s] Called\n", mn, rn);
201
202     if (rxcall != (struct rx_call *)0) {
203         hostNameResult =
204             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
205         strcpy(hostName, hostNameResult);
206         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
207                 hostName, rxcall->conn->peer->port);
208     }                           /*Valid rxcall param */
209 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
210
211     /*
212      * Return successfully.
213      */
214     return (0);
215
216 }                               /*SRXAFSCB_Probe */
217
218
219 /*------------------------------------------------------------------------
220  * SRXAFSCB_GetCE64
221  *
222  * Description:
223  *      Respond minimally to a request for returning the contents of
224  *      a cache entry, since someone out there thinks you're a Cache
225  *      Manager.
226  *
227  * Arguments:
228  *      struct rx_call *rxcall: Ptr to the associated Rx call structure.
229  *
230  * Returns:
231  *      0 (always)
232  *
233  * Environment:
234  *      Nothing interesting.
235  *
236  * Side Effects:
237  *      As advertised.
238  *------------------------------------------------------------------------*/
239
240 afs_int32
241 SRXAFSCB_GetCE64(struct rx_call * rxcall, afs_int32 index,
242                  AFSDBCacheEntry64 * ce)
243 {                               /*SRXAFSCB_GetCE64 */
244
245 #if XSTAT_FS_CALLBACK_VERBOSE
246     static char rn[] = "SRXAFSCB_GetCE64";      /*Routine name */
247     char hostName[256];         /*Host name buffer */
248     char *hostNameResult;       /*Ptr to static */
249
250     if (rxcall != (struct rx_call *)0) {
251         hostNameResult =
252             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
253         strcpy(hostName, hostNameResult);
254         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
255                 hostName, rxcall->conn->peer->port);
256     }                           /*Valid rxcall param */
257 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
258
259     return (0);
260
261 }                               /*SRXAFSCB_GetCE64 */
262
263 afs_int32
264 SRXAFSCB_GetCE(struct rx_call * rxcall, afs_int32 index, AFSDBCacheEntry * ce)
265 {                               /*SRXAFSCB_GetCE */
266
267 #if XSTAT_FS_CALLBACK_VERBOSE
268     static char rn[] = "SRXAFSCB_GetCE";        /*Routine name */
269     char hostName[256];         /*Host name buffer */
270     char *hostNameResult;       /*Ptr to static */
271
272     if (rxcall != (struct rx_call *)0) {
273         hostNameResult =
274             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
275         strcpy(hostName, hostNameResult);
276         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
277                 hostName, rxcall->conn->peer->port);
278     }                           /*Valid rxcall param */
279 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
280
281     return (0);
282
283 }                               /*SRXAFSCB_GetCE */
284
285
286 /*------------------------------------------------------------------------
287  * SRXAFSCB_GetLock
288  *
289  * Description:
290  *      Respond minimally to a request for returning the contents of
291  *      a cache lock, since someone out there thinks you're a Cache
292  *      Manager.
293  *
294  * Arguments:
295  *      struct rx_call *rxcall: Ptr to the associated Rx call structure.
296  *
297  * Returns:
298  *      0 (always)
299  *
300  * Environment:
301  *      Nothing interesting.
302  *
303  * Side Effects:
304  *      As advertised.
305  *------------------------------------------------------------------------*/
306
307 afs_int32
308 SRXAFSCB_GetLock(struct rx_call * rxcall, afs_int32 index, AFSDBLock * lock)
309 {                               /*SRXAFSCB_GetLock */
310
311 #if XSTAT_FS_CALLBACK_VERBOSE
312     static char rn[] = "SRXAFSCB_GetLock";      /*Routine name */
313     char hostName[256];         /*Host name buffer */
314     char *hostNameResult;       /*Ptr to static */
315
316     if (rxcall != (struct rx_call *)0) {
317         hostNameResult =
318             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
319         strcpy(hostName, hostNameResult);
320         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
321                 hostName, rxcall->conn->peer->port);
322     }                           /*Valid rxcall param */
323 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
324
325     return (0);
326
327 }                               /*SRXAFSCB_GetLock */
328
329
330 /*------------------------------------------------------------------------
331  * SRXAFSCB_XStatsVersion
332  *
333  * Description:
334  *      Respond minimally to a request for fetching the version of
335  *      extended Cache Manager statistics offered, since someone out
336  *      there thinks you're a Cache Manager.
337  *
338  * Arguments:
339  *      struct rx_call *rxcall: Ptr to the associated Rx call structure.
340  *
341  * Returns:
342  *      0 (always)
343  *
344  * Environment:
345  *      Nothing interesting.
346  *
347  * Side Effects:
348  *      As advertised.
349  *------------------------------------------------------------------------*/
350
351 afs_int32
352 SRXAFSCB_XStatsVersion(struct rx_call * rxcall, afs_int32 * versionNumberP)
353 {                               /*SRXAFSCB_XStatsVersion */
354
355 #if XSTAT_FS_CALLBACK_VERBOSE
356     static char rn[] = "SRXAFSCB_XStatsVersion";        /*Routine name */
357     char hostName[256];         /*Host name buffer */
358     char *hostNameResult;       /*Ptr to static */
359
360     if (rxcall != (struct rx_call *)0) {
361         hostNameResult =
362             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
363         strcpy(hostName, hostNameResult);
364         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
365                 hostName, rxcall->conn->peer->port);
366     }                           /*Valid rxcall param */
367 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
368
369     return (0);
370
371 }                               /*SRXAFSCB_XStatsVersion */
372
373
374 /*------------------------------------------------------------------------
375  * SRXAFSCB_GetXStats
376  *
377  * Description:
378  *      Respond minimally to a request for returning extended
379  *      statistics for a Cache Manager, since someone out there thinks
380  *      you're a Cache Manager.
381  *
382  * Arguments:
383  *      struct rx_call *rxcall: Ptr to the associated Rx call structure.
384  *
385  * Returns:
386  *      0 (always)
387  *
388  * Environment:
389  *      Nothing interesting.
390  *
391  * Side Effects:
392  *      As advertised.
393  *------------------------------------------------------------------------*/
394
395 afs_int32
396 SRXAFSCB_GetXStats(struct rx_call * rxcall, afs_int32 clientVersionNumber,
397                    afs_int32 collectionNumber, afs_int32 * srvVersionNumberP,
398                    afs_int32 * timeP, AFSCB_CollData * dataP)
399 {                               /*SRXAFSCB_GetXStats */
400
401 #if XSTAT_FS_CALLBACK_VERBOSE
402     static char rn[] = "SRXAFSCB_GetXStats";    /*Routine name */
403     char hostName[256];         /*Host name buffer */
404     char *hostNameResult;       /*Ptr to static */
405
406     if (rxcall != (struct rx_call *)0) {
407         hostNameResult =
408             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
409         strcpy(hostName, hostNameResult);
410         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
411                 hostName, rxcall->conn->peer->port);
412     }                           /*Valid rxcall param */
413 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
414
415     return (0);
416
417 }                               /*SRXAFSCB_GetXStats */
418
419 /*------------------------------------------------------------------------
420  * EXPORTED SRXAFSCB_InitCallBackState2
421  *
422  * Description:
423  *      This routine was used in the AFS 3.5 beta release, but not anymore.
424  *      It has since been replaced by SRXAFSCB_InitCallBackState3.
425  *
426  * Arguments:
427  *      rxcall : Ptr to Rx call on which this request came in.
428  *
429  * Returns:
430  *      RXGEN_OPCODE (always).
431  *
432  * Environment:
433  *      Nothing interesting.
434  *
435  * Side Effects:
436  *      None
437  *------------------------------------------------------------------------*/
438
439 afs_int32
440 SRXAFSCB_InitCallBackState2(struct rx_call * rxcall,
441                             struct interfaceAddr * addr)
442 {
443
444 #if XSTAT_FS_CALLBACK_VERBOSE
445     static char rn[] = "SRXAFSCB_InitCallBackState2";   /*Routine name */
446     char hostName[256];         /*Host name buffer */
447     char *hostNameResult;       /*Ptr to static */
448
449     if (rxcall != (struct rx_call *)0) {
450         hostNameResult =
451             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
452         strcpy(hostName, hostNameResult);
453         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
454                 hostName, rxcall->conn->peer->port);
455     }                           /*Valid rxcall param */
456 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
457     return RXGEN_OPCODE;
458 }
459
460 /*------------------------------------------------------------------------
461  * EXPORTED SRXAFSCB_WhoAreYou
462  *
463  * Description:
464  *      Routine called by the server-side callback RPC interface to
465  *      obtain a unique identifier for the client. The server uses
466  *      this identifier to figure out whether or not two RX connections
467  *      are from the same client, and to find out which addresses go
468  *      with which clients.
469  *
470  * Arguments:
471  *      rxcall : Ptr to Rx call on which this request came in.
472  *      addr: Ptr to return the list of interfaces for this client.
473  *
474  * Returns:
475  *      0 (Always)
476  *
477  * Environment:
478  *      Nothing interesting.
479  *
480  * Side Effects:
481  *      As advertised.
482  *------------------------------------------------------------------------*/
483
484 afs_int32
485 SRXAFSCB_WhoAreYou(struct rx_call * rxcall, struct interfaceAddr * addr)
486 {
487 #if XSTAT_FS_CALLBACK_VERBOSE
488     static char rn[] = "SRXAFSCB_WhoAreYou";    /*Routine name */
489     char hostName[256];         /*Host name buffer */
490     char *hostNameResult;       /*Ptr to static */
491
492     if (rxcall != (struct rx_call *)0) {
493         hostNameResult =
494             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
495         strcpy(hostName, hostNameResult);
496         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
497                 hostName, rxcall->conn->peer->port);
498     }                           /*Valid rxcall param */
499 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
500
501     if (rxcall && addr) {
502         if (!afs_cb_inited)
503             init_afs_cb();
504         *addr = afs_cb_interface;
505     }
506
507     /*
508      * Return successfully.
509      */
510     return (0);
511 }
512
513
514 /*------------------------------------------------------------------------
515  * EXPORTED SRXAFSCB_InitCallBackState3
516  *
517  * Description:
518  *      Routine called by the server-side callback RPC interface to
519  *      implement clearing all callbacks from this host.
520  *
521  * Arguments:
522  *      rxcall : Ptr to Rx call on which this request came in.
523  *
524  * Returns:
525  *      0 (always).
526  *
527  * Environment:
528  *      Nothing interesting.
529  *
530  * Side Effects:
531  *      As advertised.
532  *------------------------------------------------------------------------*/
533
534 afs_int32
535 SRXAFSCB_InitCallBackState3(struct rx_call * rxcall, afsUUID * uuidp)
536 {
537 #if XSTAT_FS_CALLBACK_VERBOSE
538     static char rn[] = "SRXAFSCB_InitCallBackState3";   /*Routine name */
539     char hostName[256];         /*Host name buffer */
540     char *hostNameResult;       /*Ptr to static */
541
542     if (rxcall != (struct rx_call *)0) {
543         hostNameResult =
544             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
545         strcpy(hostName, hostNameResult);
546         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
547                 hostName, rxcall->conn->peer->port);
548     }                           /*Valid rxcall param */
549 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
550
551     /*
552      * Return successfully.
553      */
554     return (0);
555 }
556
557
558 /*------------------------------------------------------------------------
559  * EXPORTED SRXAFSCB_ProbeUuid
560  *
561  * Description:
562  *      Routine called by the server-side callback RPC interface to
563  *      implement ``probing'' the Cache Manager, just making sure it's
564  *      still there is still the same client it used to be.
565  *
566  * Arguments:
567  *      rxcall : Ptr to Rx call on which this request came in.
568  *      uuidp : Ptr to UUID that must match the client's UUID.
569  *
570  * Returns:
571  *      0 if uuidp matches the UUID for this client
572  *      Non-zero otherwize
573  *
574  * Environment:
575  *      Nothing interesting.
576  *
577  * Side Effects:
578  *      As advertised.
579  *------------------------------------------------------------------------*/
580
581 afs_int32
582 SRXAFSCB_ProbeUuid(struct rx_call * rxcall, afsUUID * uuidp)
583 {
584     int code = 0;
585
586 #if XSTAT_FS_CALLBACK_VERBOSE
587     static char rn[] = "SRXAFSCB_ProbeUuid";    /*Routine name */
588     char hostName[256];         /*Host name buffer */
589     char *hostNameResult;       /*Ptr to static */
590
591     if (rxcall != (struct rx_call *)0) {
592         hostNameResult =
593             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
594         strcpy(hostName, hostNameResult);
595         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
596                 hostName, rxcall->conn->peer->port);
597     }                           /*Valid rxcall param */
598 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
599
600     if (!afs_cb_inited)
601         init_afs_cb();
602     if (!afs_uuid_equal(uuidp, &afs_cb_interface.uuid))
603         code = 1;               /* failure */
604     return code;
605 }
606
607 /*------------------------------------------------------------------------
608  * EXPORTED SRXAFSCB_GetServerPrefs
609  *
610  * Description:
611  *      Routine to list server preferences used by this client.
612  *
613  * Arguments:
614  *      a_call  : Ptr to Rx call on which this request came in.
615  *      a_index : Input server index
616  *      a_srvr_addr  : Output server address (0xffffffff on last server)
617  *      a_srvr_rank  : Output server rank
618  *
619  * Returns:
620  *      RXGEN_OPCODE   (always)
621  *
622  * Environment:
623  *      Nothing interesting.
624  *
625  * Side Effects:
626  *      As advertised.
627  *------------------------------------------------------------------------*/
628
629 afs_int32
630 SRXAFSCB_GetServerPrefs(struct rx_call * a_call, afs_int32 a_index,
631                         afs_int32 * a_srvr_addr, afs_int32 * a_srvr_rank)
632 {
633     return RXGEN_OPCODE;
634 }
635
636 /*------------------------------------------------------------------------
637  * EXPORTED SRXAFSCB_GetCellServDB
638  *
639  * Description:
640  *      Routine to list cells configured for this client
641  *
642  * Arguments:
643  *      a_call  : Ptr to Rx call on which this request came in.
644  *      a_index : Input cell index
645  *      a_name  : Output cell name ("" on last cell)
646  *      a_hosts : Output cell database servers
647  *
648  * Returns:
649  *      0 on success
650  *
651  * Environment:
652  *      Nothing interesting.
653  *
654  * Side Effects:
655  *      As advertised.
656  *------------------------------------------------------------------------*/
657
658 afs_int32
659 SRXAFSCB_GetCellServDB(struct rx_call * a_call, afs_int32 a_index,
660                        char **a_name, serverList * a_hosts)
661 {
662     return RXGEN_OPCODE;
663 }
664
665
666 afs_int32
667 SRXAFSCB_GetCellByNum(struct rx_call * a_call, afs_int32 a_cellnum,
668                       char **a_name, serverList * a_hosts)
669 {
670     return RXGEN_OPCODE;
671 }
672
673
674 /*------------------------------------------------------------------------
675  * EXPORTED SRXAFSCB_GetLocalCell
676  *
677  * Description:
678  *      Routine to return name of client's local cell
679  *
680  * Arguments:
681  *      a_call  : Ptr to Rx call on which this request came in.
682  *      a_name  : Output cell name
683  *
684  * Returns:
685  *      RXGEN_OPCODE   (always)
686  *
687  * Environment:
688  *      Nothing interesting.
689  *
690  * Side Effects:
691  *      As advertised.
692  *------------------------------------------------------------------------*/
693
694 afs_int32
695 SRXAFSCB_GetLocalCell(struct rx_call * a_call, char **a_name)
696 {
697     char *t_name;
698
699     t_name = malloc(AFSNAMEMAX);
700     if (!t_name)
701         return ENOMEM;
702     strcpy(t_name, "This is xstat_fs");
703     *a_name = t_name;
704     return 0;
705 }
706
707
708 /*------------------------------------------------------------------------
709  * EXPORTED SRXAFSCB_GetCacheConfig
710  *
711  * Description:
712  *      Routine to return parameters used to initialize client cache.
713  *      Client may request any format version. Server may not return
714  *      format version greater than version requested by client.
715  *
716  * Arguments:
717  *      a_call:        Ptr to Rx call on which this request came in.
718  *      callerVersion: Data format version desired by the client.
719  *      serverVersion: Data format version of output data.
720  *      configCount:   Number bytes allocated for output data.
721  *      config:        Client cache configuration.
722  *
723  * Returns:
724  *      RXGEN_OPCODE   (always)
725  *
726  * Environment:
727  *      Nothing interesting.
728  *
729  * Side Effects:
730  *      As advertised.
731  *------------------------------------------------------------------------*/
732
733 afs_int32
734 SRXAFSCB_GetCacheConfig(struct rx_call * a_call, afs_uint32 callerVersion,
735                         afs_uint32 * serverVersion, afs_uint32 * configCount,
736                         cacheConfig * config)
737 {
738     return RXGEN_OPCODE;
739 }
740
741 afs_int32
742 SRXAFSCB_TellMeAboutYourself(struct rx_call * rxcall,
743                              struct interfaceAddr * addr,
744                              Capabilities * capabilites)
745 {
746 #if XSTAT_FS_CALLBACK_VERBOSE
747     static char rn[] = "SRXAFSCB_TellMeAboutYourself";  /*Routine name */
748     char hostName[256];         /*Host name buffer */
749     char *hostNameResult;       /*Ptr to static */
750
751     if (rxcall != (struct rx_call *)0) {
752         hostNameResult =
753             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
754         strcpy(hostName, hostNameResult);
755         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
756                 hostName, rxcall->conn->peer->port);
757     }                           /*Valid rxcall param */
758 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
759
760     if (rxcall && addr) {
761         if (!afs_cb_inited)
762             init_afs_cb();
763         *addr = afs_cb_interface;
764     }
765
766     /*
767      * Return successfully.
768      */
769     return (0);
770 }
771
772 int SRXAFSCB_GetDE(struct rx_call *a_call, afs_int32 a_index, afs_int32 addr,
773                    afs_int32 inode, afs_int32 flags, afs_int32 time,
774                    char **fileName)
775 {
776     return RXGEN_OPCODE;
777 }