Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Mar 2009 18:18:38 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r189971 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb fs/udf
Message-ID:  <200903181818.n2IIIcnF033542@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <vm/uma.h>
 
+#include <fs/fifofs/fifo.h>
 #include <fs/udf/ecma167-udf.h>
 #include <fs/udf/osta.h>
 #include <fs/udf/udf.h>
@@ -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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903181818.n2IIIcnF033542>