From e178fdae88f2d5209a4fadd3547410b5b6ecd73c Mon Sep 17 00:00:00 2001 From: Vivek Goyal Date: Wed, 5 Nov 2014 09:25:02 -0500 Subject: [PATCH] devmapper: Export nextDeviceId so that json.Marshal() can operate on it I was trying to save nextDeviceId to a file but it would not work and json.Marshal() will do nothing. Then some search showed that I need to make first letter of struct field capital, exporting this field and now json.Marshal() works. This is a preparatory patch for the next one. Signed-off-by: Vivek Goyal Upstream-commit: 8e9a18039be6ade0b8db65f7f298959055d86192 Component: engine --- .../engine/daemon/graphdriver/devmapper/deviceset.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/engine/daemon/graphdriver/devmapper/deviceset.go b/components/engine/daemon/graphdriver/devmapper/deviceset.go index 7c767fff97..c02f369d23 100644 --- a/components/engine/daemon/graphdriver/devmapper/deviceset.go +++ b/components/engine/daemon/graphdriver/devmapper/deviceset.go @@ -68,7 +68,7 @@ type DeviceSet struct { devicePrefix string TransactionId uint64 NewTransactionId uint64 - nextDeviceId int + NextDeviceId int // Options dataLoopbackSize int64 @@ -407,7 +407,7 @@ func (devices *DeviceSet) setupBaseImage() error { log.Debugf("Initializing base device-manager snapshot") - id := devices.nextDeviceId + id := devices.NextDeviceId // Create initial device if err := createDevice(devices.getPoolDevName(), &id); err != nil { @@ -415,7 +415,7 @@ func (devices *DeviceSet) setupBaseImage() error { } // Ids are 24bit, so wrap around - devices.nextDeviceId = (id + 1) & 0xffffff + devices.NextDeviceId = (id + 1) & 0xffffff log.Debugf("Registering base device (id %v) with FS size %v", id, devices.baseFsSize) info, err := devices.registerDevice(id, "", devices.baseFsSize) @@ -703,7 +703,7 @@ func (devices *DeviceSet) AddDevice(hash, baseHash string) error { return fmt.Errorf("device %s already exists", hash) } - deviceId := devices.nextDeviceId + deviceId := devices.NextDeviceId if err := createSnapDevice(devices.getPoolDevName(), &deviceId, baseInfo.Name(), baseInfo.DeviceId); err != nil { log.Debugf("Error creating snap device: %s", err) @@ -711,7 +711,7 @@ func (devices *DeviceSet) AddDevice(hash, baseHash string) error { } // Ids are 24bit, so wrap around - devices.nextDeviceId = (deviceId + 1) & 0xffffff + devices.NextDeviceId = (deviceId + 1) & 0xffffff if _, err := devices.registerDevice(deviceId, hash, baseInfo.Size); err != nil { deleteDevice(devices.getPoolDevName(), deviceId)