bug-hurd
[Top][All Lists]
Advanced

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

Re: mtab: libdiskfs / ext2fs support changes


From: David Walter
Subject: Re: mtab: libdiskfs / ext2fs support changes
Date: Fri, 13 Sep 2002 11:50:24 -0400
User-agent: Gnus/5.090007 (Oort Gnus v0.07) XEmacs/21.4 (Honest Recruiter, hurd-i386-debian)

address@hidden (Niels Möller) writes:

> Hmm, looking at your patch, it seems you already have a declaration of
> the diskfs_notify_mtab function in diskfs.h, so you can just delete
> the above declaration from extfs.c. As for diskfs_mount_point, if
> libdiskfs users like ext2 are supposed to use that variable, the
> declaration should move from libdiskfs/priv.h to libdiskfs/diskfs.h.

Here are diffs to the current source tree following the suggestions of
Niels.

Thanks Niels.

Index: ChangeLog
===================================================================
RCS file: /cvsroot/hurd/hurd/ext2fs/ChangeLog,v
retrieving revision 1.86
diff --unified -w -i -r1.86 ChangeLog
--- ChangeLog   1 Aug 2002 00:59:41 -0000       1.86
+++ ChangeLog   13 Sep 2002 15:46:31 -0000
@@ -1,3 +1,8 @@
+2002-09-09  David Walter  <address@hidden>
+
+       * ext2fs.c (main): external symbol diskfs_mount_point added, test
+       for a non-bootstrapping filesystem and call to diskfs_notify_mtab added
+
 2002-07-31  Roland McGrath  <address@hidden>
 
        * dir.c (diskfs_direnter_hard): Fix test in last change.

Index: ext2fs.c
===================================================================
RCS file: /cvsroot/hurd/hurd/ext2fs/ext2fs.c,v
retrieving revision 1.55
diff --unified -w -i -r1.55 ext2fs.c
--- ext2fs.c    2 Jun 2002 21:40:56 -0000       1.55
+++ ext2fs.c    13 Sep 2002 15:48:55 -0000
@@ -200,6 +200,16 @@
      outside world.  */
   diskfs_startup_diskfs (bootstrap, 0);
 
+  /*
+    notify mtab when this is not a root/bootstrapping filesystem.
+
+    diskfs_init_main sets the bootstrap port to 0 if this is a
+    bootstrap filesystem, we have a catch 22 with the bootstrap
+    avoided by mtab automagically self inserting '/'. Until the root
+    filesystem is active there is no _PATH_MOUNTED to write */
+  if (bootstrap) 
+     diskfs_notify_mtab(0);
+  
   /* and so we die, leaving others to do the real work.  */
   cthread_exit (0);
   /* NOTREACHED */


Index: ChangeLog
===================================================================
RCS file: /cvsroot/hurd/hurd/libdiskfs/ChangeLog,v
retrieving revision 1.182
diff --unified -w -i -r1.182 ChangeLog
--- ChangeLog   27 Jun 2002 19:19:13 -0000      1.182
+++ ChangeLog   13 Sep 2002 15:12:19 -0000
@@ -1,3 +1,35 @@
+2002-09-13  David Walter  <address@hidden>
+
+       * opts-std-startup.c (startup_options): add --mntpath=PATH_MOUNTED
+       option
+
+2002-09-11  David Walter  <address@hidden>
+
+       * diskfs.h: added global symbols for diskfs_notify_mtab and
+       diskfs_mount_point
+
+2002-09-09  David Walter  <address@hidden>
+
+       * opts-append-std.c (diskfs_append_std_options): display mntpath
+       option.
+
+       * notify-mtab.c (diskfs_notify_mtab): new function takes a mount
+       point and writes it to _PATH_MOUNTED, if arg is null use previous
+       value because at startup the entry can't be written to mtab until
+       the filesystem is active, so it defers write until filesystem
+       startup
+
+       * notify-mtab.c added global symbol diskfs_mount_point: the
+       path this is mounted on
+
+       * opts-std-startup.c (parse_startup_opt): added call to new
+       function diskfs_notify_mtab
+
+       * opts-std-runtime.c (parse_opt): added call to new function
+       diskfs_notify_mtab
+
+       * Makefile (OTHERSRCS): added notify-mtab.c
+       
 2002-06-26  Marcus Brinkmann  <address@hidden>
 
        * Makefile (DIST_FILES): Variable removed.

Index: opts-std-startup.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libdiskfs/opts-std-startup.c,v
retrieving revision 1.20
diff --unified -w -i -r1.20 opts-std-startup.c
--- opts-std-startup.c  1 May 2002 03:00:44 -0000       1.20
+++ opts-std-startup.c  13 Sep 2002 15:09:41 -0000
@@ -23,6 +23,7 @@
 #include <argp.h>
 #include <hurd/store.h>
 #include <hurd/paths.h>
+#include <paths.h>
 #include "priv.h"
 
 const char *diskfs_boot_command_line;
@@ -66,7 +67,7 @@
   {"host-priv-port",     OPT_HOST_PRIV_PORT,     "PORT"},
   {"device-master-port", OPT_DEVICE_MASTER_PORT, "PORT"},
   {"exec-server-task",   OPT_EXEC_SERVER_TASK,   "PORT"},
