KernelModuleUtils
public
class
KernelModuleUtils
extends Object
java.lang.Object | |
↳ | com.android.tradefed.util.KernelModuleUtils |
摘要
公共构造函数 | |
---|---|
KernelModuleUtils()
|
公共方法 | |
---|---|
static
String[]
|
getDependentModules(String modName, String lsmodOutput)
返回给定模块依赖的模块的名称。 |
static
String
|
getDisplayedModuleName(String fullPath)
返回模块名称(如在加载后显示)。 |
static
CommandResult
|
installModule(ITestDevice device, String modulePath, String arg, long timeoutMs)
在给定设备上安装内核模块。 |
static
String
|
removeKoExtension(String s)
移除 `.ko` 扩展名(如果有) |
static
CommandResult
|
removeModuleWithDependency(ITestDevice device, String moduleName)
从给定设备中移除内核模块和依赖模块。 |
static
CommandResult
|
removeSingleModule(ITestDevice device, String moduleName)
从给定设备中移除内核模块。 |
公共构造函数
KernelModuleUtils
public KernelModuleUtils ()
公共方法
getDependentModules
public static String[] getDependentModules (String modName, String lsmodOutput)
返回给定模块依赖的模块的名称。
例如,如果给定模块为 `kunit`,并且 `lsmod` 输出为:
$ lsmod
Module Size Used by
kunit_test 663552 0
time_test 663558 0
kunit 57344 15 kunit_test,time_test
参数 | |
---|---|
modName |
String |
lsmodOutput |
String |
返回 | |
---|---|
String[] |
getDisplayedModuleName
public static String getDisplayedModuleName (String fullPath)
返回模块名称(如在加载后显示)。
例如,请查看文件名与 `lsmod` 返回的文件名之间的差异:
$ insmod kunit.ko
$ lsmod | grep kunit
kunit 20480 0
参数 | |
---|---|
fullPath |
String |
返回 | |
---|---|
String |
installModule
public static CommandResult installModule (ITestDevice device, String modulePath, String arg, long timeoutMs)
在指定设备上安装内核模块。
参数 | |
---|---|
device |
ITestDevice :要安装模块的设备 |
modulePath |
String :要安装的模块的路径 |
arg |
String :要传递给安装命令的参数 |
timeoutMs |
long :超时(以毫秒为单位) |
返回 | |
---|---|
CommandResult |
抛出 | |
---|---|
TargetSetupError |
如果无法安装模块 |
DeviceNotAvailableException |
如果设备不可用 |
removeKoExtension
public static String removeKoExtension (String s)
移除 `.ko` 扩展名(如果有)
参数 | |
---|---|
s |
String |
返回 | |
---|---|
String |
removeModuleWithDependency
public static CommandResult removeModuleWithDependency (ITestDevice device, String moduleName)
从给定设备中移除内核模块和依赖模块。
此方法会尝试从设备中移除目标内核模块。如果模块有任何依赖项,系统会尽量在目标模块之前移除这些依赖项模块。
参数 | |
---|---|
device |
ITestDevice :要从中移除模块的设备 |
moduleName |
String :要移除的模块的名称 |
返回 | |
---|---|
CommandResult |
抛出 | |
---|---|
DeviceNotAvailableException |
如果设备不可用 |
removeSingleModule
public static CommandResult removeSingleModule (ITestDevice device, String moduleName)
从给定设备中移除内核模块。
此方法会尝试从设备中移除目标内核模块。系统不会移除任何依赖模块。
参数 | |
---|---|
device |
ITestDevice :要从中移除模块的设备 |
moduleName |
String :要移除的模块的名称 |
返回 | |
---|---|
CommandResult |
抛出 | |
---|---|
DeviceNotAvailableException |
如果设备不可用 |