summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2004-02-10 17:08:37 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2004-02-10 17:08:37 +0000
commit14ee35611d2d24426787e80a27a65e51273de41d (patch)
treef5fb85865267f752525a9c694d474f22f9ae26c9
parent703ddd70e5f5e15ee1da16c2c4f29cafff5662ce (diff)
downloaddrakx-14ee35611d2d24426787e80a27a65e51273de41d.tar
drakx-14ee35611d2d24426787e80a27a65e51273de41d.tar.gz
drakx-14ee35611d2d24426787e80a27a65e51273de41d.tar.bz2
drakx-14ee35611d2d24426787e80a27a65e51273de41d.tar.xz
drakx-14ee35611d2d24426787e80a27a65e51273de41d.zip
floppy_device returns first floppy device, look for medias first in case of usb floppies (maybe ide floppies also? never tested) then regular floppy drive
-rw-r--r--mdk-stage1/tools.c14
-rw-r--r--mdk-stage1/tools.h1
2 files changed, 14 insertions, 1 deletions
diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c
index 7724c6e72..e3a0fa479 100644
--- a/mdk-stage1/tools.c
+++ b/mdk-stage1/tools.c
@@ -42,7 +42,8 @@
#include "automatic.h"
#include "tools.h"
-
+#include "probing.h"
+#include "modules.h"
static struct param_elem params[50];
static int param_number = 0;
@@ -476,6 +477,17 @@ int kernel_version(void)
return charstar_to_int(val.release + 2);
}
+char * floppy_device(void)
+{
+ char ** names, ** models;
+ my_insmod("sd_mod", ANY_DRIVER_TYPE, NULL, 0);
+ get_medias(FLOPPY, &names, &models, BUS_ANY);
+ if (names && *names)
+ return asprintf_("/dev/%s", *names);
+ else
+ return "/dev/fd0";
+}
+
char * asprintf_(const char *msg, ...)
{
int n;
diff --git a/mdk-stage1/tools.h b/mdk-stage1/tools.h
index be3883eb5..3b95a2f26 100644
--- a/mdk-stage1/tools.h
+++ b/mdk-stage1/tools.h
@@ -43,6 +43,7 @@ char ** grab_env(void);
char ** list_directory(char * direct);
int string_array_length(char ** a);
int kernel_version(void);
+char * floppy_device(void);
char * asprintf_(const char *msg, ...);
int scall_(int retval, char * msg, char * file, int line);
#define scall(retval, msg) scall_(retval, msg, __FILE__, __LINE__)