summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2013-07-30 11:59:19 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-09-15 23:19:30 +0200
commit70b1ab5dbb8d7d1cf63ab170e0a96a03c6dd363c (patch)
tree1253d81d18b8394e0037d109e73b2ae39427fc1f
parent8acdc0f29b9b0b043939929b1ce3e71473b0b847 (diff)
libdiskfs: add fsys_get_source
Add a user overridable function diskfs_get_source with a default implementation returning EOPNOTSUPP. Add a server function for fsys-get-source. * libdiskfs/Makefile: Add fsys-get-source.c and get-source.c * libdiskfs/diskfs.h: Add diskfs_get_source. * libdiskfs/fsys-get-source.c: New file. * libdiskfs/get-source.c: Likewise.
-rw-r--r--libdiskfs/Makefile4
-rw-r--r--libdiskfs/diskfs.h8
-rw-r--r--libdiskfs/fsys-get-source.c34
-rw-r--r--libdiskfs/get-source.c28
4 files changed, 71 insertions, 3 deletions
diff --git a/libdiskfs/Makefile b/libdiskfs/Makefile
index 1a0edd00..03c2e2b3 100644
--- a/libdiskfs/Makefile
+++ b/libdiskfs/Makefile
@@ -35,7 +35,7 @@ IOSRCS= io-async-icky.c io-async.c io-duplicate.c io-get-conch.c io-revoke.c \
io-select.c io-stat.c io-stubs.c io-write.c io-version.c io-sigio.c
FSYSSRCS=fsys-getroot.c fsys-goaway.c fsys-startup.c fsys-getfile.c \
fsys-options.c fsys-syncfs.c fsys-forward.c \
- fsys-get-children.c
+ fsys-get-children.c fsys-get-source.c
IFSOCKSRCS=ifsock.c
OTHERSRCS = conch-fetch.c conch-set.c dir-clear.c dir-init.c dir-renamed.c \
extern-inline.c \
@@ -52,7 +52,7 @@ OTHERSRCS = conch-fetch.c conch-set.c dir-clear.c dir-init.c dir-renamed.c \
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 get-source.c
SRCS = $(OTHERSRCS) $(FSSRCS) $(IOSRCS) $(FSYSSRCS) $(IFSOCKSRCS)
installhdrs = diskfs.h diskfs-pager.h
diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h
index 24895172..22262aa8 100644
--- a/libdiskfs/diskfs.h
+++ b/libdiskfs/diskfs.h
@@ -1,7 +1,7 @@
/* Definitions for fileserver helper functions
Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2007, 2008,
- 2009 Free Software Foundation, Inc.
+ 2009, 2013 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -567,6 +567,12 @@ error_t (*diskfs_create_symlink_hook)(struct node *np, const char *target);
isn't set, then the normal method (reading from the file data) is
used. If it returns any other error, it is returned to the user. */
error_t (*diskfs_read_symlink_hook)(struct node *np, char *target);
+
+/* The user may define this function. The function must set source to
+ the source device of the filesystem. The function may return an
+ EOPNOTSUPP to indicate that the concept of a source device is not
+ applicable. The default function always returns EOPNOTSUPP. */
+error_t diskfs_get_source (char *source);
/* The library exports the following functions for general use */
diff --git a/libdiskfs/fsys-get-source.c b/libdiskfs/fsys-get-source.c
new file mode 100644
index 00000000..08f227c9
--- /dev/null
+++ b/libdiskfs/fsys-get-source.c
@@ -0,0 +1,34 @@
+/* fsys_get_source
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+
+ Written by Justus Winter <4winter@informatik.uni-hamburg.de>
+
+ This file is part of the GNU Hurd.
+
+ The GNU Hurd 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.
+
+ The GNU Hurd 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 the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "priv.h"
+#include "fsys_S.h"
+
+/* Return information about the source of the receiving
+ filesystem. */
+error_t
+diskfs_S_fsys_get_source (fsys_t server,
+ mach_port_t reply,
+ mach_msg_type_name_t replyPoly,
+ char *source)
+{
+ return diskfs_get_source (source);
+}
diff --git a/libdiskfs/get-source.c b/libdiskfs/get-source.c
new file mode 100644
index 00000000..d0c143be
--- /dev/null
+++ b/libdiskfs/get-source.c
@@ -0,0 +1,28 @@
+/* Default version of diskfs_get_source
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+
+ Written by Justus Winter <4winter@informatik.uni-hamburg.de>
+
+ This file is part of the GNU Hurd.
+
+ The GNU Hurd 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.
+
+ The GNU Hurd 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 the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "priv.h"
+
+error_t
+diskfs_get_source (char *source)
+{
+ return EOPNOTSUPP;
+}