summaryrefslogtreecommitdiffstats
path: root/perl-install/c
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/c')
-rw-r--r--perl-install/c/Makefile.PL3
-rw-r--r--perl-install/c/sbus.c38
-rw-r--r--perl-install/c/stuff.xs.pm53
3 files changed, 82 insertions, 12 deletions
diff --git a/perl-install/c/Makefile.PL b/perl-install/c/Makefile.PL
index e406f1fe4..315160a17 100644
--- a/perl-install/c/Makefile.PL
+++ b/perl-install/c/Makefile.PL
@@ -3,14 +3,13 @@ use ExtUtils::MakeMaker;
# the contents of the Makefile that is written.
my $libs = '-L/usr/X11R6/lib -lX11 -lgdk -lXxf86misc';
-
$libs .= ' -lrpm -ldb1 -lz' if $ENV{C_RPM};
WriteMakefile(
'NAME' => 'stuff',
'OPTIMIZE' => '-Os',
'MAKEFILE' => 'Makefile_c',
- 'OBJECT' => 'stuff.o smp.o md5.o md5_crypt.o sbus.o',
+ 'OBJECT' => 'stuff.o smp.o md5.o md5_crypt.o sbus.o silo.o',
'VERSION_FROM' => 'stuff.pm', # finds $VERSION
'LIBS' => [$libs], # e.g., '-lm'
'DEFINE' => '', # e.g., '-DHAVE_SOMETHING'
diff --git a/perl-install/c/sbus.c b/perl-install/c/sbus.c
index 3de75fca2..85d44fa79 100644
--- a/perl-install/c/sbus.c
+++ b/perl-install/c/sbus.c
@@ -19,12 +19,11 @@
*
*/
-#include <stdlib.h>
-
#ifdef __sparc__
#include <fcntl.h>
#include <unistd.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <asm/openpromio.h>
@@ -87,6 +86,25 @@ int prom_getchild(int node)
return *(int *)op->oprom_array;
}
+char *prom_getopt(char *var, int *lenp)
+{
+ DECL_OP(MAX_VAL);
+
+ strcpy (op->oprom_array, var);
+ if (ioctl (promfd, OPROMGETOPT, op) < 0)
+ return 0;
+ if (lenp) *lenp = op->oprom_size;
+ return op->oprom_array;
+}
+
+void prom_setopt(char *var, char *value) {
+ DECL_OP(MAX_VAL);
+
+ strcpy (op->oprom_array, var);
+ strcpy (op->oprom_array + strlen (var) + 1, value);
+ ioctl (promfd, OPROMSETOPT, op);
+}
+
char *prom_getproperty(char *prop, int *lenp)
{
DECL_OP(MAX_VAL);
@@ -114,11 +132,25 @@ int prom_getbool(char *prop)
}
}
+int prom_pci2node(int bus, int devfn) {
+ DECL_OP(2*sizeof(int));
+
+ ((int *)op->oprom_array)[0] = bus;
+ ((int *)op->oprom_array)[1] = devfn;
+ if (ioctl (promfd, OPROMPCI2NODE, op) < 0)
+ return 0;
+ prom_current_node = *(int *)op->oprom_array;
+ return *(int *)op->oprom_array;
+}
+
#else
int prom_open() { return 0; }
void prom_close() {}
int prom_getsibling(int node) { return 0; }
int prom_getchild(int node) { return 0; }
-char *prom_getproperty(char *prop, int *lenp) { return NULL; }
+char *prom_getopt(char *var, int *lenp) { return 0; /* NULL */ }
+void prom_setopt(char *var, char *value) {}
+char *prom_getproperty(char *prop, int *lenp) { return 0; /* NULL */ }
int prom_getbool(char *prop) { return 0; }
+int prom_pci2node(int bus, int devfn) { return 0; }
#endif /* __sparc__ */
diff --git a/perl-install/c/stuff.xs.pm b/perl-install/c/stuff.xs.pm
index 034996d21..3967392fb 100644
--- a/perl-install/c/stuff.xs.pm
+++ b/perl-install/c/stuff.xs.pm
@@ -326,12 +326,12 @@ prom_getchild(node)
int node
void
-prom_getproperty(key)
+prom_getopt(key)
char *key
PPCODE:
int lenp = 0;
char *value = NULL;
- value = prom_getproperty(key, &lenp);
+ value = prom_getopt(key, &lenp);
EXTEND(sp, 1);
if (value != NULL) {
PUSHs(sv_2mortal(newSVpv(value, 0)));
@@ -339,23 +339,62 @@ prom_getproperty(key)
PUSHs(&PL_sv_undef);
}
-int
-prom_getbool(key)
+void
+prom_setopt(key, value)
+ char *key
+ char *value
+
+void
+prom_getproperty(key)
char *key
+ PPCODE:
+ int lenp = 0;
+ char *value = NULL;
+ value = prom_getproperty(key, &lenp);
+ EXTEND(sp, 1);
+ if (value != NULL) {
+ PUSHs(sv_2mortal(newSVpv(value, lenp)));
+ } else {
+ PUSHs(&PL_sv_undef);
+ }
void
-prom_getint(key)
+prom_getstring(key)
char *key
PPCODE:
int lenp = 0;
char *value = NULL;
value = prom_getproperty(key, &lenp);
EXTEND(sp, 1);
- if (value != NULL && lenp == sizeof(int)) {
- PUSHs(sv_2mortal(newSViv(*(int *)value)));
+ if (value != NULL) {
+ PUSHs(sv_2mortal(newSVpv(value, 0)));
} else {
PUSHs(&PL_sv_undef);
}
+
+int
+prom_getbool(key)
+ char *key
+
+
+
+void
+initSilo()
+
+char *
+disk2PromPath(disk)
+ unsigned char *disk
+
+int
+hasAliases()
+
+char *
+promRootName()
+
+void
+setPromVars(linuxAlias, bootDevice)
+ char *linuxAlias
+ char *bootDevice
';
$ENV{C_RPM} and print '