Re: [hatari-devel] GemDOS_DFree |
[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]
Previous uses this method to calculate the various sizes: (parts from the code in https://sourceforge.net/p/previous/code/1657/tree//branches/branch_filesharing/src/slirp/rpc/nfs.c) xdr_write_long(m_out, nfs_blocks(&fsstat, fsstat.f_blocks)); /* total blocks */ xdr_write_long(m_out, nfs_blocks(&fsstat, fsstat.f_bfree)); /* free blocks */ xdr_write_long(m_out, nfs_blocks(&fsstat, fsstat.f_bavail)); /* available blocks */ static uint32_t nfs_blocks(const struct statvfs* fsstat, uint64_t fsblocks) { /* take minimum as block size, looks like every filesystem uses these fields somewhat different */ fsblocks *= (uint64_t)min(fsstat->f_frsize, fsstat->f_bsize); if (fsblocks > 0x7FFFFFFF) fsblocks = 0x7FFFFFFF; /* limit size to signed 32-bit integer */ return (uint32_t)(fsblocks / BLOCK_SIZE); } Limiting the size is due to internal limitations of the guest system. This might not be necessary for Hatari. And you can of course forget about the xdr stuff. Furthermore you might want to get the size in bytes instead of blocks. The relevant part is in the min-statement.
|
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |