File tree 6 files changed +35
-13
lines changed
6 files changed +35
-13
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ Installation
17
17
Documentation
18
18
-------------
19
19
20
- http ://godoc.org /github.com/cloudsoda/go-smb2
20
+ https ://pkg.go.dev /github.com/cloudsoda/go-smb2
21
21
22
22
Examples
23
23
--------
@@ -72,7 +72,6 @@ package main
72
72
73
73
import (
74
74
" io"
75
- " io/ioutil"
76
75
" net"
77
76
78
77
" github.com/cloudsoda/go-smb2"
@@ -121,7 +120,7 @@ func main() {
121
120
panic (err)
122
121
}
123
122
124
- bs , err := ioutil .ReadAll (f)
123
+ bs , err := io .ReadAll (f)
125
124
if err != nil {
126
125
panic (err)
127
126
}
Original file line number Diff line number Diff line change @@ -1419,13 +1419,19 @@ func (f *File) Statfs() (FileFsInfo, error) {
1419
1419
}
1420
1420
1421
1421
type FileFsInfo interface {
1422
+ // The number of bytes in a single block on the volume. A block is the smallest allocation unit on the volume.
1422
1423
BlockSize () uint64
1424
+ // Number of sectors in each block.
1423
1425
FragmentSize () uint64
1426
+ // Total number of blocks on the volume that are available to the user.
1424
1427
TotalBlockCount () uint64
1428
+ // Total number of blocks on the volume.
1425
1429
FreeBlockCount () uint64
1430
+ // Total number of free blocks on the volume that are available to the user.
1426
1431
AvailableBlockCount () uint64
1427
1432
}
1428
1433
1434
+ // Definitions: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/63768db7-9012-4209-8cca-00781e7322f5
1429
1435
type fileFsFullSizeInformation struct {
1430
1436
TotalAllocationUnits int64
1431
1437
CallerAvailableAllocationUnits int64
@@ -1435,7 +1441,7 @@ type fileFsFullSizeInformation struct {
1435
1441
}
1436
1442
1437
1443
func (fi * fileFsFullSizeInformation ) BlockSize () uint64 {
1438
- return uint64 (fi .BytesPerSector )
1444
+ return uint64 (fi .BytesPerSector ) * uint64 ( fi . SectorsPerAllocationUnit )
1439
1445
}
1440
1446
1441
1447
func (fi * fileFsFullSizeInformation ) FragmentSize () uint64 {
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ package smb2_test
3
3
import (
4
4
"fmt"
5
5
"io"
6
- "io/ioutil"
7
6
"net"
8
7
9
8
"github.com/cloudsoda/go-smb2"
@@ -53,7 +52,7 @@ func Example() {
53
52
panic (err )
54
53
}
55
54
56
- bs , err := ioutil .ReadAll (f )
55
+ bs , err := io .ReadAll (f )
57
56
if err != nil {
58
57
panic (err )
59
58
}
Original file line number Diff line number Diff line change 4
4
5
5
require (
6
6
github.com/geoffgarside/ber v1.1.0
7
- golang.org/x/crypto v0.8.0
7
+ github.com/stretchr/testify v1.8.3
8
+ golang.org/x/crypto v0.9.0
9
+ )
10
+
11
+ require (
12
+ github.com/davecgh/go-spew v1.1.1 // indirect
13
+ github.com/pmezard/go-difflib v1.0.0 // indirect
14
+ gopkg.in/yaml.v3 v3.0.1 // indirect
8
15
)
Original file line number Diff line number Diff line change
1
+ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c =
2
+ github.com/davecgh/go-spew v1.1.1 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
1
3
github.com/geoffgarside/ber v1.1.0 h1:qTmFG4jJbwiSzSXoNJeHcOprVzZ8Ulde2Rrrifu5U9w =
2
4
github.com/geoffgarside/ber v1.1.0 /go.mod h1:jVPKeCbj6MvQZhwLYsGwaGI52oUorHoHKNecGT85ZCc =
5
+ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM =
6
+ github.com/pmezard/go-difflib v1.0.0 /go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4 =
7
+ github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY =
8
+ github.com/stretchr/testify v1.8.3 /go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo =
3
9
golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ =
4
10
golang.org/x/crypto v0.8.0 /go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE =
11
+ golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g =
12
+ golang.org/x/crypto v0.9.0 /go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0 =
13
+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM =
14
+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 /go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0 =
15
+ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA =
16
+ gopkg.in/yaml.v3 v3.0.1 /go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM =
Original file line number Diff line number Diff line change 8
8
"encoding/json"
9
9
"fmt"
10
10
"io"
11
- "io/ioutil"
12
11
"net"
13
12
"os"
14
13
"reflect"
@@ -18,6 +17,7 @@ import (
18
17
"time"
19
18
20
19
"github.com/cloudsoda/go-smb2"
20
+ "github.com/stretchr/testify/require"
21
21
)
22
22
23
23
func join (ss ... string ) string {
@@ -189,9 +189,8 @@ func TestReaddir(t *testing.T) {
189
189
}
190
190
191
191
fi2 , err = d2 .Readdir (1 )
192
- if err != io .EOF {
193
- t .Error ("unexpected error: " , err )
194
- }
192
+ require .Equal (t , io .EOF , err )
193
+ require .Empty (t , fi2 )
195
194
}
196
195
197
196
func TestFile (t * testing.T ) {
@@ -355,7 +354,7 @@ func TestSymlink(t *testing.T) {
355
354
356
355
f , err = fs .Open (testDir + `\linkToTestFile` )
357
356
if err == nil { // if it supports follow-symlink
358
- bs , err := ioutil .ReadAll (f )
357
+ bs , err := io .ReadAll (f )
359
358
if err != nil {
360
359
t .Fatal (err )
361
360
}
@@ -484,7 +483,7 @@ func TestRename(t *testing.T) {
484
483
t .Fatal (err )
485
484
}
486
485
defer f .Close ()
487
- bs , err := ioutil .ReadAll (f )
486
+ bs , err := io .ReadAll (f )
488
487
if err != nil {
489
488
t .Fatal (err )
490
489
}
You can’t perform that action at this time.
0 commit comments