Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

glue.C File Reference

#include <pthread.h>
#include <errno.h>
#include <iomanip>
#include "VestaSource.H"
#include "ShortIdBlock.H"
#include "FdCache.H"
#include "VRConcurrency.H"
#include "VLogHelp.H"
#include "VestaConfig.H"
#include "Mastership.H"
#include "nfsd.H"
#include "logging.H"
#include <assert.h>
#include "VestaSourceImpl.H"
#include "CharsSeq.H"
#include "CopyShortId.H"
#include "timing.H"
#include "lock_timing.H"
#include <BufStream.H>

Go to the source code of this file.

Defines

#define VR_FSID   nfs_port
#define VR_RDEV   9999
#define VR_BLOCKSIZE   NFS_MAXDATA
#define VR_BLOCKUNIT   512
#define VR_DEFAULT_COW_MAX   4
#define DP_SLOP   16

Functions

nfsstat xlate_errno (int errno_val)
nfsstat xlate_vserr (VestaSource::errorCode err)
void file_fattr (fattr *attr, struct stat *st, VestaSource *vs)
bool attrModTimeCallback (void *closure, VestaSource::attribOp op, const char *name, const char *value, time_t timestamp)
time_t attrModTime (VestaSource *vs)
nfsstat any_fattr (fattr *attr, VestaSource *vs, int fd)
VestaSourcedo_cow (VestaSource *vs, nfsstat *status, Basics::uint64 len=((Basics::uint64)-1))
nfsstat do_getattr (nfs_fh *fh, fattr *attr, AccessControl::Identity cred)
nfsstat apply_sattr (sattr *newattr, VestaSource *vs, int fd, AccessControl::Identity cred, fattr *attr)
nfsstat do_setattr (sattrargs *argp, fattr *attr, AccessControl::Identity cred)
nfsstat do_lookup (diropargs *dopa, diropokres *dp, AccessControl::Identity cred)
int fh_fd (nfs_fh *fh, nfsstat *status, int omode, VestaSource **vsout, int *oflout, AccessControl::Identity cred)
void fd_inactive (void *vsin, int fd, int ofl)
nfsstat do_readdir (readdirargs *argp, result_types *resp, AccessControl::Identity cred)
nfsstat do_create (createargs *argp, diropokres *dp, AccessControl::Identity cred)
bool namelistCallback (void *closure, VestaSource::typeTag type, Arc arc, unsigned int index, Bit32 pseudoInode, ShortId filesid, bool master)
bool dirEmptyCallback (void *closure, VestaSource::typeTag type, Arc arc, unsigned int index, Bit32 pseudoInode, ShortId filesid, bool master)
nfsstat do_remove (diropargs *argp, AccessControl::Identity cred)
nfsstat do_rename (renameargs *argp, AccessControl::Identity cred)
nfsstat do_hardlink (linkargs *argp, AccessControl::Identity cred)
nfsstat do_symlink (symlinkargs *argp, AccessControl::Identity cred)
nfsstat do_mkdir (createargs *argp, diropokres *dp, AccessControl::Identity cred)
nfsstat do_readlink (nfs_fh *fh, nfspath np, AccessControl::Identity cred)
nfsstat do_statfs (nfs_fh *argp, result_types *resp, AccessControl::Identity cred)
void GlueInit ()

Variables

