[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH] mountStage2 no longer takes a directory argument.
- From: Chris Lumens <clumens redhat com>
- To: anaconda-devel-list redhat com
- Cc:
- Subject: [PATCH] mountStage2 no longer takes a directory argument.
- Date: Tue, 17 Jun 2008 11:45:41 -0400
This removes the capability to find implicit updates.img files, but that will
be coming back in a later patch. This is just some cleanup for now.
---
loader2/cdinstall.c | 14 ++++----------
loader2/hdinstall.c | 2 +-
loader2/method.c | 15 +--------------
loader2/method.h | 2 +-
loader2/nfsinstall.c | 23 +++++++----------------
5 files changed, 14 insertions(+), 42 deletions(-)
diff --git a/loader2/cdinstall.c b/loader2/cdinstall.c
index 7f3ef12..c6bc1db 100644
--- a/loader2/cdinstall.c
+++ b/loader2/cdinstall.c
@@ -154,10 +154,9 @@ static void wrongCDMessage(void) {
static void mountCdromStage2(char *cddev, char *location) {
int gotcd1=0;
int rc;
- char *stage2loc, *imageDir;
+ char *stage2loc;
rc = asprintf(&stage2loc, "%s/images/stage2.img", location);
- rc = asprintf(&imageDir, "%s/images/", location);
do {
do {
@@ -169,7 +168,7 @@ static void mountCdromStage2(char *cddev, char *location) {
}
} while (1);
- rc = mountStage2(stage2loc, imageDir);
+ rc = mountStage2(stage2loc);
/* if we failed, umount location (usually) /mnt/source and keep going */
if (rc) {
@@ -182,7 +181,6 @@ static void mountCdromStage2(char *cddev, char *location) {
} while (!gotcd1);
free(stage2loc);
- free(imageDir);
}
/* ask about doing media check */
@@ -235,7 +233,7 @@ char * setupCdrom(char * location, struct loaderData_s * loaderData,
int i, r, rc;
int foundinvalid = 0;
int stage2inram = 0;
- char *buf, *stage2loc, *discinfoloc, *imageDir;
+ char *buf, *stage2loc, *discinfoloc;
char *stage2img;
struct device ** devices;
char *cddev = NULL;
@@ -248,11 +246,9 @@ char * setupCdrom(char * location, struct loaderData_s * loaderData,
if (loaderData && FL_STAGE2(flags)) {
stage2loc = strdup(location);
- r = asprintf(&imageDir, "%.*s", (int) (strrchr(location, '/') - location), location);
r = asprintf(&discinfoloc, "%s/.discinfo", imageDir);
} else {
r = asprintf(&stage2loc, "%s/images/stage2.img", location);
- r = asprintf(&imageDir, "%s/images", location);
r = asprintf(&discinfoloc, "%s/.discinfo", location);
}
@@ -289,7 +285,7 @@ char * setupCdrom(char * location, struct loaderData_s * loaderData,
stage2img = strdup(stage2loc);
stage2inram = 0;
}
- rc = mountStage2(stage2img, imageDir);
+ rc = mountStage2(stage2img);
if (rc) {
logMessage(INFO, "mounting stage2 failed");
@@ -314,7 +310,6 @@ char * setupCdrom(char * location, struct loaderData_s * loaderData,
devices[i]->device, location);
free(stage2loc);
- free(imageDir);
free(discinfoloc);
if (r == -1)
@@ -358,7 +353,6 @@ char * setupCdrom(char * location, struct loaderData_s * loaderData,
err:
free(stage2loc);
- free(imageDir);
free(discinfoloc);
return NULL;
}
diff --git a/loader2/hdinstall.c b/loader2/hdinstall.c
index 28fe801..3b99377 100644
--- a/loader2/hdinstall.c
+++ b/loader2/hdinstall.c
@@ -197,7 +197,7 @@ static char * setupIsoImages(char * device, char * dirName, char * location) {
if (FL_STAGE2(flags)) {
if (!copyFile(path, "/tmp/stage2.img")) {
- rc = mountStage2("/tmp/stage2.img", dirName);
+ rc = mountStage2("/tmp/stage2.img");
umount("/mnt/isodir");
free(path);
diff --git a/loader2/method.c b/loader2/method.c
index 9d34991..f1eb55d 100644
--- a/loader2/method.c
+++ b/loader2/method.c
@@ -530,10 +530,7 @@ void umountStage2(void) {
/* mount a second stage, verify the stamp file, copy updates
* Returns 0 on success, 1 on failure to mount, -1 on bad stamp */
-int mountStage2(char *stage2path, char *imageDir) {
- char *buf;
- int rc;
-
+int mountStage2(char *stage2path) {
if (access(stage2path, R_OK)) {
return 1;
}
@@ -547,16 +544,6 @@ int mountStage2(char *stage2path, char *imageDir) {
return -1;
}
- /* JKFIXME: this is kind of silly.. /mnt/source is hardcoded :/ */
- rc = asprintf(&buf, "%s/updates.img", imageDir);
- copyUpdatesImg(buf);
- free(buf);
-
- /* more hard coding */
- rc = asprintf(&buf, "%s/product.img", imageDir);
- copyProductImg(buf);
- free(buf);
-
return 0;
}
diff --git a/loader2/method.h b/loader2/method.h
index dc5f61c..36f67f3 100644
--- a/loader2/method.h
+++ b/loader2/method.h
@@ -50,7 +50,7 @@ void queryIsoMediaCheck(char * isoDir);
int verifyStamp(char * path);
void umountStage2(void);
-int mountStage2(char *stage2path, char *imageDir);
+int mountStage2(char *stage2path);
int copyFileAndLoopbackMount(int fd, char *dest, char *device, char *mntpoint);
int getFileFromBlockDevice(char *device, char *path, char * dest);
diff --git a/loader2/nfsinstall.c b/loader2/nfsinstall.c
index ae309d2..0be2aaa 100644
--- a/loader2/nfsinstall.c
+++ b/loader2/nfsinstall.c
@@ -147,7 +147,7 @@ char * mountNfsImage(struct installMethod * method,
break;
case NFS_STAGE_MOUNT: {
- char *buf, *stage2dir;
+ char *buf;
struct in_addr ip;
if (loaderData->noDns && !(inet_pton(AF_INET, host, &ip))) {
@@ -224,18 +224,14 @@ char * mountNfsImage(struct installMethod * method,
stage = NFS_STAGE_NFS;
if (!doPwMount(fullPath, "/mnt/source", "nfs", mountOpts)) {
- if (FL_STAGE2(flags)) {
- stage2dir = strdup("/mnt/source");
+ if (FL_STAGE2(flags))
tmp = asprintf(&buf, "/mnt/source/%s", strrchr(directory, '/'));
- } else {
- stage2dir = strdup("/mnt/source/images");
+ else
buf = strdup("/mnt/source/images/stage2.img");
- }
if (!access(buf, R_OK)) {
logMessage(INFO, "can access %s", buf);
- rc = mountStage2(buf, stage2dir);
- free(stage2dir);
+ rc = mountStage2(buf);
if (rc == -1) {
foundinvalid = 1;
@@ -257,7 +253,6 @@ char * mountNfsImage(struct installMethod * method,
logMessage(WARNING, "unable to access %s", buf);
free(buf);
- free(stage2dir);
umount("/mnt/source");
if ((path = isNfsIso(fullPath, mountOpts, &foundinvalid, 1)) != NULL) {
@@ -272,20 +267,16 @@ char * mountNfsImage(struct installMethod * method,
logMessage(WARNING, "failed to mount iso %s loopback", path);
free(path);
} else {
- if (FL_STAGE2(flags)) {
- stage2dir = strdup("/mnt/source");
+ if (FL_STAGE2(flags))
tmp = asprintf(&buf, "/mnt/source/%s", strrchr(directory, '/'));
- } else {
- stage2dir = strdup("/mnt/source/images");
+ else
buf = strdup("/mnt/source/images/stage2.img");
- }
rc = copyFile(buf, "/tmp/stage2.img");
- rc = mountStage2("/tmp/stage2.img", stage2dir);
+ rc = mountStage2("/tmp/stage2.img");
umountLoopback("/mnt/source", "/dev/loop1");
free(buf);
- free(stage2dir);
free(path);
if (rc && rc == -1) {
--
1.5.5.1
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]