PERFORCE change 156096 for review

Robert Watson rwatson at FreeBSD.org
Tue Jan 13 09:15:50 PST 2009


http://perforce.freebsd.org/chv.cgi?CH=156096

Change 156096 by rwatson at rwatson_freebsd_capabilities on 2009/01/13 17:15:39

	OpenSolaris compat code now hides fget_{read,write}() behind
	getf(), so update it to capability support.

Affected files ...

.. //depot/projects/trustedbsd/capabilities/src/sys/cddl/compat/opensolaris/sys/file.h#2 edit
.. //depot/projects/trustedbsd/capabilities/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c#4 edit

Differences ...

==== //depot/projects/trustedbsd/capabilities/src/sys/cddl/compat/opensolaris/sys/file.h#2 (text+ko) ====

@@ -39,9 +39,11 @@
 {
 	struct file *fp;
 
-	if (write && fget_write(curthread, fd, &fp) == 0)
+	if (write && fget_write(curthread, fd, CAP_WRITE | CAP_SEEK, &fp) ==
+	    0)
 		return (fp);
-	else if (!write && fget_read(curthread, fd, &fp) == 0)
+	else if (!write && fget_read(curthread, CAP_READ | CAP_SEEK,  fd,
+	    &fp) == 0)
 		return (fp);
 	return (NULL);
 }

==== //depot/projects/trustedbsd/capabilities/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c#4 (text+ko) ====

@@ -2466,10 +2466,6 @@
 	    &props)) != 0)
 		return (error);
 
-#if 0
-	/* XXXRW: Is this the right capability? */
-	error = fget_read(td, zc->zc_cookie, CAP_READ | CAP_SEEK, &fp);
-#endif
 	fd = zc->zc_cookie;
 	fp = getf(fd, 0);
 	if (fp == NULL) {
@@ -2619,12 +2615,6 @@
 
 	fp = getf(zc->zc_cookie, 1);
 	if (fp == NULL) {
-#if 0
-	fd = zc->zc_cookie;
-	/* XXXRW: Is this the right capability? */
-	error = fget_write(td, fd, CAP_WRITE | CAP_SEEK, &fp);
-	if (error) {
-#endif
 		dmu_objset_close(tosnap);
 		if (fromsnap)
 			dmu_objset_close(fromsnap);


More information about the p4-projects mailing list