int VOLSER_AFSVolMonitor(struct rx_call *call, transDebugEntries *result) { int ret = 0; mlog_log(MDEBVOLDB, "VOLSER_AFSVolMonitor"); ret = VOLSERFAILEDOP; out: VOLSER_EXIT; return ret; }
static void callback_deref (struct ropa_cb *cb) { cb->ref--; mlog_log (MDEBROPA, "cb_deref: %x.%x.%x (%d)", cb->fid.Volume, cb->fid.Vnode, cb->fid.Unique, cb->ref); if (cb->ref == 0) { int ret = hashtabdel (ht_callbacks, cb); mlog_log (MDEBROPA, "cb_deref: removing %x.%x.%x", cb->fid.Volume, cb->fid.Vnode, cb->fid.Unique); assert (ret == 0); if (cb->li) listdel (lru_callback, cb->li); assert (listemptyp (cb->ccpairs)); memset (&cb->fid, 0, sizeof(cb->fid)); cb->li = listaddtail (lru_callback, cb); } }
int VOLSER_AFSVolDump(struct rx_call *call, const int32_t fromTrans, const int32_t fromDate) { int ret = 0; struct trans *trans; struct dp_part *dp; volume_handle *vh; mlog_log (MDEBVOLDB, "VOLSER_AFSVolDump: trans %d fromdate %d", fromTrans, fromDate); if (!sec_is_superuser(call)) { ret = VOLSERBAD_ACCESS; goto out; } ret = vld_verify_trans (fromTrans); if (ret) goto out; ret = vld_get_trans (fromTrans, &trans); if (ret) goto out; ret = volser_fetch_vh (trans->partition, trans->volid, &dp, &vh); if (ret) { vld_put_trans(trans); goto out; } if (fromDate != 0) { vld_put_trans(trans); ret = VOLSERFAILEDOP; goto out; } ret = generate_dump(call, vh); vld_put_trans (trans); out: VOLSER_EXIT; return ret; }
static struct ropa_ccpair * add_client (struct ropa_cb *cb, struct ropa_client *c) { struct timeval tv; struct ropa_ccpair cckey, *cc; assert (cb && c); cckey.client = c; cckey.cb = cb; cc = hashtabsearch (ht_ccpairs, &cckey); if (cc) { listdel (lru_ccpair, cc->li); cc->li = listaddhead (lru_ccpair, cc); return cc; } /* The reverse of these are in break_ccpair */ callback_ref (cb); client_ref (c); cc = listdeltail (lru_ccpair); DIAGNOSTIC_CHECK_CCPAIR(cc); cc->li = NULL; if (ccpairs_inuse_p (cc)) break_ccpair (cc, TRUE); /* XXX do it for real */ gettimeofday(&tv, NULL); cc->expire = tv.tv_sec + 3600; heap_insert (heap_ccpairs, cc, &cc->heap); LWP_NoYieldSignal (heap_ccpairs); cc->cb_li = listaddtail (cb->ccpairs, cc); cc->client = c; cc->cb = cb; cc->li = listaddhead (lru_ccpair, cc); hashtabadd (ht_ccpairs, cc); mlog_log (MDEBROPA, "add_client: added %x to callback %x.%x.%x", c->addr[0].addr_in, cb->fid.Volume, cb->fid.Vnode, cb->fid.Unique); return cc; }
int VOLSER_AFSVolXListVolumes(struct rx_call *call, const int32_t partID, const int32_t flags, xvolEntries *resultEntries) { int ret = 0; mlog_log(MDEBVOLDB, "VOLSER_AFSVolXListVolumes"); ret = VOLSERFAILEDOP; out: VOLSER_EXIT; return ret; }
int VOLSER_AFSVolGetNthVolume(struct rx_call *call, const int32_t index, int32_t *volume, int32_t *partition) { int ret = 0; mlog_log(MDEBVOLDB, "VOLSER_AFSVolGetNthVolume"); ret = VOLSERFAILEDOP; out: VOLSER_EXIT; return ret; }
int VOLSER_AFSVolSetDate(struct rx_call *call, const int32_t transid, const int32_t newDate) { int ret = 0; struct trans *trans; struct dp_part *dp; volume_handle *vh; mlog_log(MDEBVOLDB, "VOLSER_AFSVolSetDate"); if (!sec_is_superuser(call)) { ret = VOLSERBAD_ACCESS; goto out; } ret = vld_verify_trans(transid); if (ret) goto out; ret = vld_get_trans(transid, &trans); if (ret) goto out; ret = volser_fetch_vh (trans->partition, trans->volid, &dp, &vh); if (ret) { vld_put_trans(trans); goto out; } vh->info.creationDate = newDate; vld_info_write(vh); vld_free (vh); dp_free (dp); vld_put_trans(trans); out: VOLSER_EXIT; return ret; }
int VOLSER_AFSVolGetName(struct rx_call *call, const int32_t tid, char tname[256]) { int ret = 0; mlog_log(MDEBVOLDB, "VOLSER_AFSVolGetName"); if (!sec_is_superuser(call)) { ret = VOLSERBAD_ACCESS; goto out; } ret = VOLSERFAILEDOP; out: VOLSER_EXIT; return ret; }
int VOLSER_AFSVolSetForwarding(struct rx_call *call, const int32_t tid, const int32_t newsite) { int ret = 0; mlog_log(MDEBVOLDB, "VOLSER_AFSVolSetForwarding"); if (!sec_is_superuser(call)) { ret = VOLSERBAD_ACCESS; goto out; } ret = VOLSERFAILEDOP; out: VOLSER_EXIT; return ret; }
int VOLSER_AFSVolNukeVolume(struct rx_call *call, const int32_t partID, const int32_t volID) { int ret = 0; mlog_log(MDEBVOLDB, "VOLSER_AFSVolNukeVolume"); if (!sec_is_superuser(call)) { ret = VOLSERBAD_ACCESS; goto out; } ret = VOLSERFAILEDOP; out: VOLSER_EXIT; return ret; }
int VOLSER_AFSVolTransCreate(struct rx_call *call, const int32_t volume, const int32_t partition, const int32_t flags, int32_t *trans) { int ret = 0; struct dp_part *dp; volume_handle *vh; mlog_log(MDEBVOLDB, "VOLSER_AFSVolTransCreate"); if (!sec_is_superuser(call)) { ret = VOLSERBAD_ACCESS; goto out; } ret = volser_fetch_vh (partition, volume, &dp, &vh); if (ret) goto out; vld_free (vh); dp_free (dp); ret = vld_create_trans(partition, volume, trans); if (ret) goto out; ret = vld_trans_set_iflags(*trans, flags); if (ret) { vld_end_trans (*trans, NULL); goto out; } out: VOLSER_EXIT; return ret; }
int VOLSER_AFSVolDeleteVolume(struct rx_call *call, const int32_t transid) { int ret = 0; int32_t backstoretype = VLD_SVOL; struct trans *trans; struct dp_part *dp; mlog_log(MDEBVOLDB, "VOLSER_AFSVolDeleteVolume"); if (!sec_is_superuser(call)) { ret = VOLSERBAD_ACCESS; goto out; } ret = vld_verify_trans(transid); if (ret) goto out; ret = vld_get_trans(transid, &trans); if (ret) goto out; ret = dp_create (trans->partition, &dp); if (ret) { vld_put_trans (trans); goto out; } ret = vld_delete_volume (dp, trans->volid, backstoretype, 0); vld_put_trans(trans); out: VOLSER_EXIT; return ret; }
int VOLSER_AFSVolSignalRestore(struct rx_call *call, const char *name, const int32_t type, const int32_t pid, const int32_t cloneid) { int ret = 0; mlog_log(MDEBVOLDB, "VOLSER_AFSVolSignalRestore"); if (!sec_is_superuser(call)) { ret = VOLSERBAD_ACCESS; goto out; } ret = VOLSERFAILEDOP; out: VOLSER_EXIT; return ret; }
int VOLSER_AFSVolForward(struct rx_call *call, const int32_t fromTrans, const int32_t fromData, const struct destServer *destination, const int32_t destTrans, const struct restoreCookie *cookie) { int ret = 0; mlog_log(MDEBVOLDB, "VOLSER_AFSVolForward"); if (!sec_is_superuser(call)) { ret = VOLSERBAD_ACCESS; goto out; } ret = VOLSERFAILEDOP; out: VOLSER_EXIT; return ret; }
int VOLSER_AFSVolSetInfo(struct rx_call *call, const int32_t transid, const struct volintInfo *volinfo) { volume_handle *vh; int ret = 0; struct dp_part *dp; struct trans *trans; mlog_log(MDEBVOLDB, "VOLSER_AFSVolSetInfo" " trans %d name %s type %d parent %d volid %d backup %d", transid, volinfo->name, volinfo->type, volinfo->parentID, volinfo->volid, volinfo->backupID); if (!sec_is_superuser(call)) { ret = VOLSERBAD_ACCESS; goto out; } ret = vld_verify_trans(transid); if (ret) goto out; ret = vld_get_trans(transid, &trans); if (ret) goto out; ret = volser_fetch_vh (trans->partition, trans->volid, &dp, &vh); if (ret) { vld_put_trans(trans); goto out; } if (volinfo->name[0]) strlcpy(vh->info.name, volinfo->name, VNAMESIZE); if (volinfo->volid) vh->info.volid = volinfo->volid; if (volinfo->type) vh->info.type = volinfo->type; if (volinfo->backupID) vh->info.backupID = volinfo->backupID; if (volinfo->parentID) vh->info.parentID = volinfo->parentID; if (volinfo->cloneID) vh->info.cloneID = volinfo->cloneID; if (volinfo->status) vh->info.status = volinfo->status; if (volinfo->copyDate) vh->info.copyDate = volinfo->copyDate; if (volinfo->inUse) vh->info.inUse = volinfo->inUse; if (volinfo->creationDate) vh->info.creationDate = volinfo->creationDate; if (volinfo->backupDate) vh->info.backupDate = volinfo->backupDate; if (volinfo->dayUse != -1) vh->info.dayUse = volinfo->dayUse; if (volinfo->filecount) vh->info.filecount = volinfo->filecount; if (volinfo->maxquota != -1) vh->info.maxquota = volinfo->maxquota; if (volinfo->size) vh->info.size = volinfo->size; vld_info_write(vh); vld_free (vh); dp_free (dp); vld_put_trans(trans); out: VOLSER_EXIT; return ret; }
int ropa_getcallback (uint32_t host, uint16_t port, const struct AFSFid *fid, AFSCallBack *callback, int32_t voltype) { struct ropa_client *c; struct ropa_cb cbkey, *cb; struct ropa_ccpair *cc ; struct AFSFid callback_fid; debug_print_callbacks(); c = client_query (host, port); if (c == NULL) { mlog_log (MDEBROPA, "ropa_getcallback: didn't find client %x/%d", host, port); update_callback_time (DEFAULT_TIMEOUT, callback, CBSHARED); return 0; } /* * At this point the client should be firmly set * in the ropa client database. */ #if 0 if (c->have_outstanding_callbacks) break_outstanding_callbacks (c); #endif if (voltype == RWVOL) { callback_fid = *fid; } else { callback_fid.Volume = fid->Volume; callback_fid.Vnode = 0; callback_fid.Unique = 0; } cbkey.fid = callback_fid; cb = hashtabsearch (ht_callbacks, &cbkey); if (cb == NULL) { cb = listdeltail (lru_callback); DIAGNOSTIC_CHECK_CALLBACK(cb); cb->li = NULL; if (callback_inuse_p (cb)) { break_callback (cb, NULL, FALSE); callback_ref(cb); } else { callback_ref(cb); cb->li = listaddhead (lru_callback, cb); } cb->fid = callback_fid; hashtabadd (ht_callbacks, cb); mlog_log (MDEBROPA, "ropa_getcallback: added callback %x.%x.%x:%x", callback_fid.Volume, callback_fid.Vnode, callback_fid.Unique, host); } else { mlog_log (MDEBROPA, "ropa_getcallback: found callback %x.%x.%x:%x", callback_fid.Volume, callback_fid.Vnode, callback_fid.Unique, host); callback_ref(cb); } cc = add_client (cb, c); callback_deref (cb); update_callback (cc, callback, CBSHARED); debug_print_callbacks(); return 0; }