aboutsummaryrefslogtreecommitdiff
path: root/pkg/mountmanager/socket.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/mountmanager/socket.go')
-rw-r--r--pkg/mountmanager/socket.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/pkg/mountmanager/socket.go b/pkg/mountmanager/socket.go
index 1b8a079..f327dcb 100644
--- a/pkg/mountmanager/socket.go
+++ b/pkg/mountmanager/socket.go
@@ -2,15 +2,23 @@ package mountmanager
import (
"fmt"
+ "path/filepath"
"github.com/seaweedfs/seaweedfs/weed/util"
)
+// DefaultSocketDir is the default directory for volume sockets.
+const DefaultSocketDir = "/var/lib/seaweedfs-mount"
+
// LocalSocketPath returns the unix socket path used to communicate with the weed mount process.
-func LocalSocketPath(volumeID string) string {
+// The baseDir parameter should be the directory where sockets are stored (e.g., derived from mountEndpoint).
+func LocalSocketPath(baseDir, volumeID string) string {
+ if baseDir == "" {
+ baseDir = DefaultSocketDir
+ }
hash := util.HashToInt32([]byte(volumeID))
if hash < 0 {
hash = -hash
}
- return fmt.Sprintf("/var/lib/seaweedfs-mount/seaweedfs-mount-%d.sock", hash)
+ return filepath.Join(baseDir, fmt.Sprintf("seaweedfs-mount-%d.sock", hash))
}