From owner-svn-src-all@FreeBSD.ORG Wed Mar 18 18:18:39 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E78D106579D; Wed, 18 Mar 2009 18:18:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0AAB18FC13; Wed, 18 Mar 2009 18:18:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2IIIcri033545; Wed, 18 Mar 2009 18:18:38 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2IIIcnF033542; Wed, 18 Mar 2009 18:18:38 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903181818.n2IIIcnF033542@svn.freebsd.org> From: John Baldwin Date: Wed, 18 Mar 2009 18:18:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189971 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb fs/udf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Mar 2009 18:18:40 -0000 Author: jhb Date: Wed Mar 18 18:18:38 2009 New Revision: 189971 URL: http://svn.freebsd.org/changeset/base/189971 Log: MFC: Add support for fifos to UDF. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/fs/udf/udf.h stable/7/sys/fs/udf/udf_vfsops.c stable/7/sys/fs/udf/udf_vnops.c Modified: stable/7/sys/fs/udf/udf.h ============================================================================== --- stable/7/sys/fs/udf/udf.h Wed Mar 18 18:08:31 2009 (r189970) +++ stable/7/sys/fs/udf/udf.h Wed Mar 18 18:18:38 2009 (r189971) @@ -137,3 +137,5 @@ int udf_vget(struct mount *, ino_t, int, extern uma_zone_t udf_zone_trans; extern uma_zone_t udf_zone_node; extern uma_zone_t udf_zone_ds; + +extern struct vop_vector udf_fifoops; Modified: stable/7/sys/fs/udf/udf_vfsops.c ============================================================================== --- stable/7/sys/fs/udf/udf_vfsops.c Wed Mar 18 18:08:31 2009 (r189970) +++ stable/7/sys/fs/udf/udf_vfsops.c Wed Mar 18 18:18:38 2009 (r189971) @@ -681,6 +681,7 @@ udf_vget(struct mount *mp, ino_t ino, in break; case 9: vp->v_type = VFIFO; + vp->v_op = &udf_fifoops; break; case 10: vp->v_type = VSOCK; Modified: stable/7/sys/fs/udf/udf_vnops.c ============================================================================== --- stable/7/sys/fs/udf/udf_vnops.c Wed Mar 18 18:08:31 2009 (r189970) +++ stable/7/sys/fs/udf/udf_vnops.c Wed Mar 18 18:18:38 2009 (r189971) @@ -48,6 +48,7 @@ #include +#include #include #include #include @@ -60,9 +61,11 @@ static vop_getattr_t udf_getattr; static vop_open_t udf_open; static vop_ioctl_t udf_ioctl; static vop_pathconf_t udf_pathconf; +static vop_print_t udf_print; static vop_read_t udf_read; static vop_readdir_t udf_readdir; static vop_readlink_t udf_readlink; +static vop_setattr_t udf_setattr; static vop_strategy_t udf_strategy; static vop_bmap_t udf_bmap; static vop_cachedlookup_t udf_lookup; @@ -84,14 +87,26 @@ static struct vop_vector udf_vnodeops = .vop_lookup = vfs_cache_lookup, .vop_open = udf_open, .vop_pathconf = udf_pathconf, + .vop_print = udf_print, .vop_read = udf_read, .vop_readdir = udf_readdir, .vop_readlink = udf_readlink, .vop_reclaim = udf_reclaim, + .vop_setattr = udf_setattr, .vop_strategy = udf_strategy, .vop_vptofh = udf_vptofh, }; +struct vop_vector udf_fifoops = { + .vop_default = &fifo_specops, + .vop_access = udf_access, + .vop_getattr = udf_getattr, + .vop_print = udf_print, + .vop_reclaim = udf_reclaim, + .vop_setattr = udf_setattr, + .vop_vptofh = udf_vptofh, +}; + MALLOC_DEFINE(M_UDFFID, "udf_fid", "UDF FileId structure"); MALLOC_DEFINE(M_UDFDS, "udf_ds", "UDF Dirstream structure"); @@ -305,6 +320,38 @@ udf_getattr(struct vop_getattr_args *a) return (0); } +static int +udf_setattr(struct vop_setattr_args *a) +{ + struct vnode *vp; + struct vattr *vap; + + vp = a->a_vp; + vap = a->a_vap; + if (vap->va_flags != (u_long)VNOVAL || vap->va_uid != (uid_t)VNOVAL || + vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL || + vap->va_mtime.tv_sec != VNOVAL || vap->va_mode != (mode_t)VNOVAL) + return (EROFS); + if (vap->va_size != (u_quad_t)VNOVAL) { + switch (vp->v_type) { + case VDIR: + return (EISDIR); + case VLNK: + case VREG: + return (EROFS); + case VCHR: + case VBLK: + case VSOCK: + case VFIFO: + case VNON: + case VBAD: + case VMARKER: + return (0); + } + } + return (0); +} + /* * File specific ioctls. */ @@ -341,6 +388,20 @@ udf_pathconf(struct vop_pathconf_args *a } } +static int +udf_print(struct vop_print_args *ap) +{ + struct vnode *vp = ap->a_vp; + struct udf_node *node = VTON(vp); + + printf(" ino %lu, on dev %s", (u_long)node->hash_id, + devtoname(node->udfmp->im_dev)); + if (vp->v_type == VFIFO) + fifo_printinfo(vp); + printf("\n"); + return (0); +} + #define lblkno(udfmp, loc) ((loc) >> (udfmp)->bshift) #define blkoff(udfmp, loc) ((loc) & (udfmp)->bmask) #define lblktosize(imp, blk) ((blk) << (udfmp)->bshift)