static stringList_t _get_mount_entries( const char * device ) { /* * zuluCryptGetMountEntry() is defined in mountinfo.c */ stringList_t stl = zuluCryptGetMoutedList() ; StringListIterator it ; StringListIterator end ; string_t st = String_1( device," ",NULL ) ; StringListGetIterators( stl,&it,&end ) ; while( it != end ){ if( StringStartsWith_1( *it,st ) ){ it++ ; }else{ StringListRemoveAt_1( stl,it,&end ) ; } } StringDelete( &st ) ; return stl ; }
static int _not_removed( stringList_t stl,StringListIterator it,StringListIterator * end ) { string_t st = *it ; StringListIterator e = it + 1 ; if( StringStartsWithAtLeastOne( st,"/dev/sd","/dev/hd","/dev/mmcblk",NULL ) ){ /* * we have a partition,lets continue */ if( e != *end ){ /* * we are not at the end of the list,ie,there is atleast one more entry */ if( StringStartsWith_1( *e,st ) ){ /* * *e will contain something like "/dev/sdc3" * st will contain something like "/dev/sdc" * * This device is partitioned and hence we remove the "/dev/sdc" entry * from the list since we dont care about it. */ StringListRemoveAt_1( stl,it,end ) ; return 0 ; } } } return 1 ; }