Skip to content

Commit ba2b29a

Browse files
committed
daemon/control: show cryptfs mode of container in status message
Use the lately introduced cryptfs mode helper container_get_cryptfs_mode() in control_container_status_new() to provide the information through the control interface. Signed-off-by: Michael Weiß <[email protected]>
1 parent eeaa84e commit ba2b29a

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

daemon/control.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ control_compartment_state_to_proto(compartment_state_t state)
235235
FATAL("Unhandled value for compartment_state_t: %d", state);
236236
}
237237
}
238-
/**
239238

239+
/**
240240
* The usual identity map between two corresponding C and protobuf enums.
241241
*/
242242
ContainerType
@@ -252,6 +252,28 @@ control_container_type_to_proto(container_type_t type)
252252
}
253253
}
254254

255+
/**
256+
* The usual identity map between two corresponding C and protobuf enums.
257+
*/
258+
CryptfsMode
259+
control_cryptfs_mode_to_proto(cryptfs_mode_t mode)
260+
{
261+
switch (mode) {
262+
case CRYPTFS_MODE_NOT_IMPLEMENTED:
263+
return CRYPTFS_MODE__NOT_IMPLEMENTED;
264+
case CRYPTFS_MODE_AUTHENC:
265+
return CRYPTFS_MODE__AUTHENC;
266+
case CRYPTFS_MODE_ENCRYPT_ONLY:
267+
return CRYPTFS_MODE__ENCRYPT_ONLY;
268+
case CRYPTFS_MODE_INTEGRITY_ENCRYPT:
269+
return CRYPTFS_MODE__INTEGRITY_ENCRYPT;
270+
case CRYPTFS_MODE_INTEGRITY_ONLY:
271+
return CRYPTFS_MODE__INTEGRITY_ONLY;
272+
default:
273+
FATAL("Unhandled value for cryptfs_mode_t: %d", mode);
274+
}
275+
}
276+
255277
/**
256278
* Get the ContainerStatus for the given container.
257279
*
@@ -289,6 +311,9 @@ control_container_status_new(const container_t *container)
289311
}
290312
}
291313

314+
c_status->cryptfs_mode =
315+
control_cryptfs_mode_to_proto(container_get_cryptfs_mode(container));
316+
292317
return c_status;
293318
}
294319

0 commit comments

Comments
 (0)