windows-64-bit-type-safety-20051105
[openafs.git] / src / WINNT / afsadmsvr / TaAfsAdmSvrCell.cpp
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #include <afs/param.h>
11 #include <afs/stds.h>
12
13 #include "TaAfsAdmSvrInternal.h"
14
15
16 /*
17  * ROUTINES ___________________________________________________________________
18  *
19  */
20
21
22       // AfsAdmSvr_ChangeCell
23       // ...changes a cell's properties.
24       //
25 extern "C" int AfsAdmSvr_ChangeCell (UINT_PTR idClient, ASID idCell, LPAFSADMSVR_CHANGECELL_PARAMS pChange, ULONG *pStatus)
26 {
27    ASACTION Action;
28    Action.Action = ACTION_CELL_CHANGE;
29    Action.idClient = idClient;
30    Action.idCell = idCell;
31    size_t iOp = AfsAdmSvr_BeginOperation (idClient, &Action);
32
33    Print (dlDETAIL, TEXT("Client 0x%08lX: ChangeCell (idCell=0x%08lX)"), idClient, idCell);
34
35    if (!AfsAdmSvr_fIsValidClient (idClient))
36       return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
37
38    // Call AfsClass to actually do it
39    //
40    PTSPROPERTIES PtsProperties;
41    PtsProperties.idUserMax = (int)(pChange->idUserMax);
42    PtsProperties.idGroupMax = (int)(pChange->idGroupMax);
43
44    ULONG status;
45    if (!AfsClass_SetPtsProperties ((LPIDENT)idCell, &PtsProperties, &status))
46       {
47       Print (dlERROR, TEXT("Client 0x%08lX: ChangeCell failed; error 0x%08lX"), idClient, status);
48       return FALSE_(status,pStatus,iOp);
49       }
50
51    AfsAdmSvr_TestProperties (idCell);
52
53    Print (dlDETAIL, TEXT("Client 0x%08lX: ChangeCell succeeded"), idClient);
54    AfsAdmSvr_EndOperation (iOp);
55    return TRUE;
56 }
57
58
59
60       // AfsAdmSvr_SetRefreshRate
61       // ...changes the refresh rate for a specific cell
62       //
63 extern "C" int AfsAdmSvr_SetRefreshRate (UINT_PTR idClient, ASID idCell, ULONG cminRefreshRate, ULONG *pStatus)
64 {
65    if (!AfsAdmSvr_fIsValidClient (idClient))
66       return FALSE_(ERROR_INVALID_PARAMETER,pStatus);
67
68    Print (dlDETAIL, TEXT("Client 0x%08lX: Setting refresh rate to %lu minutes"), idClient, cminRefreshRate);
69
70    if (!cminRefreshRate)
71       AfsAdmSvr_StopCellRefreshThread (idCell);
72    else
73       AfsAdmSvr_SetCellRefreshRate (idCell, cminRefreshRate);
74
75    return TRUE;
76 }
77