2 * Copyright 2004, International Business Machines Corporation and others.
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
10 #include <afsconfig.h>
11 #include <afs/param.h>
19 #include <afs/afsint.h>
26 int VolumeChanged; /* to keep physio happy */
29 handleit(struct cmd_syndesc *as, void *arock)
33 int bless, unbless, nofssync;
36 volumeId = atoi(as->parms[0].items->data);
37 bless = !!(as->parms[1].items);
38 unbless = !!(as->parms[2].items);
39 nofssync = !!(as->parms[3].items);
41 if (bless && unbless) {
42 fprintf(stderr,"Cannot use both -bless and -unbless\n");
46 if (VInitVolumePackage(nofssync ? salvager : volumeUtility, 5, 5, 1, 0)) {
47 fprintf(stderr,"Unable to initialize volume package\n");
51 vp = VAttachVolume(&ec, volumeId, V_VOLUPD);
53 fprintf(stderr,"VAttachVolume failed: %d\n", ec);
56 if (bless) V_blessed(vp) = 1;
57 if (unbless) V_blessed(vp) = 0;
58 VUpdateVolume(&ec, vp);
60 fprintf(stderr,"VUpdateVolume failed: %d\n", ec);
69 main(int argc, char **argv)
71 register struct cmd_syndesc *ts;
74 ts = cmd_CreateSyntax(NULL, handleit, NULL, "Manipulate volume blessed bit");
75 cmd_AddParm(ts, "-id", CMD_SINGLE, CMD_REQUIRED, "Volume id");
76 cmd_AddParm(ts, "-bless", CMD_FLAG, CMD_OPTIONAL, "Set blessed bit");
77 cmd_AddParm(ts, "-unbless", CMD_FLAG, CMD_OPTIONAL, "Clear blessed bit");
78 cmd_AddParm(ts, "-nofssync", CMD_FLAG, CMD_OPTIONAL,
79 "Don't communicate with running fileserver");
80 code = cmd_Dispatch(argc, argv);