00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <pthread.h>
00026 #include "VestaSource.H"
00027 #include "VDirSurrogate.H"
00028 #include "MultiSRPC.H"
00029 #include "VestaSourceSRPC.H"
00030
00031 static pthread_once_t once2 = PTHREAD_ONCE_INIT;
00032 static VestaSource* repositoryRoot;
00033 static VestaSource* mutableRoot;
00034 static VestaSource* volatileRoot;
00035
00036 extern "C"
00037 {
00038 void
00039 VDirSurrogate_init2()
00040 {
00041 ::repositoryRoot = NEW_CONSTR(VDirSurrogate,
00042 (2, NullShortId,
00043 VDirSurrogate::defaultHost(),
00044 VDirSurrogate::defaultPort()));
00045 ::repositoryRoot->longid = RootLongId;
00046 ::repositoryRoot->resync();
00047 ::mutableRoot = NEW_CONSTR(VDirSurrogate,
00048 (2, NullShortId,
00049 VDirSurrogate::defaultHost(),
00050 VDirSurrogate::defaultPort()));
00051 ::mutableRoot->longid = MutableRootLongId;
00052 ::mutableRoot->resync();
00053 ::volatileRoot = NEW_CONSTR(VDirSurrogate,
00054 (2, NullShortId,
00055 VDirSurrogate::defaultHost(),
00056 VDirSurrogate::defaultPort()));
00057 ::volatileRoot->longid = VolatileRootLongId;
00058 ::volatileRoot->resync();
00059 }
00060 }
00061
00062 VestaSource*
00063 LongId::lookup(lockKindTag lockKind, ReadersWritersLock** lock)
00064 throw (SRPC::failure)
00065 {
00066 assert(lockKind == LongId::noLock);
00067 assert(lock == NULL);
00068 return VDirSurrogate::LongIdLookup(*this, VDirSurrogate::defaultHost(),
00069 VDirSurrogate::defaultPort());
00070 }
00071
00072 bool
00073 LongId::valid()
00074 throw (SRPC::failure)
00075 {
00076 return VDirSurrogate::LongIdValid(*this, VDirSurrogate::defaultHost(),
00077 VDirSurrogate::defaultPort());
00078 }
00079
00080 VestaSource*
00081 VestaSource::repositoryRoot(LongId::lockKindTag lockKind,
00082 ReadersWritersLock** lock)
00083 throw (SRPC::failure)
00084 {
00085 assert(lockKind == LongId::noLock);
00086 assert(lock == NULL);
00087 pthread_once(&once2, VDirSurrogate_init2);
00088 return ::repositoryRoot;
00089 }
00090
00091 VestaSource*
00092 VestaSource::mutableRoot(LongId::lockKindTag lockKind,
00093 ReadersWritersLock** lock)
00094 throw (SRPC::failure)
00095 {
00096 assert(lockKind == LongId::noLock);
00097 assert(lock == NULL);
00098 pthread_once(&once2, VDirSurrogate_init2);
00099 return ::mutableRoot;
00100 }
00101
00102 VestaSource*
00103 VestaSource::volatileRoot(LongId::lockKindTag lockKind,
00104 ReadersWritersLock** lock)
00105 throw (SRPC::failure)
00106 {
00107 assert(lockKind == LongId::noLock);
00108 assert(lock == NULL);
00109 pthread_once(&once2, VDirSurrogate_init2);
00110 return ::volatileRoot;
00111 }
00112
00113 VestaSource::errorCode
00114 VestaSource::lookupPathname(const char* pathname, VestaSource*& result,
00115 AccessControl::Identity who, char pathnameSep)
00116 throw (SRPC::failure)
00117 {
00118 assert(false);
00119 return VestaSource::inappropriateOp;
00120 }
00121
00122 VestaSource::errorCode
00123 VestaSource::makeMutable(VestaSource*& result, ShortId sid,
00124 Basics::uint64 copyMax, AccessControl::Identity who)
00125 throw (SRPC::failure)
00126 {
00127 assert(false);
00128 return VestaSource::inappropriateOp;
00129 }
00130
00131 VestaSource::errorCode
00132 VestaSource::copyToMutable(VestaSource*& result,
00133 AccessControl::Identity who)
00134 throw (SRPC::failure)
00135 {
00136 assert(false);
00137 return VestaSource::inappropriateOp;
00138 }
00139
00140 VestaSource::errorCode
00141 VestaSource::makeFilesImmutable(unsigned int threshold,
00142 AccessControl::Identity who)
00143 throw (SRPC::failure)
00144 {
00145 assert(false);
00146 return VestaSource::inappropriateOp;
00147 }
00148
00149 VestaSource* VestaSource::getParent() throw (SRPC::failure)
00150 {
00151 LongId parent_lid = this->longid.getParent();
00152 if(!(parent_lid == NullLongId))
00153 return VDirSurrogate::LongIdLookup(parent_lid, this->host(), this->port());
00154 return NULL;
00155 }
00156
00157 bool
00158 VestaAttribs::inAttribs(const char* name, const char* value)
00159 throw (SRPC::failure)
00160 {
00161 assert(false);
00162 return false;
00163 }
00164
00165 char*
00166 VestaAttribs::getAttrib(const char* name)
00167 throw (SRPC::failure)
00168 {
00169 assert(false);
00170 return NULL;
00171 }
00172
00173 void
00174 VestaAttribs::getAttrib(const char* name,
00175 VestaSource::valueCallback cb, void* cl)
00176 {
00177 assert(false);
00178 }
00179
00180 void
00181 VestaAttribs::listAttribs(VestaSource::valueCallback cb, void* cl)
00182 {
00183 assert(false);
00184 }
00185
00186 void
00187 VestaAttribs::getAttribHistory(VestaSource::historyCallback cb, void* cl)
00188 {
00189 assert(false);
00190 }
00191
00192 VestaSource::errorCode
00193 VestaAttribs::writeAttrib(VestaSource::attribOp op,
00194 const char* name, const char* value,
00195 time_t ×tamp) throw ()
00196 {
00197 assert(false);
00198 return VestaSource::inappropriateOp;
00199 }
00200
00201 VestaSource::errorCode
00202 VestaSource::writeAttrib(VestaSource::attribOp op,
00203 const char* name, const char* value,
00204 AccessControl::Identity who, time_t timestamp)
00205 throw (SRPC::failure)
00206 {
00207 assert(false);
00208 return VestaSource::inappropriateOp;
00209 }
00210
00211 VestaSource::errorCode
00212 VestaSource::cedeMastership(const char* requestid, const char** grantidOut,
00213 AccessControl::Identity who) throw (SRPC::failure)
00214 {
00215 assert(false);
00216 return VestaSource::inappropriateOp;
00217 }
00218
00219 const char*
00220 AccessControl::GlobalIdentityRep::user(int n) throw ()
00221 {
00222 if (n == 0) {
00223 return user_;
00224 } else {
00225
00226
00227 return NULL;
00228 }
00229 }
00230
00231 const char*
00232 AccessControl::GlobalIdentityRep::group(int n) throw ()
00233 {
00234 assert("server side only" && false);
00235 return NULL;
00236 }
00237
00238 void AccessControl::GlobalIdentityRep::fill_caches() throw()
00239 {
00240 assert("server side only" && false);
00241 }
00242
00243 uid_t
00244 AccessControl::globalToUnixUser(const char* name) throw ()
00245 {
00246 assert("server side only" && false);
00247 return (uid_t) -1;
00248 }
00249
00250 gid_t
00251 AccessControl::globalToUnixGroup(const char* name) throw ()
00252 {
00253 assert("server side only" && false);
00254 return (gid_t) -1;
00255 }
00256
00257 const char*
00258 AccessControl::UnixIdentityRep::user(int n) throw ()
00259 {
00260 assert("server side only" && false);
00261 return NULL;
00262 }
00263
00264 const char*
00265 AccessControl::UnixIdentityRep::group(int n) throw ()
00266 {
00267 assert("server side only" && false);
00268 return NULL;
00269 }
00270
00271 void AccessControl::UnixIdentityRep::fill_caches() throw()
00272 {
00273 assert("server side only" && false);
00274 }