@@ -4,17 +4,17 @@ package internal
44
55import (
66 "context"
7- iofs "io/fs"
87 "fmt"
9- "syscall "
8+ iofs "io/fs "
109 "sync/atomic"
10+ "syscall"
1111
12- "github.com/yandex-cloud/geesefs/internal/cfg"
1312 "github.com/jacobsa/fuse"
1413 "github.com/jacobsa/fuse/fuseops"
1514 "github.com/jacobsa/fuse/fuseutil"
16- "github.com/yandex-cloud/geesefs/internal/pb"
1715 "github.com/sirupsen/logrus"
16+ "github.com/yandex-cloud/geesefs/internal/cfg"
17+ "github.com/yandex-cloud/geesefs/internal/pb"
1818 "google.golang.org/grpc"
1919 "google.golang.org/protobuf/types/known/timestamppb"
2020)
@@ -66,8 +66,8 @@ func (fs *ClusterFsFuse) CreateFile(ctx context.Context, op *fuseops.CreateFileO
6666 op .Entry .Attributes .Mtime = attr .Mtime .AsTime ()
6767 op .Entry .Attributes .Ctime = attr .Ctime .AsTime ()
6868 op .Entry .Attributes .Mode = iofs .FileMode (attr .Mode )
69- op .Entry .Attributes .Uid = 1000
70- op .Entry .Attributes .Gid = 1001
69+ op .Entry .Attributes .Uid = fs . Flags . Uid
70+ op .Entry .Attributes .Gid = fs . Flags . Gid
7171 op .Handle = fuseops .HandleID (handleId )
7272 },
7373 func (parent * Inode , parentOwner NodeId ) * pb.Owner {
@@ -117,8 +117,8 @@ func (fs *ClusterFsFuse) CreateFile(ctx context.Context, op *fuseops.CreateFileO
117117 op .Entry .Attributes .Mtime = resp .Attr .Mtime .AsTime ()
118118 op .Entry .Attributes .Ctime = resp .Attr .Ctime .AsTime ()
119119 op .Entry .Attributes .Mode = iofs .FileMode (resp .Attr .Mode )
120- op .Entry .Attributes .Uid = 1000
121- op .Entry .Attributes .Gid = 1001
120+ op .Entry .Attributes .Uid = fs . Flags . Uid
121+ op .Entry .Attributes .Gid = fs . Flags . Gid
122122 op .Handle = fuseops .HandleID (resp .HandleId )
123123
124124 return nil
@@ -336,8 +336,8 @@ func (fs *ClusterFsFuse) CreateSymlink(ctx context.Context, op *fuseops.CreateSy
336336 op .Entry .Attributes .Mtime = attr .Mtime .AsTime ()
337337 op .Entry .Attributes .Ctime = attr .Ctime .AsTime ()
338338 op .Entry .Attributes .Mode = iofs .FileMode (attr .Mode )
339- op .Entry .Attributes .Uid = 1000
340- op .Entry .Attributes .Gid = 1001
339+ op .Entry .Attributes .Uid = fs . Flags . Uid
340+ op .Entry .Attributes .Gid = fs . Flags . Gid
341341 },
342342 func (parent * Inode , parentOwner NodeId ) * pb.Owner {
343343 var resp * pb.CreateSymlinkResponse
@@ -381,8 +381,8 @@ func (fs *ClusterFsFuse) CreateSymlink(ctx context.Context, op *fuseops.CreateSy
381381 op .Entry .Attributes .Mtime = resp .Attr .Mtime .AsTime ()
382382 op .Entry .Attributes .Ctime = resp .Attr .Ctime .AsTime ()
383383 op .Entry .Attributes .Mode = iofs .FileMode (resp .Attr .Mode )
384- op .Entry .Attributes .Uid = 1000
385- op .Entry .Attributes .Gid = 1001
384+ op .Entry .Attributes .Uid = fs . Flags . Uid
385+ op .Entry .Attributes .Gid = fs . Flags . Gid
386386
387387 return nil
388388 },
@@ -450,8 +450,8 @@ func (fs *ClusterFsFuse) MkDir(ctx context.Context, op *fuseops.MkDirOp) (err er
450450 op .Entry .Attributes .Mtime = attr .Mtime .AsTime ()
451451 op .Entry .Attributes .Ctime = attr .Ctime .AsTime ()
452452 op .Entry .Attributes .Mode = iofs .FileMode (attr .Mode )
453- op .Entry .Attributes .Uid = 1000
454- op .Entry .Attributes .Gid = 1001
453+ op .Entry .Attributes .Uid = fs . Flags . Uid
454+ op .Entry .Attributes .Gid = fs . Flags . Gid
455455 },
456456 func (parent * Inode , parentOwner NodeId ) * pb.Owner {
457457 // 1st phase
@@ -496,8 +496,8 @@ func (fs *ClusterFsFuse) MkDir(ctx context.Context, op *fuseops.MkDirOp) (err er
496496 op .Entry .Attributes .Mtime = resp .Attr .Mtime .AsTime ()
497497 op .Entry .Attributes .Ctime = resp .Attr .Ctime .AsTime ()
498498 op .Entry .Attributes .Mode = iofs .FileMode (resp .Attr .Mode )
499- op .Entry .Attributes .Uid = 1000
500- op .Entry .Attributes .Gid = 1001
499+ op .Entry .Attributes .Uid = fs . Flags . Uid
500+ op .Entry .Attributes .Gid = fs . Flags . Gid
501501
502502 return nil
503503 },
@@ -643,8 +643,8 @@ func (fs *ClusterFsFuse) LookUpInode(ctx context.Context, op *fuseops.LookUpInod
643643 op .Entry .Attributes .Mtime = pbAttr .Mtime .AsTime ()
644644 op .Entry .Attributes .Ctime = pbAttr .Ctime .AsTime ()
645645 op .Entry .Attributes .Mode = iofs .FileMode (pbAttr .Mode )
646- op .Entry .Attributes .Uid = 1000
647- op .Entry .Attributes .Gid = 1001
646+ op .Entry .Attributes .Uid = fs . Flags . Uid
647+ op .Entry .Attributes .Gid = fs . Flags . Gid
648648 },
649649 func (parent * Inode , parentOwner NodeId ) * pb.Owner {
650650 // 1st phase
@@ -688,8 +688,8 @@ func (fs *ClusterFsFuse) LookUpInode(ctx context.Context, op *fuseops.LookUpInod
688688 op .Entry .Attributes .Mtime = resp .Attr .Mtime .AsTime ()
689689 op .Entry .Attributes .Ctime = resp .Attr .Ctime .AsTime ()
690690 op .Entry .Attributes .Mode = iofs .FileMode (resp .Attr .Mode )
691- op .Entry .Attributes .Uid = 1000
692- op .Entry .Attributes .Gid = 1001
691+ op .Entry .Attributes .Uid = fs . Flags . Uid
692+ op .Entry .Attributes .Gid = fs . Flags . Gid
693693
694694 return nil
695695 },
@@ -749,8 +749,8 @@ func (fs *ClusterFsFuse) GetInodeAttributes(ctx context.Context, op *fuseops.Get
749749 } else {
750750 op .Attributes .Nlink = 1
751751 }
752- op .Attributes .Uid = 1000
753- op .Attributes .Gid = 1001
752+ op .Attributes .Uid = fs . Flags . Uid
753+ op .Attributes .Gid = fs . Flags . Gid
754754 },
755755 func (inode * Inode , inodeOwner NodeId ) * pb.Owner {
756756 var resp * pb.GetInodeAttributesResponse
@@ -780,8 +780,8 @@ func (fs *ClusterFsFuse) GetInodeAttributes(ctx context.Context, op *fuseops.Get
780780 op .Attributes .Mtime = resp .Attributes .Mtime .AsTime ()
781781 op .Attributes .Ctime = resp .Attributes .Ctime .AsTime ()
782782 op .Attributes .Mode = iofs .FileMode (resp .Attributes .Mode )
783- op .Attributes .Uid = 1000
784- op .Attributes .Gid = 1001
783+ op .Attributes .Uid = fs . Flags . Uid
784+ op .Attributes .Gid = fs . Flags . Gid
785785
786786 return nil
787787 },
@@ -801,8 +801,8 @@ func (fs *ClusterFsFuse) SetInodeAttributes(ctx context.Context, op *fuseops.Set
801801 } else {
802802 op .Attributes .Nlink = 1
803803 }
804- op .Attributes .Uid = 1000
805- op .Attributes .Gid = 1001
804+ op .Attributes .Uid = fs . Flags . Uid
805+ op .Attributes .Gid = fs . Flags . Gid
806806 },
807807 func (inode * Inode , inodeOwner NodeId ) * pb.Owner {
808808 var mtime * timestamppb.Timestamp
@@ -839,8 +839,8 @@ func (fs *ClusterFsFuse) SetInodeAttributes(ctx context.Context, op *fuseops.Set
839839 op .Attributes .Mtime = resp .Attributes .Mtime .AsTime ()
840840 op .Attributes .Ctime = resp .Attributes .Ctime .AsTime ()
841841 op .Attributes .Mode = iofs .FileMode (resp .Attributes .Mode )
842- op .Attributes .Uid = 1000
843- op .Attributes .Gid = 1001
842+ op .Attributes .Uid = fs . Flags . Uid
843+ op .Attributes .Gid = fs . Flags . Gid
844844
845845 return nil
846846 },
0 commit comments