bug-hurd
[Top][All Lists]
Advanced

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

[PATCH] Add priority support to the filesystem of the mountee.


From: Sergiu Ivanov
Subject: [PATCH] Add priority support to the filesystem of the mountee.
Date: Tue, 11 Aug 2009 00:02:01 +0300
User-agent: Mutt/1.5.18 (2008-05-17)

>From f80e4d6fbf270d0bcebc9f101da307633ab96f99 Mon Sep 17 00:00:00 2001
From: Sergiu Ivanov <unlimitedscolobb@gmail.com>
Date: Mon, 10 Aug 2009 20:22:29 +0000
Subject: [PATCH] Add priority support to the filesystem of the mountee.

* mount.c (mountee_priority): New variable.
(setup_unionmount): Register the mountee with the specified
priority.
* mount.h (mountee_priority): New variable.
* netfs.c (netfs_append_args): Append the priority of the mountee
before the main loop.  Don't append the it in the main loop.
* option.c (argp_parse_common_options): Store the priority
assigned to the mountee.
---
 mount.c   |    5 ++++-
 mount.h   |    2 ++
 netfs.c   |   34 ++++++++++++++++++++++++----------
 options.c |    2 ++
 4 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/mount.c b/mount.c
index 8213819..909fc79 100644
--- a/mount.c
+++ b/mount.c
@@ -41,6 +41,8 @@ node_t * mountee_node;
 mach_port_t mountee_root;
 mach_port_t mountee_control = MACH_PORT_NULL;
 
+int mountee_priority = 0;
+
 int mountee_started = 0;
 
 /* Shows the mode in which the current instance of unionmount
@@ -219,7 +221,8 @@ setup_unionmount (void)
 
   /* A path equal to "" will mean that the current ULFS entry is the
      mountee port.  */
-  ulfs_register ("", 0, 0);
+  debug_msg_send ("mountee_priority = %d", mountee_priority);
+  ulfs_register ("", 0, mountee_priority);
 
   mountee_started = 1;
 
diff --git a/mount.h b/mount.h
index f959c38..4459629 100644
--- a/mount.h
+++ b/mount.h
@@ -36,6 +36,8 @@ extern size_t mountee_argz_len;
 extern mach_port_t mountee_root;
 extern mach_port_t mountee_control;
 
+extern int mountee_priority;
+
 extern int mountee_started;
 
 /* Shows the mode in which the current instance of unionmount
diff --git a/netfs.c b/netfs.c
index 2abafa1..4a60dac 100644
--- a/netfs.c
+++ b/netfs.c
@@ -93,6 +93,15 @@ netfs_append_args (char **argz, size_t *argz_len)
         on the whether the unionmount is transparent or not.  */
       char * opt_name;
 
+      /* Also append the priority of the mountee's filesystem.  */
+      if (mountee_priority)
+       if ((err = asprintf (&buf, "%s=%d", OPT_LONG (OPT_LONG_PRIORITY),
+                            mountee_priority)) != -1)
+         {
+           err = argz_add (argz, argz_len, buf);
+           free (buf);
+         }
+
       mountee_cl = malloc (mountee_argz_len);
       if (!mountee_cl)
        return ENOMEM;
@@ -125,16 +134,21 @@ netfs_append_args (char **argz, size_t *argz_len)
          err = argz_add (argz, argz_len,
                          OPT_LONG (OPT_LONG_WRITABLE));
       if (! err)
-       if (ulfs->priority)
-         {
-           char *buf = NULL;
-           if ((err = asprintf (&buf, "%s=%s", OPT_LONG (OPT_LONG_PRIORITY), 
-                     ulfs->priority)) != -1)
-             {
-               err = argz_add (argz, argz_len, buf);
-               free (buf);
-             }
-         }
+       {
+         if (ulfs->path && !ulfs->path[0])
+           continue;
+
+         if (ulfs->priority)
+           {
+             char *buf = NULL;
+             if ((err = asprintf (&buf, "%s=%s", OPT_LONG (OPT_LONG_PRIORITY),
+                                  ulfs->priority)) != -1)
+               {
+                 err = argz_add (argz, argz_len, buf);
+                 free (buf);
+               }
+           }
+       }
 
       if (! err)
        {
diff --git a/options.c b/options.c
index 4b9a594..493e932 100644
--- a/options.c
+++ b/options.c
@@ -147,6 +147,8 @@ argp_parse_common_options (int key, char *arg, struct 
argp_state *state)
       err = argz_create_sep (arg, ' ', &mountee_argz, &mountee_argz_len);
       if (err)
        error (EXIT_FAILURE, err, "argz_create_sep");
+
+      mountee_priority = ulfs_priority;
       break;
 
     case OPT_UNDERLYING:       /* --underlying  */
-- 
1.6.3.3





reply via email to

[Prev in Thread] Current Thread [Next in Thread]