int nfs_port
bool shortIdSymlink = false
Text shortIdSymlinkPrefix
int shortIdSymlinkLength = 0
bool allowSymlink = false
bool bsdChown = false
int cowMax = VR_DEFAULT_COW_MAX
CowInProgresscowInProgress
struct {
   nfsstat   error
   int   errno_val
nfs_errtbl []


Define Documentation

#define DP_SLOP   16
 

Definition at line 1416 of file glue.C.

#define VR_BLOCKSIZE   NFS_MAXDATA
 

Definition at line 72 of file glue.C.

Referenced by any_fattr().

#define VR_BLOCKUNIT   512
 

Definition at line 73 of file glue.C.

Referenced by any_fattr().

#define VR_DEFAULT_COW_MAX   4
 

Definition at line 74 of file glue.C.

#define VR_FSID   nfs_port
 

Definition at line 70 of file glue.C.

Referenced by any_fattr(), and file_fattr().

#define VR_RDEV   9999
 

Definition at line 71 of file glue.C.

Referenced by any_fattr(), and file_fattr().


Function Documentation

nfsstat any_fattr fattr *  attr,
VestaSource vs,
int  fd
 

Definition at line 292 of file glue.C.

References VestaSource::ac, FdCache::any, VestaSource::appendableDirectory, attrModTime(), FdCache::close(), VestaSource::device, VestaSource::evaluatorDirectory, VestaSource::evaluatorROEDirectory, file_fattr(), FileShortIdRootLongId, VestaAttribs::getAttrib(), VestaAttribs::getAttribConst(), LongId::getParent(), VestaSource::ghost, AccessControl::group, ToUnixIdClosure::id, VestaSource::immutableDirectory, VestaSource::immutableFile, LongId::isAncestorOf(), VestaSource::longid, VestaSource::master, AccessControl::mode, VestaSource::mutableDirectory, VestaSource::mutableFile, AccessControl::owner, VestaSource::pseudoInode, RECORD_TIME_POINT, RootLongId, ToUnixIdClosure::setid, VestaSource::shortId(), shortIdSymlink, shortIdSymlinkLength, ShortIdBlock::shortIdToName(), VestaSource::size(), VestaSource::stub, VestaSource::timestamp(), FdCache::tryopen(), VestaSource::type, AccessControl::vforeignGroup, AccessControl::vforeignUser, VestaSource::volatileDirectory, VestaSource::volatileROEDirectory, VR_BLOCKSIZE, VR_BLOCKUNIT, VR_FSID, VR_RDEV, ToUnixIdClosure::vs, and xlate_errno().

Referenced by apply_sattr(), do_getattr(), do_lookup(), nfsd_nfsproc_read_2(), and nfsd_nfsproc_write_2().

nfsstat apply_sattr sattr *  newattr,
VestaSource vs,
int  fd,
AccessControl::Identity  cred,
fattr *  attr
 

Definition at line 777 of file glue.C.

References VestaSource::ac, VestaSource::addAttrib(), AccessControl::administrative, FdCache::any, any_fattr(), bsdChown, AccessControl::check(), FdCache::close(), VestaLog::commit(), file_fattr(), AccessControl::formatModeBits(), AccessControl::group, VestaSource::immutableDirectory, VestaSource::immutableFile, VRErrorCode::invalidArgs, LongId::isAncestorOf(), VestaSource::longid, VestaSource::master, AccessControl::mode, VestaSource::mutableFile, MutableRootLongId, VRErrorCode::ok, ok(), FdCache::open(), AccessControl::owner, AccessControl::ownership, RECORD_TIME_POINT, VestaSource::removeAttrib(), FdCache::ro, RootLongId, FdCache::rw, VestaSource::setAttrib(), VestaSource::setTimestamp(), VestaSource::shortId(), ShortIdBlock::shortIdToName(), VestaLog::start(), VestaSource::timestamp(), VestaSource::type, AccessControl::unixToGlobalGroup(), AccessControl::unixToGlobalUser(), VRLog, AccessControl::write, xlate_errno(), and xlate_vserr().

Referenced by do_create(), do_mkdir(), and do_setattr().

time_t attrModTime VestaSource vs  ) 
 

Definition at line 282 of file glue.C.

References attrModTimeCallback(), and AttrModTimeClosure::time.

Referenced by any_fattr().

bool attrModTimeCallback void *  closure,
VestaSource::attribOp  op,
const char *  name,
const char *  value,
time_t  timestamp
 

Definition at line 273 of file glue.C.

References AttrModTimeClosure::time.

Referenced by attrModTime().

bool dirEmptyCallback void *  closure,
VestaSource::typeTag  type,
Arc  arc,
unsigned int  index,
Bit32  pseudoInode,
ShortId  filesid,
bool  master
 

Definition at line 1708 of file glue.C.

Referenced by do_remove().

VestaSource* do_cow VestaSource vs,
nfsstat *  status,
Basics::uint64  len = ((Basics::uint64)-1)
 

