support pathconf (more or less copypasted from ufs). for njoly's tests.

This commit is contained in:
pooka 2010-07-21 06:58:25 +00:00
parent 857eb74b8b
commit 3ccd6a8fda
2 changed files with 44 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dtfs.c,v 1.1 2010/07/06 14:16:44 pooka Exp $ */
/* $NetBSD: dtfs.c,v 1.2 2010/07/21 06:58:25 pooka Exp $ */
/*
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
@ -206,6 +206,7 @@ main(int argc, char *argv[])
PUFFSOP_SET(pops, dtfs, node, readlink);
PUFFSOP_SET(pops, dtfs, node, mknod);
PUFFSOP_SET(pops, dtfs, node, inactive);
PUFFSOP_SET(pops, dtfs, node, pathconf);
PUFFSOP_SET(pops, dtfs, node, reclaim);
srandom(time(NULL)); /* for random generation numbers */

View File

@ -1,4 +1,4 @@
/* $NetBSD: dtfs_vnops.c,v 1.6 2010/07/14 21:24:40 pooka Exp $ */
/* $NetBSD: dtfs_vnops.c,v 1.7 2010/07/21 06:58:25 pooka Exp $ */
/*
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
@ -514,6 +514,47 @@ dtfs_node_write(struct puffs_usermount *pu, void *opc, uint8_t *buf,
return 0;
}
int
dtfs_node_pathconf(struct puffs_usermount *pu, puffs_cookie_t opc,
int name, register_t *retval)
{
switch (name) {
case _PC_LINK_MAX:
*retval = LINK_MAX;
return 0;
case _PC_NAME_MAX:
*retval = NAME_MAX;
return 0;
case _PC_PATH_MAX:
*retval = PATH_MAX;
return 0;
case _PC_PIPE_BUF:
*retval = PIPE_BUF;
return 0;
case _PC_CHOWN_RESTRICTED:
*retval = 1;
return 0;
case _PC_NO_TRUNC:
*retval = 1;
return 0;
case _PC_SYNC_IO:
*retval = 1;
return 0;
case _PC_FILESIZEBITS:
*retval = 43; /* this one goes to 11 */
return 0;
case _PC_SYMLINK_MAX:
*retval = MAXPATHLEN;
return 0;
case _PC_2_SYMLINKS:
*retval = 1;
return 0;
default:
return EINVAL;
}
}
int
dtfs_node_inactive(struct puffs_usermount *pu, puffs_cookie_t opc)
{