|
|
@ -18,6 +18,7 @@ package main |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"errors" |
|
|
|
"errors" |
|
|
|
|
|
|
|
"io" |
|
|
|
"net/rpc" |
|
|
|
"net/rpc" |
|
|
|
"path" |
|
|
|
"path" |
|
|
|
"strconv" |
|
|
|
"strconv" |
|
|
@ -49,6 +50,12 @@ func splitNetPath(networkPath string) (netAddr, netPath string) { |
|
|
|
// disks as well.
|
|
|
|
// disks as well.
|
|
|
|
func toStorageErr(err error) error { |
|
|
|
func toStorageErr(err error) error { |
|
|
|
switch err.Error() { |
|
|
|
switch err.Error() { |
|
|
|
|
|
|
|
case io.EOF.Error(): |
|
|
|
|
|
|
|
return io.EOF |
|
|
|
|
|
|
|
case io.ErrUnexpectedEOF.Error(): |
|
|
|
|
|
|
|
return io.ErrUnexpectedEOF |
|
|
|
|
|
|
|
case errUnexpected.Error(): |
|
|
|
|
|
|
|
return errUnexpected |
|
|
|
case errDiskFull.Error(): |
|
|
|
case errDiskFull.Error(): |
|
|
|
return errDiskFull |
|
|
|
return errDiskFull |
|
|
|
case errVolumeNotFound.Error(): |
|
|
|
case errVolumeNotFound.Error(): |
|
|
@ -57,14 +64,20 @@ func toStorageErr(err error) error { |
|
|
|
return errVolumeExists |
|
|
|
return errVolumeExists |
|
|
|
case errFileNotFound.Error(): |
|
|
|
case errFileNotFound.Error(): |
|
|
|
return errFileNotFound |
|
|
|
return errFileNotFound |
|
|
|
|
|
|
|
case errFileNameTooLong.Error(): |
|
|
|
|
|
|
|
return errFileNameTooLong |
|
|
|
|
|
|
|
case errFileAccessDenied.Error(): |
|
|
|
|
|
|
|
return errFileAccessDenied |
|
|
|
case errIsNotRegular.Error(): |
|
|
|
case errIsNotRegular.Error(): |
|
|
|
return errIsNotRegular |
|
|
|
return errIsNotRegular |
|
|
|
case errVolumeNotEmpty.Error(): |
|
|
|
case errVolumeNotEmpty.Error(): |
|
|
|
return errVolumeNotEmpty |
|
|
|
return errVolumeNotEmpty |
|
|
|
case errFileAccessDenied.Error(): |
|
|
|
|
|
|
|
return errFileAccessDenied |
|
|
|
|
|
|
|
case errVolumeAccessDenied.Error(): |
|
|
|
case errVolumeAccessDenied.Error(): |
|
|
|
return errVolumeAccessDenied |
|
|
|
return errVolumeAccessDenied |
|
|
|
|
|
|
|
case errCorruptedFormat.Error(): |
|
|
|
|
|
|
|
return errCorruptedFormat |
|
|
|
|
|
|
|
case errUnformattedDisk.Error(): |
|
|
|
|
|
|
|
return errUnformattedDisk |
|
|
|
} |
|
|
|
} |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|