summaryrefslogtreecommitdiffstats
path: root/perl-install/c
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2004-06-18 05:20:25 +0000
committerOlivier Blin <oblin@mandriva.org>2004-06-18 05:20:25 +0000
commit622997696fb4a7bcedee2b81ddcf07598c3d2e52 (patch)
treeec7368c8012d9b8b01073be635e0d77115fb4612 /perl-install/c
parenta989352435472bfc67bc0ef5ea00f8c78ac70ecd (diff)
downloaddrakx-622997696fb4a7bcedee2b81ddcf07598c3d2e52.tar
drakx-622997696fb4a7bcedee2b81ddcf07598c3d2e52.tar.gz
drakx-622997696fb4a7bcedee2b81ddcf07598c3d2e52.tar.bz2
drakx-622997696fb4a7bcedee2b81ddcf07598c3d2e52.tar.xz
drakx-622997696fb4a7bcedee2b81ddcf07598c3d2e52.zip
in disk-iso install, automatically choose and change ISO images, according to their volume id and application id
Diffstat (limited to 'perl-install/c')
-rw-r--r--perl-install/c/stuff.xs.pl28
1 files changed, 28 insertions, 0 deletions
diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl
index 2097f0efc..c4049eb95 100644
--- a/perl-install/c/stuff.xs.pl
+++ b/perl-install/c/stuff.xs.pl
@@ -33,6 +33,7 @@ print '
#include <linux/cdrom.h>
#include <linux/loop.h>
#include <linux/blkpg.h>
+#include <linux/iso_fs.h>
#include <net/if.h>
#include <net/route.h>
#include <netinet/in.h>
@@ -146,6 +147,12 @@ SV * iconv_(char* s, char* from_charset, char* to_charset) {
return newSVpv(retval, 0);
}
+int length_of_space_padded(char *str, int len) {
+ while (len >= 0 && str[len-1] == \' \')
+ --len;
+ return len;
+}
+
MODULE = c::stuff PACKAGE = c::stuff
';
@@ -697,6 +704,27 @@ standard_charset()
OUTPUT:
RETVAL
+void
+get_loopback_name(int fd)
+ INIT:
+ struct loop_info loopinfo;
+ PPCODE:
+ if (!ioctl(fd, LOOP_GET_STATUS, &loopinfo))
+ XPUSHs(sv_2mortal(newSVpv(loopinfo.lo_name, 0)));
+
+void
+get_iso_volume_ids(int fd)
+ INIT:
+ struct iso_primary_descriptor voldesc;
+ PPCODE:
+ lseek(fd, 16 * ISOFS_BLOCK_SIZE, SEEK_SET);
+ if (read(fd, &voldesc, sizeof(struct iso_primary_descriptor)) == sizeof(struct iso_primary_descriptor)) {
+ if (voldesc.type[0] == ISO_VD_PRIMARY && !strncmp(voldesc.id, ISO_STANDARD_ID, sizeof(voldesc.id))) {
+ XPUSHs(sv_2mortal(newSVpv(voldesc.volume_id, length_of_space_padded(voldesc.volume_id, sizeof(voldesc.volume_id)))));
+ XPUSHs(sv_2mortal(newSVpv(voldesc.application_id, length_of_space_padded(voldesc.application_id, sizeof(voldesc.application_id)))));
+ }
+ }
+
';
$ENV{C_RPM} and print '