Applied to rtslib-fb. Thanks -- Regards -- Andy On 07/10/2012 04:08 AM, Christoph Hellwig wrote: > Any driver in the Linux kernel can be built in, so don't try to be smart > to check for possible modules. Just try to load a driver and ignore the > return value - either it was built in or loaded and things are fine, > or it's not available at all and the code needs to cope with this at > a higher level. > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > > diff --git a/rtslib/utils.py b/rtslib/utils.py > index 61bc186..593a0a1 100644 > --- a/rtslib/utils.py > +++ b/rtslib/utils.py > @@ -599,21 +599,6 @@ def is_valid_wwn(wwn_type, wwn, wwn_list=None): > else: > return False > > -def list_available_kernel_modules(): > - ''' > - List all loadable kernel modules as registered by depmod > - ''' > - kver = os.uname()[2] > - depfile = "/lib/modules/%s/modules.dep" % kver > - handle = open(depfile) > - try: > - lines = handle.readlines() > - finally: > - handle.close() > - > - return [os.path.basename(line.partition(":")[0]).partition(".")[0] > - for line in lines] > - > def list_loaded_kernel_modules(): > ''' > List all currently loaded kernel modules > @@ -629,20 +614,14 @@ def modprobe(module): > @return: Whether of not we had to load the module. > ''' > if module not in list_loaded_kernel_modules(): > - if module in list_available_kernel_modules(): > - try: > - exec_argv(["modprobe", module]) > - except Exception, msg: > - raise RTSLibError("Kernel module %s exists " > - % module + "but fails to load: %s" % msg) > - else: > - return True > - else: > - raise RTSLibError("Kernel module %s does not exists on disk " > - % module + "and is not loaded.") > - else: > return False > > + try: > + exec_argv(["modprobe", module]) > + except e: > + pass > + return True > + > def exec_argv(argv, strip=True, shell=False): > ''' > Executes a command line given as an argv table and either: > -- > To unsubscribe from this list: send the line "unsubscribe target-devel" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html