From bcdcf5cf38951c09b39a6ef7561981f09792d03f Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Mon, 23 May 2011 06:24:09 +0100 Subject: [PATCH] vlserver: Add flags to extent address entries Add a "flags" field to the extent address entry so that we can store per server bit flag information. Rename the header flags feel (and corresponding macro) so that it's explicitly a header flag. Take this opportunity to also fix this comment to clarify that the header flags are not a copy of anything from the vlentry, but that they must be at the same structure offset as the vlentry flags field (so that something accessing an extent block as if it was a vlentry can see what it is from the flags) Change-Id: If8a4816418d9400fb971679c08b4777e7d83c983 Reviewed-on: http://gerrit.openafs.org/4776 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/vlserver/cnvldb.c | 4 ++-- src/vlserver/vldb_check.c | 8 ++++---- src/vlserver/vlserver.p.h | 9 ++++++--- src/vlserver/vlutils.c | 4 ++-- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/vlserver/cnvldb.c b/src/vlserver/cnvldb.c index bbbb51409..85cde3ed6 100644 --- a/src/vlserver/cnvldb.c +++ b/src/vlserver/cnvldb.c @@ -399,7 +399,7 @@ read_mhentries(afs_uint32 mh_addr, int oldfd) } /* Verify that this block is the right one */ - if (ntohl(base[0]->ex_flags) != VLCONTBLOCK) { /* check if flag is correct */ + if (ntohl(base[0]->ex_hdrflags) != VLCONTBLOCK) { /* check if flag is correct */ free(base[0]); base[0] = 0; return; @@ -442,7 +442,7 @@ read_mhentries(afs_uint32 mh_addr, int oldfd) } /* Verify that this block knows its an extent block */ - if (ntohl(base[j]->ex_flags) != VLCONTBLOCK) { + if (ntohl(base[j]->ex_hdrflags) != VLCONTBLOCK) { free(base[j]); base[j] = 0; continue; diff --git a/src/vlserver/vldb_check.c b/src/vlserver/vldb_check.c index 496bbe604..f027e7797 100644 --- a/src/vlserver/vldb_check.c +++ b/src/vlserver/vldb_check.c @@ -351,7 +351,7 @@ readMH(afs_int32 addr, struct extentaddr *mhblockP) vldbread(addr, (char *)mhblockP, VL_ADDREXTBLK_SIZE); mhblockP->ex_count = ntohl(mhblockP->ex_count); - mhblockP->ex_flags = ntohl(mhblockP->ex_flags); + mhblockP->ex_hdrflags = ntohl(mhblockP->ex_hdrflags); for (i = 0; i < VL_MAX_ADDREXTBLKS; i++) mhblockP->ex_contaddrs[i] = ntohl(mhblockP->ex_contaddrs[i]); @@ -497,7 +497,7 @@ readSIT(int base, int addr) quiet_println("multihome info block: base %d\n", base); if (base == 0) { quiet_println(" count = %u\n", ntohl(extent->ex_count)); - quiet_println(" flags = %u\n", ntohl(extent->ex_flags)); + quiet_println(" flags = %u\n", ntohl(extent->ex_hdrflags)); for (i = 0; i < VL_MAX_ADDREXTBLKS; i++) { quiet_println(" contaddrs[%d] = %u\n", i, ntohl(extent->ex_contaddrs[i])); @@ -897,7 +897,7 @@ CheckIpAddrs(struct vlheader *header) * addresses of all the mh blocks. */ readMH(header->SIT, MHblock); - if (MHblock->ex_flags != VLCONTBLOCK) { + if (MHblock->ex_hdrflags != VLCONTBLOCK) { log_error (VLDB_CHECK_ERROR,"Multihomed Block 0: Bad entry at %u: Not a valid multihomed block\n", header->SIT); @@ -919,7 +919,7 @@ CheckIpAddrs(struct vlheader *header) continue; readMH(caddrs[i], MHblock); - if (MHblock->ex_flags != VLCONTBLOCK) { + if (MHblock->ex_hdrflags != VLCONTBLOCK) { log_error (VLDB_CHECK_ERROR,"Multihomed Block 0: Bad entry at %u: Not a valid multihomed block\n", header->SIT); diff --git a/src/vlserver/vlserver.p.h b/src/vlserver/vlserver.p.h index d32449361..dc6ffa06d 100644 --- a/src/vlserver/vlserver.p.h +++ b/src/vlserver/vlserver.p.h @@ -106,7 +106,8 @@ struct extentaddr { struct { afs_int32 count; /* # of valid addresses */ afs_int32 spares1[2]; - afs_int32 flags; /* must match vlentry's flags field XXX */ + afs_int32 flags; /* must be in the same position as the vlentry's + flags field */ afs_uint32 contaddrs[VL_MAX_ADDREXTBLKS]; afs_int32 spares2[24]; } _ex_header; @@ -114,16 +115,18 @@ struct extentaddr { afsUUID hostuuid; afs_int32 uniquifier; afs_uint32 addrs[VL_MAXIPADDRS_PERMH]; - afs_int32 spares[12]; + afs_uint32 flags; + afs_int32 spares[11]; } _ex_addrentry; } _ex_un; }; #define ex_count _ex_un._ex_header.count -#define ex_flags _ex_un._ex_header.flags +#define ex_hdrflags _ex_un._ex_header.flags #define ex_contaddrs _ex_un._ex_header.contaddrs #define ex_hostuuid _ex_un._ex_addrentry.hostuuid #define ex_addrs _ex_un._ex_addrentry.addrs #define ex_uniquifier _ex_un._ex_addrentry.uniquifier +#define ex_srvflags _ex_un._ex_addrentry.flags #define VLog(level, str) ViceLog(level, str) diff --git a/src/vlserver/vlutils.c b/src/vlserver/vlutils.c index 231bc2db4..06f7efd43 100644 --- a/src/vlserver/vlutils.c +++ b/src/vlserver/vlutils.c @@ -266,7 +266,7 @@ readExtents(struct ubik_trans *trans) } /* After reading it in, check to see if its a real continuation block */ - if (ntohl(rd_ex_addr[i]->ex_flags) != VLCONTBLOCK) { + if (ntohl(rd_ex_addr[i]->ex_hdrflags) != VLCONTBLOCK) { extent_mod = 1; rd_ex_addr[0]->ex_contaddrs[i] = 0; free(rd_ex_addr[i]); /* Not the place to create it */ @@ -409,7 +409,7 @@ GetExtentBlock(struct vl_ctx *ctx, register afs_int32 base) memset(ctx->ex_addr[base], 0, VL_ADDREXTBLK_SIZE); /* Write the full extension block at end of vldb */ - ctx->ex_addr[base]->ex_flags = htonl(VLCONTBLOCK); + ctx->ex_addr[base]->ex_hdrflags = htonl(VLCONTBLOCK); blockindex = ntohl(ctx->cheader->vital_header.eofPtr); code = vlwrite(ctx->trans, blockindex, (char *)ctx->ex_addr[base], -- 2.39.5