Re: [master 1/3] imount: allow bind mounts.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This looks reasonable and I have no objections.

Martin

----- "Ales Kozumplik" <akozumpl@xxxxxxxxxx> 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@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

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

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux