SftpFileSystemInformation.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. using Renci.SshNet.Common;
  2. namespace Renci.SshNet.Sftp
  3. {
  4. /// <summary>
  5. /// Contains File system information exposed by statvfs@openssh.com request.
  6. /// </summary>
  7. public class SftpFileSytemInformation
  8. {
  9. internal const ulong SSH_FXE_STATVFS_ST_RDONLY = 0x1;
  10. internal const ulong SSH_FXE_STATVFS_ST_NOSUID = 0x2;
  11. private ulong _flag;
  12. /// <summary>
  13. /// Gets the file system block size.
  14. /// </summary>
  15. /// <value>
  16. /// The file system block size.
  17. /// </value>
  18. public ulong FileSystemBlockSize { get; private set; }
  19. /// <summary>
  20. /// Gets the fundamental file system size of the block.
  21. /// </summary>
  22. /// <value>
  23. /// The fundamental file system block size.
  24. /// </value>
  25. public ulong BlockSize { get; private set; }
  26. /// <summary>
  27. /// Gets the total blocks.
  28. /// </summary>
  29. /// <value>
  30. /// The total blocks.
  31. /// </value>
  32. public ulong TotalBlocks { get; private set; }
  33. /// <summary>
  34. /// Gets the free blocks.
  35. /// </summary>
  36. /// <value>
  37. /// The free blocks.
  38. /// </value>
  39. public ulong FreeBlocks { get; private set; }
  40. /// <summary>
  41. /// Gets the available blocks.
  42. /// </summary>
  43. /// <value>
  44. /// The available blocks.
  45. /// </value>
  46. public ulong AvailableBlocks { get; private set; }
  47. /// <summary>
  48. /// Gets the total nodes.
  49. /// </summary>
  50. /// <value>
  51. /// The total nodes.
  52. /// </value>
  53. public ulong TotalNodes { get; private set; }
  54. /// <summary>
  55. /// Gets the free nodes.
  56. /// </summary>
  57. /// <value>
  58. /// The free nodes.
  59. /// </value>
  60. public ulong FreeNodes { get; private set; }
  61. /// <summary>
  62. /// Gets the available nodes.
  63. /// </summary>
  64. /// <value>
  65. /// The available nodes.
  66. /// </value>
  67. public ulong AvailableNodes { get; private set; }
  68. /// <summary>
  69. /// Gets the sid.
  70. /// </summary>
  71. /// <value>
  72. /// The sid.
  73. /// </value>
  74. public ulong Sid { get; private set; }
  75. /// <summary>
  76. /// Gets a value indicating whether this instance is read only.
  77. /// </summary>
  78. /// <value>
  79. /// <c>true</c> if this instance is read only; otherwise, <c>false</c>.
  80. /// </value>
  81. public bool IsReadOnly
  82. {
  83. get { return (_flag & SSH_FXE_STATVFS_ST_RDONLY) == SSH_FXE_STATVFS_ST_RDONLY; }
  84. }
  85. /// <summary>
  86. /// Gets a value indicating whether [supports set uid].
  87. /// </summary>
  88. /// <value>
  89. /// <c>true</c> if [supports set uid]; otherwise, <c>false</c>.
  90. /// </value>
  91. public bool SupportsSetUid
  92. {
  93. get { return (_flag & SSH_FXE_STATVFS_ST_NOSUID) == 0; }
  94. }
  95. /// <summary>
  96. /// Gets the max name lenght.
  97. /// </summary>
  98. /// <value>
  99. /// The max name lenght.
  100. /// </value>
  101. public ulong MaxNameLenght { get; private set; }
  102. /// <summary>
  103. /// Initializes a new instance of the <see cref="SftpFileSytemInformation" /> class.
  104. /// </summary>
  105. /// <param name="bsize">The bsize.</param>
  106. /// <param name="frsize">The frsize.</param>
  107. /// <param name="blocks">The blocks.</param>
  108. /// <param name="bfree">The bfree.</param>
  109. /// <param name="bavail">The bavail.</param>
  110. /// <param name="files">The files.</param>
  111. /// <param name="ffree">The ffree.</param>
  112. /// <param name="favail">The favail.</param>
  113. /// <param name="sid">The sid.</param>
  114. /// <param name="flag">The flag.</param>
  115. /// <param name="namemax">The namemax.</param>
  116. internal SftpFileSytemInformation(ulong bsize, ulong frsize, ulong blocks, ulong bfree, ulong bavail, ulong files, ulong ffree, ulong favail, ulong sid, ulong flag, ulong namemax)
  117. {
  118. FileSystemBlockSize = bsize;
  119. BlockSize = frsize;
  120. TotalBlocks = blocks;
  121. FreeBlocks = bfree;
  122. AvailableBlocks = bavail;
  123. TotalNodes = files;
  124. FreeNodes = ffree;
  125. AvailableNodes = favail;
  126. Sid = sid;
  127. _flag = flag;
  128. MaxNameLenght = namemax;
  129. }
  130. }
  131. }