diff options
author | ethersphere <thesw@rm.eth> | 2018-06-20 20:06:27 +0800 |
---|---|---|
committer | ethersphere <thesw@rm.eth> | 2018-06-22 03:10:31 +0800 |
commit | e187711c6545487d4cac3701f0f506bb536234e2 (patch) | |
tree | d2f6150f70b84b36e49a449082aeda267b4b9046 /swarm/fuse/swarmfs_util.go | |
parent | 574378edb50c907b532946a1d4654dbd6701b20a (diff) | |
download | go-tangerine-e187711c6545487d4cac3701f0f506bb536234e2.tar go-tangerine-e187711c6545487d4cac3701f0f506bb536234e2.tar.gz go-tangerine-e187711c6545487d4cac3701f0f506bb536234e2.tar.bz2 go-tangerine-e187711c6545487d4cac3701f0f506bb536234e2.tar.lz go-tangerine-e187711c6545487d4cac3701f0f506bb536234e2.tar.xz go-tangerine-e187711c6545487d4cac3701f0f506bb536234e2.tar.zst go-tangerine-e187711c6545487d4cac3701f0f506bb536234e2.zip |
swarm: network rewrite merge
Diffstat (limited to 'swarm/fuse/swarmfs_util.go')
-rw-r--r-- | swarm/fuse/swarmfs_util.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/swarm/fuse/swarmfs_util.go b/swarm/fuse/swarmfs_util.go index 169b67487..9bbb0f6ac 100644 --- a/swarm/fuse/swarmfs_util.go +++ b/swarm/fuse/swarmfs_util.go @@ -24,7 +24,7 @@ import ( "os/exec" "runtime" - "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/swarm/log" ) func externalUnmount(mountPoint string) error { @@ -38,11 +38,11 @@ func externalUnmount(mountPoint string) error { // Try FUSE-specific commands if umount didn't work. switch runtime.GOOS { case "darwin": - return exec.CommandContext(ctx, "diskutil", "umount", "force", mountPoint).Run() + return exec.CommandContext(ctx, "diskutil", "umount", mountPoint).Run() case "linux": return exec.CommandContext(ctx, "fusermount", "-u", mountPoint).Run() default: - return fmt.Errorf("unmount: unimplemented") + return fmt.Errorf("swarmfs unmount: unimplemented") } } @@ -54,14 +54,14 @@ func addFileToSwarm(sf *SwarmFile, content []byte, size int) error { sf.lock.Lock() defer sf.lock.Unlock() - sf.key = fkey + sf.addr = fkey sf.fileSize = int64(size) sf.mountInfo.lock.Lock() defer sf.mountInfo.lock.Unlock() sf.mountInfo.LatestManifest = mhash - log.Info("Added new file:", "fname", sf.name, "New Manifest hash", mhash) + log.Info("swarmfs added new file:", "fname", sf.name, "new Manifest hash", mhash) return nil } @@ -75,7 +75,7 @@ func removeFileFromSwarm(sf *SwarmFile) error { defer sf.mountInfo.lock.Unlock() sf.mountInfo.LatestManifest = mkey - log.Info("Removed file:", "fname", sf.name, "New Manifest hash", mkey) + log.Info("swarmfs removed file:", "fname", sf.name, "new Manifest hash", mkey) return nil } @@ -102,20 +102,20 @@ func removeDirectoryFromSwarm(sd *SwarmDir) error { } func appendToExistingFileInSwarm(sf *SwarmFile, content []byte, offset int64, length int64) error { - fkey, mhash, err := sf.mountInfo.swarmApi.AppendFile(sf.mountInfo.LatestManifest, sf.path, sf.name, sf.fileSize, content, sf.key, offset, length, true) + fkey, mhash, err := sf.mountInfo.swarmApi.AppendFile(sf.mountInfo.LatestManifest, sf.path, sf.name, sf.fileSize, content, sf.addr, offset, length, true) if err != nil { return err } sf.lock.Lock() defer sf.lock.Unlock() - sf.key = fkey + sf.addr = fkey sf.fileSize = sf.fileSize + int64(len(content)) sf.mountInfo.lock.Lock() defer sf.mountInfo.lock.Unlock() sf.mountInfo.LatestManifest = mhash - log.Info("Appended file:", "fname", sf.name, "New Manifest hash", mhash) + log.Info("swarmfs appended file:", "fname", sf.name, "new Manifest hash", mhash) return nil } |