FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora User

 
 
LinkBack Thread Tools
 
Old 04-08-2010, 02:58 PM
Ales Kozumplik
 
Default umountLoopback() now accepts NULL as device.

I am going to mount /mnt/runtime without a loopback so the parameter will
actually be NULL.
---
loader/method.c | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/loader/method.c b/loader/method.c
index d6f83e6..969a47e 100644
--- a/loader/method.c
+++ b/loader/method.c
@@ -62,16 +62,20 @@ extern uint64_t flags;
int umountLoopback(char * mntpoint, char * device) {
int loopfd;

- umount(mntpoint);
-
- logMessage(INFO, "umounting loopback %s %s", mntpoint, device);
-
- loopfd = open(device, O_RDONLY);
-
- if (ioctl(loopfd, LOOP_CLR_FD, 0) == -1)
- logMessage(ERROR, "LOOP_CLR_FD failed for %s %s: %m", mntpoint, device);
+ if (device)
+ logMessage(INFO, "umounting loopback %s (device %s)", mntpoint, device);
+ else
+ logMessage(INFO, "umounting loopback %s", mntpoint);

- close(loopfd);
+ umount(mntpoint);
+
+ if (device) {
+ /* ak: I think this is unnecessary anyway */
+ loopfd = open(device, O_RDONLY);
+ if (ioctl(loopfd, LOOP_CLR_FD, 0) == -1)
+ logMessage(ERROR, "LOOP_CLR_FD failed for %s %s: %m", mntpoint, device);
+ close(loopfd);
+ }

return 0;
}
@@ -429,7 +433,6 @@ int mountStage2(char *stage2path) {
return 0;
}

-
/* copies a second stage from fd to dest and mounts on mntpoint */
int copyFileAndLoopbackMount(int fd, char * dest, char * device, char * mntpoint,
progressCB pbcb, struct progressCBdata *data,
--
1.6.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-09-2010, 11:17 AM
Martin Sivak
 
Default umountLoopback() now accepts NULL as device.

Well, but why to put this in umountLoopback at all? Don't we have separate umount call? And if this is here because we call this to umount stage2 and we need to decide how we mounted it, then the decision logic should be in the caller function and not here.

Martin

----- "Ales Kozumplik" <akozumpl@redhat.com> wrote:

> I am going to mount /mnt/runtime without a loopback so the parameter
> will
> actually be NULL.
> ---
> loader/method.c | 23 +++++++++++++----------
> 1 files changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/loader/method.c b/loader/method.c
> index d6f83e6..969a47e 100644
> --- a/loader/method.c
> +++ b/loader/method.c
> @@ -62,16 +62,20 @@ extern uint64_t flags;
> int umountLoopback(char * mntpoint, char * device) {
> int loopfd;
>
> - umount(mntpoint);
> -
> - logMessage(INFO, "umounting loopback %s %s", mntpoint, device);
> -
> - loopfd = open(device, O_RDONLY);
> -
> - if (ioctl(loopfd, LOOP_CLR_FD, 0) == -1)
> - logMessage(ERROR, "LOOP_CLR_FD failed for %s %s: %m",
> mntpoint, device);
> + if (device)
> + logMessage(INFO, "umounting loopback %s (device %s)",
> mntpoint, device);
> + else
> + logMessage(INFO, "umounting loopback %s", mntpoint);
>
> - close(loopfd);
> + umount(mntpoint);
> +
> + if (device) {
> + /* ak: I think this is unnecessary anyway */
> + loopfd = open(device, O_RDONLY);
> + if (ioctl(loopfd, LOOP_CLR_FD, 0) == -1)
> + logMessage(ERROR, "LOOP_CLR_FD failed for %s %s: %m",
> mntpoint, device);
> + close(loopfd);
> + }
>
> return 0;
> }
> @@ -429,7 +433,6 @@ int mountStage2(char *stage2path) {
> return 0;
> }
>
> -
> /* copies a second stage from fd to dest and mounts on mntpoint */
> int copyFileAndLoopbackMount(int fd, char * dest, char * device, char
> * mntpoint,
> progressCB pbcb, struct progressCBdata
> *data,
> --
> 1.6.6
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 07:39 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org