From 3e6c1df2f60e1349f34c81ea54e1622fb6f5dd9d Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Wed, 8 Jun 2011 22:50:27 -0500 Subject: [PATCH] libafs: memset dirHeader->hashTable Clear dirHeader->hashTable via memset instead of via a loop. This is more efficient, and avoids the loop getting optimized into an unusable _memset call on recent versions of Solaris Studio when building for the kernel. Thanks to Jeff Blaine for reporting the issue with Solaris Studio. Reviewed-on: http://gerrit.openafs.org/4829 Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit f091ace32e3045da396d577055dafd67888ff7ea) Change-Id: Ia098730c3e83429ce4f886b1427159d13eff4c4e Reviewed-on: http://gerrit.openafs.org/6414 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/afs/afs_dynroot.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/afs/afs_dynroot.c b/src/afs/afs_dynroot.c index 374aa6f6ee..24b8140b03 100644 --- a/src/afs/afs_dynroot.c +++ b/src/afs/afs_dynroot.c @@ -404,8 +404,7 @@ afs_RebuildDynroot(void) dirHeader->alloMap[0] = EPP - DHE - 1; for (i = 1; i < MAXPAGES; i++) dirHeader->alloMap[i] = EPP; - for (i = 0; i < NHASHENT; i++) - dirHeader->hashTable[i] = 0; + memset(dirHeader->hashTable, 0, NHASHENT * sizeof(dirHeader->hashTable[0])); /* Install ".", "..", and the dynamic mount directory */ afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, ".", 1); @@ -501,8 +500,7 @@ afs_RebuildDynrootMount(void) dirHeader->alloMap[0] = EPP - DHE - 1; for (i = 1; i < MAXPAGES; i++) dirHeader->alloMap[i] = EPP; - for (i = 0; i < NHASHENT; i++) - dirHeader->hashTable[i] = 0; + memset(dirHeader->hashTable, 0, NHASHENT * sizeof(dirHeader->hashTable[0])); /* Install "." and ".." */ afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, ".", 1);