コード例 #1
0
afs_int32
SRXAFSCB_ProbeUuid(struct rx_call * rxcall, afsUUID * uuidp)
{
    int code = 0;

#if XSTAT_FS_CALLBACK_VERBOSE
    static char rn[] = "SRXAFSCB_ProbeUuid";	/*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 (!afs_cb_inited)
	init_afs_cb();
    if (!afs_uuid_equal(uuidp, &afs_cb_interface.uuid))
	code = 1;		/* failure */
    return code;
}
コード例 #2
0
ファイル: serialize_state.c プロジェクト: bagdxk/openafs
static int
fs_stateCheckHeader(struct fs_state_header * hdr)
{
    int ret = 0;

    if (!hdr->valid) {
	ViceLog(0, ("fs_stateCheckHeader: dump was previously flagged invalid\n"));
	ret = 1;
    }
#ifdef WORDS_BIGENDIAN
    else if (!hdr->endianness) {
	ViceLog(0, ("fs_stateCheckHeader: wrong endianness\n"));
	ret = 1;
    }
#else /* AFSLITTLE_ENDIAN */
    else if (hdr->endianness) {
	ViceLog(0, ("fs_stateCheckHeader: wrong endianness\n"));
	ret = 1;
    }
#endif /* AFSLITTLE_ENDIAN */

    else if (hdr->stamp.magic != FS_STATE_MAGIC) {
	ViceLog(0, ("fs_stateCheckHeader: invalid dump header\n"));
	ret = 1;
    }
    else if (hdr->stamp.version != FS_STATE_VERSION) {
	ViceLog(0, ("fs_stateCheckHeader: unknown dump format version number\n"));
	ret = 1;
    }

    else if (!hdr->stats_detailed) {
	ViceLog(0, ("fs_stateCheckHeader: wrong config flags\n"));
	ret = 1;
    }

    else if (!afs_uuid_equal(&hdr->server_uuid, &FS_HostUUID)) {
	ViceLog(0, ("fs_stateCheckHeader: server UUID does not match this server's UUID\n"));
	ret = 1;
    }

    /* the cml_version_string is included for informational purposes only.  If someone ever
     * wants to limit state dump reloading based upon the contents of this string, just
     * uncomment the following code.  uncommenting this code is _strongly discouraged_ because
     * we already make use of the version stamps in the various dump headers to deal with
     * data structure version incompatabilities.
    else if (strncmp(hdr->server_version_string, cml_version_number,
		     sizeof(hdr->server_version_string)) != 0) {
	ViceLog(0, ("fs_stateCheckHeader: dump from different server version\n"));
	ret = 1;
    }
    */

    else if (strncmp(hdr->server_version_string, cml_version_number,
		     sizeof(hdr->server_version_string)) != 0) {
	ViceLog(0, ("fs_stateCheckHeader: dump from different server version ; attempting state reload anyway\n"));
    }


    return ret;
}
コード例 #3
0
afs_int32
SRXAFSCB_ProbeUuid(struct rx_call *a_call, afsUUID *a_uuid)
{
    rpc_test_request_ctx *ctx = CTX_FOR_RXCALL(a_call);
    if ( !afs_uuid_equal(&ctx->cb_listen_addr.uuid, a_uuid) )
        return (1);
    else
        return (0);
}
コード例 #4
0
int
SRXAFSCB_ProbeUuid(struct rx_call *rxcall, afsUUID *uuidp)
{
    int code = 0;
    if (!afs_cb_inited)
	init_afs_cb();
    if (!afs_uuid_equal(uuidp, &afs_cb_interface.uuid))
	code = 1;		/* failure */
    return code;
}
コード例 #5
0
ファイル: afs_callback.c プロジェクト: SimonWilkinson/openafs
int
SRXAFSCB_ProbeUuid(struct rx_call *a_call, afsUUID * a_uuid)
{
    int code = 0;
    XSTATS_DECLS;

    RX_AFS_GLOCK();
    AFS_STATCNT(SRXAFSCB_Probe);

    XSTATS_START_CMTIME(AFS_STATS_CM_RPCIDX_PROBE);
    if (!afs_uuid_equal(a_uuid, &afs_cb_interface.uuid))
	code = 1;		/* failure */
    XSTATS_END_TIME;

    RX_AFS_GUNLOCK();

    return code;
}
コード例 #6
0
ファイル: afscp_server.c プロジェクト: gsell/openafs-osd
/* takes server in host byte order */
struct afscp_server *
afscp_ServerById(struct afscp_cell *thecell, afsUUID * u)
{
    /* impliment uniquifiers? */
    int i, code;
    struct afscp_server **newlist;
    struct afscp_server **newall;
    struct afscp_server *ret = NULL;
    afsUUID tmp;
    bulkaddrs addrs;
    struct ListAddrByAttributes attrs;
    afs_int32 nentries, uniq;
    char s[512];
    afsUUID_to_string(u, s, 511);
    afs_dprintf(("GetServerByID %s\n", s));

    for (i = 0; i < thecell->nservers; i++) {
	if (afs_uuid_equal(&thecell->fsservers[i]->id, u)) {
	    return thecell->fsservers[i];
	}
    }

    if (thecell->nservers >= thecell->srvsalloced) {
	if (thecell->srvsalloced)
	    thecell->srvsalloced = thecell->srvsalloced * 2;
	else
	    thecell->srvsalloced = 4;
	newlist = realloc(thecell->fsservers,
			  thecell->srvsalloced *
			  sizeof(struct afscp_server *));
	if (newlist == NULL) {
	    return NULL;
	}
	thecell->fsservers = newlist;
    }
    ret = malloc(sizeof(struct afscp_server));
    if (ret == NULL) {
	return NULL;
    }
    memset(ret, 0, sizeof(struct afscp_server));
    thecell->fsservers[thecell->nservers] = ret;
    memmove(&ret->id, u, sizeof(afsUUID));
    ret->cell = thecell->id;
    memset(&tmp, 0, sizeof(tmp));
    memset(&addrs, 0, sizeof(addrs));
    memset(&attrs, 0, sizeof(attrs));
    attrs.Mask = VLADDR_UUID;
    memmove(&attrs.uuid, u, sizeof(afsUUID));

    code = ubik_VL_GetAddrsU(thecell->vlservers, 0, &attrs, &tmp,
			     &uniq, &nentries, &addrs);
    if (code != 0) {
	return NULL;
    }
    if (nentries > AFS_MAXHOSTS) {
	nentries = AFS_MAXHOSTS;
	/* XXX I don't want to do *that* much dynamic allocation */
	abort();
    }

    ret->naddrs = nentries;
    for (i = 0; i < nentries; i++) {
	ret->addrs[i] = htonl(addrs.bulkaddrs_val[i]);
	ret->conns[i] = rx_NewConnection(ret->addrs[i],
					 htons(AFSCONF_FILEPORT),
					 1, thecell->security,
					 thecell->scindex);
    }
    _xdr_free(_xdr_bulkaddrs, &addrs);
    thecell->nservers++;

    if (afscp_nservers >= afscp_srvsalloced) {
	if (afscp_srvsalloced)
	    afscp_srvsalloced = afscp_srvsalloced * 2;
	else
	    afscp_srvsalloced = 4;
	newall = realloc(allservers,
			 afscp_srvsalloced * sizeof(struct afscp_server *));
	if (newall == NULL) {
	    return ret;
	}
	allservers = newall;
    }
    ret->index = afscp_nservers;
    allservers[afscp_nservers++] = ret;
    return ret;
}