if ((amode & VWRITE) && (AFS_IS_DISCONNECTED && !AFS_IS_DISCON_RW)) {
afs_PutFakeStat(&fakestate);
AFS_DISCON_UNLOCK();
- printf("Network is down in afs_vnop_access\n");
+ /* printf("Network is down in afs_vnop_access\n"); */
return ENETDOWN;
}
/* Get a new dcache for it first. */
new_dc = afs_GetDCache(tvc, (afs_size_t) 0, &treq, &offset, &len, 1);
if (!new_dc) {
- printf("afs_mkdir: can't get new dcache for dir.\n");
+ /* printf("afs_mkdir: can't get new dcache for dir.\n"); */
code = ENOENT;
goto done;
}
(afs_int32 *) &newFid.Fid,
(afs_int32 *) &adp->f.fid.Fid);
ReleaseWriteLock(&afs_xdcache);
- if (code)
- printf("afs_mkdir: afs_dirMakeDir code = %u\n", code);
+ /* if (code) printf("afs_mkdir: afs_dirMakeDir code = %u\n", code); */
afs_PutDCache(new_dc);
if (!tdc) {
ReleaseWriteLock(&adp->lock);
- printf("afs_rmdir: No local dcache!\n");
+ /* printf("afs_rmdir: No local dcache!\n"); */
code = ENETDOWN;
goto done;
}
ReleaseSharedLock(&afs_xvcache);
if (!tvc) {
- printf("afs_rmdir: Can't find dir's vcache!\n");
+ /* printf("afs_rmdir: Can't find dir's vcache!\n"); */
ReleaseSharedLock(&tdc->lock);
afs_PutDCache(tdc); /* drop ref count */
ReleaseWriteLock(&adp->lock);
#ifdef AFS_DISCON_ENV
if (AFS_IS_DISCONNECTED && (afs_DCacheMissingChunks(tvc) != 0)) {
ReleaseReadLock(&tvc->lock);
- printf("Network is down in afs_open: missing chunks\n");
+ /* printf("Network is down in afs_open: missing chunks\n"); */
code = ENETDOWN;
goto done;
}
(tvc, ((tvc->f.states & CForeign) ? PRSFS_READ : PRSFS_LOOKUP),
&treq, CHECK_MODE_BITS)) {
code = EACCES;
- printf("afs_Open: no access for dir\n");
+ /* printf("afs_Open: no access for dir\n"); */
goto done;
}
}
tdc = afs_GetDCache(avc, 0, areq, &offset, &len, 0);
if (!tdc) {
- printf("afs_DisconCreateSymlink: can't get new dcache for symlink.\n");
+ /* printf("afs_DisconCreateSymlink: can't get new dcache for symlink.\n"); */
return ENOENT;
}
* high-level write op.
*/
if (avc->execsOrWriters <= 0) {
- printf("WARNING: afs_ufswr vp=%lx, exOrW=%d\n", (unsigned long)avc,
+ afs_warn("WARNING: afs_ufswr vp=%lx, exOrW=%d\n", (unsigned long)avc,
avc->execsOrWriters);
}
#else
* high-level write op.
*/
if (avc->execsOrWriters <= 0) {
- printf("WARNING: afs_ufswr vcp=%lx, exOrW=%d\n", (unsigned long)avc,
+ afs_warn("WARNING: afs_ufswr vcp=%lx, exOrW=%d\n", (unsigned long)avc,
avc->execsOrWriters);
}
#else
#ifdef AFS_AIX32_ENV
osi_ReleaseVM(avc, acred);
#endif
- printf("avc->vc_error=%d\n", avc->vc_error);
+ /* printf("avc->vc_error=%d\n", avc->vc_error); */
code = avc->vc_error;
avc->vc_error = 0;
}
rx_extraPackets = AFS_NRXPACKETS; /* smaller # of packets */
code = rx_InitHost(rx_bindhost, htons(7001));
if (code) {
- printf("AFS: RX failed to initialize %d).\n", code);
+ afs_warn("AFS: RX failed to initialize %d).\n", code);
return code;
}
rx_SetRxDeadTime(afs_rx_deadtime);
thread_terminate(current_thread());
break;
case AFSOP_START_BKG:
- printf("Install matching afsd! Old background daemons not supported.\n");
+ afs_warn("Install matching afsd! Old background daemons not supported.\n");
thread_terminate(current_thread());
break;
case AFSOP_START_TRUNCDAEMON:
thread_terminate(current_thread());
break;
default:
- printf("Unknown op %ld in StartDaemon()\n", (long)parm);
+ afs_warn("Unknown op %ld in StartDaemon()\n", (long)parm);
break;
}
}
complete_and_exit(0, 0);
break;
default:
- printf("Unknown op %ld in StartDaemon()\n", (long)parm);
+ afs_warn("Unknown op %ld in StartDaemon()\n", (long)parm);
break;
}
return 0;
#endif
if (!kernel_thread(afsd_thread, (void *)rock, CLONE_VFORK | SIGCHLD))
- printf("kernel_thread failed. afs startup will not complete\n");
+ afs_warn("kernel_thread failed. afs startup will not complete\n");
}
void
/* Do the check here if the correct afsd is not installed. */
if (!cs_warned) {
cs_warned = 1;
- printf("Please install afsd with check server daemon.\n");
+ afs_warn("Please install afsd with check server daemon.\n");
}
if (lastNMinCheck + afs_probe_interval < now) {
/* only check down servers */
/* ablocks is reported in 1K blocks */
code = afs_InitMemCache(afiles, AFS_FIRSTCSIZE, aflags);
if (code != 0) {
- printf("afsd: memory cache too large for available memory.\n");
- printf("afsd: AFS files cannot be accessed.\n\n");
+ afs_warn("afsd: memory cache too large for available memory.\n");
+ afs_warn("afsd: AFS files cannot be accessed.\n\n");
dcacheDisabled = 1;
afiles = ablocks = 0;
} else
- printf("Memory cache: Allocating %d dcache entries...",
+ afs_warn("Memory cache: Allocating %d dcache entries...",
aDentries);
} else {
cacheDiskType = AFS_FCACHE_TYPE_UFS;
/* Alloc a 4k block. */
data = (char *) afs_osi_Alloc(4096);
if (!data) {
- printf("afs_MakeShadowDir: could not alloc data\n");
+ afs_warn("afs_MakeShadowDir: could not alloc data\n");
ret_code = ENOMEM;
goto done;
}
if (tnf.name_len == -1)
code = ENOENT;
} else {
- printf("Directory dcache not found!\n");
+ /* printf("Directory dcache not found!\n"); */
code = ENOENT;
}
static int
list_dir_hook(void *hdata, char *aname, afs_int32 vnode, afs_int32 unique)
{
- printf("list_dir_hook: %s v:%u u:%u\n", aname, vnode, unique);
+ /* printf("list_dir_hook: %s v:%u u:%u\n", aname, vnode, unique); */
return 0;
}
*adp = NULL;
if (afs_GetParentDirFid(avc, afid)) {
- printf("afs_GetParentVCache: Couldn't find parent dir's FID.\n");
+ /* printf("afs_GetParentVCache: Couldn't find parent dir's FID.\n"); */
return ENOENT;
}
code = afs_GetVnodeName(avc, afid, aname, deleted);
if (code) {
- printf("afs_GetParentVCache: Couldn't find file name\n");
+ /* printf("afs_GetParentVCache: Couldn't find file name\n"); */
goto end;
}
*adp = afs_FindVCache(afid, 0, 1);
ReleaseSharedLock(&afs_xvcache);
if (!*adp) {
- printf("afs_GetParentVCache: Couldn't find parent dir's vcache\n");
+ /* printf("afs_GetParentVCache: Couldn't find parent dir's vcache\n"); */
code = ENOENT;
goto end;
}
if ((*adp)->f.ddirty_flags & VDisconCreate) {
- printf("afs_GetParentVCache: deferring until parent exists\n");
+ /* printf("afs_GetParentVCache: deferring until parent exists\n"); */
code = EAGAIN;
goto end;
}
/* Get old name. */
old_name = (char *) afs_osi_Alloc(AFSNAMEMAX);
if (!old_name) {
- printf("afs_ProcessOpRename: Couldn't alloc space for old name.\n");
+ /* printf("afs_ProcessOpRename: Couldn't alloc space for old name.\n"); */
return ENOMEM;
}
code = afs_GetVnodeName(avc, &old_pdir_fid, old_name, 1);
if (code) {
- printf("afs_ProcessOpRename: Couldn't find old name.\n");
+ /* printf("afs_ProcessOpRename: Couldn't find old name.\n"); */
goto done;
}
/* Alloc data first. */
new_name = (char *) afs_osi_Alloc(AFSNAMEMAX);
if (!new_name) {
- printf("afs_ProcessOpRename: Couldn't alloc space for new name.\n");
+ /* printf("afs_ProcessOpRename: Couldn't alloc space for new name.\n"); */
code = ENOMEM;
goto done;
}
} else {
/* Get parent dir's FID.*/
if (afs_GetParentDirFid(avc, &new_pdir_fid)) {
- printf("afs_ProcessOpRename: Couldn't find new parent dir FID.\n");
+ /* printf("afs_ProcessOpRename: Couldn't find new parent dir FID.\n"); */
code = ENOENT;
goto done;
}
/* And finally get the new name. */
code = afs_GetVnodeName(avc, &new_pdir_fid, new_name, 0);
if (code) {
- printf("afs_ProcessOpRename: Couldn't find new name.\n");
+ /* printf("afs_ProcessOpRename: Couldn't find new name.\n"); */
goto done;
}
SHARED_LOCK,
NULL));
- if (code)
- printf("afs_ProcessOpRename: server code=%u\n", code);
+ /* if (code) printf("afs_ProcessOpRename: server code=%u\n", code); */
done:
if (new_name)
afs_osi_Free(new_name, AFSNAMEMAX);
/* TODO: Handle errors. */
if (code) {
- printf("afs_ProcessOpCreate: error while creating vnode on server, code=%d .\n", code);
+ /* printf("afs_ProcessOpCreate: error while creating vnode on server, code=%d .\n", code); */
goto end;
}
tname = afs_osi_Alloc(AFSNAMEMAX);
if (!tname) {
- printf("afs_ProcessOpRemove: Couldn't alloc space for file name\n");
+ /* printf("afs_ProcessOpRemove: Couldn't alloc space for file name\n"); */
return ENOMEM;
}
} /* if (vType(avc) == VREG) */
- if (code)
- printf("afs_ProcessOpRemove: server returned code=%u\n", code);
+ /* if (code) printf("afs_ProcessOpRemove: server returned code=%u\n", code); */
end:
afs_osi_Free(tname, AFSNAMEMAX);
afs_ResetVCache(tvc, acred);
tvc->f.truncPos = AFS_NOTRUNC;
} else {
- printf("afs_ResyncDisconFiles: no resolution policy selected.\n");
+ /* printf("afs_ResyncDisconFiles: no resolution policy selected.\n"); */
} /* if DV match or client wins policy */
unlock_srv_file:
struct afs_q *q;
int i = 0;
- printf("List of dirty files: \n");
+ afs_warn("List of dirty files: \n");
ObtainReadLock(&afs_disconDirtyLock);
for (q = QPrev(&afs_disconDirty); q != &afs_disconDirty; q = QPrev(q)) {
tvc = QEntry(q, struct vcache, dirtyq);
- printf("Cell=%u Volume=%u VNode=%u Unique=%u\n",
+ afs_warn("Cell=%u Volume=%u VNode=%u Unique=%u\n",
tvc->f.fid.Cell,
tvc->f.fid.Fid.Volume,
tvc->f.fid.Fid.Vnode,
#ifdef AFS_MAXVCOUNT_ENV
afsd_dynamic_vcaches = dynamic_vcaches;
- printf("%s dynamically allocated vcaches\n",
- ( afsd_dynamic_vcaches ? "enabling" : "disabling" ));
+ afs_warn("%s dynamically allocated vcaches\n",
+ ( afsd_dynamic_vcaches ? "enabling" : "disabling" ));
#endif
- printf("Starting AFS cache scan...");
+ afs_warn("Starting AFS cache scan...");
if (afs_cacheinit_flag)
return 0;
afs_cacheinit_flag = 1;
return 0;
nomem:
- printf("afsd: memCache allocation failure at %d KB.\n",
- (index * memCacheBlkSize) / 1024);
+ afs_warn("afsd: memCache allocation failure at %d KB.\n",
+ (index * memCacheBlkSize) / 1024);
while (--index >= 0) {
afs_osi_Free((memCache + index)->data, memCacheBlkSize);
(memCache + index)->data = NULL;
if (rv && (osi_Time() < pag_epoch)) {
if (!afs_pag_timewarn) {
afs_pag_timewarn = 1;
- printf("clock went backwards, not PAG throttling");
+ afs_warn("clock went backwards, not PAG throttling");
}
rv = 0;
}
{
if (afs_pag_sleep(acred)) {
if (!afs_pag_sleepcnt) {
- printf("%s() PAG throttling triggered, pid %d... sleeping. sleepcnt %d\n",
- "afs_pag_wait", osi_getpid(), afs_pag_sleepcnt);
+ afs_warn("%s() PAG throttling triggered, pid %d... sleeping. sleepcnt %d\n",
+ "afs_pag_wait", osi_getpid(), afs_pag_sleepcnt);
}
afs_pag_sleepcnt++;
if (set_parent_pag) {
#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
# if defined(AFS_DARWIN_ENV)
- afs_proc_t *p = current_proc(); /* XXX */
+ afs_proc_t *p = current_proc(); /* XXX */
+ char procname[256];
+ proc_selfname(procname, 256);
# else
afs_proc_t *p = curproc; /* XXX */
+ char *procname = p->p_comm;
# endif
-# ifndef AFS_DARWIN80_ENV
- uprintf("Process %d (%s) tried to change pags in PSetTokens\n",
- p->p_pid, p->p_comm);
-# endif
+ afs_warnuser("Process %d (%s) tried to change pags in PSetTokens\n",
+ MyPidxx2Pid(MyPidxx), procname);
setpag(p, acred, -1, &pag, 1);
#else
setpag(acred, -1, &pag, 1);
afs_uint32 pag;
#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
# if defined(AFS_DARWIN_ENV)
- afs_proc_t *p = current_proc(); /* XXX */
+ afs_proc_t *p = current_proc(); /* XXX */
+ char procname[256];
+ proc_selfname(procname, 256);
# else
afs_proc_t *p = curproc; /* XXX */
+ char *procname = p->p_comm;
# endif
-# ifndef AFS_DARWIN80_ENV
- uprintf("Process %d (%s) tried to change pags in PSetTokens\n",
- p->p_pid, p->p_comm);
-# endif
+ afs_warnuser("Process %d (%s) tried to change pags in PSetTokens\n",
+ MyPidxx2Pid(MyPidxx), procname);
if (!setpag(p, acred, -1, &pag, 1)) {
#else
if (!setpag(acred, -1, &pag, 1)) {
touchedSize = 0;
for (k = 0; k < num; sp++, k++) {
if (debugsetsp) {
- printf("sp host=%x, rank=%d\n", sp->host.s_addr, sp->rank);
+ afs_warn("sp host=%x, rank=%d\n", sp->host.s_addr, sp->rank);
}
matches = 0;
ObtainReadLock(&afs_xserver);
if (sa && matches) { /* found one! */
if (debugsetsp) {
- printf("sa ip=%x, ip_rank=%d\n", sa->sa_ip, sa->sa_iprank);
+ afs_warn("sa ip=%x, ip_rank=%d\n", sa->sa_ip, sa->sa_iprank);
}
sa->sa_iprank = sp->rank + afs_randomMod15();
afs_SortOneServer(sa->server);
afs_in_sync = 0;
if (code && !force) {
- printf("Files not synchronized properly, still in discon state. \n"
+ afs_warnuser("Files not synchronized properly, still in discon state. \n"
"Please retry or use \"force\".\n");
mode = 0;
} else {
afs_ClearAllStatdFlag();
afs_is_disconnected = 0;
afs_is_discon_rw = 0;
- printf("\nSync succeeded. You are back online.\n");
+ afs_warnuser("\nSync succeeded. You are back online.\n");
}
ReleaseWriteLock(&afs_discon_lock);
afs_stats_cmperf.vcacheXAllocs--;
} else {
if (afs_norefpanic) {
- printf("flush vc refcnt < 1");
+ afs_warn("flush vc refcnt < 1");
afs_norefpanic++;
} else
osi_Panic("flush vc refcnt < 1");
We probably need a way to be smarter about this. */
tvc->nextfree = tmpReclaimedVCList;
tmpReclaimedVCList = tvc;
- printf("Reclaim list flush %lx failed: %d\n", (unsigned long) tvc, code);
+ /* printf("Reclaim list flush %lx failed: %d\n", (unsigned long) tvc, code); */
}
if (tvc->f.states & (CVInit
#ifdef AFS_DARWIN80_ENV
break;
}
if (!afsd_dynamic_vcaches && anumber == target) {
- printf("afs_ShakeLooseVCaches: warning none freed, using %d of %d\n",
+ afs_warn("afs_ShakeLooseVCaches: warning none freed, using %d of %d\n",
afs_vcount, afs_maxvcount);
}
} /* finished freeing up space */
if(!afsd_dynamic_vcaches) {
afs_ShakeLooseVCaches(anumber);
if (afs_vcount >= afs_maxvcount) {
- printf("afs_NewVCache - none freed\n");
+ afs_warn("afs_NewVCache - none freed\n");
return NULL;
}
}
* then there probably needs to be some sort of additional
* mutual exclusion (an Embryonic flag would suffice).
* -GAW */
- printf("afs_NewVCache: lost the race\n");
+ afs_warn("afs_NewVCache: lost the race\n");
return (tvc);
}
tvc->v = vp;
}
if (astatus->Mask & AFS_SETOWNER) {
- printf("Not allowed yet. \n");
- /*avc->f.m.Owner = astatus->Owner;*/
+ /* printf("Not allowed yet. \n"); */
+ /*avc->f.m.Owner = astatus->Owner;*/
}
if (astatus->Mask & AFS_SETGROUP) {
- printf("Not allowed yet. \n");
- /*avc->f.m.Group = astatus->Group;*/
+ /* printf("Not allowed yet. \n"); */
+ /*avc->f.m.Group = astatus->Group;*/
}
if (astatus->Mask & AFS_SETMODE) {
if (AFS_IS_DISCONNECTED) {
/* Nothing to do otherwise...*/
code = ENETDOWN;
- printf("Network is down in afs_GetCache");
+ /* printf("Network is down in afs_GetCache"); */
} else
code = afs_FetchStatus(tvc, afid, areq, &OutStatus);
origCBs = afs_allCBs; /* if anything changes, we don't have a cb */
if (AFS_IS_DISCONNECTED) {
- printf("Network is down in afs_LookupVcache\n");
+ /* printf("Network is down in afs_LookupVcache\n"); */
code = ENETDOWN;
} else
code =