Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ language: go

go:
- "1.13.x"
- "1.15.x"

before_install:
- sudo apt-get update
Expand Down
6 changes: 3 additions & 3 deletions btrfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ func SubvolCreate(path string) error {
if len(name) > C.BTRFS_PATH_NAME_MAX {
return errors.Errorf("%q too long for subvolume", name)
}
nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.name[0]))
nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.name[0]))[:C.BTRFS_PATH_NAME_MAX:C.BTRFS_PATH_NAME_MAX]
copy(nameptr[:C.BTRFS_PATH_NAME_MAX], []byte(name))

if err := ioctl(fp.Fd(), C.BTRFS_IOC_SUBVOL_CREATE, uintptr(unsafe.Pointer(&args))); err != nil {
Expand Down Expand Up @@ -311,7 +311,7 @@ func SubvolSnapshot(dst, src string, readonly bool) error {
return errors.Errorf("%q too long for subvolume", dstname)
}

nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(name))
nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(name))[:C.BTRFS_SUBVOL_NAME_MAX:C.BTRFS_SUBVOL_NAME_MAX]
copy(nameptr[:C.BTRFS_SUBVOL_NAME_MAX], []byte(dstname))

if readonly {
Expand Down Expand Up @@ -370,7 +370,7 @@ func SubvolDelete(path string) error {
return errors.Errorf("%q too long for subvolume", name)
}

nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.name[0]))
nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.name[0]))[:C.BTRFS_SUBVOL_NAME_MAX:C.BTRFS_SUBVOL_NAME_MAX]
copy(nameptr[:C.BTRFS_SUBVOL_NAME_MAX], []byte(name))

if err := ioctl(fp.Fd(), C.BTRFS_IOC_SNAP_DESTROY, uintptr(unsafe.Pointer(&args))); err != nil {
Expand Down