Definition at line 530 of file glue.C.

References CowInProgress::active, Basics::cond::broadcast(), CopyShortId(), cowMax, DBG_ALWAYS, DBG_COW, Repos::dprintf(), error, VestaSource::immutableFile, Repos::isDebugLevel(), Basics::mutex::lock(), CowInProgress::longid, VestaSource::longid, LongId::lookup(), VestaSource::makeMutable(), VestaSource::mutableFile, NullShortId, VRErrorCode::ok, LongId::readLock, ReadersWritersLock::releaseRead(), RWLOCK_LOCKED_REASON, VestaSource::shortId(), Basics::OBufStream::str(), VestaSource::type, Basics::mutex::unlock(), Basics::cond::wait(), LongId::writeLock, xlate_errno(), and xlate_vserr().

Referenced by do_hardlink(), do_setattr(), and fh_fd().

nfsstat do_create createargs *  argp,
diropokres *  dp,
AccessControl::Identity  cred
 

Definition at line 1568 of file glue.C.

References VestaSource::appendableDirectory, apply_sattr(), FdCache::close(), VestaSource::dontReplace, VestaSource::evaluatorDirectory, VestaSource::evaluatorROEDirectory, SourceOrDerived::fdcreate(), VestaSource::immutableDirectory, VestaSource::insertMutableFile(), VestaSource::longid, VestaSource::lookup(), VestaSource::makeMutable(), VestaSource::mutableDirectory, VRErrorCode::notFound, NullLongId, VRErrorCode::ok, RECORD_TIME_POINT, FdCache::rw, RWLOCK_LOCKED_REASON, VestaSource::type, VestaSource::volatileDirectory, VestaSource::volatileROEDirectory, LongId::writeLock, xlate_errno(), and xlate_vserr().

Referenced by nfsd_nfsproc_create_2().

nfsstat do_getattr nfs_fh *  fh,
fattr *  attr,
AccessControl::Identity  cred
 

Definition at line 648 of file glue.C.

References any_fattr(), VestaSource::immutableFile, VestaSource::lookup(), VestaSource::mutableFile, NullLongId, LongId::readLock, RECORD_TIME_POINT, RWLOCK_LOCKED_REASON, and VestaSource::type.

Referenced by nfsd_nfsproc_getattr_2().

nfsstat do_hardlink linkargs *  argp,
AccessControl::Identity  cred
 

Definition at line 2032 of file glue.C.

References LongId::checkLock, do_cow(), VestaSource::dontReplace, VestaSource::evaluatorDirectory, VestaSource::evaluatorROEDirectory, FileShortIdRootLongId, VestaSource::fptag, LongId::getParent(), VestaSource::immutableDirectory, VestaSource::immutableFile, VestaSource::insertFile(), VestaSource::insertMutableFile(), LongId::isAncestorOf(), VestaSource::longid, VestaSource::lookup(), VestaSource::makeMutable(), VestaSource::mutableDirectory, VestaSource::mutableFile, MutableRootLongId, NullLongId, VRErrorCode::ok, ReadersWritersLock::release(), ReadersWritersLock::releaseWrite(), RWLOCK_LOCKED_REASON, VestaSource::shortId(), VestaSource::type, VestaSource::volatileDirectory, VestaSource::volatileROEDirectory, VolatileRootLongId, LongId::writeLock, and xlate_vserr().

Referenced by nfsd_nfsproc_link_2().

nfsstat do_lookup diropargs *  dopa,
diropokres *  dp,
AccessControl::Identity  cred
 

Definition at line 1181 of file glue.C.

References any_fattr(), VestaSource::appendableDirectory, VestaSource::evaluatorDirectory, VestaSource::evaluatorROEDirectory, LongId::getParent(), VestaSource::immutableDirectory, VestaSource::immutableFile, VestaSource::longid, LongId::lookup(), VestaSource::lookup(), VestaSource::mutableDirectory, VestaSource::mutableFile, NullLongId, VRErrorCode::ok, LongId::readLock, RECORD_TIME_POINT, RWLOCK_LOCKED_REASON, TIMING_RECORD_LONGID, VestaSource::type, LongId::value, VestaSource::volatileDirectory, VestaSource::volatileROEDirectory, and xlate_vserr().

