Skip to content

Commit a52daa2

Browse files
committed
refactor(btrfs): separate init from implementation
Part of #4513 Signed-off-by: Jian Zeng <[email protected]>
1 parent 4154235 commit a52daa2

2 files changed

Lines changed: 3 additions & 16 deletions

File tree

cmd/containerd/builtins_btrfs_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818

1919
package main
2020

21-
import _ "github.com/containerd/containerd/snapshots/btrfs"
21+
import _ "github.com/containerd/containerd/snapshots/btrfs/plugin"

snapshots/btrfs/btrfs.go

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,18 @@ import (
2626
"strings"
2727

2828
"github.com/containerd/btrfs"
29+
"github.com/containerd/continuity/fs"
30+
2931
"github.com/containerd/containerd/log"
3032
"github.com/containerd/containerd/mount"
31-
"github.com/containerd/containerd/platforms"
3233
"github.com/containerd/containerd/plugin"
3334
"github.com/containerd/containerd/snapshots"
3435
"github.com/containerd/containerd/snapshots/storage"
35-
"github.com/containerd/continuity/fs"
3636

37-
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
3837
"github.com/pkg/errors"
3938
"github.com/sirupsen/logrus"
4039
)
4140

42-
func init() {
43-
plugin.Register(&plugin.Registration{
44-
ID: "btrfs",
45-
Type: plugin.SnapshotPlugin,
46-
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
47-
ic.Meta.Platforms = []ocispec.Platform{platforms.DefaultSpec()}
48-
ic.Meta.Exports = map[string]string{"root": ic.Root}
49-
return NewSnapshotter(ic.Root)
50-
},
51-
})
52-
}
53-
5441
type snapshotter struct {
5542
device string // device of the root
5643
root string // root provides paths for internal storage.

0 commit comments

Comments
 (0)