Skip to content

Commit 8390388

Browse files
author
Dmitry Rozhkov
committed
qat: make users explicitly opt in to have kernel mode compiled in
1 parent 3d9b19d commit 8390388

File tree

4 files changed

+38
-2
lines changed

4 files changed

+38
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ lint:
3232
@rc=0 ; for f in $$(find -name \*.go | grep -v \.\/vendor) ; do golint -set_exit_status $$f || rc=1 ; done ; exit $$rc
3333

3434
$(cmds):
35-
cd cmd/$@; go build
35+
cd cmd/$@; $(GO) build
3636

3737
build: $(cmds)
3838

3939
clean:
40-
@for cmd in $(cmds) ; do pwd=$(shell pwd) ; cd cmd/$$cmd ; go clean ; cd $$pwd ; done
40+
@for cmd in $(cmds) ; do pwd=$(shell pwd) ; cd cmd/$$cmd ; $(GO) clean ; cd $$pwd ; done
4141

4242
TAG?=$(shell git rev-parse HEAD)
4343

cmd/qat_plugin/kerneldrv/kerneldrv.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// +build kerneldrv
16+
1517
package kerneldrv
1618

1719
import (

cmd/qat_plugin/kerneldrv/kerneldrv_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// +build kerneldrv
16+
1517
package kerneldrv
1618

1719
import (

cmd/qat_plugin/kerneldrv/stub.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright 2019 Intel Corporation. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// +build !kerneldrv
16+
17+
package kerneldrv
18+
19+
import (
20+
"fmt"
21+
"os"
22+
23+
dpapi "github.com/intel/intel-device-plugins-for-kubernetes/pkg/deviceplugin"
24+
)
25+
26+
// NewDevicePlugin creates a non-functional stub for kernel mode device plugins.
27+
func NewDevicePlugin() dpapi.Scanner {
28+
fmt.Println("kernel mode is not supported in this build. Use 'kerneldrv' build tag to have this mode enabled. Exiting...")
29+
os.Exit(1)
30+
31+
return nil
32+
}

0 commit comments

Comments
 (0)