-
+  {"mntpath", 'm', "PATH_MOUNTED", 0, "write PATH_MOUNTED to " _PATH_MOUNTED },
   {0}
 };
 
@@ -96,6 +97,7 @@
       diskfs_synchronous = 0;
       diskfs_default_sync_interval = 0;
       break;
+    case 'm': diskfs_notify_mtab(arg); break;
 
       /* Boot options */
     case OPT_DEVICE_MASTER_PORT:

Index: opts-std-runtime.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libdiskfs/opts-std-runtime.c,v
retrieving revision 1.11
diff --unified -w -i -r1.11 opts-std-runtime.c
--- opts-std-runtime.c  1 May 2002 03:00:44 -0000       1.11
+++ opts-std-runtime.c  13 Sep 2002 15:09:28 -0000
@@ -106,6 +106,7 @@
     case OPT_ATIME: h->noatime = 0; break;
     case OPT_NO_INHERIT_DIR_GROUP: h->noinheritdirgroup = 1; break;
     case OPT_INHERIT_DIR_GROUP: h->noinheritdirgroup = 0; break;
+    case 'm': diskfs_notify_mtab (arg); break;
     case 'n': h->sync_interval = 0; h->sync = 0; break;
     case 's':
       if (arg)

Index: opts-append-std.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libdiskfs/opts-append-std.c,v
retrieving revision 1.10
diff --unified -w -i -r1.10 opts-append-std.c
--- opts-append-std.c   8 May 2002 09:56:54 -0000       1.10
+++ opts-append-std.c   13 Sep 2002 15:07:58 -0000
@@ -61,7 +61,16 @@
            }
        }
     }
+  if (!err)
+  {
+     if (diskfs_mount_point)
+     {
+        char*buf=0;
+        asprintf(&buf, "--mntpath=%s", diskfs_mount_point);
+        err = argz_add (argz, argz_len, buf);
+     }
+  }
 
   return err;
 }

Index: notify-mtab.c
===================================================================
--- notify-mtab.c.orig  Mon Sep  9 22:00:25 2002
+++ notify-mtab.c       Tue Sep 10 14:08:06 2002
@@ -0,0 +1,42 @@
+/* notify-mtab: write the path of this translator to _PATH_MOUNTED
+
+   Copyright (C) 2002 Free Software Foundation
+
+   Written by David Walter <address@hidden>
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#define _GNU_SOURCE 1
+
+#include <stdio.h>
+#include <paths.h>
+#include "priv.h"
+char *diskfs_mount_point=0;
+void diskfs_notify_mtab(char*path)
+{
+   if (path)
+   {
+      if (diskfs_mount_point)
+         free (diskfs_mount_point);
+      diskfs_mount_point = strdup(path);
+   }
+   FILE* mtab = fopen(_PATH_MOUNTED, "a+");
+   if(mtab)
+   {
+      fprintf(mtab, "%s\n", diskfs_mount_point);
+      fclose(mtab);
+   }
+}
+

Index: Makefile
===================================================================
RCS file: /cvsroot/hurd/hurd/libdiskfs/Makefile,v
retrieving revision 1.71
diff --unified -w -i -r1.71 Makefile
--- Makefile    27 Jun 2002 19:19:13 -0000      1.71
+++ Makefile    13 Sep 2002 15:05:58 -0000
@@ -51,7 +51,9 @@
        remount.c console.c disk-pager.c \
        name-cache.c direnter.c dirrewrite.c dirremove.c lookup.c dead-name.c \
        validate-mode.c validate-group.c validate-author.c validate-flags.c \
-       validate-rdev.c validate-owner.c extra-version.c
+       validate-rdev.c validate-owner.c extra-version.c \
+   notify-mtab.c 
+
 SRCS = $(OTHERSRCS) $(FSSRCS) $(IOSRCS) $(FSYSSRCS) $(IFSOCKSRCS)
 LCLHDRS = diskfs.h priv.h lithp.h fsmutations.h diskfs-pager.h fhandle.h
 installhdrs = diskfs.h diskfs-pager.h

Index: diskfs.h
===================================================================
RCS file: /cvsroot/hurd/hurd/libdiskfs/diskfs.h,v
retrieving revision 1.98
diff --unified -w -i -r1.98 diskfs.h
--- diskfs.h    27 Jun 2002 19:19:13 -0000      1.98
+++ diskfs.h    13 Sep 2002 15:01:29 -0000
@@ -973,4 +973,19 @@
 /* Make errors go somewhere reasonable.  */
 void diskfs_console_stdio ();
 
+/*
+  diskfs_notify_mtab: write the path of a translator to the mount
+  table
+
+  This  is not a  boot option.   Notice that  every running  system is
+  assumed by /hurd/mtab to have a root which is automagically inserted
+  in mtab at startup.
+
+  A NULL arg uses the current value of diskfs_mount_point otherwise
+  diskfs_mount_point is set to path and written to _PATH_MOUNTED */
+
+void diskfs_notify_mtab (char* path);
+/* The global mount point for this translator */
+extern char*diskfs_mount_point;
+
 #endif /* hurd/diskfs.h */

-- 
/^\
\ /     ASCII RIBBON CAMPAIGN
 X        AGAINST HTML MAIL
/ \




reply via email to

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