2001-10-08 17:58:52 +04:00
/*
2004-03-30 23:35:44 +04:00
* Copyright ( C ) 2001 - 2004 Sistina Software , Inc . All rights reserved .
* Copyright ( C ) 2004 Red Hat , Inc . All rights reserved .
2001-10-08 17:58:52 +04:00
*
2004-03-30 23:35:44 +04:00
* This file is part of LVM2 .
*
* This copyrighted material is made available to anyone wishing to use ,
* modify , copy , or redistribute it subject to the terms and conditions
* of the GNU General Public License v .2 .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software Foundation ,
* Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
2001-10-08 17:58:52 +04:00
*/
# include "dev-cache.h"
# include "log.h"
# include <stdio.h>
int main ( int argc , char * * argv )
{
int i ;
struct device * dev ;
struct dev_iter * iter ;
2001-10-25 15:34:55 +04:00
struct list_head * tmp ;
2014-05-29 11:41:03 +04:00
struct dm_str_list * sl ;
2001-10-25 15:34:55 +04:00
if ( argc < 2 ) {
fprintf ( stderr , " usage: %s <dir> \n " , argv [ 0 ] ) ;
exit ( 1 ) ;
}
2001-10-08 17:58:52 +04:00
init_log ( stderr ) ;
2001-10-08 20:08:16 +04:00
init_debug ( _LOG_INFO ) ;
2001-10-08 17:58:52 +04:00
if ( ! dev_cache_init ( ) ) {
2001-10-08 20:08:16 +04:00
log_err ( " couldn't initialise dev_cache_init failed " ) ;
2001-10-08 17:58:52 +04:00
exit ( 1 ) ;
}
for ( i = 1 ; i < argc ; i + + ) {
if ( ! dev_cache_add_dir ( argv [ i ] ) ) {
2001-10-08 20:08:16 +04:00
log_err ( " couldn't add '%s' to dev_cache " , argv [ i ] ) ;
2001-10-08 17:58:52 +04:00
exit ( 1 ) ;
}
}
if ( ! ( iter = dev_iter_create ( NULL ) ) ) {
2001-10-08 20:08:16 +04:00
log_err ( " couldn't create iterator " ) ;
2001-10-08 17:58:52 +04:00
exit ( 1 ) ;
}
2001-10-25 15:34:55 +04:00
while ( ( dev = dev_iter_get ( iter ) ) ) {
printf ( " %s " , dev - > name ) ;
list_for_each ( tmp , & dev - > aliases ) {
2014-05-29 11:41:03 +04:00
sl = list_entry ( tmp , struct dm_str_list , list ) ;
2001-10-25 15:34:55 +04:00
printf ( " , %s " , sl - > str ) ;
}
printf ( " \n " ) ;
}
2001-10-08 17:58:52 +04:00
dev_iter_destroy ( iter ) ;
dev_cache_exit ( ) ;
dump_memory ( ) ;
fin_log ( ) ;
return 0 ;
}