Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libukfs * allow callers to store a private data pointer ...
details: https://anonhg.NetBSD.org/src/rev/82a8fb569996
branches: trunk
changeset: 747781:82a8fb569996
user: pooka <pooka%NetBSD.org@localhost>
date: Fri Oct 02 09:32:01 2009 +0000
description:
* allow callers to store a private data pointer behind the ukfs handle
* release reference on root vnode before unmounting
(and reaquire the root vnode if unmount fails)
* return correct error value if unmount fails
diffstat:
lib/libukfs/ukfs.c | 30 +++++++++++++++++++++++++-----
lib/libukfs/ukfs.h | 4 +++-
2 files changed, 28 insertions(+), 6 deletions(-)
diffs (86 lines):
diff -r 62ca57eaed40 -r 82a8fb569996 lib/libukfs/ukfs.c
--- a/lib/libukfs/ukfs.c Fri Oct 02 07:43:15 2009 +0000
+++ b/lib/libukfs/ukfs.c Fri Oct 02 09:32:01 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ukfs.c,v 1.36 2009/09/29 11:17:00 pooka Exp $ */
+/* $NetBSD: ukfs.c,v 1.37 2009/10/02 09:32:01 pooka Exp $ */
/*
* Copyright (c) 2007, 2008 Antti Kantee. All Rights Reserved.
@@ -68,6 +68,7 @@
struct ukfs {
struct mount *ukfs_mp;
struct vnode *ukfs_rvp;
+ void *ukfs_specific;
pthread_spinlock_t ukfs_spin;
pid_t ukfs_nextpid;
@@ -98,6 +99,20 @@
return rvp;
}
+void
+ukfs_setspecific(struct ukfs *ukfs, void *priv)
+{
+
+ ukfs->ukfs_specific = priv;
+}
+
+void *
+ukfs_getspecific(struct ukfs *ukfs)
+{
+
+ return ukfs->ukfs_specific;
+}
+
#ifdef DONT_WANT_PTHREAD_LINKAGE
#define pthread_spin_lock(a)
#define pthread_spin_unlock(a)
@@ -302,20 +317,25 @@
{
if ((flags & UKFS_RELFLAG_NOUNMOUNT) == 0) {
- int rv, mntflag;
+ int rv, mntflag, error;
ukfs_chdir(fs, "/");
mntflag = 0;
if (flags & UKFS_RELFLAG_FORCE)
mntflag = MNT_FORCE;
rump_setup_curlwp(nextpid(fs), 1, 1);
+ rump_vp_rele(fs->ukfs_rvp);
+ fs->ukfs_rvp = NULL;
rv = rump_sys_unmount(fs->ukfs_mountpath, mntflag);
- rump_clear_curlwp();
- if (rv) {
+ if (rv == -1) {
+ error = errno;
+ rump_vfs_root(fs->ukfs_mp, &fs->ukfs_rvp, 0);
+ rump_clear_curlwp();
ukfs_chdir(fs, fs->ukfs_mountpath);
- errno = rv;
+ errno = error;
return -1;
}
+ rump_clear_curlwp();
}
if (fs->ukfs_devpath) {
diff -r 62ca57eaed40 -r 82a8fb569996 lib/libukfs/ukfs.h
--- a/lib/libukfs/ukfs.h Fri Oct 02 07:43:15 2009 +0000
+++ b/lib/libukfs/ukfs.h Fri Oct 02 09:32:01 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ukfs.h,v 1.9 2009/07/22 20:46:34 pooka Exp $ */
+/* $NetBSD: ukfs.h,v 1.10 2009/10/02 09:32:01 pooka Exp $ */
/*
* Copyright (c) 2007, 2008 Antti Kantee. All Rights Reserved.
@@ -108,6 +108,8 @@
struct mount *ukfs_getmp(struct ukfs *);
struct vnode *ukfs_getrvp(struct ukfs *);
+void ukfs_setspecific(struct ukfs *, void *);
+void * ukfs_getspecific(struct ukfs *);
/* dynamic loading of library modules */
int ukfs_modload(const char *);
Home |
Main Index |
Thread Index |
Old Index