mode_t to enum vtype conversion
This commit is contained in:
parent
5676e026f8
commit
194d17d824
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: puffs.h,v 1.9 2006/11/18 12:40:35 pooka Exp $ */
|
||||
/* $NetBSD: puffs.h,v 1.10 2006/11/21 23:11:09 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
|
||||
|
@ -207,6 +207,7 @@ int puffs_gendotdent(struct dirent **, ino_t, int, size_t *);
|
|||
int puffs_nextdent(struct dirent **, const char *, ino_t,
|
||||
uint8_t, size_t *);
|
||||
int puffs_vtype2dt(enum vtype);
|
||||
enum vtype puffs_mode2vt(mode_t);
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: subr.c,v 1.8 2006/11/14 11:45:03 pooka Exp $ */
|
||||
/* $NetBSD: subr.c,v 1.9 2006/11/21 23:11:09 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.8 2006/11/14 11:45:03 pooka Exp $");
|
||||
__RCSID("$NetBSD: subr.c,v 1.9 2006/11/21 23:11:09 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -203,3 +203,27 @@ puffs_vtype2dt(enum vtype vt)
|
|||
|
||||
return DT_UNKNOWN;
|
||||
}
|
||||
|
||||
enum vtype
|
||||
puffs_mode2vt(mode_t mode)
|
||||
{
|
||||
|
||||
switch (mode & S_IFMT) {
|
||||
case S_IFIFO:
|
||||
return VFIFO;
|
||||
case S_IFCHR:
|
||||
return VCHR;
|
||||
case S_IFDIR:
|
||||
return VDIR;
|
||||
case S_IFBLK:
|
||||
return VBLK;
|
||||
case S_IFREG:
|
||||
return VREG;
|
||||
case S_IFLNK:
|
||||
return VLNK;
|
||||
case S_IFSOCK:
|
||||
return VSOCK;
|
||||
default:
|
||||
return VBAD; /* XXX: not really true, but ... */
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue