SftpFileSytemInformation
Contains File system information exposed by statvfs@openssh.com request.
using Renci.SshNet.Common;
namespace Renci.SshNet.Sftp
{
public class SftpFileSytemInformation
{
internal const ulong SSH_FXE_STATVFS_ST_RDONLY = 1;
internal const ulong SSH_FXE_STATVFS_ST_NOSUID = 2;
private readonly ulong _flag;
public ulong FileSystemBlockSize { get; set; }
public ulong BlockSize { get; set; }
public ulong TotalBlocks { get; set; }
public ulong FreeBlocks { get; set; }
public ulong AvailableBlocks { get; set; }
public ulong TotalNodes { get; set; }
public ulong FreeNodes { get; set; }
public ulong AvailableNodes { get; set; }
public ulong Sid { get; set; }
public bool IsReadOnly => (_flag & 1) == 1;
public bool SupportsSetUid => (_flag & 2) == 0;
public ulong MaxNameLenght { get; set; }
internal SftpFileSytemInformation(ulong bsize, ulong frsize, ulong blocks, ulong bfree, ulong bavail, ulong files, ulong ffree, ulong favail, ulong sid, ulong flag, ulong namemax)
{
FileSystemBlockSize = bsize;
BlockSize = frsize;
TotalBlocks = blocks;
FreeBlocks = bfree;
AvailableBlocks = bavail;
TotalNodes = files;
FreeNodes = ffree;
AvailableNodes = favail;
Sid = sid;
_flag = flag;
MaxNameLenght = namemax;
}
internal void SaveData(SshDataStream stream)
{
stream.Write(FileSystemBlockSize);
stream.Write(BlockSize);
stream.Write(TotalBlocks);
stream.Write(FreeBlocks);
stream.Write(AvailableBlocks);
stream.Write(TotalNodes);
stream.Write(FreeNodes);
stream.Write(AvailableNodes);
stream.Write(Sid);
stream.Write(_flag);
stream.Write(MaxNameLenght);
}
}
}