]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/install+setup/install/ide.c
1 /* SmoothWall install program.
3 * This program is distributed under the terms of the GNU General Public
4 * Licence. See the file COPYING for details.
6 * (c) Lawrence Manning, 2001
7 * Contains some functs for scanning /proc for ide info on CDROMS and
14 int initialize_ide() {
15 mysystem("/sbin/modprobe ide-generic");
16 mysystem("/sbin/modprobe generic");
17 mysystem("/sbin/modprobe ide-cd");
18 mysystem("/sbin/modprobe ide-disk");
23 /* checkide(). Scans the named drive letter and returns the IDE_??? type. */
24 int checkide(char letter
)
27 char filename
[STRING_SIZE
];
28 char buffer
[STRING_SIZE
];
30 sprintf(filename
, "/proc/ide/hd%c/media", letter
);
32 if (!(f
= fopen(filename
, "r")))
35 if (!(fgets(buffer
, STRING_SIZE
, f
)))
37 printf("Couldn't read from %s\n", filename
);
46 if (strcmp(buffer
, "cdrom") == 0)
48 else if (strcmp(buffer
, "disk") == 0)
54 /* findidetype(). Finds the first ide deveice of the given IDE_?? type. */
55 char findidetype(int type
)
59 for (letter
= 'a'; letter
<= 'z'; letter
++)
61 if ((checkide(letter
)) == type
)