va->va_mode doesn't contain the full argument to the mknod() system call,

so introduce puffs_addvtype2mode() and use that in null.c to generate the
proper syscall argument
This commit is contained in:
pooka 2007-03-16 08:14:49 +00:00
parent 108c9e1aa3
commit 2df275c4cd
3 changed files with 27 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: null.c,v 1.10 2007/03/16 07:43:14 pooka Exp $ */
/* $NetBSD: null.c,v 1.11 2007/03/16 08:14:49 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -30,7 +30,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
__RCSID("$NetBSD: null.c,v 1.10 2007/03/16 07:43:14 pooka Exp $");
__RCSID("$NetBSD: null.c,v 1.11 2007/03/16 08:14:49 pooka Exp $");
#endif /* !lint */
/*
@ -224,9 +224,11 @@ puffs_null_node_mknod(struct puffs_cc *pcc, void *opc, void **newnode,
{
struct puffs_usermount *pu = puffs_cc_getusermount(pcc);
struct puffs_node *pn;
mode_t mode;
int rv;
if (mknod(PCNPATH(pcn), va->va_mode, va->va_rdev) == -1)
mode = puffs_addvtype2mode(va->va_mode, va->va_type);
if (mknod(PCNPATH(pcn), mode, va->va_rdev) == -1)
return errno;
if ((rv = processvattr(PCNPATH(pcn), va, 0)) != 0) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: puffs.h,v 1.31 2007/02/15 17:04:46 pooka Exp $ */
/* $NetBSD: puffs.h,v 1.32 2007/03/16 08:14:49 pooka Exp $ */
/*
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
@ -434,6 +434,7 @@ int puffs_nextdent(struct dirent **, const char *, ino_t,
int puffs_vtype2dt(enum vtype);
enum vtype puffs_mode2vt(mode_t);
void puffs_stat2vattr(struct vattr *va, const struct stat *);
mode_t puffs_addvtype2mode(mode_t, enum vtype);
/*
* Requests

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr.c,v 1.14 2007/02/15 12:51:24 pooka Exp $ */
/* $NetBSD: subr.c,v 1.15 2007/03/16 08:14:49 pooka Exp $ */
/*
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
@ -30,7 +30,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
__RCSID("$NetBSD: subr.c,v 1.14 2007/02/15 12:51:24 pooka Exp $");
__RCSID("$NetBSD: subr.c,v 1.15 2007/03/16 08:14:49 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@ -277,3 +277,21 @@ puffs_stat2vattr(struct vattr *va, const struct stat *sb)
va->va_filerev = 0;
va->va_vaflags = 0;
}
mode_t
puffs_addvtype2mode(mode_t mode, enum vtype type)
{
switch (type) {
case VCHR:
mode |= S_IFCHR;
break;
case VBLK:
mode |= S_IFBLK;
break;
default:
break;
}
return mode;
}