static int xixfs_statfs( struct dentry * dentry, struct kstatfs *buf ) { PXIXFS_LINUX_VCB pVCB = XIXFS_SB(dentry->d_sb); XIXFS_ASSERT_VCB(pVCB); /* If the count of free cluster is still unknown, counts it here. */ DebugTrace(DEBUG_LEVEL_TRACE, (DEBUG_TARGET_VFSAPIT|DEBUG_TARGET_VCB), ("Enter xixfs_statfs\n")); buf->f_type = dentry->d_sb->s_magic; buf->f_bsize = CLUSTER_SIZE; buf->f_blocks =( (pVCB->XixcoreVcb.LotSize/CLUSTER_SIZE) * pVCB->XixcoreVcb.NumLots ); if(pVCB->XixcoreVcb.IsVolumeWriteProtected) { buf->f_bfree = ( (pVCB->XixcoreVcb.LotSize/CLUSTER_SIZE) * pVCB->XixcoreVcb.NumLots ); buf->f_bavail = ( (pVCB->XixcoreVcb.LotSize/CLUSTER_SIZE) * pVCB->XixcoreVcb.NumLots ); }else{ buf->f_bfree = ( (pVCB->XixcoreVcb.LotSize/CLUSTER_SIZE) * xixcore_FindSetBitCount(pVCB->XixcoreVcb.NumLots, xixcore_GetDataBufferOfBitMap(pVCB->XixcoreVcb.MetaContext.VolumeFreeMap->Data))); buf->f_bavail =( (pVCB->XixcoreVcb.LotSize/CLUSTER_SIZE) * xixcore_FindSetBitCount(pVCB->XixcoreVcb.NumLots, xixcore_GetDataBufferOfBitMap(pVCB->XixcoreVcb.MetaContext.VolumeFreeMap->Data))); } buf->f_namelen = 1024; DebugTrace(DEBUG_LEVEL_TRACE, (DEBUG_TARGET_VFSAPIT|DEBUG_TARGET_VCB), ("Exit xixfs_statfs\n")); return 0; }
NTSTATUS xixfs_QueryFsSizeInfo ( IN PXIXFS_IRPCONTEXT pIrpContext, IN PXIXFS_VCB pVcb, IN PFILE_FS_SIZE_INFORMATION Buffer, IN uint32 Length, IN OUT uint32 *ByteToReturn ) { PAGED_CODE(); DebugTrace(DEBUG_LEVEL_TRACE, (DEBUG_TARGET_VOLINFO|DEBUG_TARGET_IRPCONTEXT), ("Enter xixfs_QueryFsSizeInfo \n")); if(Length < sizeof(FILE_FS_SIZE_INFORMATION)){ *ByteToReturn = 0; return STATUS_INVALID_PARAMETER; } Buffer->TotalAllocationUnits.QuadPart = xixfs_GetLcnFromLot(pVcb->XixcoreVcb.LotSize, pVcb->XixcoreVcb.NumLots ); // changed by ILGU HONG for readonly 09052006 if(pVcb->XixcoreVcb.IsVolumeWriteProtected){ Buffer->AvailableAllocationUnits.QuadPart = ((pVcb->XixcoreVcb.LotSize/CLUSTER_SIZE)* pVcb->XixcoreVcb.NumLots); }else{ Buffer->AvailableAllocationUnits.QuadPart = ((pVcb->XixcoreVcb.LotSize/CLUSTER_SIZE)* xixcore_FindSetBitCount(pVcb->XixcoreVcb.NumLots, xixcore_GetDataBuffer(pVcb->XixcoreVcb.MetaContext.VolumeFreeMap->Data)) ); } // changed by ILGU HONG for readonly end Buffer->SectorsPerAllocationUnit = (CLUSTER_SIZE / pVcb->XixcoreVcb.SectorSize); Buffer->BytesPerSector = pVcb->XixcoreVcb.SectorSize; /* DbgPrint("1 NumLots(%I64d): TotalUnit(%I64d):AvailableUnit(%I64d):SecPerUnit(%ld):BytesPerSec(%ld)\n", pVcb->NumLots, Buffer->TotalAllocationUnits.QuadPart, Buffer->AvailableAllocationUnits.QuadPart, Buffer->SectorsPerAllocationUnit, Buffer->BytesPerSector); */ *ByteToReturn =(( sizeof(FILE_FS_SIZE_INFORMATION) + 7)/8)*8; DebugTrace(DEBUG_LEVEL_TRACE, (DEBUG_TARGET_VOLINFO|DEBUG_TARGET_IRPCONTEXT), ("Exit xixfs_QueryFsSizeInfo \n")); return STATUS_SUCCESS; }