Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/puffs/rump_smbfs Use new p2k interfaces and make it...



details:   https://anonhg.NetBSD.org/src/rev/123381aefc74
branches:  trunk
changeset: 748265:123381aefc74
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sun Oct 18 19:38:35 2009 +0000

description:
Use new p2k interfaces and make it possible to detach rump_smbfs

diffstat:

 usr.sbin/puffs/rump_smbfs/rump_smbfs.c |  33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diffs (60 lines):

diff -r 8b54a379d645 -r 123381aefc74 usr.sbin/puffs/rump_smbfs/rump_smbfs.c
--- a/usr.sbin/puffs/rump_smbfs/rump_smbfs.c    Sun Oct 18 19:37:25 2009 +0000
+++ b/usr.sbin/puffs/rump_smbfs/rump_smbfs.c    Sun Oct 18 19:38:35 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump_smbfs.c,v 1.2 2009/10/18 15:14:13 pooka Exp $     */
+/*     $NetBSD: rump_smbfs.c,v 1.3 2009/10/18 19:38:35 pooka Exp $     */
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -41,30 +41,39 @@
 
 #include "mount_smbfs.h"
 
+struct p2k_mount *docancel;
+static void
+pcancel(void)
+{
+
+       abort();
+       if (docancel)
+               p2k_cancel(docancel, 0);
+}
+
 int
 main(int argc, char *argv[])
 {
        struct smbfs_args args;
        char canon_dev[MAXPATHLEN], canon_dir[MAXPATHLEN];
+       struct p2k_mount *p2m;
        int rv, mntflags;
 
        setprogname(argv[0]);
 
-       /*
-        * XXX: rump_init() creates threads, we cannot detach after that.
-        * so let's call rump_smbfs work in progress and force debugging
-        * mode ;)  (I should go into marketing)
-        */
-       printf("rump_smbfs is work-in-progress.  forcing debug mode\n");
-       setenv("P2K_DEBUG", "1", 1);
-       rump_init();
+       p2m = p2k_init(PUFFS_KFLAG_WTCACHE);
+       atexit(pcancel);
+       docancel = p2m;
+       /* XXX: this will exit upon error.  therefore kludge with atexit */
        mount_smbfs_parseargs(argc, argv, &args, &mntflags,
            canon_dev, canon_dir);
+       docancel = NULL;
 
-       rv = p2k_run_fs(MOUNT_SMBFS, canon_dev, canon_dir, mntflags, &args,
-           sizeof(args), PUFFS_KFLAG_WTCACHE);
-       if (rv == -1)
+       if (p2k_setup_fs(p2m, MOUNT_SMBFS, canon_dev, canon_dir, mntflags,
+           &args, sizeof(args)) == -1)
                err(1, "mount");
+       if (p2k_mainloop(p2m) == -1)
+               err(1, "fs service");
 
        return 0;
 }



Home | Main Index | Thread Index | Old Index