]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/install+setup/install/ide.c
dfde3a983f9d9d81cd04742c70cf2a1064512239
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
10 * $Id: ide.c,v 1.4 2003/12/11 11:25:53 riddles Exp $
16 /* checkide(). Scans the named drive letter and returns the IDE_??? type. */
17 int checkide(char letter
)
20 char filename
[STRING_SIZE
];
21 char buffer
[STRING_SIZE
];
23 sprintf(filename
, "/proc/ide/hd%c/media", letter
);
25 if (!(f
= fopen(filename
, "r")))
28 if (!(fgets(buffer
, STRING_SIZE
, f
)))
30 printf("Couldn't read from %s\n", filename
);
39 if (strcmp(buffer
, "cdrom") == 0)
41 else if (strcmp(buffer
, "disk") == 0)
47 /* findidetype(). Finds the first ide deveice of the given IDE_?? type. */
48 char findidetype(int type
)
52 for (letter
= 'a'; letter
<= 'z'; letter
++)
54 if ((checkide(letter
)) == type
)