not ready for primetime. not even close.
volser: cmd comerr tviced usd kauth audit
${COMPILE_PART1} volser ${COMPILE_PART2}
+tvolser: project tviced usd libafsrpc libafsauthent
+ case ${SYS_NAME} in \
+ alpha_dux*|sgi_*|sun*_5*|rs_aix*|*linux*|hp_ux11*|ia64_hpux*) \
+ ${COMPILE_PART1} tvolser ${COMPILE_PART2} ;; \
+ *_darwin_[1-6][0-9]) \
+ echo Not building MT volser for ${SYS_NAME} ;; \
+ *_darwin_*) \
+ ${COMPILE_PART1} tvolser ${COMPILE_PART2} ;; \
+ *) \
+ echo Not building MT volser for ${SYS_NAME} ;; \
+ esac
+
venus: cmd comerr volser ptserver
${COMPILE_PART1} venus ${COMPILE_PART2}
${COMPILE_PART1} venus/test ${COMPILE_PART2}
src/tests/OpenAFS/Dirpath.pm \
src/tsm41/Makefile \
src/tviced/Makefile \
+src/tvolser/Makefile \
src/ubik/Makefile \
src/update/Makefile \
src/usd/test/Makefile \
--- /dev/null
+# Copyright 2000, 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
+
+srcdir=@srcdir@
+include @TOP_OBJDIR@/src/config/Makefile.config
+HELPER_SPLINT=@HELPER_SPLINT@
+
+CC=${MT_CC}
+CFLAGS=${COMMON_CFLAGS} -I.. -DNINTERFACE ${MT_CFLAGS} -DRXDEBUG
+
+CCRULE=${CC} ${CFLAGS} -c $?
+
+VICED=../viced
+VLSERVER=../vlserver
+LWP=../lwp
+LIBACL=../libacl
+UTIL=../util
+DIR=../dir
+VOL=../vol
+FSINT=../fsint
+VOLSER=../volser
+
+VOLSEROBJS=volmain.o volprocs.o physio.o voltrans.o volerr.o volint.cs.o dumpstuff.o volint.ss.o volint.xdr.o vscommon.o
+
+VLSERVEROBJS=#vldbint.cs.o vldbint.xdr.o
+
+LWPOBJS=lock.o fasttime.o threadname.o
+
+LIBACLOBJS=aclprocs.o netprocs.o
+
+UTILOBJS=assert.o uuid.o serverLog.o fileutil.o netutils.o dirpath.o volparse.o flipbase64.o softsig.o
+
+DIROBJS=buffer.o dir.o salvage.o
+
+VOLOBJS= vnode.o volume.o vutil.o partition.o fssync.o purge.o \
+ clone.o devname.o common.o ihandle.o listinodes.o namei_ops.o nuke.o
+
+FSINTOBJS=# afsaux.o afscbint.cs.o afsint.ss.o afsint.xdr.o
+
+objects= ${VOLSEROBJS} ${VLSERVEROBJS} ${LWPOBJS} ${LIBACLOBJS} \
+ ${UTILOBJS} ${DIROBJS} ${VOLOBJS} ${FSINTOBJS}
+
+LIBS=${TOP_LIBDIR}/libafsauthent.a ${TOP_LIBDIR}/libafsrpc.a ${TOP_LIBDIR}/util.a
+
+all: volserver
+
+COMPILE=${CC} ${CFLAGS} -c $?
+
+volmain.o: ${VOLSER}/volmain.c
+ ${COMPILE}
+volprocs.o: ${VOLSER}/volprocs.c
+ ${COMPILE}
+physio.o: ${VOLSER}/physio.c
+ ${COMPILE}
+voltrans.o: ${VOLSER}/voltrans.c
+ ${COMPILE}
+volerr.o: ${VOLSER}/volerr.c
+ ${COMPILE}
+volint.cs.o: ${VOLSER}/volint.cs.c
+ ${COMPILE}
+dumpstuff.o: ${VOLSER}/dumpstuff.c
+ ${COMPILE}
+volint.ss.o: ${VOLSER}/volint.ss.c
+ ${COMPILE}
+volint.xdr.o: ${VOLSER}/volint.xdr.c
+ ${COMPILE}
+
+assert.o: ${UTIL}/assert.c
+ ${COMPILE}
+
+uuid.o: ${UTIL}/uuid.c
+ ${COMPILE}
+
+serverLog.o: ${UTIL}/serverLog.c
+ ${COMPILE}
+
+fileutil.o: ${UTIL}/fileutil.c
+ ${COMPILE}
+
+volparse.o: ${UTIL}/volparse.c
+ ${COMPILE}
+
+flipbase64.o: ${UTIL}/flipbase64.c
+ ${COMPILE}
+
+netutils.o: ${UTIL}/netutils.c
+ ${COMPILE}
+
+dirpath.o: ${UTIL}/dirpath.c
+ ${COMPILE}
+
+softsig.o: ${UTIL}/softsig.c
+ ${COMPILE}
+
+lock.o: ${LWP}/lock.c
+ ${COMPILE}
+
+fasttime.o: ${LWP}/fasttime.c
+ ${COMPILE}
+
+threadname.o: ${LWP}/threadname.c
+ ${COMPILE}
+
+aclprocs.o: ${LIBACL}/aclprocs.c
+ ${COMPILE}
+
+netprocs.o: ${LIBACL}/netprocs.c
+ ${COMPILE}
+
+vldbint.cs.o: ${VLSERVER}/vldbint.cs.c
+ ${COMPILE}
+
+vldbint.xdr.o: ${VLSERVER}/vldbint.xdr.c
+ ${COMPILE}
+
+buffer.o: ${DIR}/buffer.c
+ ${COMPILE}
+
+dir.o: ${DIR}/dir.c
+ ${COMPILE}
+
+salvage.o: ${DIR}/salvage.c
+ ${COMPILE}
+
+vnode.o: ${VOL}/vnode.c
+ ${COMPILE}
+
+volume.o: ${VOL}/volume.c
+ ${COMPILE}
+
+vutil.o: ${VOL}/vutil.c
+ ${COMPILE}
+
+partition.o: ${VOL}/partition.c
+ ${COMPILE}
+
+nuke.o: ${VOL}/nuke.c
+ ${COMPILE}
+
+fssync.o: ${VOL}/fssync.c
+ ${COMPILE}
+
+purge.o: ${VOL}/purge.c
+ ${COMPILE}
+
+clone.o: ${VOL}/clone.c
+ ${COMPILE}
+
+devname.o: ${VOL}/devname.c
+ ${COMPILE}
+
+common.o: ${VOL}/common.c
+ ${COMPILE}
+
+vscommon.o: ${VOLSER}/common.c
+ ${COMPILE} -o vscommon.o
+
+listinodes.o: ${VOL}/listinodes.c
+ ${COMPILE}
+
+ihandle.o: ${VOL}/ihandle.c
+ ${COMPILE}
+
+namei_ops.o: ${VOL}/namei_ops.c
+ ${COMPILE}
+
+afsaux.o: ${FSINT}/afsaux.c
+ ${COMPILE}
+
+afscbint.cs.o: ${FSINT}/afscbint.cs.c
+ ${COMPILE}
+
+afscbint.ss.o: ${FSINT}/afscbint.ss.c
+ ${COMPILE}
+
+afsint.cs.o: ${FSINT}/afsint.cs.c
+ ${COMPILE}
+
+afsint.ss.o: ${FSINT}/afsint.ss.c
+ ${COMPILE}
+
+afsint.xdr.o: ${FSINT}/afsint.xdr.c
+ ${COMPILE}
+
+volserver: ${objects} ${LIBS}
+ ${CC} ${LDFLAGS} -o volserver ${objects} ${LIBS} ${MTLIBS} ${XLIBS}
+
+${DEST}/root.server/usr/afs/bin/volserver: volserver
+ ${INSTALL} -ns $? $@
+
+install: ${DESTDIR}${afssrvlibexecdir}/volserver
+
+clean:
+ $(RM) -f *.o volserver core AFS_component_version_number.c
+
+include ../config/Makefile.version
+
+${DESTDIR}${afssrvlibexecdir}/volserver: volserver
+ ${INSTALL} -ns $? $@
+
+dest: ${DEST}/root.server/usr/afs/bin/volserver
+
else
command.partName[0] = 0;
assert(FS_sd != -1);
+ VFSYNC_LOCK
#ifdef AFS_NT40_ENV
if (send(FS_sd, (char *)&command, sizeof(command), 0) != sizeof(command)) {
printf("FSYNC_askfs: write to file server failed\n");
- return FSYNC_DENIED;
+ response = FSYNC_DENIED;
+ goto done;
}
while ((n = recv(FS_sd, &response, 1, 0)) != 1) {
if (n == 0 || WSAEINTR != WSAGetLastError()) {
printf("FSYNC_askfs: No response from file server\n");
- return FSYNC_DENIED;
+ response = FSYNC_DENIED;
+ goto done;
}
}
#else
if (write(FS_sd, &command, sizeof(command)) != sizeof(command)) {
printf("FSYNC_askfs: write to file server failed\n");
- return FSYNC_DENIED;
+ response = FSYNC_DENIED;
+ goto done;
}
while ((n = read(FS_sd, &response, 1)) != 1) {
if (n == 0 || errno != EINTR) {
printf("FSYNC_askfs: No response from file server\n");
- return FSYNC_DENIED;
+ response = FSYNC_DENIED;
+ goto done;
}
}
#endif
("FSYNC_askfs: negative response from file server; volume %u, command %d\n",
command.volume, (int)command.command);
}
+ done:
+ VFSYNC_UNLOCK
return response;
}
#ifdef AFS_PTHREAD_ENV
pthread_mutex_t vol_glock_mutex;
pthread_mutex_t vol_attach_mutex;
+pthread_mutex_t vol_fsync_mutex;
pthread_cond_t vol_put_volume_cond;
pthread_cond_t vol_sleep_cond;
#endif /* AFS_PTHREAD_ENV */
#include <pthread.h>
extern pthread_mutex_t vol_glock_mutex;
extern pthread_mutex_t vol_attach_mutex;
+extern pthread_mutex_t vol_fsync_mutex;
extern pthread_cond_t vol_put_volume_cond;
extern pthread_cond_t vol_sleep_cond;
#define VATTACH_LOCK \
assert(pthread_mutex_lock(&vol_glock_mutex) == 0);
#define VOL_UNLOCK \
assert(pthread_mutex_unlock(&vol_glock_mutex) == 0);
+#define VFSYNC_LOCK \
+ assert(pthread_mutex_lock(&vol_fsync_mutex) == 0);
+#define VFSYNC_UNLOCK \
+ assert(pthread_mutex_unlock(&vol_fsync_mutex) == 0);
#else /* AFS_PTHREAD_ENV */
#define VATTACH_LOCK
#define VATTACH_UNLOCK
#define VOL_LOCK
#define VOL_UNLOCK
+#define VFSYNC_LOCK
+#define VFSYNC_UNLOCK
#endif /* AFS_PTHREAD_ENV */
typedef enum { fileServer, volumeUtility, salvager } ProgramType;
handle = NULL;
/* Verify that the parition is valid before writing to it. */
- if (!(partition = VGetPartition(partname, 0))) {
+ if (!(partition = VGetPartition_r(partname, 0))) {
Log("VCreateVolume: partition %s is not in service.\n", partname);
*ec = VNOVOL;
return NULL;
nearInodeHash(volumeId, nearInode);
nearInode %= partition->f_files;
#endif
- VLockPartition(partname);
+ VLockPartition_r(partname);
memset(&tempHeader, 0, sizeof(tempHeader));
tempHeader.stamp.magic = VOLUMEHEADERMAGIC;
tempHeader.stamp.version = VOLUMEHEADERVERSION;
}
fsync(fd);
close(fd);
- return (VAttachVolumeByName(ec, partname, headerName, V_SECRETLY));
+ return (VAttachVolumeByName_r(ec, partname, headerName, V_SECRETLY));
}
#include <afs/afsutil.h>
#include <afs/com_err.h>
+#ifndef AFS_PTHREAD_ENV
/*@printflike@*/ void
Log(const char *format, ...)
{
vViceLog(0, (format, args));
va_end(args);
}
+#endif
void
LogError(afs_int32 errcode)
("%s: %s\n", error_table_name(errcode), error_message(errcode)));
}
+#ifndef AFS_PTHREAD_ENV
/*@printflike@*/ void
Abort(const char *format, ...)
{
va_end(args);
abort();
}
+#endif
void
InitErrTabs(void)
{
+#ifndef AFS_PTHREAD_ENV
initialize_KA_error_table();
initialize_RXK_error_table();
initialize_KTC_error_table();
initialize_CMD_error_table();
initialize_VL_error_table();
initialize_VOLS_error_table();
+#endif
return;
}
#endif
#endif
#include <sys/stat.h>
+#ifdef AFS_PTHREAD_ENV
+#include <assert.h>
+#else /* AFS_PTHREAD_ENV */
#include <afs/assert.h>
+#endif /* AFS_PTHREAD_ENV */
#include <rx/xdr.h>
#include <rx/rx.h>
#include <afs/afsint.h>
/* Now write the data out */
if (iod_Write(iodp, (char *)p, howMany) != howMany)
error = VOLSERDUMPERROR;
+#ifndef AFS_PTHREAD_ENV
IOMGR_Poll();
+#endif
}
if (pad) { /* Any padding we hadn't reported yet */
code =
DumpVnode(iodp, vnode, V_id(vp),
bitNumberToVnodeNumber(vnodeIndex, class), flag);
+#ifndef AFS_PTHREAD_ENV
if (!flag)
IOMGR_Poll(); /* if we dont' xfr data, but scan instead, could lose conn */
+#endif
}
STREAM_CLOSE(file);
FDH_CLOSE(fdP);
#include <afs/afsint.h>
#include <stdio.h>
#include <signal.h>
+#ifdef AFS_PTHREAD_ENV
+#include <assert.h>
+#else /* AFS_PTHREAD_ENV */
#include <afs/assert.h>
+#endif /* AFS_PTHREAD_ENV */
#include <afs/prs_fs.h>
#include <afs/nfs.h>
#include <lwp.h>
extern int (*vol_PollProc) ();
extern struct volser_trans *TransList();
+#ifndef AFS_PTHREAD_ENV
extern int IOMGR_Poll();
+#endif
char *GlobalNameHack = NULL;
int hackIsIn = 0;
afs_int32 GlobalVolCloneId, GlobalVolParentId;
while (1) {
tv.tv_sec = GCWAKEUP;
tv.tv_usec = 0;
+#ifdef AFS_PTHREAD_ENV
+ select(0, 0, 0, 0, &tv);
+#else
(void)IOMGR_Select(0, 0, 0, 0, &tv);
+#endif
GCTrans();
TryUnlock();
loop++;
if (TTsleep) {
while (1) {
+#ifdef AFS_PTHREAD_ENV
+ sleep(TTrun);
+#else /* AFS_PTHREAD_ENV */
IOMGR_Sleep(TTrun);
+#endif
for (tt = TransList(); tt; tt = tt->next) {
if ((strcmp(tt->lastProcName, "DeleteVolume") == 0)
|| (strcmp(tt->lastProcName, "Clone") == 0)
int argc;
char **argv;
{
- char *pid;
register afs_int32 code;
struct rx_securityClass *(securityObjects[3]);
struct rx_service *service;
#endif
VInitVolumePackage(volumeUtility, 0, 0, CONNECT_FS, 0);
DInit(40);
+#ifndef AFS_PTHREAD_ENV
vol_PollProc = IOMGR_Poll; /* tell vol pkg to poll io system periodically */
+#endif
#ifndef AFS_NT40_ENV
rxi_syscallp = volser_syscall;
#endif
OpenLog(AFSDIR_SERVER_VOLSERLOG_FILEPATH);
SetupLogSignals();
- /* create the lwp to garbage-collect old transactions and sleep periodically */
- LWP_CreateProcess(BKGLoop, 16 * 1024, 3, (void *)0, "vol bkg daemon",
- &pid);
- LWP_CreateProcess(BKGSleep, 16 * 1024, 3, (void *)0, "vol slp daemon",
- &pid);
+ {
+#ifdef AFS_PTHREAD_ENV
+ pthread_t tid;
+ pthread_attr_t tattr;
+ assert(pthread_attr_init(&tattr) == 0);
+ assert(pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) == 0);
+
+ assert(pthread_create(&tid, &tattr, BKGLoop, NULL) == 0);
+ assert(pthread_create(&tid, &tattr, BKGSleep, NULL) == 0);
+#else
+ PROCESS pid;
+ LWP_CreateProcess(BKGLoop, 16*1024, 3, 0, "vol bkg daemon", &pid);
+ LWP_CreateProcess(BKGSleep,16*1024, 3, 0, "vol slp daemon", &pid);
+#endif
+ }
/* Create a single security object, in this case the null security object, for unauthenticated connections, which will be used to control security on connections made to this server */
#include <rx/rxkad.h>
#include <afs/afsint.h>
#include <signal.h>
+#ifdef AFS_PTHREAD_ENV
+#include <assert.h>
+#else /* AFS_PTHREAD_ENV */
#include <afs/assert.h>
+#endif /* AFS_PTHREAD_ENV */
#include <afs/prs_fs.h>
#include <afs/nfs.h>
#include <lwp.h>
if (volid == volumeId) { /*copy other things too */
found = 1;
+#ifndef AFS_PTHREAD_ENV
IOMGR_Poll(); /*make sure that the client doesnot time out */
+#endif
ttc = NewTrans(volid, partid);
if (!ttc) {
pntr->status = VBUSY;
* doesn't time out) and to set up a transaction on the volume.
*/
found = 1;
+#ifndef AFS_PTHREAD_ENV
IOMGR_Poll();
+#endif
ttc = NewTrans(currVolID, a_partID);
if (!ttc) {
/*
}
if (flags) { /*copy other things too */
+#ifndef AFS_PTHREAD_ENV
IOMGR_Poll(); /*make sure that the client doesnot time out */
+#endif
ttc = NewTrans(volid, partid);
if (!ttc) {
pntr->status = VBUSY;
* Full info about the volume desired. Poll to make sure the
* client doesn't time out, then start up a new transaction.
*/
+#ifndef AFS_PTHREAD_ENV
IOMGR_Poll();
+#endif
ttc = NewTrans(volid, a_partID);
if (!ttc) {
/*
#ifndef _VOLSER_
#define _VOLSER_ 1
+
+#ifdef AFS_PTHREAD_ENV
+#include <assert.h>
+#include <pthread.h>
+#endif
+
/* vflags, representing state of the volume */
#define VTDeleteOnSalvage 1 /* delete on next salvage */
#define VTOutOfService 2 /* never put this volume online */