modprobe-small: define and use DEPMOD_OPT_n (option mask)

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Kang-Che Sung 2017-02-09 22:48:52 +08:00 committed by Denys Vlasenko
parent c393b1e919
commit af316aabf2

View File

@ -79,6 +79,7 @@ int lsmod_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
#define is_rmmod (ENABLE_RMMOD && (ONLY_APPLET || applet_name[0] == 'r')) #define is_rmmod (ENABLE_RMMOD && (ONLY_APPLET || applet_name[0] == 'r'))
enum { enum {
DEPMOD_OPT_n = (1 << 0), /* dry-run, print to stdout */
OPT_q = (1 << 0), /* be quiet */ OPT_q = (1 << 0), /* be quiet */
OPT_r = (1 << 1), /* module removal instead of loading */ OPT_r = (1 << 1), /* module removal instead of loading */
}; };
@ -477,7 +478,7 @@ static int start_dep_bb_writeout(void)
int fd; int fd;
/* depmod -n: write result to stdout */ /* depmod -n: write result to stdout */
if (applet_name[0] == 'd' && (option_mask32 & 1)) if (is_depmod && (option_mask32 & DEPMOD_OPT_n))
return STDOUT_FILENO; return STDOUT_FILENO;
fd = open(DEPFILE_BB".new", O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0644); fd = open(DEPFILE_BB".new", O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0644);