nfsstat do_mkdir createargs *  argp,
diropokres *  dp,
AccessControl::Identity  cred
 

Definition at line 2261 of file glue.C.

References VestaSource::appendableDirectory, apply_sattr(), Text::cchars(), VestaLog::commit(), VestaSource::dontReplace, Text::Empty(), VestaSource::evaluatorDirectory, VestaSource::evaluatorROEDirectory, VestaSource::immutableDirectory, VestaSource::insertAppendableDirectory(), VestaSource::insertMutableDirectory(), VestaSource::longid, VestaSource::lookup(), VestaSource::makeMutable(), VestaSource::master, VestaSource::mutableDirectory, myMasterHint, VRErrorCode::notFound, NullLongId, VRErrorCode::ok, RECORD_TIME_POINT, ReadersWritersLock::releaseWrite(), RWLOCK_LOCKED_REASON, VestaSource::setAttrib(), VestaLog::start(), VestaSource::type, VestaSource::volatileDirectory, VestaSource::volatileROEDirectory, VRLog, LongId::writeLock, and xlate_vserr().

Referenced by nfsd_nfsproc_mkdir_2().

nfsstat do_readdir readdirargs *  argp,
result_types resp,
AccessControl::Identity  cred
 

Definition at line 1451 of file glue.C.

References VestaSource::appendableDirectory, readdirClosure::cookie_incr, readdirClosure::count, readdirClosure::e, VestaSource::evaluatorDirectory, VestaSource::evaluatorROEDirectory, readdirClosure::first, readdirClosure::full, LongId::getParent(), VestaSource::immutableDirectory, VestaSource::list(), VestaSource::longid, VestaSource::mutableDirectory, NullLongId, NullShortId, VestaSource::pseudoInode, result_types::r_readdirres, LongId::readLock, RECORD_TIME_POINT, readdirClosure::res_size, RWLOCK_LOCKED_REASON, TIMING_RECORD_LONGID, VestaSource::type, VestaSource::volatileDirectory, VestaSource::volatileROEDirectory, VolatileRootLongId, readdirClosure::vs, and xlate_vserr().

Referenced by nfsd_nfsproc_readdir_2().

nfsstat do_readlink nfs_fh *  fh,
nfspath  np,
AccessControl::Identity  cred
 

Definition at line 2400 of file glue.C.

References Text::cchars(), FileShortIdRootLongId, VestaAttribs::getAttribConst(), LongId::getParent(), VestaSource::ghost, LongId::isAncestorOf(), FindLastClosure::last, VestaSource::list(), VestaSource::longid, NullLongId, LongId::readLock, ReadersWritersLock::releaseRead(), RWLOCK_LOCKED_REASON, VestaSource::shortId(), shortIdSymlink, shortIdSymlinkLength, SourceOrDerived::shortIdToName(), VestaSource::stub, and VestaSource::type.

Referenced by nfsd_nfsproc_readlink_2().

nfsstat do_remove diropargs *  argp,
AccessControl::Identity  cred
 

Definition at line 1720 of file glue.C.

References VestaSource::ac, VestaSource::appendableDirectory, FP::ByteCnt, AccessControl::check(), AccessControl::del, dirEmptyCallback(), VestaSource::evaluatorDirectory, VestaSource::evaluatorROEDirectory, VestaSource::fptag, VestaSource::ghost, VestaSource::immutableDirectory, VestaSource::insertGhost(), VestaSource::list(), VestaSource::lookup(), VestaSource::lookupIndex(), VestaSource::makeMutable(), VestaSource::master, VestaSource::mutableDirectory, namelistCallback(), VRErrorCode::notFound, NullLongId, VRErrorCode::ok, VestaSource::reallyDelete(), ReadersWritersLock::releaseWrite(), VestaSource::replaceDiff, RWLOCK_LOCKED_REASON, VestaSource::setAttrib(), Basics::OBufStream::str(), VestaSource::stub, FP::Tag::ToBytes(), VestaSource::type, VestaSource::typeTagChar(), NamelistClosure::val, VestaSource::volatileDirectory, VestaSource::volatileROEDirectory, LongId::writeLock, and xlate_vserr().

