int zuluCryptRemoveKey( const char * device ,const char * pass,size_t pass_size ) { string_t st ; int fd ; int r ; if( StringPrefixEqual( device,"/dev/" ) ){ return _remove_key( device,pass,pass_size ) ; }else{ /* * zuluCryptAttachLoopDeviceToFile() is defined in ./create_loop.c */ if( zuluCryptAttachLoopDeviceToFile( device,O_RDWR,&fd,&st ) ){ r = _remove_key( StringContent( st ),pass,pass_size ) ; StringDelete( &st ) ; close( fd ) ; return r ; }else{ return 2 ; } } }
void _rm_from_bplus(bp_tree * tree, int k) { bp_node * p = NULL; int i = -1; if (!_find(tree->root, k, p, i)) { return; } if (p == tree->root && p->n == 1) { delete tree->root; tree->root = tree->sqt = NULL; return; } int max = p->max_key(); _remove_key(p, i); if (p == tree->root) { return; } if (p->max_key() != max) { _update_key(p->parent, max, p->max_key()); } bp_node * t = NULL; while (p->n == 1) { if (p == tree->root) { tree->root = p->ptr[0]; if (tree->root) { tree->root->parent = NULL; } else { tree->sqt = NULL; } delete p; break; } t = p; p = p->parent; _process_weak_node(tree, t); } }