void filesrv::gotdds (bool ok) { if (!ok) { (*cb) (false); return; } u_int8_t key[sha1::hashsize]; privkey->get_privkey_hash (key, hostid); fhkey.setkey (key, sizeof (key)); bzero (key, sizeof (key)); for (filesys *fsp = fstab.base (); fsp < fstab.lim (); fsp++) { if (fsp == fsp->parent) /* Make sure readdir returns unique fileid for /.., since an * accessible copy of /.. may reside somewhere else in the file * system and otherwise break pwd. */ fsp->inotab->insert (fsp->fileid_root_dd, 1); else { fsp->parent->inotab->insert (fsp->fileid_mntpt, fsidino2ino (fsp->fsid, fsp->fileid_root)); fsp->inotab->insert (fsp->fileid_root_dd, fsidino2ino (fsp->parent->fsid, fsp->fileid_mntpt_dd)); } } #if 0 for (filesys *fsp = fstab.base (); fsp < fstab.lim (); fsp++) { warnx << fsp->path_mntpt << ":\n"; warnx ("fsid 0x%qx, / 0x%qx, /.. 0x%qx, mp 0x%qx, mp/.. 0x%qx\n", fsp->fsid, fsp->fileid_root, fsp->fileid_root_dd, fsp->fileid_mntpt, fsp->fileid_mntpt_dd); fsp->inotab->traverse (wrap (dumpsubst)); } #endif fh3trans fht (fh3trans::ENCODE, fhkey, 0); fsinfo.set_prog (ex_NFS_PROGRAM); fsinfo.nfs->set_vers (ex_NFS_V3); fsinfo.nfs->v3->root = fstab[0].fh_root; if (!rpc_traverse (fht, fsinfo.nfs->v3->root)) fatal ("filesrv::finish: nfs3_transres encode failed (err %d)\n", fht.err); fsinfo.nfs->v3->subfs.setsize (fstab.size () - 1); for (size_t i = 1; i < fstab.size (); i++) { fsinfo.nfs->v3->subfs[i-1].path = fstab[i].path_mntpt; fsinfo.nfs->v3->subfs[i-1].fh = fstab[i].fh_root; fht.srvno = i; if (!rpc_traverse (fht, fsinfo.nfs->v3->subfs[i-1].fh)) fatal ("filesrv::finish: nfs3_transres encode failed (err %d)\n", fht.err); } cb_t c = cb; cb = NULL; (*c) (true); }
bool rpc_traverse (XDR *xdrs, dbrec_rev &obj) { if (!rpc_traverse (xdrs, implicit_cast<sfsauth_dbrec &> (obj))) return false; if (rpc_traverse (xdrs, obj.dbrev)) return true; if (xdrs->x_op != XDR_DECODE) return false; obj.dbrev = 0; return true; }
BOOL xdr_int (XDR *xdrs, void *objp) { u_int32_t val; switch (xdrs->x_op) { case XDR_ENCODE: val = *static_cast<int *> (objp); return rpc_traverse (xdrs, val); case XDR_DECODE: if (!rpc_traverse (xdrs, val)) return false; *static_cast<int *> (objp) = val; default: return true; } }
bool rpc_traverse (attrvec &av, link3wcc &obj) { rpc_traverse (av, obj.file_attributes); attrinfo &x = av.push_back (); x.fh = &reinterpret_cast<link3args *> (av[0].fh)->link.dir; x.set_wcc (&obj.linkdir_wcc); return true; }
bool rpc_traverse (attrvec &av, rename3wcc &obj) { rpc_traverse (av, obj.fromdir_wcc); attrinfo &x = av.push_back (); x.fh = &reinterpret_cast<rename3args *> (av[0].fh)->to.dir; x.set_wcc (&obj.todir_wcc); return true; }
bool nfs3_transarg (fh3trans &fht, void *objp, u_int32_t proc) { switch (proc) { NFS_PROGRAM_3_APPLY_NONULL (transarg); case NFSPROC_CLOSE: if (rpc_traverse (fht, *static_cast<nfs_fh3 *>(objp))) return true; if (!fht.err) fht.err = NFS3ERR_INVAL; return false; break; default: panic ("nfs3_transarg: bad proc %d\n", proc); } }
BOOL xdr_string (XDR *xdrs, void *objp) { return rpc_traverse (xdrs, *static_cast<rpc_str<RPC_INFINITY> *> (objp)); }