off_t size;
void *memory;
const struct file_ops *ops;
+ const struct kmod_ctx *ctx;
};
#ifdef ENABLE_XZ
load_reg, unload_reg
};
-struct kmod_file *kmod_file_open(const char *filename)
+struct kmod_file *kmod_file_open(const struct kmod_ctx *ctx,
+ const char *filename)
{
struct kmod_file *file = calloc(1, sizeof(struct kmod_file));
const struct comp_type *itr;
file->ops = ®_ops;
err = file->ops->load(file);
+ file->ctx = ctx;
error:
if (err < 0) {
if (file->fd >= 0)
return -ENOSYS;
}
- file = kmod_file_open(path);
+ file = kmod_file_open(mod->ctx, path);
if (file == NULL) {
err = -errno;
return err;
if (path == NULL)
return -ENOENT;
- file = kmod_file_open(path);
+ file = kmod_file_open(mod->ctx, path);
if (file == NULL)
return -errno;
if (path == NULL)
return -ENOENT;
- file = kmod_file_open(path);
+ file = kmod_file_open(mod->ctx, path);
if (file == NULL)
return -errno;
if (path == NULL)
return -ENOENT;
- file = kmod_file_open(path);
+ file = kmod_file_open(mod->ctx, path);
if (file == NULL)
return -errno;
if (path == NULL)
return -ENOENT;
- file = kmod_file_open(path);
+ file = kmod_file_open(mod->ctx, path);
if (file == NULL)
return -errno;
#include "libkmod-hash.h"
/* libkmod-file.c */
-struct kmod_file *kmod_file_open(const char *filename) __must_check __attribute__((nonnull(1)));
+struct kmod_file *kmod_file_open(const struct kmod_ctx *ctx, const char *filename) __must_check __attribute__((nonnull(1,2)));
void *kmod_file_get_contents(const struct kmod_file *file) __must_check __attribute__((nonnull(1)));
off_t kmod_file_get_size(const struct kmod_file *file) __must_check __attribute__((nonnull(1)));
void kmod_file_unref(struct kmod_file *file) __attribute__((nonnull(1)));