From 988d22662a040dd43ee4c80f7b1c756791796ac0 Mon Sep 17 00:00:00 2001 From: mycroft Date: Tue, 19 Jul 1994 23:33:59 +0000 Subject: [PATCH] Implement pathconf(2). --- sys/isofs/cd9660/cd9660_node.h | 3 +- sys/isofs/cd9660/cd9660_vnops.c | 75 +++++++++++++++++++++++++-------- 2 files changed, 59 insertions(+), 19 deletions(-) diff --git a/sys/isofs/cd9660/cd9660_node.h b/sys/isofs/cd9660/cd9660_node.h index 6649b18a93a1..f72a6361e785 100644 --- a/sys/isofs/cd9660/cd9660_node.h +++ b/sys/isofs/cd9660/cd9660_node.h @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660_node.h,v 1.5 1994/07/19 14:14:13 mycroft Exp $ */ +/* $NetBSD: cd9660_node.h,v 1.6 1994/07/19 23:33:59 mycroft Exp $ */ /*- * Copyright (c) 1994 @@ -129,6 +129,7 @@ int cd9660_unlock __P((struct vop_unlock_args *)); int cd9660_strategy __P((struct vop_strategy_args *)); int cd9660_print __P((struct vop_print_args *)); int cd9660_islocked __P((struct vop_islocked_args *)); +int cd9660_pathconf __P((struct vop_pathconf_args *)); int cd9660_blkatoff __P((struct vop_blkatoff_args *)); void cd9660_defattr __P((struct iso_directory_record *, struct iso_node *, struct buf *)); diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c index 85d228223c60..98ea80136dae 100644 --- a/sys/isofs/cd9660/cd9660_vnops.c +++ b/sys/isofs/cd9660/cd9660_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660_vnops.c,v 1.11 1994/07/19 15:14:09 mycroft Exp $ */ +/* $NetBSD: cd9660_vnops.c,v 1.12 1994/07/19 23:34:01 mycroft Exp $ */ /*- * Copyright (c) 1994 @@ -857,21 +857,6 @@ cd9660_unlock(ap) return (0); } -/* - * Check for a locked inode. - */ -int -cd9660_islocked(ap) - struct vop_islocked_args /* { - struct vnode *a_vp; - } */ *ap; -{ - - if (VTOI(ap->a_vp)->i_flag & IN_LOCKED) - return (1); - return (0); -} - /* * Calculate the logical to physical mapping if not done already, * then call the device strategy routine. @@ -920,10 +905,66 @@ cd9660_print(ap) struct vnode *a_vp; } */ *ap; { + printf("tag VT_ISOFS, isofs vnode\n"); return (0); } +/* + * Check for a locked inode. + */ +int +cd9660_islocked(ap) + struct vop_islocked_args /* { + struct vnode *a_vp; + } */ *ap; +{ + + if (VTOI(ap->a_vp)->i_flag & IN_LOCKED) + return (1); + return (0); +} + +/* + * Return POSIX pathconf information applicable to cd9660 filesystems. + */ +int +cd9660_pathconf(ap) + struct vop_pathconf_args /* { + struct vnode *a_vp; + int a_name; + int *a_retval; + } */ *ap; +{ + + switch (ap->a_name) { + case _PC_LINK_MAX: + *ap->a_retval = 1; + return (0); + case _PC_NAME_MAX: + if (VTOI(ap->a_vp)->i_mnt->iso_ftype == ISO_FTYPE_RRIP) + *ap->a_retval = NAME_MAX; + else + *ap->a_retval = 23; /* XXX 8.8;5 */ + return (0); + case _PC_PATH_MAX: + *ap->a_retval = PATH_MAX; + return (0); + case _PC_PIPE_BUF: + *ap->a_retval = PIPE_BUF; + return (0); + case _PC_CHOWN_RESTRICTED: + *ap->a_retval = 1; + return (0); + case _PC_NO_TRUNC: + *ap->a_retval = 1; + return (0); + default: + return (EINVAL); + } + /* NOTREACHED */ +} + /* * Unsupported operation */ @@ -953,8 +994,6 @@ cd9660_enotsupp() #define cd9660_rmdir ((int (*) __P((struct vop_rmdir_args *)))cd9660_enotsupp) #define cd9660_symlink \ ((int (*) __P((struct vop_symlink_args *)))cd9660_enotsupp) -#define cd9660_pathconf \ - ((int (*) __P((struct vop_pathconf_args *)))cd9660_enotsupp) #define cd9660_advlock \ ((int (*) __P((struct vop_advlock_args *)))cd9660_enotsupp) #define cd9660_valloc ((int(*) __P(( \