Windows: add cm_Gen8Dot3VolNameW()

Change-Id: Ic514719ee247d60862cc9ff07de16e5de4ffb774
Reviewed-on: http://gerrit.openafs.org/5352
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
Jeffrey Altman 2011-09-03 20:16:09 -04:00 committed by Jeffrey Altman
parent 69463ac0cb
commit 741e478970
2 changed files with 40 additions and 0 deletions

View File

@ -593,6 +593,43 @@ void cm_Gen8Dot3NameIntW(const clientchar_t * longname, cm_dirFid_t * pfid,
*shortNameEndp = shortName;
}
void cm_Gen8Dot3VolNameW(afs_uint32 cell, afs_uint32 volume,
clientchar_t *shortName, clientchar_t **shortNameEndp)
{
clientchar_t number[12];
int i, nsize = 0;
int validExtension = 0;
/* Unparse the file's cell and volume numbers */
do {
number[nsize] = cm_8Dot3Mapping[cell % cm_8Dot3MapSize];
nsize++;
cell /= cm_8Dot3MapSize;
} while (cell);
do {
number[nsize] = cm_8Dot3Mapping[volume % cm_8Dot3MapSize];
nsize++;
volume /= cm_8Dot3MapSize;
} while (volume && nsize < 8);
/* Copy uniquifier characters */
for (i=0; i < nsize; i++) {
*shortName++ = number[i];
}
/* Add extension characters */
*shortName++ = '.'; /* copy dot */
*shortName++ = 'v';
*shortName++ = 'o';
*shortName++ = 'l';
/* Trailing null */
*shortName = 0;
if (shortNameEndp)
*shortNameEndp = shortName;
}
/*! \brief Compare 'pattern' (containing metacharacters '*' and '?') with the file name 'name'.
\note This procedure works recursively calling itself.

View File

@ -79,6 +79,9 @@ extern void cm_Gen8Dot3NameInt(const fschar_t * longname, cm_dirFid_t * pfid,
extern void cm_Gen8Dot3NameIntW(const clientchar_t* longname, cm_dirFid_t * pfid,
clientchar_t *shortName, clientchar_t **shortNameEndp);
extern void cm_Gen8Dot3VolNameW(afs_uint32 cell, afs_uint32 volume,
clientchar_t *shortName, clientchar_t **shortNameEndp);
extern int cm_MatchMask(clientchar_t *namep, clientchar_t *maskp, int flags);
extern BOOL cm_TargetPerceivedAsDirectory(const fschar_t *target);