bug-hurd
[Top][All Lists]
Advanced

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

[PATCH 11/16] libdiskfs: add fsys_get_source


From: Justus Winter
Subject: [PATCH 11/16] libdiskfs: add fsys_get_source
Date: Tue, 30 Jul 2013 11:59:19 +0200

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.
---
 libdiskfs/Makefile          |    4 ++--
 libdiskfs/diskfs.h          |    8 +++++++-
 libdiskfs/fsys-get-source.c |   34 ++++++++++++++++++++++++++++++++++
 libdiskfs/get-source.c      |   28 ++++++++++++++++++++++++++++
 4 files changed, 71 insertions(+), 3 deletions(-)
 create mode 100644 libdiskfs/fsys-get-source.c
 create mode 100644 libdiskfs/get-source.c

diff --git a/libdiskfs/Makefile b/libdiskfs/Makefile
index 1a0edd0..03c2e2b 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 2489517..22262aa 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 0000000..08f227c
--- /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 <address@hidden>
+
+   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 0000000..d0c143b
--- /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 <address@hidden>
+
+   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;
+}
-- 
1.7.10.4




reply via email to

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