mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 15:30:14 +00:00
vol-bless-20041202
FIXES 15928 add volume blesser
This commit is contained in:
parent
f32f9810b1
commit
93bc285e69
@ -25,7 +25,7 @@ VLIBOBJS=vnode.o volume.o vutil.o partition.o fssync.o purge.o \
|
||||
clone.o nuke.o devname.o listinodes.o common.o ihandle.o \
|
||||
namei_ops.o fstab.o
|
||||
|
||||
OBJECTS=${VLIBOBJS} physio.o vol-salvage.o vol-info.o vol-dump.o
|
||||
OBJECTS=${VLIBOBJS} physio.o vol-salvage.o vol-info.o vol-dump.o vol-bless.o
|
||||
|
||||
all: gi \
|
||||
${TOP_LIBDIR}/vlib.a \
|
||||
@ -164,6 +164,9 @@ volinfo: vol-info.o physio.o ihandle.o fstab.o ${LIBS}
|
||||
${CC} ${CFLAGS} -o volinfo vol-info.o physio.o \
|
||||
ihandle.o fstab.o ${LIBS} ${XLIBS}
|
||||
|
||||
vol-bless: vol-bless.o physio.o ihandle.o ${LIBS}
|
||||
${CC} ${CFLAGS} -o vol-bless vol-bless.o physio.o ${LIBS} ${XLIBS}
|
||||
|
||||
fs_conv_dux40D: fs_conv_411.o
|
||||
${CC} ${CFLAGS} ${TOP_LIBDIR}/libcmd.a -o fs_conv_dux40D fs_conv_411.o ${LIBS} ${XLIBS}
|
||||
|
||||
@ -282,4 +285,4 @@ check-splint::
|
||||
vnode.c volume.c vutil.c partition.c fssync.c purge.c \
|
||||
clone.c nuke.c devname.c listinodes.c common.c ihandle.c \
|
||||
namei_ops.c \
|
||||
physio.c vol-salvage.c vol-info.c
|
||||
physio.c vol-salvage.c vol-info.c vol-bless.c
|
||||
|
@ -89,6 +89,14 @@ $(VOLINFO): $(OUT)\vol-info.obj $(OUT)\physio.obj $(OUT)\volinfo.res $(EXEC_LIBS
|
||||
$(EXECONLINK)
|
||||
$(EXEPREP)
|
||||
|
||||
############################################################################
|
||||
# build volinfo
|
||||
VOLBLESS = $(DESTDIR)\root.server\usr\afs\bin\vol-bless.exe
|
||||
|
||||
$(VOLBLESS): $(OUT)\vol-bless.obj $(OUT)\physio.obj $(OUT)\vol-bless.res $(EXEC_LIBS)
|
||||
$(EXECONLINK)
|
||||
$(EXEPREP)
|
||||
|
||||
############################################################################
|
||||
# generate versioninfo resources
|
||||
$(OUT)\salvager.res: salvager.rc AFS_component_version_number.h
|
||||
|
86
src/vol/vol-bless.c
Normal file
86
src/vol/vol-bless.c
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright 2004, International Business Machines Corporation and others.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This software has been released under the terms of the IBM Public
|
||||
* License. For details, see the LICENSE file in the top-level source
|
||||
* directory or online at http://www.openafs.org/dl/license10.html
|
||||
*/
|
||||
|
||||
#include <afsconfig.h>
|
||||
#include <afs/param.h>
|
||||
|
||||
RCSID
|
||||
("$Header$");
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <afs/cmd.h>
|
||||
|
||||
#include <rx/xdr.h>
|
||||
#include <afs/afsint.h>
|
||||
#include "nfs.h"
|
||||
#include "lock.h"
|
||||
#include "ihandle.h"
|
||||
#include "vnode.h"
|
||||
#include "volume.h"
|
||||
|
||||
int VolumeChanged; /* to keep physio happy */
|
||||
|
||||
static int
|
||||
handleit(struct cmd_syndesc *as, char *arock)
|
||||
{
|
||||
Volume *vp;
|
||||
Error ec;
|
||||
int bless, unbless, nofssync;
|
||||
int volumeId;
|
||||
|
||||
volumeId = atoi(as->parms[0].items->data);
|
||||
bless = !!(as->parms[1].items);
|
||||
unbless = !!(as->parms[2].items);
|
||||
nofssync = !!(as->parms[3].items);
|
||||
|
||||
if (bless && unbless) {
|
||||
fprintf(stderr,"Cannot use both -bless and -unbless\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (VInitVolumePackage(nofssync ? salvager : volumeUtility, 5, 5, 1, 0)) {
|
||||
fprintf(stderr,"Unable to initialize volume package\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
vp = VAttachVolume(&ec, volumeId, V_VOLUPD);
|
||||
if (ec) {
|
||||
fprintf(stderr,"VAttachVolume failed: %d\n", ec);
|
||||
exit(1);
|
||||
}
|
||||
if (bless) V_blessed(vp) = 1;
|
||||
if (unbless) V_blessed(vp) = 0;
|
||||
VUpdateVolume(&ec, vp);
|
||||
if (ec) {
|
||||
fprintf(stderr,"VUpdateVolume failed: %d\n", ec);
|
||||
VPutVolume(vp);
|
||||
exit(1);
|
||||
}
|
||||
VPutVolume(vp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
register struct cmd_syndesc *ts;
|
||||
afs_int32 code;
|
||||
|
||||
ts = cmd_CreateSyntax(NULL, handleit, 0, "Manipulate volume blessed bit");
|
||||
cmd_AddParm(ts, "-id", CMD_SINGLE, CMD_REQUIRED, "Volume id");
|
||||
cmd_AddParm(ts, "-bless", CMD_FLAG, CMD_OPTIONAL, "Set blessed bit");
|
||||
cmd_AddParm(ts, "-unbless", CMD_FLAG, CMD_OPTIONAL, "Clear blessed bit");
|
||||
cmd_AddParm(ts, "-nofssync", CMD_FLAG, CMD_OPTIONAL,
|
||||
"Don't communicate with running fileserver");
|
||||
code = cmd_Dispatch(argc, argv);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user