Skip to content

Commit

Permalink
expand api with map command; clean up a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
bwalex committed Jul 3, 2011
1 parent 94d9e91 commit bc488b4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
22 changes: 21 additions & 1 deletion tc-play-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 2 additions & 7 deletions tc-play-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit bc488b4

Please sign in to comment.