[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/3] Add the ``--mount'' command line option.
From: |
Sergiu Ivanov |
Subject: |
[PATCH 1/3] Add the ``--mount'' command line option. |
Date: |
Sun, 5 Jul 2009 15:59:25 +0300 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
>From 880a92b0dc13834fc08d541a9d936e0b0b83a220 Mon Sep 17 00:00:00 2001
From: Sergiu Ivanov <unlimitedscolobb@gmail.com>
Date: Thu, 18 Jun 2009 22:51:58 +0300
Subject: [PATCH] Add the ``--mount'' command line option.
* Makefile (OBJS): Add mount.o
* options.h (OPT_MOUNT, OPT_LONG_MOUNT): Define.
* options.c (argp_common_options): Add option ``-mount''.
(argp_parse_common_options): Handle the new option.
* mount.h: New file.
* mount.c: Likewise.
---
Makefile | 8 ++++++--
mount.c | 29 +++++++++++++++++++++++++++++
mount.h | 32 ++++++++++++++++++++++++++++++++
options.c | 17 ++++++++++++++++-
options.h | 7 ++++++-
5 files changed, 89 insertions(+), 4 deletions(-)
create mode 100644 mount.c
create mode 100644 mount.h
diff --git a/Makefile b/Makefile
index b180072..fd8adfe 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,10 @@
# Hurd unionfs
-# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2005, 2009
+# Free Software Foundation, Inc.
+#
# Written by Jeroen Dekkers <jeroen@dekkers.cx>.
+#
+# Adapted for unionmount by Sergiu Ivanov <unlimitedscolobb@gmail.com>.
#
# 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
@@ -25,7 +29,7 @@ CFLAGS += -Wall -g -O2 -D_FILE_OFFSET_BITS=64 -std=gnu99 \
LDFLAGS += -lnetfs -lfshelp -liohelp -lthreads \
-lports -lihash -lshouldbeinlibc
OBJS = main.o node.o lnode.o ulfs.o ncache.o netfs.o \
- lib.o options.o pattern.o stow.o update.o
+ lib.o options.o pattern.o stow.o update.o mount.o
MIGCOMSFLAGS = -prefix stow_
fs_notify-MIGSFLAGS = -imacros ./stow-mutations.h
diff --git a/mount.c b/mount.c
new file mode 100644
index 0000000..7bc1fb8
--- /dev/null
+++ b/mount.c
@@ -0,0 +1,29 @@
+/* Hurd unionmount
+ The core of unionmount functionality.
+
+ Copyright (C) 2009 Free Software Foundation, Inc.
+
+ Written by Sergiu Ivanov <unlimitedscolobb@gmail.com>.
+
+ 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 of the
+ License, 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA. */
+
+#define _GNU_SOURCE
+
+#include "mount.h"
+
+/* The command line for starting the mountee. */
+char * mountee_argz;
+size_t mountee_argz_len;
diff --git a/mount.h b/mount.h
new file mode 100644
index 0000000..69b5574
--- /dev/null
+++ b/mount.h
@@ -0,0 +1,32 @@
+/* Hurd unionmount
+ General information and properties for unionmount/unionfs.
+
+ Copyright (C) 2009 Free Software Foundation, Inc.
+
+ Written by Sergiu Ivanov <unlimitedscolobb@gmail.com>.
+
+ 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 of the
+ License, 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA. */
+
+#ifndef INCLUDED_UNIONMOUNT_H
+#define INCLUDED_UNIONMOUNT_H
+
+#include <unistd.h>
+
+/* The command line for starting the mountee. */
+extern char * mountee_argz;
+extern size_t mountee_argz_len;
+
+#endif /* not INCLUDED_UNIONMOUNT_H */
diff --git a/options.c b/options.c
index ef29a02..a14fe4e 100644
--- a/options.c
+++ b/options.c
@@ -1,7 +1,10 @@
/* Hurd unionfs
- Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2005, 2009 Free Software Foundation, Inc.
+
Written by Moritz Schulte <moritz@duesseldorf.ccc.de>.
+ Adapted for unionmount by Sergiu Ivanov <unlimitedscolobb@gmail.com>.
+
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 of the
@@ -23,6 +26,7 @@
#include <argp.h>
#include <error.h>
+#include <argz.h>
#include "options.h"
#include "ulfs.h"
@@ -33,6 +37,7 @@
#include "pattern.h"
#include "stow.h"
#include "update.h"
+#include "mount.h"
/* This variable is set to a non-zero value after parsing of the
startup options. Whenever the argument parser is later called to
@@ -51,6 +56,9 @@ static const struct argp_option argp_common_options[] =
"send debugging messages to stderr" },
{ OPT_LONG_CACHE_SIZE, OPT_CACHE_SIZE, "SIZE", 0,
"specify the maximum number of nodes in the cache" },
+ { OPT_LONG_MOUNT, OPT_MOUNT, "MOUNTEE", 0,
+ "use MOUNTEE as translator command line, start the translator,"
+ "and add its filesystem"},
{ 0, 0, 0, 0, "Runtime options:", 1 },
{ OPT_LONG_STOW, OPT_STOW, "STOWDIR", 0,
"stow given directory", 1},
@@ -124,6 +132,13 @@ argp_parse_common_options (int key, char *arg, struct
argp_state *state)
ulfs_match = 0;
break;
+ case OPT_MOUNT:
+ /* TODO: Improve the mountee command line parsing mechanism. */
+ err = argz_create_sep (arg, ' ', &mountee_argz, &mountee_argz_len);
+ if (err)
+ error (EXIT_FAILURE, err, "argz_create_sep");
+ break;
+
case OPT_UNDERLYING: /* --underlying */
case ARGP_KEY_ARG:
diff --git a/options.h b/options.h
index eb74ce6..95a6ddb 100644
--- a/options.h
+++ b/options.h
@@ -1,7 +1,10 @@
/* Hurd unionfs
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2009 Free Software Foundation, Inc.
+
Written by Moritz Schulte <moritz@duesseldorf.ccc.de>.
+ Adapted for unionmount by Sergiu Ivanov <unlimitedscolobb@gmail.com>.
+
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 of the
@@ -29,6 +32,7 @@
#define OPT_PATTERN 'm'
#define OPT_PRIORITY 'p'
#define OPT_STOW 's'
+#define OPT_MOUNT 't'
/* The long options. */
#define OPT_LONG_UNDERLYING "underlying"
@@ -40,6 +44,7 @@
#define OPT_LONG_PATTERN "match"
#define OPT_LONG_PRIORITY "priority"
#define OPT_LONG_STOW "stow"
+#define OPT_LONG_MOUNT "mount"
#define OPT_LONG(o) "--" o
--
1.5.2.4