-
-
Save durka/fb0ff64d8aabb82f0bc81c4102ded8ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fn remote_df2(SshInfo { user, pass, host, dir }: SshInfo) -> Result<Bytes> { | |
| let (tcp, sess) = ssh(user, pass, host)?; | |
| let sftp = sess.sftp()?; | |
| let file = sftp.open(Path::new(dir))?; | |
| unsafe { | |
| let mut handle = mem::transmute_copy::<ssh2::File, *mut LIBSSH2_SFTP_HANDLE>(&file); | |
| let mut attrs: LIBSSH2_SFTP_STATVFS = mem::zeroed(); | |
| sftp.rc(libssh2_sftp_fstatvfs(handle, &mut attrs))?; | |
| Ok(Bytes(attrs.f_bavail * attrs.f_bsize)) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment