You need to call statvfs on a path that is on the mounted filesystem you want to check, e.g.
statvfs("/", &buf)
Any path on the filesystem will do, e.g. "/home/user/foo/tmp/file.txt"
statvfs on /dev/sda1 will likely report usage of the /dev filesystem.