@@ -10,21 +10,21 @@ import (
1010 "k8s.io/klog/v2"
1111)
1212
13- type Smb struct {
13+ type SMB struct {
1414 hostAPI smbapi.API
1515 fs fs.Interface
1616}
1717
1818type Interface interface {
19- // NewSmbGlobalMapping creates an SMB mapping on the SMB client to an SMB share.
20- NewSmbGlobalMapping (context.Context , * NewSmbGlobalMappingRequest ) (* NewSmbGlobalMappingResponse , error )
19+ // NewSMBGlobalMapping creates an SMB mapping on the SMB client to an SMB share.
20+ NewSMBGlobalMapping (context.Context , * NewSMBGlobalMappingRequest ) (* NewSMBGlobalMappingResponse , error )
2121
22- // RemoveSmbGlobalMapping removes the SMB mapping to an SMB share.
23- RemoveSmbGlobalMapping (context.Context , * RemoveSmbGlobalMappingRequest ) (* RemoveSmbGlobalMappingResponse , error )
22+ // RemoveSMBGlobalMapping removes the SMB mapping to an SMB share.
23+ RemoveSMBGlobalMapping (context.Context , * RemoveSMBGlobalMappingRequest ) (* RemoveSMBGlobalMappingResponse , error )
2424}
2525
26- // check that Smb implements the Interface
27- var _ Interface = & Smb {}
26+ // check that SMB implements the Interface
27+ var _ Interface = & SMB {}
2828
2929func normalizeWindowsPath (path string ) string {
3030 normalizedPath := strings .Replace (path , "/" , "\\ " , - 1 )
@@ -46,21 +46,21 @@ func getRootMappingPath(path string) (string, error) {
4646 klog .Errorf ("remote path (%s) is invalid" , path )
4747 return "" , fmt .Errorf ("remote path (%s) is invalid" , path )
4848 }
49- // parts[0] is a smb host name
50- // parts[1] is a smb share name
49+ // parts[0] is a SMB host name
50+ // parts[1] is a SMB share name
5151 return strings .ToLower ("\\ \\ " + parts [0 ] + "\\ " + parts [1 ]), nil
5252}
5353
54- func New (hostAPI smbapi.API , fsClient fs.Interface ) (* Smb , error ) {
55- return & Smb {
54+ func New (hostAPI smbapi.API , fsClient fs.Interface ) (* SMB , error ) {
55+ return & SMB {
5656 hostAPI : hostAPI ,
5757 fs : fsClient ,
5858 }, nil
5959}
6060
61- func (s * Smb ) NewSmbGlobalMapping (context context.Context , request * NewSmbGlobalMappingRequest ) (* NewSmbGlobalMappingResponse , error ) {
62- klog .V (2 ).Infof ("calling NewSmbGlobalMapping with remote path %q" , request .RemotePath )
63- response := & NewSmbGlobalMappingResponse {}
61+ func (s * SMB ) NewSMBGlobalMapping (context context.Context , request * NewSMBGlobalMappingRequest ) (* NewSMBGlobalMappingResponse , error ) {
62+ klog .V (2 ).Infof ("calling NewSMBGlobalMapping with remote path %q" , request .RemotePath )
63+ response := & NewSMBGlobalMappingResponse {}
6464 remotePath := normalizeWindowsPath (request .RemotePath )
6565 localPath := request .LocalPath
6666
@@ -74,7 +74,7 @@ func (s *Smb) NewSmbGlobalMapping(context context.Context, request *NewSmbGlobal
7474 return response , err
7575 }
7676
77- isMapped , err := s .hostAPI .IsSmbMapped (mappingPath )
77+ isMapped , err := s .hostAPI .IsSMBMapped (mappingPath )
7878 if err != nil {
7979 isMapped = false
8080 }
@@ -89,9 +89,9 @@ func (s *Smb) NewSmbGlobalMapping(context context.Context, request *NewSmbGlobal
8989
9090 if ! validResp .Valid {
9191 klog .V (4 ).Infof ("RemotePath %s is not valid, removing now" , mappingPath )
92- err := s .hostAPI .RemoveSmbGlobalMapping (mappingPath )
92+ err := s .hostAPI .RemoveSMBGlobalMapping (mappingPath )
9393 if err != nil {
94- klog .Errorf ("RemoveSmbGlobalMapping (%s) failed with %v" , mappingPath , err )
94+ klog .Errorf ("RemoveSMBGlobalMapping (%s) failed with %v" , mappingPath , err )
9595 return response , err
9696 }
9797 isMapped = false
@@ -102,9 +102,9 @@ func (s *Smb) NewSmbGlobalMapping(context context.Context, request *NewSmbGlobal
102102
103103 if ! isMapped {
104104 klog .V (4 ).Infof ("Remote %s not mapped. Mapping now!" , mappingPath )
105- err = s .hostAPI .NewSmbGlobalMapping (mappingPath , request .Username , request .Password )
105+ err = s .hostAPI .NewSMBGlobalMapping (mappingPath , request .Username , request .Password )
106106 if err != nil {
107- klog .Errorf ("failed NewSmbGlobalMapping %v" , err )
107+ klog .Errorf ("failed NewSMBGlobalMapping %v" , err )
108108 return response , err
109109 }
110110 }
@@ -116,20 +116,20 @@ func (s *Smb) NewSmbGlobalMapping(context context.Context, request *NewSmbGlobal
116116 klog .Errorf ("failed validate plugin path %v" , err )
117117 return response , err
118118 }
119- err = s .hostAPI .NewSmbLink (remotePath , localPath )
119+ err = s .hostAPI .NewSMBLink (remotePath , localPath )
120120 if err != nil {
121- klog .Errorf ("failed NewSmbLink %v" , err )
121+ klog .Errorf ("failed NewSMBLink %v" , err )
122122 return response , fmt .Errorf ("creating link %s to %s failed with error: %v" , localPath , remotePath , err )
123123 }
124124 }
125125
126- klog .V (2 ).Infof ("NewSmbGlobalMapping on remote path %q is completed" , request .RemotePath )
126+ klog .V (2 ).Infof ("NewSMBGlobalMapping on remote path %q is completed" , request .RemotePath )
127127 return response , nil
128128}
129129
130- func (s * Smb ) RemoveSmbGlobalMapping (context context.Context , request * RemoveSmbGlobalMappingRequest ) (* RemoveSmbGlobalMappingResponse , error ) {
131- klog .V (2 ).Infof ("calling RemoveSmbGlobalMapping with remote path %q" , request .RemotePath )
132- response := & RemoveSmbGlobalMappingResponse {}
130+ func (s * SMB ) RemoveSMBGlobalMapping (context context.Context , request * RemoveSMBGlobalMappingRequest ) (* RemoveSMBGlobalMappingResponse , error ) {
131+ klog .V (2 ).Infof ("calling RemoveSMBGlobalMapping with remote path %q" , request .RemotePath )
132+ response := & RemoveSMBGlobalMappingResponse {}
133133 remotePath := normalizeWindowsPath (request .RemotePath )
134134
135135 if remotePath == "" {
@@ -142,12 +142,12 @@ func (s *Smb) RemoveSmbGlobalMapping(context context.Context, request *RemoveSmb
142142 return response , err
143143 }
144144
145- err = s .hostAPI .RemoveSmbGlobalMapping (mappingPath )
145+ err = s .hostAPI .RemoveSMBGlobalMapping (mappingPath )
146146 if err != nil {
147- klog .Errorf ("failed RemoveSmbGlobalMapping %v" , err )
147+ klog .Errorf ("failed RemoveSMBGlobalMapping %v" , err )
148148 return response , err
149149 }
150150
151- klog .V (2 ).Infof ("RemoveSmbGlobalMapping on remote path %q is completed" , request .RemotePath )
151+ klog .V (2 ).Infof ("RemoveSMBGlobalMapping on remote path %q is completed" , request .RemotePath )
152152 return response , nil
153153}
0 commit comments