Initial IBM OpenAFS 1.0 tree
[openafs.git] / src / WINNT / afsadmsvr / TaAfsAdmSvrCell.cpp
1
2 #include <afs/param.h>
3 #include <afs/stds.h>
4
5 #include "TaAfsAdmSvrInternal.h"
6
7
8 /*
9  * ROUTINES ___________________________________________________________________
10  *
11  */
12
13
14       // AfsAdmSvr_ChangeCell
15       // ...changes a cell's properties.
16       //
17 int AfsAdmSvr_ChangeCell (DWORD idClient, ASID idCell, LPAFSADMSVR_CHANGECELL_PARAMS pChange, ULONG *pStatus)
18 {
19    ASACTION Action;
20    Action.Action = ACTION_CELL_CHANGE;
21    Action.idClient = idClient;
22    Action.idCell = idCell;
23    size_t iOp = AfsAdmSvr_BeginOperation (idClient, &Action);
24
25    Print (dlDETAIL, TEXT("Client 0x%08lX: ChangeCell (idCell=0x%08lX)"), idClient, idCell);
26
27    if (!AfsAdmSvr_fIsValidClient (idClient))
28       return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
29
30    // Call AfsClass to actually do it
31    //
32    PTSPROPERTIES PtsProperties;
33    PtsProperties.idUserMax = (int)(pChange->idUserMax);
34    PtsProperties.idGroupMax = (int)(pChange->idGroupMax);
35
36    ULONG status;
37    if (!AfsClass_SetPtsProperties ((LPIDENT)idCell, &PtsProperties, &status))
38       {
39       Print (dlERROR, TEXT("Client 0x%08lX: ChangeCell failed; error 0x%08lX"), idClient, status);
40       return FALSE_(status,pStatus,iOp);
41       }
42
43    AfsAdmSvr_TestProperties (idCell);
44
45    Print (dlDETAIL, TEXT("Client 0x%08lX: ChangeCell succeeded"), idClient);
46    AfsAdmSvr_EndOperation (iOp);
47    return TRUE;
48 }
49
50
51
52       // AfsAdmSvr_SetRefreshRate
53       // ...changes the refresh rate for a specific cell
54       //
55 int AfsAdmSvr_SetRefreshRate (DWORD idClient, ASID idCell, ULONG cminRefreshRate, ULONG *pStatus)
56 {
57    if (!AfsAdmSvr_fIsValidClient (idClient))
58       return FALSE_(ERROR_INVALID_PARAMETER,pStatus);
59
60    Print (dlDETAIL, TEXT("Client 0x%08lX: Setting refresh rate to %lu minutes"), idClient, cminRefreshRate);
61
62    if (!cminRefreshRate)
63       AfsAdmSvr_StopCellRefreshThread (idCell);
64    else
65       AfsAdmSvr_SetCellRefreshRate (idCell, cminRefreshRate);
66
67    return TRUE;
68 }
69