Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f9db165 authored by Elliott Hughes's avatar Elliott Hughes Committed by Gerrit Code Review
Browse files

Merge "Fix insmod module size"

parents 7297278a eaa3b4ec
Loading
Loading
Loading
Loading
+2 −5
Original line number Original line Diff line number Diff line
@@ -57,16 +57,13 @@ extern "C" int init_module(void *, unsigned long, const char *);


static int insmod(const char *filename, char *options)
static int insmod(const char *filename, char *options)
{
{
    std::string module;
    char filename_val[PROP_VALUE_MAX];
    char filename_val[PROP_VALUE_MAX];
    int ret;
    if (expand_props(filename_val, filename, sizeof(filename_val)) == -1) {

    ret = expand_props(filename_val, filename, sizeof(filename_val));
    if (ret) {
        ERROR("insmod: cannot expand '%s'\n", filename);
        ERROR("insmod: cannot expand '%s'\n", filename);
        return -EINVAL;
        return -EINVAL;
    }
    }


    std::string module;
    if (!read_file(filename_val, &module)) {
    if (!read_file(filename_val, &module)) {
        return -1;
        return -1;
    }
    }
+4 −3
Original line number Original line Diff line number Diff line
@@ -382,13 +382,13 @@ static void parse_new_section(struct parse_state *state, int kw,


static void parse_config(const char *fn, const std::string& data)
static void parse_config(const char *fn, const std::string& data)
{
{
    struct parse_state state;
    struct listnode import_list;
    struct listnode import_list;
    struct listnode *node;
    struct listnode *node;
    char *args[INIT_PARSER_MAXARGS];
    char *args[INIT_PARSER_MAXARGS];
    int nargs;


    nargs = 0;
    int nargs = 0;

    parse_state state;
    state.filename = fn;
    state.filename = fn;
    state.line = 0;
    state.line = 0;
    state.ptr = strdup(data.c_str());  // TODO: fix this code!
    state.ptr = strdup(data.c_str());  // TODO: fix this code!
@@ -442,6 +442,7 @@ bool init_parse_config_file(const char* path) {
        return false;
        return false;
    }
    }


    data.push_back('\n'); // TODO: fix parse_config.
    parse_config(path, data);
    parse_config(path, data);
    dump_parser_state();
    dump_parser_state();


+1 −0
Original line number Original line Diff line number Diff line
@@ -420,6 +420,7 @@ static void load_properties_from_file(const char* filename, const char* filter)
    Timer t;
    Timer t;
    std::string data;
    std::string data;
    if (read_file(filename, &data)) {
    if (read_file(filename, &data)) {
        data.push_back('\n');
        load_properties(&data[0], filter);
        load_properties(&data[0], filter);
    }
    }
    NOTICE("(Loading properties from %s took %.2fs.)\n", filename, t.duration());
    NOTICE("(Loading properties from %s took %.2fs.)\n", filename, t.duration());
+4 −3
Original line number Original line Diff line number Diff line
@@ -193,10 +193,10 @@ static void parse_line(struct parse_state *state, char **args, int nargs)


static void parse_config(const char *fn, const std::string& data)
static void parse_config(const char *fn, const std::string& data)
{
{
    struct parse_state state;
    char *args[UEVENTD_PARSER_MAXARGS];
    char *args[UEVENTD_PARSER_MAXARGS];
    int nargs;

    nargs = 0;
    int nargs = 0;
    parse_state state;
    state.filename = fn;
    state.filename = fn;
    state.line = 1;
    state.line = 1;
    state.ptr = strdup(data.c_str());  // TODO: fix this code!
    state.ptr = strdup(data.c_str());  // TODO: fix this code!
@@ -231,6 +231,7 @@ int ueventd_parse_config_file(const char *fn)
        return -1;
        return -1;
    }
    }


    data.push_back('\n'); // TODO: fix parse_config.
    parse_config(fn, data);
    parse_config(fn, data);
    dump_parser_state();
    dump_parser_state();
    return 0;
    return 0;
+0 −4
Original line number Original line Diff line number Diff line
@@ -172,9 +172,6 @@ bool read_file(const char* path, std::string* content) {


    bool okay = android::base::ReadFdToString(fd, content);
    bool okay = android::base::ReadFdToString(fd, content);
    TEMP_FAILURE_RETRY(close(fd));
    TEMP_FAILURE_RETRY(close(fd));
    if (okay) {
        content->append("\n", 1);
    }
    return okay;
    return okay;
}
}


@@ -460,4 +457,3 @@ std::string bytes_to_hex(const uint8_t* bytes, size_t bytes_len) {
        android::base::StringAppendF(&hex, "%02x", bytes[i]);
        android::base::StringAppendF(&hex, "%02x", bytes[i]);
    return hex;
    return hex;
}
}