int afs_osi_Stat(struct osi_file *afile, struct osi_stat *astat) { AFS_STATCNT(osi_Stat); astat->size = i_size_read(OSIFILE_INODE(afile)); astat->mtime = OSIFILE_INODE(afile)->i_mtime.tv_sec; astat->atime = OSIFILE_INODE(afile)->i_atime.tv_sec; return 0; }
int afs_osi_Stat(struct osi_file *afile, struct osi_stat *astat) { AFS_STATCNT(osi_Stat); ObtainWriteLock(&afs_xosi, 320); astat->size = i_size_read(OSIFILE_INODE(afile)); astat->mtime = OSIFILE_INODE(afile)->i_mtime.tv_sec; astat->atime = OSIFILE_INODE(afile)->i_atime.tv_sec; ReleaseWriteLock(&afs_xosi); return 0; }
int afs_osi_Stat(struct osi_file *afile, struct osi_stat *astat) { afs_int32 code; AFS_STATCNT(osi_Stat); ObtainWriteLock(&afs_xosi, 320); astat->size = i_size_read(OSIFILE_INODE(afile)); astat->mtime = OSIFILE_INODE(afile)->i_mtime; astat->atime = OSIFILE_INODE(afile)->i_atime; code = 0; ReleaseWriteLock(&afs_xosi); return code; }
int afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat) { register afs_int32 code; AFS_STATCNT(osi_Stat); MObtainWriteLock(&afs_xosi, 320); astat->size = i_size_read(OSIFILE_INODE(afile)); #if defined(AFS_LINUX26_ENV) astat->mtime = OSIFILE_INODE(afile)->i_mtime.tv_sec; astat->atime = OSIFILE_INODE(afile)->i_atime.tv_sec; #else astat->mtime = OSIFILE_INODE(afile)->i_mtime; astat->atime = OSIFILE_INODE(afile)->i_atime; #endif code = 0; MReleaseWriteLock(&afs_xosi); return code; }
int osi_UFSClose(struct osi_file *afile) { AFS_STATCNT(osi_Close); if (afile) { if (OSIFILE_INODE(afile)) { filp_close(afile->filp, NULL); } } kfree(afile); return 0; }
int osi_UFSClose(register struct osi_file *afile) { AFS_STATCNT(osi_Close); if (afile) { if (OSIFILE_INODE(afile)) { filp_close(afile->filp, NULL); } } osi_FreeLargeSpace(afile); return 0; }
int osi_UFSTruncate(struct osi_file *afile, afs_int32 asize) { afs_int32 code; struct osi_stat tstat; struct iattr newattrs; struct inode *inode = OSIFILE_INODE(afile); AFS_STATCNT(osi_Truncate); /* This routine only shrinks files, and most systems * have very slow truncates, even when the file is already * small enough. Check now and save some time. */ code = afs_osi_Stat(afile, &tstat); if (code || tstat.size <= asize) return code; ObtainWriteLock(&afs_xosi, 321); AFS_GUNLOCK(); afs_linux_lock_inode(inode); #ifdef STRUCT_INODE_HAS_I_ALLOC_SEM down_write(&inode->i_alloc_sem); #endif newattrs.ia_size = asize; newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; newattrs.ia_ctime = CURRENT_TIME; /* avoid notify_change() since it wants to update dentry->d_parent */ #ifdef HAVE_LINUX_SETATTR_PREPARE code = setattr_prepare(file_dentry(afile->filp), &newattrs); #else code = inode_change_ok(inode, &newattrs); #endif if (!code) code = afs_inode_setattr(afile, &newattrs); if (!code) truncate_inode_pages(&inode->i_data, asize); code = -code; #ifdef STRUCT_INODE_HAS_I_ALLOC_SEM up_write(&inode->i_alloc_sem); #endif afs_linux_unlock_inode(inode); AFS_GLOCK(); ReleaseWriteLock(&afs_xosi); return code; }
int osi_UFSTruncate(struct osi_file *afile, afs_int32 asize) { afs_int32 code; struct osi_stat tstat; struct iattr newattrs; struct inode *inode = OSIFILE_INODE(afile); AFS_STATCNT(osi_Truncate); /* This routine only shrinks files, and most systems * have very slow truncates, even when the file is already * small enough. Check now and save some time. */ code = afs_osi_Stat(afile, &tstat); if (code || tstat.size <= asize) return code; ObtainWriteLock(&afs_xosi, 321); AFS_GUNLOCK(); #ifdef STRUCT_INODE_HAS_I_ALLOC_SEM down_write(&inode->i_alloc_sem); #endif #ifdef STRUCT_INODE_HAS_I_MUTEX mutex_lock(&inode->i_mutex); #else down(&inode->i_sem); #endif newattrs.ia_size = asize; newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; #if defined(AFS_LINUX24_ENV) newattrs.ia_ctime = CURRENT_TIME; /* avoid notify_change() since it wants to update dentry->d_parent */ lock_kernel(); code = inode_change_ok(inode, &newattrs); if (!code) { #ifdef INODE_SETATTR_NOT_VOID code = inode_setattr(inode, &newattrs); #else inode_setattr(inode, &newattrs); #endif } unlock_kernel(); if (!code) truncate_inode_pages(&inode->i_data, asize); #else i_size_write(inode, asize); if (inode->i_sb->s_op && inode->i_sb->s_op->notify_change) { code = inode->i_sb->s_op->notify_change(&afile->dentry, &newattrs); } if (!code) { truncate_inode_pages(inode, asize); if (inode->i_op && inode->i_op->truncate) inode->i_op->truncate(inode); } #endif code = -code; #ifdef STRUCT_INODE_HAS_I_MUTEX mutex_unlock(&inode->i_mutex); #else up(&inode->i_sem); #endif #ifdef STRUCT_INODE_HAS_I_ALLOC_SEM up_write(&inode->i_alloc_sem); #endif AFS_GLOCK(); ReleaseWriteLock(&afs_xosi); return code; }