changeset 4340:3c0d0e161a41

6276786 VOP_GETATTR on ctfs status files should return permissions 0444
author acruz
date Tue, 29 May 2007 10:57:45 -0700
parents 24b45a78e29e
children 68ad29579bb7
files usr/src/uts/common/fs/ctfs/ctfs_ctl.c
diffstat 1 files changed, 29 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/fs/ctfs/ctfs_ctl.c	Tue May 29 09:36:44 2007 -0700
+++ b/usr/src/uts/common/fs/ctfs/ctfs_ctl.c	Tue May 29 10:57:45 2007 -0700
@@ -117,16 +117,16 @@
 }
 
 /*
- * ctfs_ctl_getattr - VOP_GETATTR entry point
+ * ctfs_ctl_common_getattr
+ * Implements fucntionality common to ctl and status ctfs VOP_GETATTR
+ * entry points. It assumes vp->v_data is set
  */
-/* ARGSUSED */
 static int
-ctfs_ctl_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr)
+ctfs_ctl_common_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr)
 {
 	ctfs_ctlnode_t *ctlnode = vp->v_data;
 
 	vap->va_type = VREG;
-	vap->va_mode = 0222;
 	vap->va_nlink = 1;
 	vap->va_size = 0;
 	vap->va_ctime = ctlnode->ctfs_ctl_contract->ct_ctime;
@@ -140,6 +140,30 @@
 }
 
 /*
+ * ctfs_ctl_getattr - VOP_GETATTR entry point
+ */
+/* ARGSUSED */
+static int
+ctfs_ctl_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr)
+{
+	vap->va_mode = 0222;
+
+	return (ctfs_ctl_common_getattr(vp, vap, flags, cr));
+}
+
+/*
+ * ctfs_stat_getattr - VOP_GETATTR entry point
+ */
+/* ARGSUSED */
+static int
+ctfs_stat_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr)
+{
+	vap->va_mode = 0444;
+
+	return (ctfs_ctl_common_getattr(vp, vap, flags, cr));
+}
+
+/*
  * ctfs_ctl_ioctl - VOP_IOCTL entry point
  *
  * All the ct_ctl_*(3contract) interfaces point here.
@@ -279,7 +303,7 @@
 	{ VOPNAME_OPEN,		{ .vop_open = ctfs_open } },
 	{ VOPNAME_CLOSE,	{ .vop_close = ctfs_close } },
 	{ VOPNAME_IOCTL,	{ .vop_ioctl = ctfs_stat_ioctl } },
-	{ VOPNAME_GETATTR,	{ .vop_getattr = ctfs_ctl_getattr } },
+	{ VOPNAME_GETATTR,	{ .vop_getattr = ctfs_stat_getattr } },
 	{ VOPNAME_ACCESS,	{ .vop_access = ctfs_access_readonly } },
 	{ VOPNAME_READDIR,	{ .error = fs_notdir } },
 	{ VOPNAME_LOOKUP,	{ .error = fs_notdir } },