SftpFileSystemInformation.cs 4.3 KB

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