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>
/* 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... */
#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 */
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;