Referenced by nfsd_nfsproc_remove_2(), and nfsd_nfsproc_rmdir_2().

nfsstat do_rename renameargs *  argp,
AccessControl::Identity  cred
 

Definition at line 1900 of file glue.C.

References VestaSource::ac, ReadersWritersLock::acquireRead(), VestaSource::appendableDirectory, AccessControl::check(), LongId::checkLock, AccessControl::del, VestaSource::evaluatorDirectory, VestaSource::evaluatorROEDirectory, VestaSource::immutableDirectory, LongId::isAncestorOf(), VestaSource::lookup(), VestaSource::makeMutable(), VestaSource::mutableDirectory, NullLongId, VRErrorCode::ok, ReadersWritersLock::releaseRead(), ReadersWritersLock::releaseWrite(), VestaSource::renameTo(), VestaSource::replaceDiff, RWLOCK_LOCKED_REASON, VestaSource::type, VestaSource::volatileDirectory, VestaSource::volatileROEDirectory, VolatileRootLock, VolatileRootLongId, LongId::writeLock, LongId::writeLockV, and xlate_vserr().

Referenced by nfsd_nfsproc_rename_2().

nfsstat do_setattr sattrargs *  argp,
fattr *  attr,
AccessControl::Identity  cred
 

Definition at line 1090 of file glue.C.

References apply_sattr(), VestaSource::copyToMutable(), do_cow(), VestaAttribs::hasAttribs(), VestaSource::immutableFile, LongId::isAncestorOf(), VestaSource::longid, VestaSource::lookup(), MutableRootLongId, NullLongId, VRErrorCode::ok, RECORD_TIME_POINT, ReadersWritersLock::releaseWrite(), RWLOCK_LOCKED_REASON, VestaSource::type, VolatileRootLongId, LongId::writeLock, and xlate_vserr().

Referenced by nfsd_nfsproc_setattr_2().

nfsstat do_statfs nfs_fh *  argp,
result_types resp,
AccessControl::Identity  cred
 

Definition at line 2478 of file glue.C.

References Text::cchars(), ok(), result_types::r_statfsres, and xlate_errno().

Referenced by nfsd_nfsproc_statfs_2().

nfsstat do_symlink symlinkargs *  argp,
AccessControl::Identity  cred
 

Definition at line 2173 of file glue.C.

References allowSymlink, VestaSource::appendableDirectory, VestaSource::dontReplace, VestaSource::ghost, VestaSource::insertStub(), VestaSource::lookup(), VestaSource::master, VRErrorCode::notFound, NullLongId, VRErrorCode::ok, RECORD_TIME_POINT, RWLOCK_LOCKED_REASON, VestaSource::stub, VestaSource::type, LongId::writeLock, and xlate_vserr().

Referenced by nfsd_nfsproc_symlink_2().

void fd_inactive void *  vsin,
int  fd,
int  ofl
 

Definition at line 1398 of file glue.C.

References FdCache::close(), DEVICE_FAKE_FD, and VestaSource::shortId().

Referenced by nfsd_nfsproc_read_2(), and nfsd_nfsproc_write_2().

int fh_fd nfs_fh *  fh,
nfsstat *  status,
int  omode,
VestaSource **  vsout,
int *  oflout,
AccessControl::Identity  cred
 

Definition at line 1274 of file glue.C.

References VestaSource::ac, FdCache::any, AccessControl::check(), VestaSource::device, DEVICE_FAKE_FD, do_cow(), error, VestaSource::immutableFile, LongId::isAncestorOf(), VestaSource::longid, VestaSource::mutableFile, MutableRootLongId, FdCache::open(), AccessControl::ownership, AccessControl::read, LongId::readLock, RECORD_TIME_POINT, FdCache::rw, RWLOCK_LOCKED_REASON, VestaSource::shortId(), VestaSource::type, VolatileRootLongId, AccessControl::write, and xlate_errno().

