mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 15:30:14 +00:00
vol: use defines for header name length
instead of randomly hardcoding numbers in several places, use macros Change-Id: I153cbe74d0d297496fb39449c4a71ec81d5637c5 Reviewed-on: http://gerrit.openafs.org/8806 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
This commit is contained in:
parent
5afe7a882b
commit
8bfce8f278
@ -39,6 +39,8 @@
|
||||
/* maximum numbe of Vice partitions */
|
||||
#define VOLMAXPARTS 255
|
||||
|
||||
#define VFORMATDIGITS 10
|
||||
|
||||
/* All volumes will have a volume header name in this format */
|
||||
#if defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV)
|
||||
/* Note that <afs/param.h> must have been included before we get here... */
|
||||
@ -48,7 +50,7 @@
|
||||
#define VFORMAT "V%010lu.vol"
|
||||
#define VHDREXT ".vol"
|
||||
#endif
|
||||
#define VHDRNAMELEN (11 + sizeof(VHDREXT) - 1) /* must match VFORMAT */
|
||||
#define VHDRNAMELEN (VFORMATDIGITS + 1 + sizeof(VHDREXT) - 1) /* must match VFORMAT */
|
||||
#define VMAXPATHLEN 64 /* Maximum length (including null) of a volume
|
||||
* external path name */
|
||||
|
||||
|
@ -1924,7 +1924,7 @@ GetNextVol(DIR *dirp, char *volname, afs_uint32 *volid)
|
||||
while ((dp = readdir(dirp)) != NULL) {
|
||||
/* could be optimized on platforms with dp->d_namlen */
|
||||
if (dp->d_name[0] == 'V' && strlen(dp->d_name) == VHDRNAMELEN
|
||||
&& strcmp(&(dp->d_name[11]), VHDREXT) == 0) {
|
||||
&& strcmp(&(dp->d_name[VFORMATDIGITS + 1]), VHDREXT) == 0) {
|
||||
*volid = VolumeNumber(dp->d_name);
|
||||
strcpy(volname, dp->d_name);
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user