Browse code

devmapper: add useful comments

Solomon Hykes authored on 2013/10/17 10:42:05
Showing 2 changed files
... ...
@@ -88,6 +88,10 @@ func (devices *DeviceSetDM) hasImage(name string) bool {
88 88
 	return err == nil
89 89
 }
90 90
 
91
+// ensureImage creates a sparse file of <size> bytes at the path
92
+// <root>/devicemapper/<name>.
93
+// If the file already exists, it does nothing.
94
+// Either way it returns the full path.
91 95
 func (devices *DeviceSetDM) ensureImage(name string, size int64) (string, error) {
92 96
 	dirname := devices.loopbackDir()
93 97
 	filename := path.Join(dirname, name)
... ...
@@ -18,6 +18,7 @@ package devmapper
18 18
 #define LOOP_CTL_GET_FREE       0x4C82
19 19
 #endif
20 20
 
21
+// FIXME: this could easily be rewritten in go
21 22
 char*			attach_loop_device(const char *filename, int *loop_fd_out)
22 23
 {
23 24
   struct loop_info64	loopinfo = {0};
... ...
@@ -441,6 +442,7 @@ func free(p *C.char) {
441 441
 	C.free(unsafe.Pointer(p))
442 442
 }
443 443
 
444
+// This is the programmatic example of "dmsetup create"
444 445
 func createPool(poolName string, dataFile *os.File, metadataFile *os.File) error {
445 446
 	task, err := createTask(DeviceCreate, poolName)
446 447
 	if task == nil {