add librados and test calling it
This commit is contained in:
1 parent
5f53a15964
commit
08bde77a90
3 files changed
+18
-1
No files matched your search
+1
-1
Submodule ceph updated: 239cbebf96...ad1f5e0c3d.
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/quantum/castle/pkg/castled"
|
||||
@@ -9,6 +10,13 @@ import (
|
||||
|
||||
func main() {
|
||||
|
||||
if len(os.Args) > 1 && os.Args[1] == "version" {
|
||||
fmt.Printf("cephd: %v\n", cephd.Version())
|
||||
rmajor, rminor, rpatch := cephd.RadosVersion()
|
||||
fmt.Printf("rados: %v.%v.%v\n", rmajor, rminor, rpatch)
|
||||
return
|
||||
}
|
||||
|
||||
if len(os.Args) > 2 && os.Args[1] == "daemon" {
|
||||
cephd.RunDaemon(os.Args[2], os.Args[3:]...)
|
||||
return
|
||||
|
||||
@@ -10,6 +10,7 @@ package cephd
|
||||
// #include <stdlib.h>
|
||||
// #include <string.h>
|
||||
// #include "cephd/libcephd.h"
|
||||
// #include "rados/librados.h"
|
||||
import "C"
|
||||
|
||||
import (
|
||||
@@ -18,6 +19,14 @@ import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Version returns the major, minor, and patch components of the version of
|
||||
// the RADOS library linked against.
|
||||
func RadosVersion() (int, int, int) {
|
||||
var c_major, c_minor, c_patch C.int
|
||||
C.rados_version(&c_major, &c_minor, &c_patch)
|
||||
return int(c_major), int(c_minor), int(c_patch)
|
||||
}
|
||||
|
||||
// cephdError represents an error
|
||||
type cephdError int
|
||||
|
||||
|
||||
Reference in new issue
Block a user