Skip to content

Commit

Permalink
Support building internal/ with GOOS=windows
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalif committed Jun 9, 2023
1 parent e84bb87 commit 7cd8e0a
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 7 deletions.
4 changes: 2 additions & 2 deletions internal/cluster_conn_pool.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !windows

package internal

import (
Expand All @@ -16,8 +18,6 @@ const OUTSTAGE_TIMEOUT = 10 * time.Second

var connsLog = GetLogger("conns")

type NodeId uint64

type Peer struct {
mu sync.RWMutex
address string
Expand Down
2 changes: 2 additions & 0 deletions internal/cluster_fs.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !windows

package internal

import (
Expand Down
2 changes: 2 additions & 0 deletions internal/cluster_fs_fuse.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !windows

package internal

import (
Expand Down
2 changes: 2 additions & 0 deletions internal/cluster_fs_grpc.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !windows

package internal

import (
Expand Down
2 changes: 2 additions & 0 deletions internal/cluster_grpc_server.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !windows

package internal

import (
Expand Down
2 changes: 2 additions & 0 deletions internal/cluster_inode.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !windows

package internal

import (
Expand Down
2 changes: 2 additions & 0 deletions internal/cluster_recovery.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !windows

package internal

import (
Expand Down
11 changes: 6 additions & 5 deletions internal/handles.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
"github.com/aws/aws-sdk-go/aws"

"github.com/jacobsa/fuse/fuseops"
"golang.org/x/sys/unix"

"github.com/sirupsen/logrus"
)
Expand All @@ -44,6 +43,8 @@ const (
ST_DELETED int32 = 4
)

type NodeId uint64

type MountedFS interface {
Join(ctx context.Context) error
}
Expand Down Expand Up @@ -583,12 +584,12 @@ func (inode *Inode) getXattrMap(name string, userOnly bool) (
if userOnly {
return nil, "", syscall.EPERM
} else {
return nil, "", unix.ENODATA
return nil, "", syscall.ENODATA
}
}

if meta == nil {
return nil, "", unix.ENODATA
return nil, "", syscall.ENODATA
}

return
Expand Down Expand Up @@ -638,11 +639,11 @@ func (inode *Inode) SetXattr(name string, value []byte, flags uint32) error {

if flags != 0x0 {
_, ok := meta[name]
if flags == unix.XATTR_CREATE {
if flags == XATTR_CREATE {
if ok {
return syscall.EEXIST
}
} else if flags == unix.XATTR_REPLACE {
} else if flags == XATTR_REPLACE {
if !ok {
return syscall.ENODATA
}
Expand Down
26 changes: 26 additions & 0 deletions internal/utils_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// +build !windows

// Copyright 2021 Yandex LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package internal

import (
"golang.org/x/sys/unix"
)

const (
XATTR_CREATE = unix.XATTR_CREATE
XATTR_REPLACE = unix.XATTR_REPLACE
)
20 changes: 20 additions & 0 deletions internal/utils_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2021 Yandex LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package internal

const (
XATTR_CREATE = 0x1
XATTR_REPLACE = 0x2
)

0 comments on commit 7cd8e0a

Please sign in to comment.