コード例 #1
0
ファイル: statvfs.c プロジェクト: Alexandr-Galko/samba
static int darwin_statvfs(const char *path, vfs_statvfs_struct *statbuf)
{
	struct statfs sbuf;
	int ret;

	ret = statfs(path, &sbuf);
	if (ret != 0) {
		return ret;
	}

	statbuf->OptimalTransferSize = sbuf.f_iosize;
	statbuf->BlockSize = sbuf.f_bsize;
	statbuf->TotalBlocks = sbuf.f_blocks;
	statbuf->BlocksAvail = sbuf.f_bfree;
	statbuf->UserBlocksAvail = sbuf.f_bavail;
	statbuf->TotalFileNodes = sbuf.f_files;
	statbuf->FreeFileNodes = sbuf.f_ffree;
	statbuf->FsIdentifier = *(uint64_t *)(&sbuf.f_fsid); /* Ick. */
	statbuf->FsCapabilities = darwin_fs_capabilities(sbuf.f_mntonname);

	return 0;
}
コード例 #2
0
static int bsd_statvfs(const char *path, vfs_statvfs_struct *statbuf)
{
	struct statfs sbuf;
	int ret;

	ret = statfs(path, &sbuf);
	if (ret == 0) {
		statbuf->OptimalTransferSize = sbuf.f_iosize;
		statbuf->BlockSize = sbuf.f_bsize;
		statbuf->TotalBlocks = sbuf.f_blocks;
		statbuf->BlocksAvail = sbuf.f_bfree;
		statbuf->UserBlocksAvail = sbuf.f_bavail;
		statbuf->TotalFileNodes = sbuf.f_files;
		statbuf->FreeFileNodes = sbuf.f_ffree;
		statbuf->FsIdentifier =
			(((uint64_t) sbuf.f_fsid.val[0] << 32) & 0xffffffff00000000LL) |
			    (uint64_t) sbuf.f_fsid.val[1];
#ifdef DARWINOS
		statbuf->FsCapabilities = darwin_fs_capabilities(sbuf.f_mntonname);
#else
		/* Try to extrapolate some of the fs flags into the
		 * capabilities
		 */
		statbuf->FsCapabilities =
		    FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
#ifdef MNT_ACLS
		if (sbuf.f_flags & MNT_ACLS)
			statbuf->FsCapabilities |= FILE_PERSISTENT_ACLS;
#endif
#endif
		if (sbuf.f_flags & MNT_QUOTA)
			statbuf->FsCapabilities |= FILE_VOLUME_QUOTAS;
		if (sbuf.f_flags & MNT_RDONLY)
			statbuf->FsCapabilities |= FILE_READ_ONLY_VOLUME;
	}

	return ret;
}