Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libp2k Provide p2k_run_diskfs(), which acts like p2k_run...
details: https://anonhg.NetBSD.org/src/rev/1a022dccf2b0
branches: trunk
changeset: 747982:1a022dccf2b0
user: pooka <pooka%NetBSD.org@localhost>
date: Wed Oct 07 20:55:25 2009 +0000
description:
Provide p2k_run_diskfs(), which acts like p2k_run_fs(), but taps
into ukfs_mount_disk() instead of ukfs_mount()
diffstat:
lib/libp2k/p2k.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++--------
lib/libp2k/p2k.h | 4 +++-
2 files changed, 49 insertions(+), 9 deletions(-)
diffs (111 lines):
diff -r 8ca6b20b2ba5 -r 1a022dccf2b0 lib/libp2k/p2k.c
--- a/lib/libp2k/p2k.c Wed Oct 07 20:53:38 2009 +0000
+++ b/lib/libp2k/p2k.c Wed Oct 07 20:55:25 2009 +0000
@@ -1,9 +1,10 @@
-/* $NetBSD: p2k.c,v 1.18 2009/10/06 16:57:54 pooka Exp $ */
+/* $NetBSD: p2k.c,v 1.19 2009/10/07 20:55:25 pooka Exp $ */
/*
- * Copyright (c) 2007 Antti Kantee. All Rights Reserved.
+ * Copyright (c) 2007, 2008, 2009 Antti Kantee. All Rights Reserved.
*
- * Development of this software was supported by Google Summer of Code.
+ * Development of this software was supported by the
+ * Finnish Cultural Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -245,10 +246,12 @@
ukfs_setspecific(ukfs, p2m);
}
-int
-p2k_run_fs(const char *vfsname, const char *devpath, const char *mountpath,
- int mntflags, void *arg, size_t alen, uint32_t puffs_flags)
+static int
+runfs(const char *vfsname, const char *devpath, int partition,
+ const char *mountpath, int mntflags, void *arg, size_t alen,
+ uint32_t puffs_flags)
{
+ char partpath[UKFS_PARTITION_MAXPATHLEN];
char typebuf[PUFFS_TYPELEN];
struct puffs_ops *pops;
struct puffs_usermount *pu = NULL;
@@ -322,7 +325,17 @@
strlcat(typebuf, vfsname, sizeof(typebuf));
}
- pu = puffs_init(pops, devpath, typebuf, NULL, puffs_flags);
+ if (UKFS_USEPARTITION(partition)) {
+ char partbuf[UKFS_PARTITION_MAGICLEN+1];
+
+ strlcpy(partpath, devpath, sizeof(partpath));
+ snprintf(partbuf, sizeof(partbuf), "%s%c%%",
+ UKFS_PARTITION_SCANMAGIC, partition + 'a');
+ strlcat(partpath, partbuf, sizeof(partpath));
+ } else {
+ strlcpy(partpath, devpath, sizeof(partpath));
+ }
+ pu = puffs_init(pops, partpath, typebuf, NULL, puffs_flags);
if (pu == NULL)
goto out;
@@ -331,7 +344,12 @@
if (ukfs_init() == -1)
return -1;
- ukfs = ukfs_mount(vfsname, devpath, mountpath, mntflags, arg, alen);
+ if (partition != UKFS_PARTITION_NA)
+ ukfs = ukfs_mount_disk(vfsname, devpath, partition,
+ mountpath, mntflags, arg, alen);
+ else
+ ukfs = ukfs_mount(vfsname, devpath, mountpath, mntflags,
+ arg, alen);
if (ukfs == NULL)
goto out;
allocp2m(ukfs);
@@ -370,6 +388,26 @@
return rv;
}
+
+int
+p2k_run_fs(const char *vfsname, const char *devpath, const char *mountpath,
+ int mntflags, void *arg, size_t alen, uint32_t puffs_flags)
+{
+
+ return runfs(vfsname, devpath, UKFS_PARTITION_NA, mountpath,
+ mntflags, arg, alen, puffs_flags);
+}
+
+int
+p2k_run_diskfs(const char *vfsname, const char *devpath, int partition,
+ const char *mountpath, int mntflags, void *arg, size_t alen,
+ uint32_t puffs_flags)
+{
+
+ return runfs(vfsname, devpath, partition, mountpath, mntflags,
+ arg, alen, puffs_flags);
+}
+
int
p2k_fs_statvfs(struct puffs_usermount *pu, struct statvfs *sbp)
{
diff -r 8ca6b20b2ba5 -r 1a022dccf2b0 lib/libp2k/p2k.h
--- a/lib/libp2k/p2k.h Wed Oct 07 20:53:38 2009 +0000
+++ b/lib/libp2k/p2k.h Wed Oct 07 20:55:25 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: p2k.h,v 1.2 2008/08/01 14:50:29 pooka Exp $ */
+/* $NetBSD: p2k.h,v 1.3 2009/10/07 20:55:25 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -36,6 +36,8 @@
int p2k_run_fs(const char *, const char *, const char *, int,
void *, size_t, uint32_t);
+int p2k_run_diskfs(const char *, const char *, int, const char *, int,
+ void *, size_t, uint32_t);
__END_DECLS
Home |
Main Index |
Thread Index |
Old Index