Adapt ukfs users to the new ukfs_part interface.

This commit is contained in:
pooka 2009-12-03 14:27:16 +00:00
parent 3b493fbd05
commit a1c4673949
12 changed files with 72 additions and 64 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: p2k.c,v 1.29 2009/11/20 14:24:58 pooka Exp $ */
/* $NetBSD: p2k.c,v 1.30 2009/12/03 14:27:16 pooka Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Antti Kantee. All Rights Reserved.
@ -364,10 +364,11 @@ p2k_cancel(struct p2k_mount *p2m, int error)
static int
setupfs(struct p2k_mount *p2m, const char *vfsname, const char *devpath,
int partition, const char *mountpath, int mntflags,
struct ukfs_part *part, const char *mountpath, int mntflags,
void *arg, size_t alen)
{
char partpath[UKFS_PARTITION_MAXPATHLEN];
char partpath[UKFS_DEVICE_MAXPATHLEN];
char partbuf[UKFS_DEVICE_MAXSTR];
char typebuf[PUFFS_TYPELEN];
struct puffs_usermount *pu = p2m->p2m_pu;
struct p2k_node *p2n_root;
@ -383,22 +384,16 @@ setupfs(struct p2k_mount *p2m, const char *vfsname, const char *devpath,
strlcat(typebuf, vfsname, sizeof(typebuf));
}
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');
strlcpy(partpath, devpath, sizeof(partpath));
if (ukfs_part_tostring(part, partbuf, sizeof(partbuf))) {
strlcat(partpath, partbuf, sizeof(partpath));
} else {
strlcpy(partpath, devpath, sizeof(partpath));
}
puffs_setmntinfo(pu, partpath, typebuf);
if (ukfs_init() == -1)
goto out;
if (partition != UKFS_PARTITION_NA)
ukfs = ukfs_mount_disk(vfsname, devpath, partition,
if (part != ukfs_part_na)
ukfs = ukfs_mount_disk(vfsname, devpath, part,
mountpath, mntflags, arg, alen);
else
ukfs = ukfs_mount(vfsname, devpath, mountpath, mntflags,
@ -460,7 +455,7 @@ p2k_run_fs(const char *vfsname, const char *devpath, const char *mountpath,
p2m = p2k_init(puffs_flags);
if (p2m == NULL)
return -1;
rv = setupfs(p2m, vfsname, devpath, UKFS_PARTITION_NA, mountpath,
rv = setupfs(p2m, vfsname, devpath, ukfs_part_na, mountpath,
mntflags, arg, alen);
if (rv == -1)
return rv;
@ -468,7 +463,7 @@ p2k_run_fs(const char *vfsname, const char *devpath, const char *mountpath,
}
int
p2k_run_diskfs(const char *vfsname, const char *devpath, int partition,
p2k_run_diskfs(const char *vfsname, const char *devpath, struct ukfs_part *part,
const char *mountpath, int mntflags, void *arg, size_t alen,
uint32_t puffs_flags)
{
@ -478,7 +473,7 @@ p2k_run_diskfs(const char *vfsname, const char *devpath, int partition,
p2m = p2k_init(puffs_flags);
if (p2m == NULL)
return -1;
rv = setupfs(p2m, vfsname, devpath, partition, mountpath, mntflags,
rv = setupfs(p2m, vfsname, devpath, part, mountpath, mntflags,
arg, alen);
if (rv == -1)
return rv;
@ -490,17 +485,17 @@ p2k_setup_fs(struct p2k_mount *p2m, const char *vfsname, const char *devpath,
const char *mountpath, int mntflags, void *arg, size_t alen)
{
return setupfs(p2m, vfsname, devpath, UKFS_PARTITION_NA, mountpath,
return setupfs(p2m, vfsname, devpath, ukfs_part_na, mountpath,
mntflags, arg, alen);
}
int
p2k_setup_diskfs(struct p2k_mount *p2m, const char *vfsname,
const char *devpath, int partition, const char *mountpath,
const char *devpath, struct ukfs_part *part, const char *mountpath,
int mntflags, void *arg, size_t alen)
{
return setupfs(p2m, vfsname, devpath, partition, mountpath, mntflags,
return setupfs(p2m, vfsname, devpath, part, mountpath, mntflags,
arg, alen);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: p2k.h,v 1.6 2009/11/21 12:16:19 pooka Exp $ */
/* $NetBSD: p2k.h,v 1.7 2009/12/03 14:27:16 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -32,14 +32,16 @@
#include <sys/types.h>
#include <rump/ukfs.h>
struct p2k_mount;
__BEGIN_DECLS
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);
int p2k_run_diskfs(const char *, const char *, struct ukfs_part *,
const char *, int, void *, size_t, uint32_t);
struct p2k_mount *p2k_init(uint32_t);
void p2k_cancel(struct p2k_mount *, int);
@ -47,7 +49,8 @@ void p2k_cancel(struct p2k_mount *, int);
int p2k_setup_fs(struct p2k_mount *, const char *,
const char *, const char *, int, void *, size_t);
int p2k_setup_diskfs(struct p2k_mount *, const char *, const char *,
int, const char *, int, void *, size_t);
struct ukfs_part *, const char *, int,
void *, size_t);
int p2k_mainloop(struct p2k_mount *);
__END_DECLS

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_cd9660.c,v 1.5 2009/10/07 20:59:09 pooka Exp $ */
/* $NetBSD: rump_cd9660.c,v 1.6 2009/12/03 14:27:16 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -43,13 +43,14 @@ int
main(int argc, char *argv[])
{
struct iso_args args;
char canon_dev[UKFS_PARTITION_MAXPATHLEN], canon_dir[MAXPATHLEN];
int mntflags, part;
char canon_dev[UKFS_DEVICE_MAXPATHLEN], canon_dir[MAXPATHLEN];
struct ukfs_part *part;
int mntflags;
int rv;
setprogname(argv[0]);
UKFS_PARTITION_ARGVPROBE(part);
UKFS_DEVICE_ARGVPROBE(&part);
mount_cd9660_parseargs(argc, argv, &args, &mntflags,
canon_dev, canon_dir);
rv = p2k_run_diskfs(MOUNT_CD9660, canon_dev, part, canon_dir, mntflags,

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_efs.c,v 1.4 2009/10/07 20:59:09 pooka Exp $ */
/* $NetBSD: rump_efs.c,v 1.5 2009/12/03 14:27:16 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -44,13 +44,14 @@ int
main(int argc, char *argv[])
{
struct efs_args args;
char canon_dev[UKFS_PARTITION_MAXPATHLEN], canon_dir[MAXPATHLEN];
int mntflags, part;
char canon_dev[UKFS_DEVICE_MAXPATHLEN], canon_dir[MAXPATHLEN];
struct ukfs_part *part;
int mntflags;
int rv;
setprogname(argv[0]);
UKFS_PARTITION_ARGVPROBE(part);
UKFS_DEVICE_ARGVPROBE(&part);
mount_efs_parseargs(argc, argv, &args, &mntflags, canon_dev, canon_dir);
rv = p2k_run_diskfs(MOUNT_EFS, canon_dev, part, canon_dir, mntflags,
&args, sizeof(args), 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_ext2fs.c,v 1.6 2009/10/07 20:59:09 pooka Exp $ */
/* $NetBSD: rump_ext2fs.c,v 1.7 2009/12/03 14:27:16 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -44,13 +44,14 @@ int
main(int argc, char *argv[])
{
struct ufs_args args;
char canon_dev[UKFS_PARTITION_MAXPATHLEN], canon_dir[MAXPATHLEN];
int mntflags, part;
char canon_dev[UKFS_DEVICE_MAXPATHLEN], canon_dir[MAXPATHLEN];
struct ukfs_part *part;
int mntflags;
int rv;
setprogname(argv[0]);
UKFS_PARTITION_ARGVPROBE(part);
UKFS_DEVICE_ARGVPROBE(&part);
mount_ext2fs_parseargs(argc, argv, &args, &mntflags,
canon_dev, canon_dir);
rv = p2k_run_diskfs(MOUNT_EXT2FS, canon_dev, part, canon_dir, mntflags,

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_ffs.c,v 1.4 2009/10/07 20:59:09 pooka Exp $ */
/* $NetBSD: rump_ffs.c,v 1.5 2009/12/03 14:27:16 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -44,13 +44,14 @@ int
main(int argc, char *argv[])
{
struct ufs_args args;
char canon_dev[UKFS_PARTITION_MAXPATHLEN], canon_dir[MAXPATHLEN];
int mntflags, part;
char canon_dev[UKFS_DEVICE_MAXPATHLEN], canon_dir[MAXPATHLEN];
struct ukfs_part *part;
int mntflags;
int rv;
setprogname(argv[0]);
UKFS_PARTITION_ARGVPROBE(part);
UKFS_DEVICE_ARGVPROBE(&part);
mount_ffs_parseargs(argc, argv, &args, &mntflags, canon_dev, canon_dir);
rv = p2k_run_diskfs(MOUNT_FFS, canon_dev, part, canon_dir,
mntflags, &args, sizeof(args), 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_hfs.c,v 1.4 2009/10/07 20:59:09 pooka Exp $ */
/* $NetBSD: rump_hfs.c,v 1.5 2009/12/03 14:27:16 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -44,13 +44,14 @@ int
main(int argc, char *argv[])
{
struct hfs_args args;
char canon_dev[UKFS_PARTITION_MAXPATHLEN], canon_dir[MAXPATHLEN];
int mntflags, part;
char canon_dev[UKFS_DEVICE_MAXPATHLEN], canon_dir[MAXPATHLEN];
struct ukfs_part *part;
int mntflags;
int rv;
setprogname(argv[0]);
UKFS_PARTITION_ARGVPROBE(part);
UKFS_DEVICE_ARGVPROBE(&part);
mount_hfs_parseargs(argc, argv, &args, &mntflags, canon_dev, canon_dir);
rv = p2k_run_diskfs(MOUNT_HFS, canon_dev, part, canon_dir, mntflags,
&args, sizeof(args), 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_lfs.c,v 1.12 2009/11/05 14:17:07 pooka Exp $ */
/* $NetBSD: rump_lfs.c,v 1.13 2009/12/03 14:27:16 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -60,17 +60,18 @@ int
main(int argc, char *argv[])
{
struct ufs_args args;
char canon_dev[UKFS_PARTITION_MAXPATHLEN], canon_dir[MAXPATHLEN];
char canon_dev[UKFS_DEVICE_MAXPATHLEN], canon_dir[MAXPATHLEN];
char rawdev[MAXPATHLEN];
struct p2k_mount *p2m;
pthread_t cleanerthread;
int mntflags, part;
struct ukfs_part *part;
int mntflags;
int rv;
setprogname(argv[0]);
UKFS_PARTITION_ARGVPROBE(part);
if (part != UKFS_PARTITION_NONE) {
UKFS_DEVICE_ARGVPROBE(&part);
if (part != ukfs_part_none) {
errx(1, "lfs does not currently support embedded partitions");
}
mount_lfs_parseargs(argc, argv, &args, &mntflags, canon_dev, canon_dir);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_msdos.c,v 1.5 2009/10/07 20:59:09 pooka Exp $ */
/* $NetBSD: rump_msdos.c,v 1.6 2009/12/03 14:27:16 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -44,13 +44,14 @@ int
main(int argc, char *argv[])
{
struct msdosfs_args args;
char canon_dev[UKFS_PARTITION_MAXPATHLEN], canon_dir[MAXPATHLEN];
int mntflags, part;
char canon_dev[UKFS_DEVICE_MAXPATHLEN], canon_dir[MAXPATHLEN];
struct ukfs_part *part;
int mntflags;
int rv;
setprogname(argv[0]);
UKFS_PARTITION_ARGVPROBE(part);
UKFS_DEVICE_ARGVPROBE(&part);
mount_msdos_parseargs(argc, argv, &args, &mntflags,
canon_dev, canon_dir);
rv = p2k_run_diskfs(MOUNT_MSDOS, canon_dev, part, canon_dir, mntflags,

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_ntfs.c,v 1.4 2009/10/07 20:59:09 pooka Exp $ */
/* $NetBSD: rump_ntfs.c,v 1.5 2009/12/03 14:27:16 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -44,13 +44,14 @@ int
main(int argc, char *argv[])
{
struct ntfs_args args;
char canon_dev[UKFS_PARTITION_MAXPATHLEN], canon_dir[MAXPATHLEN];
int mntflags, part;
char canon_dev[UKFS_DEVICE_MAXPATHLEN], canon_dir[MAXPATHLEN];
struct ukfs_part *part;
int mntflags;
int rv;
setprogname(argv[0]);
UKFS_PARTITION_ARGVPROBE(part);
UKFS_DEVICE_ARGVPROBE(&part);
mount_ntfs_parseargs(argc, argv, &args, &mntflags,
canon_dev, canon_dir);
rv = p2k_run_diskfs(MOUNT_NTFS, canon_dev, part, canon_dir, mntflags,

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_sysvbfs.c,v 1.2 2009/10/07 20:59:09 pooka Exp $ */
/* $NetBSD: rump_sysvbfs.c,v 1.3 2009/12/03 14:27:17 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -41,13 +41,14 @@ int
main(int argc, char *argv[])
{
struct sysvbfs_args args;
char canon_dev[UKFS_PARTITION_MAXPATHLEN], canon_dir[MAXPATHLEN];
int mntflags, part;
char canon_dev[UKFS_DEVICE_MAXPATHLEN], canon_dir[MAXPATHLEN];
struct ukfs_part *part;
int mntflags;
int rv;
setprogname(argv[0]);
UKFS_PARTITION_ARGVPROBE(part);
UKFS_DEVICE_ARGVPROBE(&part);
mount_sysvbfs_parseargs(argc, argv, &args, &mntflags,
canon_dev, canon_dir);
rv = p2k_run_diskfs(MOUNT_SYSVBFS, canon_dev, part, canon_dir, mntflags,

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_udf.c,v 1.4 2009/10/07 20:59:10 pooka Exp $ */
/* $NetBSD: rump_udf.c,v 1.5 2009/12/03 14:27:17 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -44,13 +44,14 @@ int
main(int argc, char *argv[])
{
struct udf_args args;
char canon_dev[UKFS_PARTITION_MAXPATHLEN], canon_dir[MAXPATHLEN];
int mntflags, part;
char canon_dev[UKFS_DEVICE_MAXPATHLEN], canon_dir[MAXPATHLEN];
struct ukfs_part *part;
int mntflags;
int rv;
setprogname(argv[0]);
UKFS_PARTITION_ARGVPROBE(part);
UKFS_DEVICE_ARGVPROBE(&part);
mount_udf_parseargs(argc, argv, &args, &mntflags, canon_dev, canon_dir);
rv = p2k_run_diskfs(MOUNT_UDF, canon_dev, part, canon_dir, mntflags,
&args, sizeof(args), 0);