forked from pool/cachefilesd
* no changelog available - remove fix-cpu-spin.patch (solved differently upstream) OBS-URL: https://build.opensuse.org/package/show/filesystems/cachefilesd?expand=0&rev=22
82 lines
2.4 KiB
Diff
82 lines
2.4 KiB
Diff
Index: cachefilesd.c
|
|
===================================================================
|
|
--- cachefilesd.c.orig
|
|
+++ cachefilesd.c
|
|
@@ -53,6 +53,7 @@
|
|
#include <sys/time.h>
|
|
#include <sys/vfs.h>
|
|
#include <sys/stat.h>
|
|
+#include <libkmod.h>
|
|
|
|
typedef enum objtype {
|
|
OBJTYPE_INDEX,
|
|
@@ -292,6 +293,9 @@ int main(int argc, char *argv[])
|
|
long page_size;
|
|
int _cachefd, nullfd, opt, loop, open_max;
|
|
bool nodaemon = false;
|
|
+ struct kmod_ctx *ctx;
|
|
+ struct kmod_module *mod;
|
|
+ int kmod_status;
|
|
|
|
/* handle help request */
|
|
if (argc == 2 && strcmp(argv[1], "--help") == 0)
|
|
@@ -366,6 +370,29 @@ int main(int argc, char *argv[])
|
|
/* just in case... */
|
|
sync();
|
|
|
|
+ if (!(ctx = kmod_new(NULL, NULL))) {
|
|
+ oserror("Failed to allocate memory for kmod.");
|
|
+ }
|
|
+
|
|
+ kmod_load_resources(ctx);
|
|
+
|
|
+ kmod_status = kmod_module_new_from_name(ctx, "cachefiles", &mod);
|
|
+
|
|
+ if(kmod_status < 0) oserror("Cannot load cachefiles module");
|
|
+
|
|
+ kmod_status = kmod_module_probe_insert_module(mod, KMOD_PROBE_APPLY_BLACKLIST,NULL, NULL, NULL, NULL);
|
|
+
|
|
+ if (kmod_status == 0)
|
|
+ info("Inserted module '%s'", kmod_module_get_name(mod));
|
|
+ else if (kmod_status == KMOD_PROBE_APPLY_BLACKLIST)
|
|
+ oserror("Module '%s' is blacklisted", kmod_module_get_name(mod));
|
|
+ else {
|
|
+ oserror("Failed to insert '%s'", kmod_module_get_name(mod));
|
|
+ }
|
|
+
|
|
+ kmod_module_unref(mod);
|
|
+ kmod_unref(ctx);
|
|
+
|
|
/* open the devfile or the procfile on fd 3 */
|
|
_cachefd = open(devfile, O_RDWR);
|
|
if (_cachefd < 0) {
|
|
Index: configure.ac
|
|
===================================================================
|
|
--- configure.ac.orig
|
|
+++ configure.ac
|
|
@@ -29,6 +29,8 @@ AC_SUBST([systemdsystemunitdir], [$with_
|
|
fi
|
|
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
|
|
|
|
+PKG_CHECK_MODULES([KMOD], [libkmod])
|
|
+
|
|
# Checks for typedefs, structures, and compiler characteristics.
|
|
AC_TYPE_SIZE_T
|
|
AC_TYPE_SSIZE_T
|
|
Index: Makefile.am
|
|
===================================================================
|
|
--- Makefile.am.orig
|
|
+++ Makefile.am
|
|
@@ -8,7 +8,8 @@ endif
|
|
|
|
sysconf_DATA = cachefilesd.conf
|
|
|
|
-cachefilesd_CFLAGS = -fwhole-program
|
|
+cachefilesd_CFLAGS = $(KMOD_CFLAGS) -fwhole-program
|
|
+cachefilesd_LDADD = $(KMOD_LIBS)
|
|
cachefilesd_SOURCES = cachefilesd.c
|
|
dist_man8_MANS = cachefilesd.8
|
|
-dist_man5_MANS = cachefilesd.conf.5
|
|
\ No newline at end of file
|
|
+dist_man5_MANS = cachefilesd.conf.5
|