From: Derrick Brashear Date: Tue, 4 Mar 2003 16:19:46 +0000 (+0000) Subject: capabilities-20030304 X-Git-Tag: openafs-devel-1_3_50~342 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=2712c1202ab17436ced8b466575c8bebdd9f68b7;p=packages%2Fo%2Fopenafs.git capabilities-20030304 need to remove dummy capability, but otherwise this is the rpc part. --- diff --git a/src/afs/afs_callback.c b/src/afs/afs_callback.c index 9d3b7d796..ee0a7a7fd 100644 --- a/src/afs/afs_callback.c +++ b/src/afs/afs_callback.c @@ -1436,3 +1436,38 @@ int SRXAFSCB_GetCellByNum(struct rx_call *a_call, afs_int32 a_cellnum, return 0; } +int SRXAFSCB_TellMeAboutYourself(struct rx_call *a_call, + struct interfaceAddr *addr, + Capabilities *capabilities) +{ + int i; + int code = 0; + afs_int32 *dataBuffP; + afs_int32 dataBytes; + + RX_AFS_GLOCK(); + + AFS_STATCNT(SRXAFSCB_WhoAreYou); + + ObtainReadLock(&afs_xinterface); + + /* return all network interface addresses */ + addr->numberOfInterfaces = afs_cb_interface.numberOfInterfaces; + addr->uuid = afs_cb_interface.uuid; + for ( i=0; i < afs_cb_interface.numberOfInterfaces; i++) { + addr->addr_in[i] = ntohl(afs_cb_interface.addr_in[i]); + addr->subnetmask[i] = ntohl(afs_cb_interface.subnetmask[i]); + addr->mtu[i] = ntohl(afs_cb_interface.mtu[i]); + } + + ReleaseReadLock(&afs_xinterface); + + RX_AFS_GUNLOCK(); + + dataBuffP = (afs_int32 *)afs_osi_Alloc(dataBytes); + memcpy((char *)dataBuffP, "1", dataBytes); + capabilities->Capabilities_len = dataBytes/sizeof(afs_int32); + capabilities->Capabilities_val = dataBuffP; + + return code; +} diff --git a/src/fsint/afscbint.xg b/src/fsint/afscbint.xg index e65891550..8edc66ff5 100644 --- a/src/fsint/afscbint.xg +++ b/src/fsint/afscbint.xg @@ -107,3 +107,7 @@ proc GetCellByNum( OUT serverList *cellHosts ) = 65537; +proc TellMeAboutYourself( + OUT struct interfaceAddr *addr, + OUT Capabilities *capabilities +) = 65538; diff --git a/src/fsint/afsint.xg b/src/fsint/afsint.xg index a225783c3..b0fb6fda2 100644 --- a/src/fsint/afsint.xg +++ b/src/fsint/afsint.xg @@ -694,3 +694,7 @@ StoreData64( GiveUpAllCallBacks( ) = 65539; + +GetCapabilities( + Capabilities *capabilities +) = 65540; diff --git a/src/fsint/common.xg b/src/fsint/common.xg index 83d50a1f6..88da5555f 100644 --- a/src/fsint/common.xg +++ b/src/fsint/common.xg @@ -156,4 +156,7 @@ typedef afs_int32 serverList; typedef afs_uint32 cacheConfig<>; +const AFSCAPABILITIESMAX = 196; +typedef afs_int32 Capabilities; + %#endif /* FSINT_COMMON_XG */ diff --git a/src/fsprobe/fsprobe_callback.c b/src/fsprobe/fsprobe_callback.c index bffcf0690..f5fc6c91e 100644 --- a/src/fsprobe/fsprobe_callback.c +++ b/src/fsprobe/fsprobe_callback.c @@ -752,3 +752,38 @@ afs_int32 SRXAFSCB_GetCacheConfig( { return RXGEN_OPCODE; } + +afs_int32 SRXAFSCB_TellMeAboutYourself(struct rx_call *rxcall, + struct interfaceAddr *addr, + Capabilities *capabilities) +{ + int i; + int code = 0; + int count; + +#if FSPROBE_CALLBACK_VERBOSE + static char rn[] = "SRXAFSCB_TellMeAboutYourself"; /*Routine name*/ + char hostName[256]; /*Host name buffer*/ + char *hostNameResult; /*Ptr to static*/ + + if (rxcall != (struct rx_call *)0) { + hostNameResult = + hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host)); + strcpy(hostName, hostNameResult); + fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", + mn, rn, hostName, rxcall->conn->peer->port); + } /*Valid rxcall param*/ +#endif /* FSPROBE_CALLBACK_VERBOSE */ + + if ( rxcall && addr ) + { + if (!afs_cb_inited) init_afs_cb(); + *addr = afs_cb_interface; + } + + /* + * Return successfully. + */ + return(0); +} + diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 4d44846a4..beaea59a2 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -5980,6 +5980,19 @@ afs_int32 SRXAFS_Lookup(struct rx_call *call_p, } +afs_int32 SRXAFS_GetCapabilities(struct rx_call *acall, + Capabilities *capabilities) +{ + afs_int32 *dataBuffP; + afs_int32 dataBytes; + + dataBuffP = (afs_int32 *)malloc(dataBytes); + memcpy((char *)dataBuffP, "1", dataBytes); + capabilities->Capabilities_len = dataBytes/sizeof(afs_int32); + capabilities->Capabilities_val = dataBuffP; + return 0; +} + afs_int32 SRXAFS_FlushCPS(struct rx_call *acall, struct ViceIds *vids, struct IPAddrs *addrs, diff --git a/src/xstat/xstat_fs_callback.c b/src/xstat/xstat_fs_callback.c index c38574850..2ef32a0b1 100644 --- a/src/xstat/xstat_fs_callback.c +++ b/src/xstat/xstat_fs_callback.c @@ -196,7 +196,7 @@ afs_int32 SRXAFSCB_InitCallBackState(rxcall) *------------------------------------------------------------------------*/ afs_int32 SRXAFSCB_Probe(rxcall) - struct rx_call *rxcall; + struct rx_call *rxcall; { /*SRXAFSCB_Probe*/ @@ -461,8 +461,8 @@ afs_int32 SRXAFSCB_GetXStats(rxcall, clientVersionNumber, collectionNumber, *------------------------------------------------------------------------*/ afs_int32 SRXAFSCB_InitCallBackState2(rxcall, addr) -struct rx_call *rxcall; -struct interfaceAddr * addr; + struct rx_call *rxcall; + struct interfaceAddr * addr; { #if XSTAT_FS_CALLBACK_VERBOSE @@ -471,11 +471,11 @@ struct interfaceAddr * addr; char *hostNameResult; /*Ptr to static*/ if (rxcall != (struct rx_call *)0) { - hostNameResult = - hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host)); - strcpy(hostName, hostNameResult); - fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", - mn, rn, hostName, rxcall->conn->peer->port); + hostNameResult = + hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host)); + strcpy(hostName, hostNameResult); + fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", + mn, rn, hostName, rxcall->conn->peer->port); } /*Valid rxcall param*/ #endif /* XSTAT_FS_CALLBACK_VERBOSE */ return RXGEN_OPCODE; @@ -506,8 +506,8 @@ struct interfaceAddr * addr; *------------------------------------------------------------------------*/ afs_int32 SRXAFSCB_WhoAreYou(rxcall, addr) -struct rx_call *rxcall; -struct interfaceAddr *addr; + struct rx_call *rxcall; + struct interfaceAddr *addr; { int i; int code = 0; @@ -519,11 +519,11 @@ struct interfaceAddr *addr; char *hostNameResult; /*Ptr to static*/ if (rxcall != (struct rx_call *)0) { - hostNameResult = - hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host)); - strcpy(hostName, hostNameResult); - fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", - mn, rn, hostName, rxcall->conn->peer->port); + hostNameResult = + hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host)); + strcpy(hostName, hostNameResult); + fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", + mn, rn, hostName, rxcall->conn->peer->port); } /*Valid rxcall param*/ #endif /* XSTAT_FS_CALLBACK_VERBOSE */ @@ -561,8 +561,8 @@ struct interfaceAddr *addr; *------------------------------------------------------------------------*/ afs_int32 SRXAFSCB_InitCallBackState3(rxcall, uuidp) -struct rx_call *rxcall; -afsUUID *uuidp; + struct rx_call *rxcall; + afsUUID *uuidp; { #if XSTAT_FS_CALLBACK_VERBOSE static char rn[] = "SRXAFSCB_InitCallBackState3"; /*Routine name*/ @@ -570,11 +570,11 @@ afsUUID *uuidp; char *hostNameResult; /*Ptr to static*/ if (rxcall != (struct rx_call *)0) { - hostNameResult = - hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host)); - strcpy(hostName, hostNameResult); - fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", - mn, rn, hostName, rxcall->conn->peer->port); + hostNameResult = + hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host)); + strcpy(hostName, hostNameResult); + fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", + mn, rn, hostName, rxcall->conn->peer->port); } /*Valid rxcall param*/ #endif /* XSTAT_FS_CALLBACK_VERBOSE */ @@ -609,8 +609,8 @@ afsUUID *uuidp; *------------------------------------------------------------------------*/ afs_int32 SRXAFSCB_ProbeUuid(rxcall, uuidp) -struct rx_call *rxcall; -afsUUID *uuidp; + struct rx_call *rxcall; + afsUUID *uuidp; { int code = 0; @@ -620,11 +620,11 @@ afsUUID *uuidp; char *hostNameResult; /*Ptr to static*/ if (rxcall != (struct rx_call *)0) { - hostNameResult = - hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host)); - strcpy(hostName, hostNameResult); - fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", - mn, rn, hostName, rxcall->conn->peer->port); + hostNameResult = + hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host)); + strcpy(hostName, hostNameResult); + fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", + mn, rn, hostName, rxcall->conn->peer->port); } /*Valid rxcall param*/ #endif /* XSTAT_FS_CALLBACK_VERBOSE */ @@ -776,3 +776,37 @@ afs_int32 SRXAFSCB_GetCacheConfig( { return RXGEN_OPCODE; } + +afs_int32 SRXAFSCB_TellMeAboutYourself(struct rx_call *rxcall, + struct interfaceAddr *addr, + Capabilities *capabilites) +{ + int i; + int code = 0; + int count; + +#if XSTAT_FS_CALLBACK_VERBOSE + static char rn[] = "SRXAFSCB_TellMeAboutYourself"; /*Routine name*/ + char hostName[256]; /*Host name buffer*/ + char *hostNameResult; /*Ptr to static*/ + + if (rxcall != (struct rx_call *)0) { + hostNameResult = + hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host)); + strcpy(hostName, hostNameResult); + fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", + mn, rn, hostName, rxcall->conn->peer->port); + } /*Valid rxcall param*/ +#endif /* XSTAT_FS_CALLBACK_VERBOSE */ + + if ( rxcall && addr ) + { + if (!afs_cb_inited) init_afs_cb(); + *addr = afs_cb_interface; + } + + /* + * Return successfully. + */ + return(0); +}