else if (strncmp("ufs", vp->v_mount->mnt_vfc->vfc_name, 3) == 0)
#endif
afs_CacheFSType = AFS_APPL_UFS_CACHE;
+#ifdef AFS_DARWIN80_ENV
+ else if (strncmp("apfs", buffer, 4) == 0)
+ afs_CacheFSType = AFS_APPL_APFS_CACHE;
+#endif
else
osi_Panic("Unknown cache vnode type\n");
#ifdef AFS_DARWIN80_ENV
#endif
}
-struct osi_file *
+void *
osi_UFSOpen(afs_dcache_id_t *ainode)
{
struct vnode *vp;
struct vattr va;
- register struct osi_file *afile = NULL;
+ struct osi_file *afile = NULL;
extern int cacheDiskType;
afs_int32 code = 0;
int dummy;
/* valid for alpha_osf, SunOS, Ultrix */
memset(&afs_osi_cred, 0, sizeof(afs_ucred_t));
afs_osi_cred.cr_ref++;
+#ifndef AFS_DARWIN110_ENV
afs_osi_cred.cr_ngroups = 1;
+#endif
afs_osicred_initialized = 1;
}
- afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
+ afile = osi_AllocSmallSpace(sizeof(struct osi_file));
AFS_GUNLOCK();
#ifdef AFS_CACHE_VNODE_PATH
- if (ainode->ufs < 0) {
- switch (ainode->ufs) {
- case AFS_CACHE_CELLS_INODE:
- snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "CellItems");
- break;
- case AFS_CACHE_ITEMS_INODE:
- snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "CacheItems");
- break;
- case AFS_CACHE_VOLUME_INODE:
- snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "VolumeItems");
- break;
- default:
- osi_Panic("Invalid negative inode");
- }
- } else {
- dummy = ainode->ufs / afs_numfilesperdir;
- snprintf(fname, 1024, "%s/D%d/V%d", afs_cachebasedir, dummy, ainode->ufs);
+ if (!ainode->ufs) {
+ osi_Panic("No cache inode\n");
}
- code = vnode_open(fname, O_RDWR, 0, 0, &vp, afs_osi_ctxtp);
+ code = vnode_open(ainode->ufs, O_RDWR, 0, 0, &vp, afs_osi_ctxtp);
#else
#ifndef AFS_DARWIN80_ENV
if (afs_CacheFSType == AFS_APPL_HFS_CACHE)
code = afs_osi_Stat(afile, &tstat);
afile->size = tstat.size;
#endif
- return afile;
+ return (void *)afile;
}
int
-afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat)
+afs_osi_Stat(struct osi_file *afile, struct osi_stat *astat)
{
- register afs_int32 code;
+ afs_int32 code;
struct vattr tvattr;
AFS_STATCNT(osi_Stat);
ObtainWriteLock(&afs_xosi, 320);
}
int
-osi_UFSClose(register struct osi_file *afile)
+osi_UFSClose(struct osi_file *afile)
{
AFS_STATCNT(osi_Close);
if (afile->vnode) {
}
int
-osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
+osi_UFSTruncate(struct osi_file *afile, afs_int32 asize)
{
afs_ucred_t *oldCred;
struct vattr tvattr;
- register afs_int32 code;
+ afs_int32 code;
struct osi_stat tstat;
AFS_STATCNT(osi_Truncate);
/* Generic read interface */
int
-afs_osi_Read(register struct osi_file *afile, int offset, void *aptr,
+afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
afs_int32 asize)
{
afs_ucred_t *oldCred;
afs_size_t resid;
- register afs_int32 code;
+ afs_int32 code;
#ifdef AFS_DARWIN80_ENV
uio_t uio;
#endif
* down. No point in crashing when we are already shutting down
*/
if (!afile) {
- if (!afs_shuttingdown)
+ if (afs_shuttingdown == AFS_RUNNING)
osi_Panic("osi_Read called with null param");
else
- return EIO;
+ return -EIO;
}
if (offset != -1)
} else {
afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, resid,
ICL_TYPE_INT32, code);
- code = -1;
+ if (code > 0) {
+ code = -code;
+ }
}
return code;
}
/* Generic write interface */
int
-afs_osi_Write(register struct osi_file *afile, afs_int32 offset, void *aptr,
+afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
afs_int32 asize)
{
afs_ucred_t *oldCred;
afs_size_t resid;
- register afs_int32 code;
+ afs_int32 code;
#ifdef AFS_DARWIN80_ENV
uio_t uio;
#endif
code = asize - resid;
afile->offset += code;
} else {
- code = -1;
+ if (code > 0) {
+ code = -code;
+ }
}
if (afile->proc) {
(*afile->proc) (afile, code);