Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

expand api with map command; clean up a bit

  • Loading branch information...
commit bc488b47865c59009b10e0aeb433c16ad8795f92 1 parent 94d9e91
@bwalex authored
Showing with 23 additions and 8 deletions.
  1. +21 −1 tc-play-api.c
  2. +2 −7 tc-play-api.h
View
22 tc-play-api.c
@@ -101,7 +101,27 @@ tc_api_create_volume(tc_api_op *api_opts)
int
tc_api_map_volume(tc_api_op *api_opts)
{
- return TC_OK;
+ int nkeyfiles;
+ int err;
+
+ if ((api_opts == NULL) ||
+ (api_opts->tc_device == NULL)) {
+ errno = EFAULT;
+ return TC_ERR;
+ }
+
+ for (nkeyfiles = 0; (nkeyfiles < MAX_KEYFILES) &&
+ (api_opts->tc_keyfiles[nkeyfiles] != NULL); nkeyfiles++)
+ ;
+
+ err = map_volume(api_opts->tc_map_name, api_opts->device,
+ /* sflag */ 0, /* sys_dev */ NULL,
+ /* protect_hidden */ 0, api_opts->tc_keyfiles, nkeyfiles,
+ /* h_keyfiles[] */ NULL, /* n_hkeyfiles */ 0,
+ api_opts->passphrase, /* passphrase_hidden */ NULL,
+ api_opts->tc_interactive_prompt, api_opts->tc_password_retries);
+
+ return (err) ? TC_ERR : TC_OK;
}
int
View
9 tc-play-api.h
@@ -27,17 +27,10 @@
* SUCH DAMAGE.
*/
-#define TC_API_OP_MAP 0x01
-#define TC_API_OP_CREATE 0x02
-#define TC_API_CHECK_CIPHER 0x03
-#define TC_API_CHECK_PRF_HASH 0x04
-
#define TC_OK 0
#define TC_ERR -1
typedef struct tc_api_op {
- int tc_op;
-
/* Common fields */
char *tc_device;
char *tc_cipher;
@@ -47,6 +40,8 @@ typedef struct tc_api_op {
/* Fields for mapping */
char *tc_map_name;
+ int tc_password_retries;
+ int tc_interactive_prompt;
/* Fields for creation */
size_t tc_size_hidden_in_blocks;
Please sign in to comment.
Something went wrong with that request. Please try again.