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 <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit f091ace32e3045da396d577055dafd67888ff7ea)

Change-Id: Ia098730c3e83429ce4f886b1427159d13eff4c4e
Reviewed-on: http://gerrit.openafs.org/6414
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
Andrew Deason 2011-06-08 22:50:27 -05:00 committed by Derrick Brashear
parent eb4bee410a
commit 3e6c1df2f6

View File

@ -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);