From 3bb4e05ce4a1c9ac1339b451c4c18cfef8bcbeb9 Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Fri, 23 Nov 2012 00:20:15 -0500 Subject: Permit users to disable module loading support Inspired by e30431623a7d871da123cc37055ac49abf2c20ea from systemd. Signed-off-by: Richard Yao --- src/udev/Makefile.am | 11 ++++++----- src/udev/udev-builtin.c | 2 ++ src/udev/udev.h | 4 ++++ 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src/udev') diff --git a/src/udev/Makefile.am b/src/udev/Makefile.am index 7ceb31951a..2486824e86 100644 --- a/src/udev/Makefile.am +++ b/src/udev/Makefile.am @@ -50,7 +50,6 @@ libudev_core_la_SOURCES = \ udev-builtin-firmware.c \ udev-builtin-hwdb.c \ udev-builtin-input_id.c \ - udev-builtin-kmod.c \ udev-builtin-net_id.c \ udev-builtin-path_id.c \ udev-builtin-usb_id.c \ @@ -104,17 +103,19 @@ libudev_core_la_CFLAGS = \ $(AM_CFLAGS) \ $(BLKID_CFLAGS) -if HAVE_LIBKMOD -libudev_core_la_CFLAGS += $(KMOD_CFLAGS) -endif - libudev_core_la_LIBADD = \ $(top_builddir)/src/libudev/libudev-private.la \ $(BLKID_LIBS) +if HAVE_MODULES +libudev_core_la_SOURCES += \ + udev-builtin-kmod.c + if HAVE_LIBKMOD +libudev_core_la_CFLAGS += $(KMOD_CFLAGS) libudev_core_la_LIBADD += $(KMOD_LIBS) endif +endif if HAVE_ACL libudev_core_la_SOURCES += \ diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c index ee81b2d713..45494147eb 100644 --- a/src/udev/udev-builtin.c +++ b/src/udev/udev-builtin.c @@ -35,7 +35,9 @@ static const struct udev_builtin *builtins[] = { [UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware, [UDEV_BUILTIN_HWDB] = &udev_builtin_hwdb, [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id, +#ifdef HAVE_MODULES [UDEV_BUILTIN_KMOD] = &udev_builtin_kmod, +#endif [UDEV_BUILTIN_NET_ID] = &udev_builtin_net_id, [UDEV_BUILTIN_PATH_ID] = &udev_builtin_path_id, [UDEV_BUILTIN_USB_ID] = &udev_builtin_usb_id, diff --git a/src/udev/udev.h b/src/udev/udev.h index 82cd2ad6d0..4c2861009f 100644 --- a/src/udev/udev.h +++ b/src/udev/udev.h @@ -139,7 +139,9 @@ enum udev_builtin_cmd { UDEV_BUILTIN_FIRMWARE, UDEV_BUILTIN_HWDB, UDEV_BUILTIN_INPUT_ID, +#ifdef HAVE_MODULES UDEV_BUILTIN_KMOD, +#endif UDEV_BUILTIN_NET_ID, UDEV_BUILTIN_PATH_ID, UDEV_BUILTIN_USB_ID, @@ -162,7 +164,9 @@ extern const struct udev_builtin udev_builtin_btrfs; extern const struct udev_builtin udev_builtin_firmware; extern const struct udev_builtin udev_builtin_hwdb; extern const struct udev_builtin udev_builtin_input_id; +#ifdef HAVE_MODULES extern const struct udev_builtin udev_builtin_kmod; +#endif extern const struct udev_builtin udev_builtin_net_id; extern const struct udev_builtin udev_builtin_path_id; extern const struct udev_builtin udev_builtin_usb_id; -- cgit v1.2.3-54-g00ecf