/*
*-----------------------------------------------------------------------------
*
- * Sleeper --
+ * FileLockSleeper --
*
* Have the calling thread sleep "for a while". The duration of the
* sleep is determined by the count that is passed in. Checks are
*/
static int
-Sleeper(LockValues *myValues, // IN/OUT:
- uint32 *loopCount) // IN/OUT:
+FileLockSleeper(LockValues *myValues, // IN/OUT:
+ uint32 *loopCount) // IN/OUT:
{
uint32 msecSleepTime;
/*
*-----------------------------------------------------------------------------
*
- * RemoveLockingFile --
+ * FileLockRemoveLockingFile --
*
* Remove the specified file.
*
*/
static int
-RemoveLockingFile(ConstUnicode lockDir, // IN:
- ConstUnicode fileName) // IN:
+FileLockRemoveLockingFile(ConstUnicode lockDir, // IN:
+ ConstUnicode fileName) // IN:
{
int err;
Unicode path;
/*
*-----------------------------------------------------------------------------
*
- * ActivateLockList
+ * FileLockActivateList
*
* Insure a lock list entry exists for the lock directory.
*
*/
static int
-ActivateLockList(ConstUnicode dirName, // IN:
- LockValues *myValues) // IN:
+FileLockActivateList(ConstUnicode dirName, // IN:
+ LockValues *myValues) // IN:
{
ActiveLock *ptr;
/*
*-----------------------------------------------------------------------------
*
- * ScanDirectory --
+ * FileLockScanDirectory --
*
* Call the specified function for each member file found in the
* specified directory.
*/
static int
-ScanDirectory(ConstUnicode lockDir, // IN:
- int (*func)( // IN:
- ConstUnicode lockDir,
- ConstUnicode fileName,
- LockValues *memberValues,
- LockValues *myValues
- ),
- LockValues *myValues, // IN:
- Bool cleanUp) // IN:
+FileLockScanDirectory(ConstUnicode lockDir, // IN:
+ int (*func)( // IN:
+ ConstUnicode lockDir,
+ ConstUnicode fileName,
+ LockValues *memberValues,
+ LockValues *myValues
+ ),
+ LockValues *myValues, // IN:
+ Bool cleanUp) // IN:
{
uint32 i;
int err;
Log(LGPFX" %s discarding %s from %s'; invalid file name.\n",
__FUNCTION__, UTF8(fileList[i]), UTF8(lockDir));
- err = RemoveLockingFile(lockDir, fileList[i]);
+ err = FileLockRemoveLockingFile(lockDir, fileList[i]);
if (err != 0) {
goto bail;
}
if (Unicode_StartsWith(fileList[i], "D")) {
if (cleanUp) {
- err = ActivateLockList(fileList[i], myValues);
+ err = FileLockActivateList(fileList[i], myValues);
if (err != 0) {
goto bail;
}
Unicode_Free(memberValues.memberName);
- err = RemoveLockingFile(lockDir, fileList[i]);
+ err = FileLockRemoveLockingFile(lockDir, fileList[i]);
if (err != 0) {
break;
}
/*
*-----------------------------------------------------------------------------
*
- * Scanner --
+ * FileLockScanner --
*
* Call the specified function for each member file found in the
* specified directory. If a rescan is necessary check the list
*/
static int
-Scanner(ConstUnicode lockDir, // IN:
- int (*func)( // IN:
- ConstUnicode lockDir,
- ConstUnicode fileName,
- LockValues *memberValues,
- LockValues *myValues
- ),
- LockValues *myValues, // IN:
- Bool cleanUp) // IN:
+FileLockScanner(ConstUnicode lockDir, // IN:
+ int (*func)( // IN:
+ ConstUnicode lockDir,
+ ConstUnicode fileName,
+ LockValues *memberValues,
+ LockValues *myValues
+ ),
+ LockValues *myValues, // IN:
+ Bool cleanUp) // IN:
{
int err;
ActiveLock *ptr;
while (TRUE) {
ActiveLock *prev;
- err = ScanDirectory(lockDir, func, myValues, cleanUp);
+ err = FileLockScanDirectory(lockDir, func, myValues, cleanUp);
if ((err > 0) || ((err == 0) && (myValues->lockList == NULL))) {
break;
}
/*
*-----------------------------------------------------------------------------
*
- * WaitForPossession --
+ * FileLockWaitForPossession --
*
* Wait until the caller has a higher priority towards taking
* possession of a lock than the specified file.
*/
static int
-WaitForPossession(ConstUnicode lockDir, // IN:
- ConstUnicode fileName, // IN:
- LockValues *memberValues, // IN:
- LockValues *myValues) // IN:
+FileLockWaitForPossession(ConstUnicode lockDir, // IN:
+ ConstUnicode fileName, // IN:
+ LockValues *memberValues, // IN:
+ LockValues *myValues) // IN:
{
int err = 0;
path = Unicode_Join(lockDir, DIRSEPS, fileName, NULL);
- while ((err = Sleeper(myValues, &loopCount)) == 0) {
+ while ((err = FileLockSleeper(myValues, &loopCount)) == 0) {
/* still there? */
err = FileAttributesRobust(path, NULL);
if (err != 0) {
Warning(LGPFX" %s discarding file '%s'; invalid executionID.\n",
__FUNCTION__, UTF8(path));
- err = RemoveLockingFile(lockDir, fileName);
+ err = FileLockRemoveLockingFile(lockDir, fileName);
break;
}
}
/*
*-----------------------------------------------------------------------------
*
- * NumberScan --
+ * FileLockNumberScan --
*
* Determine the maxmimum number value within the current locking set.
*
*/
static int
-NumberScan(ConstUnicode lockDir, // IN:
- ConstUnicode fileName, // IN:
- LockValues *memberValues, // IN:
- LockValues *myValues) // IN/OUT:
+FileLockNumberScan(ConstUnicode lockDir, // IN:
+ ConstUnicode fileName, // IN:
+ LockValues *memberValues, // IN:
+ LockValues *myValues) // IN/OUT:
{
ASSERT(lockDir);
ASSERT(fileName);
/*
*-----------------------------------------------------------------------------
*
- * MakeDirectory --
+ * FileLockMakeDirectory --
*
* Create a directory.
*
*/
static int
-MakeDirectory(ConstUnicode pathName) // IN:
+FileLockMakeDirectory(ConstUnicode pathName) // IN:
{
int err;
} else {
if (err == ENOENT) {
/* Not there anymore; locker unlocked or timed out */
- err = MakeDirectory(lockDir);
+ err = FileLockMakeDirectory(lockDir);
if ((err != 0) && (err != EEXIST)) {
Warning(LGPFX" %s creation failure on '%s': %s\n",
*memberFilePath = Unicode_Join(lockDir, DIRSEPS, *memberName, NULL);
- err = MakeDirectory(*entryDirectory);
+ err = FileLockMakeDirectory(*entryDirectory);
if (err == 0) {
/*
}
/* what is max(Number[1]... Number[all lockers])? */
- *err = Scanner(lockDir, NumberScan, &myValues, FALSE);
+ *err = FileLockScanner(lockDir, FileLockNumberScan, &myValues, FALSE);
if (*err != 0) {
/* clean up */
}
/* Attempt to acquire the lock */
- *err = Scanner(lockDir, WaitForPossession, &myValues, TRUE);
+ *err = FileLockScanner(lockDir, FileLockWaitForPossession,
+ &myValues, TRUE);
switch (*err) {
case 0: