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 imount: allow bind mounts.

---
isys/imount.c | 25 +++++++++++++++++++------
isys/imount.h | 2 ++
2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/isys/imount.c b/isys/imount.c
index 9653e74..ed0f5a7 100644
--- a/isys/imount.c
+++ b/isys/imount.c
@@ -84,18 +84,21 @@ int mountCommandWrapper(int mode, char *dev, char *where, char *fs,
int stdout_pipe[2], stderr_pipe[2];
char *opts = NULL, *device = NULL, *cmd = NULL;

- if (mode == IMOUNT_MODE_MOUNT) {
+ switch (mode) {
+ case IMOUNT_MODE_MOUNT:
+ case IMOUNT_MODE_BIND:
cmd = "/bin/mount";
- } else if (mode == IMOUNT_MODE_UMOUNT) {
+ if (mkdirChain(where))
+ return IMOUNT_ERR_ERRNO;
+ break;
+ case IMOUNT_MODE_UMOUNT:
cmd = "/bin/umount";
- } else {
+ break;
+ default:
return IMOUNT_ERR_MODE;
}

if (mode == IMOUNT_MODE_MOUNT) {
- if (mkdirChain(where))
- return IMOUNT_ERR_ERRNO;
-
if (strstr(fs, "nfs")) {
if (options) {
if (asprintf(&opts, "%s,nolock", options) == -1) {
@@ -167,6 +170,11 @@ int mountCommandWrapper(int mode, char *dev, char *where, char *fs,
rc = execl(cmd, cmd, "-n", "-t", fs, device, where, NULL);
exit(1);
}
+ } else if (mode == IMOUNT_MODE_BIND) {
+ logProgramMessage(INFO, "Running... %s --bind %s %s",
+ cmd, dev, where);
+ rc = execl(cmd, cmd, "--bind", dev, where, NULL);
+ exit(1);
} else if (mode == IMOUNT_MODE_UMOUNT) {
logProgramMessage(INFO, "Running... %s %s", cmd, where);
rc = execl(cmd, cmd, where, NULL);
@@ -241,6 +249,11 @@ int mountCommandWrapper(int mode, char *dev, char *where, char *fs,
return 0;
}

+int doBindMount(char* path, char *where, char **err) {
+ return mountCommandWrapper(IMOUNT_MODE_BIND,
+ path, where, NULL, NULL, err);
+}
+
int doPwMount(char *dev, char *where, char *fs, char *options, char **err) {
return mountCommandWrapper(IMOUNT_MODE_MOUNT,
dev, where, fs, options, err);
diff --git a/isys/imount.h b/isys/imount.h
index 9fa6769..d1b7cf3 100644
--- a/isys/imount.h
+++ b/isys/imount.h
@@ -39,7 +39,9 @@

#define IMOUNT_MODE_MOUNT 1
#define IMOUNT_MODE_UMOUNT 2
+#define IMOUNT_MODE_BIND 3

+int doBindMount(char* path, char *where, char **err);
int doPwMount(char *dev, char *where, char *fs, char *options, char **err);
int doPwUmount(char *where, char **err);
int mkdirChain(char * origChain);
--
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:18 AM
Martin Sivak
 
Default imount: allow bind mounts.

This looks reasonable and I have no objections.

Martin

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

> ---
> isys/imount.c | 25 +++++++++++++++++++------
> isys/imount.h | 2 ++
> 2 files changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/isys/imount.c b/isys/imount.c
> index 9653e74..ed0f5a7 100644
> --- a/isys/imount.c
> +++ b/isys/imount.c
> @@ -84,18 +84,21 @@ int mountCommandWrapper(int mode, char *dev, char
> *where, char *fs,
> int stdout_pipe[2], stderr_pipe[2];
> char *opts = NULL, *device = NULL, *cmd = NULL;
>
> - if (mode == IMOUNT_MODE_MOUNT) {
> + switch (mode) {
> + case IMOUNT_MODE_MOUNT:
> + case IMOUNT_MODE_BIND:
> cmd = "/bin/mount";
> - } else if (mode == IMOUNT_MODE_UMOUNT) {
> + if (mkdirChain(where))
> + return IMOUNT_ERR_ERRNO;
> + break;
> + case IMOUNT_MODE_UMOUNT:
> cmd = "/bin/umount";
> - } else {
> + break;
> + default:
> return IMOUNT_ERR_MODE;
> }
>
> if (mode == IMOUNT_MODE_MOUNT) {
> - if (mkdirChain(where))
> - return IMOUNT_ERR_ERRNO;
> -
> if (strstr(fs, "nfs")) {
> if (options) {
> if (asprintf(&opts, "%s,nolock", options) == -1) {
> @@ -167,6 +170,11 @@ int mountCommandWrapper(int mode, char *dev, char
> *where, char *fs,
> rc = execl(cmd, cmd, "-n", "-t", fs, device, where,
> NULL);
> exit(1);
> }
> + } else if (mode == IMOUNT_MODE_BIND) {
> + logProgramMessage(INFO, "Running... %s --bind %s %s",
> + cmd, dev, where);
> + rc = execl(cmd, cmd, "--bind", dev, where, NULL);
> + exit(1);
> } else if (mode == IMOUNT_MODE_UMOUNT) {
> logProgramMessage(INFO, "Running... %s %s", cmd, where);
> rc = execl(cmd, cmd, where, NULL);
> @@ -241,6 +249,11 @@ int mountCommandWrapper(int mode, char *dev, char
> *where, char *fs,
> return 0;
> }
>
> +int doBindMount(char* path, char *where, char **err) {
> + return mountCommandWrapper(IMOUNT_MODE_BIND,
> + path, where, NULL, NULL, err);
> +}
> +
> int doPwMount(char *dev, char *where, char *fs, char *options, char
> **err) {
> return mountCommandWrapper(IMOUNT_MODE_MOUNT,
> dev, where, fs, options, err);
> diff --git a/isys/imount.h b/isys/imount.h
> index 9fa6769..d1b7cf3 100644
> --- a/isys/imount.h
> +++ b/isys/imount.h
> @@ -39,7 +39,9 @@
>
> #define IMOUNT_MODE_MOUNT 1
> #define IMOUNT_MODE_UMOUNT 2
> +#define IMOUNT_MODE_BIND 3
>
> +int doBindMount(char* path, char *where, char **err);
> int doPwMount(char *dev, char *where, char *fs, char *options, char
> **err);
> int doPwUmount(char *where, char **err);
> int mkdirChain(char * origChain);
> --
> 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 08:31 PM.

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