Skip to content

Commit

Permalink
gofumpt; fix op remove.
Browse files Browse the repository at this point in the history
  • Loading branch information
smallfz committed Sep 13, 2024
1 parent 20578a6 commit b84fd0d
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 17 deletions.
16 changes: 7 additions & 9 deletions log/levels.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ const (
NOTSET = 8
)

var (
idx = map[int]string{
CRITICAL: "critical",
ERROR: "error",
WARNING: "warning",
INFO: "info",
DEBUG: "debug",
}
)
var idx = map[int]string{
CRITICAL: "critical",
ERROR: "error",
WARNING: "warning",
INFO: "info",
DEBUG: "debug",
}

func GetLevelName(lev int) string {
if name, found := idx[lev]; found {
Expand Down
2 changes: 1 addition & 1 deletion nfs/implv3/access.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func Access(h *nfs.RPCMsgCall, ctx nfs.RPCContext) (int, error) {
AttributesFollow: true,
Attributes: &nfs.FileAttrs{
Type: nfs.FTYPE_NF3DIR,
Mode: uint32(0777),
Mode: uint32(0o777),
Size: 0,
Used: 0,
ATime: nfs.MakeNfsTime(now),
Expand Down
2 changes: 1 addition & 1 deletion nfs/implv3/fsinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func FsInfo(h *nfs.RPCMsgCall, ctx nfs.RPCContext) (int, error) {
AttributesFollow: true,
Attributes: &nfs.FileAttrs{
Type: nfs.FTYPE_NF3DIR,
Mode: uint32(0755),
Mode: uint32(0o755),
Size: 1 << 63,
Used: 0,
ATime: nfs.MakeNfsTime(now),
Expand Down
2 changes: 1 addition & 1 deletion nfs/implv3/fsstat.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func FsStat(h *nfs.RPCMsgCall, ctx nfs.RPCContext) (int, error) {
AttributesFollow: true,
Attributes: &nfs.FileAttrs{
Type: nfs.FTYPE_NF3DIR,
Mode: uint32(0755),
Mode: uint32(0o755),
Size: capacity,
Used: 0,
ATime: nfs.MakeNfsTime(now),
Expand Down
2 changes: 1 addition & 1 deletion nfs/implv3/getattr.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func GetAttr(h *nfs.RPCMsgCall, ctx nfs.RPCContext) (int, error) {

attr := nfs.FileAttrs{
Type: ftype,
Mode: uint32(0755),
Mode: uint32(0o755),
Size: uint64(fi.Size()),
Used: uint64(fi.Size()),
Rdev: nfs.SpecData{},
Expand Down
2 changes: 1 addition & 1 deletion nfs/implv3/pathconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func PathConf(h *nfs.RPCMsgCall, ctx nfs.RPCContext) (int, error) {
AttributesFollow: true,
Attributes: &nfs.FileAttrs{
Type: nfs.FTYPE_NF3DIR,
Mode: uint32(0755),
Mode: uint32(0o755),
Size: 1 << 63,
Used: 0,
ATime: nfs.MakeNfsTime(now),
Expand Down
3 changes: 2 additions & 1 deletion nfs/implv3/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package implv3
import (
"crypto/md5"
"encoding/binary"
"github.com/smallfz/libnfs-go/nfs"
"os"
"path"
"time"

"github.com/smallfz/libnfs-go/nfs"
)

func getFileId(name string) uint64 {
Expand Down
3 changes: 2 additions & 1 deletion nfs/implv4/attrs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package implv4

import (
"encoding/json"
"github.com/smallfz/libnfs-go/log"
"testing"

"github.com/smallfz/libnfs-go/log"
)

func TestFAttr4Decoding(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion nfs/implv4/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
)

func commit(x nfs.RPCContext, args *nfs.COMMIT4args) (*nfs.COMMIT4res, error) {

vfs := x.GetFS()
fh := x.Stat().CurrentHandle()
pathName, err := vfs.ResolveHandle(fh)
Expand Down
1 change: 1 addition & 0 deletions nfs/implv4/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func remove(x nfs.RPCContext, args *nfs.REMOVE4args) (*nfs.REMOVE4res, error) {
fi, err := vfs.Stat(pathName)
if err != nil {
log.Warnf(" remove: vfs.Stat(%s): %v", pathName, err)
return &nfs.REMOVE4res{Status: nfs.NFS4ERR_PERM}, nil
}

if fi.IsDir() && fi.NumLinks() > 2 {
Expand Down
2 changes: 2 additions & 0 deletions server/mux_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ type Mux struct {
stat nfs.StatService
}

var _ nfs.RPCContext = (*Mux)(nil)

func (x *Mux) Reader() *xdr.Reader {
return x.reader
}
Expand Down
2 changes: 2 additions & 0 deletions server/mux_v4.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ type Muxv4 struct {
stat nfs.StatService
}

var _ nfs.RPCContext = (*Muxv4)(nil)

func (x *Muxv4) Reader() *xdr.Reader {
return x.reader
}
Expand Down

0 comments on commit b84fd0d

Please sign in to comment.