[lxc-devel] [go-lxc/v2] Add missing comments for exported functions
caglar10ur on Github
lxc-bot at linuxcontainers.org
Sat Sep 16 22:23:02 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 302 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170916/732fc519/attachment.bin>
-------------- next part --------------
From 7b6d52db23a1ab279ff19daa82ae129bd5461ee8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=2E=C3=87a=C4=9Flar=20Onur?= <caglar at 10ur.org>
Date: Sat, 16 Sep 2017 15:22:16 -0700
Subject: [PATCH] Add missing comments for exported functions
---
container.go | 5 ++++-
lxc-binding.go | 3 +++
options.go | 11 ++++++-----
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/container.go b/container.go
index ffc7276..e9a760c 100644
--- a/container.go
+++ b/container.go
@@ -452,6 +452,7 @@ func (c *Container) Start() error {
return nil
}
+// StartWithArgs starts the container using given arguments.
func (c *Container) StartWithArgs(args []string) error {
if err := c.makeSure(isNotRunning); err != nil {
return err
@@ -1178,6 +1179,7 @@ func (c *Container) RunCommandStatus(args []string, options AttachOptions) (int,
return ret, nil
}
+// RunCommandNoWait runs the given command and returns without waiting it to finish.
func (c *Container) RunCommandNoWait(args []string, options AttachOptions) (int, error) {
if len(args) == 0 {
return -1, ErrInsufficientNumberOfArguments
@@ -1591,6 +1593,7 @@ func (c *Container) Restore(opts RestoreOptions) error {
return nil
}
+// Migrate migrates the container.
func (c *Container) Migrate(cmd uint, opts MigrateOptions) error {
if err := c.makeSure(isNotDefined | isGreaterEqualThanLXC20); err != nil {
return err
@@ -1636,7 +1639,7 @@ func (c *Container) Migrate(cmd uint, opts MigrateOptions) error {
ret := C.int(C.go_lxc_migrate(c.container, C.uint(cmd), &copts, &extras))
if ret != 0 {
- return fmt.Errorf("migration failed %d\n", ret)
+ return fmt.Errorf("migration failed %d", ret)
}
return nil
diff --git a/lxc-binding.go b/lxc-binding.go
index a45648f..834ad58 100644
--- a/lxc-binding.go
+++ b/lxc-binding.go
@@ -198,6 +198,7 @@ func ActiveContainers(lxcpath ...string) []Container {
return containers
}
+// VersionNumber returns the LXC version.
func VersionNumber() (major int, minor int) {
major = C.LXC_VERSION_MAJOR
minor = C.LXC_VERSION_MINOR
@@ -205,6 +206,7 @@ func VersionNumber() (major int, minor int) {
return
}
+// VersionAtLeast returns true when the tested version >= current version.
func VersionAtLeast(major int, minor int, micro int) bool {
if C.LXC_DEVEL == 1 {
return true
@@ -228,6 +230,7 @@ func VersionAtLeast(major int, minor int, micro int) bool {
return true
}
+// IsSupportedConfigItem returns true if the key belongs to a supported config item.
func IsSupportedConfigItem(key string) bool {
configItem := C.CString(key)
defer C.free(unsafe.Pointer(configItem))
diff --git a/options.go b/options.go
index 5b53c60..7130851 100644
--- a/options.go
+++ b/options.go
@@ -142,7 +142,7 @@ type ConsoleOptions struct {
EscapeCharacter rune
}
-// DefailtConsoleOptions is a convenient set of options to be used.
+// DefaultConsoleOptions is a convenient set of options to be used.
var DefaultConsoleOptions = ConsoleOptions{
Tty: -1,
StdinFd: os.Stdin.Fd(),
@@ -175,25 +175,26 @@ var DefaultCloneOptions = CloneOptions{
Backend: Directory,
}
-// CheckpointOptions type is used for defining checkpoint options for CRIU
+// CheckpointOptions type is used for defining checkpoint options for CRIU.
type CheckpointOptions struct {
Directory string
Stop bool
Verbose bool
}
-// RestoreOptions type is used for defining restore options for CRIU
+// RestoreOptions type is used for defining restore options for CRIU.
type RestoreOptions struct {
Directory string
Verbose bool
}
+// MigrateOptions type is used for defining migrate options.
type MigrateOptions struct {
Directory string
+ PredumpDir string
+ ActionScript string
Verbose bool
Stop bool
- PredumpDir string
PreservesInodes bool
- ActionScript string
GhostLimit uint64
}
More information about the lxc-devel
mailing list