/* * NOTE: This function has an important side effect. If this machine * is not the first in a new cell, then this function will get the * cell name from the config info. The cell name may be needed in * config calls that come later, and so this function must be called * before they are. */ static int IsConfigInfoValid(BOOL& bValid, afs_status_t& nStatus) { if (bCancel) return FALSE; afs_status_t configStatus; char *pszCellName = 0; NextStep(IDS_CHECK_CONFIG_INFO); bValid = FALSE; g_LogFile.Write("Is there valid configuration information on this machine: "); int nResult = cfg_HostQueryStatus(GetHostnameA(), &configStatus, &pszCellName, &nStatus); if (!nResult) return FALSE; g_LogFile.WriteBoolResult((configStatus == 0)); if (configStatus == 0) lstrncpy(g_CfgData.szCellName, A2S(pszCellName), MAX_CELL_NAME_LEN); else g_LogFile.WriteError("The configuration information on this host is not valid", configStatus); bValid = (BOOL)(configStatus == 0); return TRUE; }
static BOOL AreWeLastDBServer(BOOL& bLast, afs_status_t& nStatus) { ASSERT(g_CfgData.szHostname[0]); char *pszCellname = 0; char *pszCellServDB = 0; bLast = FALSE; g_LogFile.Write("Checking if this machine is the last DB server in the cell.\r\n"); g_LogFile.Write("Getting CellServDB from host %s.\r\n", GetHostnameA()); int nResult = cfg_CellServDbEnumerate(GetHostnameA(), &pszCellname, &pszCellServDB, &nStatus); if (!nResult) return FALSE; if (!pszCellServDB) { g_LogFile.Write("There are no DB servers in CellServDB!!!!!"); ASSERT(FALSE); // This should not be possible return FALSE; } char *psz = pszCellServDB; int i; for (i = 0; *psz; psz += strlen(psz) + 1) i++; if (i == 1) { ASSERT(lstrcmp(g_CfgData.szHostname, A2S(pszCellServDB)) == 0); g_LogFile.Write("This machine IS the last DB server in the cell.\r\n"); bLast = TRUE; } else g_LogFile.Write("This machine is NOT the last DB server in the cell.\r\n"); return TRUE; }
static DWORD WINAPI Salvage(LPVOID param) { afs_status_t nStatus; void *hServer; int nResult; nResult = bos_ServerOpen(g_hCell, GetHostnameA(), &hServer, &nStatus); if (!nResult) { ShowError(hDlg, nStatus, IDS_BOS_OPEN_FAILED); return FALSE; } nResult = bos_Salvage(g_hCell, hServer, S2A(pszPartitionName), S2A(pszVolumeName), nNumProcesses, S2A(szTempDir), 0, VOS_NORMAL, BOS_SALVAGE_DAMAGED_VOLUMES, BOS_SALVAGE_DONT_WRITE_INODES, BOS_SALVAGE_DONT_WRITE_ROOT_INODES, BOS_SALVAGE_DONT_FORCE_DIRECTORIES, BOS_SALVAGE_DONT_FORCE_BLOCK_READS, &nStatus); if (!nResult) ShowError(hDlg, nStatus, IDS_SALVAGE_ERROR); bos_ServerClose(hServer, &nStatus); g_CfgData.bReuseAdminInfo = nResult; return nResult; }
static BOOL IsClientConfigured(BOOL& bConfigured, afs_status_t& nStatus) { if (bCancel) return FALSE; bConfigured = FALSE; NextStep(IDS_CHECK_AFS_CLIENT); short isInstalled; afs_status_t configStatus; char *pszCellName = 0; g_LogFile.Write("Is the AFS Client installed on this machine: "); if (!cfg_ClientQueryStatus(GetHostnameA(), &isInstalled, &g_CfgData.nClientVersion, &configStatus, &pszCellName, &nStatus)) { ImmediateErrorDialog(nStatus, IDS_ERROR_AFS_CLIENT_CHECK); return FALSE; } g_LogFile.WriteBoolResult((BOOL)isInstalled); bConfigured = (BOOL)(configStatus == 0); if (bConfigured) lstrncpy(g_CfgData.szClientCellName, A2S(pszCellName), MAX_CELL_NAME_LEN); else g_LogFile.WriteError("The client configuration information on this host is not valid", configStatus); if (!isInstalled) { g_LogFile.Write("ERROR: AFS Client is not installed. The AFS Server requires the AFS Client.\r\n"); ImmediateErrorDialog(0, IDS_ERROR_AFS_CLIENT_NOT_INSTALLED); nStatus = -1; // Just need something nonzero return FALSE; } return TRUE; }