21 #undef ZYPP_BASE_LOGGER_LOGGROUP
22 #define ZYPP_BASE_LOGGER_LOGGROUP "MODALIAS"
43 inline bool isBlackListed(
const Pathname & dir_r,
const char * file_r )
45 #define PATH_IS( D, F ) ( ::strcmp( file_r, F ) == 0 && ::strcmp( dir_r.c_str(), D ) == 0 )
49 return PATH_IS(
"/sys/devices/system",
"memory" );
59 AutoDispose<DIR *> dir( ::opendir( dir_r.c_str() ), ::closedir );
63 struct dirent * dirent = NULL;
64 while ( (dirent = ::
readdir(dir)) != NULL )
66 if ( dirent->d_name[0] ==
'.' )
69 if ( isBlackListed( dir_r, dirent->d_name ) )
72 PathInfo pi( dir_r / dirent->d_name, PathInfo::LSTAT );
76 foreach_file_recursive( pi.path(), arg );
78 else if ( pi.isFile() && ::strcmp( dirent->d_name,
"modalias" ) == 0 )
81 std::ifstream str( pi.path().c_str() );
84 arg.push_back( line );
101 const char * dir = getenv(
"ZYPP_MODALIAS_SYSFS");
104 DBG <<
"Using /sys directory : " << dir << endl;
127 bool query(
const char * cap_r )
const
129 if ( cap_r && *cap_r )
133 if ( fnmatch( cap_r, (*it).c_str(), 0 ) == 0 )
147 static shared_ptr<Impl> _nullimpl(
new Impl );
170 : _pimpl(
Impl::nullimpl() )
189 {
return str << *obj.
_pimpl; }