Referenced by nfsd_nfsproc_read_2(), and nfsd_nfsproc_write_2().

void file_fattr fattr *  attr,
struct stat *  st,
VestaSource vs
 

Definition at line 207 of file glue.C.

References VestaSource::ac, FileShortIdRootLongId, VestaAttribs::getAttrib(), AccessControl::group, ToUnixIdClosure::id, VestaSource::immutableFile, LongId::isAncestorOf(), VestaSource::linkCount(), VestaSource::longid, AccessControl::mode, AccessControl::owner, VestaSource::pseudoInode, RootLongId, ToUnixIdClosure::setid, VestaSource::type, AccessControl::vforeignGroup, AccessControl::vforeignUser, VR_FSID, VR_RDEV, and ToUnixIdClosure::vs.

Referenced by any_fattr(), and apply_sattr().

void GlueInit  ) 
 

Definition at line 2505 of file glue.C.

References CowInProgress::active, allowSymlink, bsdChown, Text::cchars(), FdCache::close(), cowMax, DBG_ALWAYS, Repos::dprintf(), VestaConfig::get(), VestaConfig::get_int(), VestaConfig::get_Text(), NEW_PTRFREE_ARRAY, and shortIdSymlink.

Referenced by main().

bool namelistCallback void *  closure,
VestaSource::typeTag  type,
Arc  arc,
unsigned int  index,
Bit32  pseudoInode,
ShortId  filesid,
bool  master
 

Definition at line 1698 of file glue.C.

References NamelistClosure::val.

Referenced by do_remove().

nfsstat xlate_errno int  errno_val  ) 
 

Definition at line 123 of file glue.C.

References Text::cchars(), DBG_ALWAYS, Repos::dprintf(), Basics::errno_Text(), error, and nfs_errtbl.

Referenced by any_fattr(), apply_sattr(), do_cow(), do_create(), do_statfs(), fh_fd(), nfsd_nfsproc_read_2(), and nfsd_nfsproc_write_2().

nfsstat xlate_vserr VestaSource::errorCode  err  ) 
 

Definition at line 138 of file glue.C.

References VRErrorCode::inappropriateOp, VRErrorCode::invalidArgs, VRErrorCode::isADirectory, VRErrorCode::longIdOverflow, VRErrorCode::nameInUse, VRErrorCode::nameTooLong, VRErrorCode::noPermission, VRErrorCode::notADirectory, VRErrorCode::notFound, VRErrorCode::notMaster, VRErrorCode::ok, VRErrorCode::outOfSpace, and VRErrorCode::rpcFailure.

Referenced by apply_sattr(), do_cow(), do_create(), do_hardlink(), do_lookup(), do_mkdir(), do_readdir(), do_remove(), do_rename(), do_setattr(), and do_symlink().


Variable Documentation

bool allowSymlink = false
 

Definition at line 80 of file glue.C.

Referenced by do_symlink(), and GlueInit().

bool bsdChown = false
 

Definition at line 81 of file glue.C.

Referenced by apply_sattr(), and GlueInit().

CowInProgress* cowInProgress
 

Definition at line 91 of file glue.C.

int cowMax = VR_DEFAULT_COW_MAX
 

Definition at line 86 of file glue.C.

Referenced by do_cow(), and GlueInit().

int errno_val
 

Definition at line 95 of file glue.C.

nfsstat error
 

Definition at line 94 of file glue.C.

Referenced by do_cow(), fh_fd(), and xlate_errno().

const { ... } nfs_errtbl[]
 

Referenced by xlate_errno().

int nfs_port
 

Definition at line 357 of file nfsd.C.

Referenced by main().

bool shortIdSymlink = false
 

Definition at line 77 of file glue.C.

Referenced by any_fattr(), do_readlink(), and GlueInit().

int shortIdSymlinkLength = 0
 

Definition at line 79 of file glue.C.

Referenced by any_fattr(), and do_readlink().

Text shortIdSymlinkPrefix
 

Definition at line 78 of file glue.C.


Generated on Mon May 8 00:49:03 2006 for Vesta by  doxygen 1.4.2