~smoser/ubuntu/quantal/module-init-tools/lp-1115710

« back to all changes in this revision

Viewing changes to modinfo.c

  • Committer: Bazaar Package Importer
  • Author(s): Andy Whitcroft
  • Date: 2011-06-08 11:53:21 UTC
  • mfrom: (0.1.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110608115321-2zwtf5l3mbbz1sck
Tags: 3.13-1ubuntu1
* Manual Resync with Debian version 3.13-1.
  - Remaining changes:
    + Ubuntu specific control scripts carrying upgrade quirks
    + Ubuntu specific modprobe.d/depmod.d contents
    + debian/patches/ubuntu-maps_by_default -- Reenable map files
    + debian/patches/ubuntu-modinfo-wantparm-uninitialised -- fix
      performance issue due to unitialised variable in modinfo
    + switch source to 'unapply-patches' to simplify merging with
      debian upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
                      const char *filename, char sep)
55
55
{
56
56
        int j;
 
57
        int wantparm = 0;
57
58
        unsigned int taglen = strlen(tag);
 
59
        struct param *i, *params = NULL;
58
60
 
59
61
        if (streq(tag, "filename")) {
60
62
                printf("%s%c", filename, sep);
61
63
                return;
62
64
        }
63
65
 
 
66
        if (streq(tag, "parm"))
 
67
                wantparm = 1;
 
68
 
64
69
        for (j = 0; j < tags->cnt; j++) {
65
70
                const char *info = tags->str[j];
66
 
                if (strncmp(info, tag, taglen) == 0 && info[taglen] == '=')
67
 
                        printf("%s%c", info + taglen + 1, sep);
 
71
                if (wantparm) {
 
72
                        /* We expect this in parm and parmtype. */
 
73
                        char *colon = strchr(info, ':');
 
74
 
 
75
                        /* We store these for handling at the end */
 
76
                        if (strstarts(info, "parm=") && colon) {
 
77
                                i = add_param(info + strlen("parm="), &params);
 
78
                                i->param = colon + 1;
 
79
                                continue;
 
80
                        }
 
81
                        if (strstarts(info, "parmtype=") && colon) {
 
82
                                i = add_param(info + strlen("parmtype="), &params);
 
83
                                i->type = colon + 1;
 
84
                                continue;
 
85
                        }
 
86
                } else
 
87
                        if (strncmp(info, tag, taglen) == 0 && info[taglen] == '=')
 
88
                                printf("%s%c", info + taglen + 1, sep);
 
89
        }
 
90
 
 
91
        /* Now show parameters. */
 
92
        for (i = params; i; i = i->next) {
 
93
                if (!i->param)
 
94
                        printf("%s (%s)%c", i->name, i->type, sep);
 
95
                else if (i->type)
 
96
                        printf("%s%s (%s)%c", i->name, i->param, i->type, sep);
 
97
                else
 
98
                        printf("%s%s%c", i->name, i->param, sep);
68
99
        }
69
100
}
70
101
 
122
153
        }
123
154
}
124
155
 
125
 
static struct option options[] =
 
156
static const struct option options[] =
126
157
{
127
158
        {"author", 0, 0, 'a'},
128
159
        {"description", 0, 0, 'd'},