blob: 735e131e6a1d8905395b9bacf3c20131350731b5 [file] [log] [blame]
Wichert Akkermane2613b42001-03-17 17:29:43 +00001#include <stdio.h>
2#include <stdlib.h>
Roland McGrath3dfd7992004-06-04 02:03:05 +00003#include <string.h>
Wichert Akkermane2613b42001-03-17 17:29:43 +00004
5#include <asm/ioctl.h>
6#include <linux/types.h>
7
8#include "ioctldefs.h"
9#include <linux/atmioc.h>
10
11struct ioctlent {
12 const char* header;
13 const char* name;
14 unsigned long code;
15};
16
17struct ioctlent ioctls[] = {
18#include "ioctls.h"
19};
20
21int nioctls = sizeof(ioctls) / sizeof(ioctls[0]);
22
23
24int compare(const void* a, const void* b) {
25 unsigned long code1 = ((struct ioctlent *) a)->code;
26 unsigned long code2 = ((struct ioctlent *) b)->code;
Roland McGrath3dfd7992004-06-04 02:03:05 +000027 const char *name1 = ((struct ioctlent *) a)->name;
28 const char *name2 = ((struct ioctlent *) b)->name;
29 return (code1 > code2) ? 1 : (code1 < code2) ? -1 : strcmp (name1, name2);
Wichert Akkermane2613b42001-03-17 17:29:43 +000030}
31
32
33int main(int argc, char** argv) {
34 int i;
35
36 qsort(ioctls, nioctls, sizeof(ioctls[0]), compare);
Roland McGrath3dfd7992004-06-04 02:03:05 +000037 puts ("\t/* Generated by ioctlsort */");
Wichert Akkermane2613b42001-03-17 17:29:43 +000038 for (i = 0; i < nioctls; i++)
39 printf("\t{\"%s\",\t\"%s\",\t%#lx},\n",
40 ioctls[i].header, ioctls[i].name, ioctls[i].code);
41
42 return 0;
43}
44
45