PERFORCE change 108854 for review

Adam Martin adamartin at FreeBSD.org
Tue Oct 31 20:41:28 UTC 2006


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

Change 108854 by adamartin at adamartin_hobbes on 2006/10/31 20:40:14

	AutoFS fixes for minor quirks, and fixing pseudofs...
	(I had pseudofs_vnops.c from stock.)
	Submitted by:	ADAM Martin

Affected files ...

.. //depot/projects/soc2006/adamartin_autofs/autofs/autofs_ctl.h#2 edit
.. //depot/projects/soc2006/adamartin_autofs/autofs/autofs_dev.c#3 edit
.. //depot/projects/soc2006/adamartin_autofs/autofs/autofs_pfsops.c#3 edit
.. //depot/projects/soc2006/adamartin_autofs/pseudofs/pseudofs_vnops.c#2 edit

Differences ...

==== //depot/projects/soc2006/adamartin_autofs/autofs/autofs_ctl.h#2 (text+ko) ====

@@ -65,6 +65,7 @@
 
 extern struct autofs_ctl_state autofs_ctl_state;
 
+extern int autofs_ctl_init( void );
 
 #define MAX_NODE_COUNT	( 32 )
 

==== //depot/projects/soc2006/adamartin_autofs/autofs/autofs_dev.c#3 (text+ko) ====

@@ -46,20 +46,25 @@
 
 struct uio *in_buffer, *out_buffer;
 
-#define IOV_BUF_COUNT	(16)
+#define IOV_BUF_COUNT	( 16 )
 
 int
-write_buffer(struct uio *buf, void *data, int len)
+write_buffer( struct uio *buf, void *data, int len )
 {
+	$cleanup_init_size( 8 );
 	int error;
 	error = 0;
-	if (buf->uio_iovcnt < IOV_BUF_COUNT) {
+	if( buf->uio_iovcnt < IOV_BUF_COUNT )
+	{
 		buf->uio_iov[ buf->uio_iovcnt ].iov_base= data;
 		buf->uio_iov[ buf->uio_iovcnt ].iov_len= len;
 		buf->uio_iovcnt++;
-	} else
-		error = ENOMEM;
+	}
+	else
+	{
+		error= ENOMEM;
+	}
 
-	return error;
+	$return error;
 }
 

==== //depot/projects/soc2006/adamartin_autofs/autofs/autofs_pfsops.c#3 (text+ko) ====

@@ -90,6 +90,7 @@
 	DEBUG KPRINTF( "cn_namelen= %ld, cn_consume= %ld\n", c.cn_namelen,
 				c.cn_consume );
 
+	/* Prepare a mount message */
 	msg.flags=		0;
 	msg.transaction_id=	0;
 	msg.message_type=	COMMAND_MOUNT_REQUEST;
@@ -99,7 +100,12 @@
 	mr.mountpoint_len=	c.cn_namelen;
 	strlcpy( mr.mountpoint, c.cn_nameptr, c.cn_namelen );
 
-	send_mount_request( &msg );
+	/* Take a lock and if it's not taken yet fire off the request. */
+
+	if( take_autofs_lock( instance, node ) )
+	{
+		send_mount_request( &msg );
+	}
 	
 	return 1;
 }

==== //depot/projects/soc2006/adamartin_autofs/pseudofs/pseudofs_vnops.c#2 (text+ko) ====

@@ -2,6 +2,10 @@
  * Copyright (c) 2001 Dag-Erling Coïdan Smørgrav
  * All rights reserved.
  *
+ * Modifications to handle more hooks for vnops to pfs files:
+ * Copyright (c) 2006 ADAM David Alan Martin
+ * All rights reserved.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -355,6 +359,8 @@
 	if (!pfs_visible(curthread, pd, pvd->pvd_pid, NULL))
 		PFS_RETURN (ENOENT);
 
+
+
 	/* self */
 	namelen = cnp->cn_namelen;
 	pname = cnp->cn_nameptr;
@@ -404,6 +410,23 @@
 			goto got_pnode;
 	}
 
+
+	/*
+	 * ADAM Martin:
+	 * Use PFS lookup on a resolved Vnode, don't actually get
+	 * the vnode though.  Does it belong here?
+	 */
+
+	// LOOKUP_ENABLE (to drop this whole section change // to /*)
+	if (pd->pn_lookup != 0)
+	#ifdef USE_PFSRETURN_ON_LOOKUP_CALLBACK
+		PFS_RETURN (pd->pn_lookup(curthread, pfind(pid), pd, cnp));
+	#else
+		pd->pn_lookup(curthread, pfind(pid), pd, cnp);
+	#endif
+	/**/
+
+
 	PFS_RETURN (ENOENT);
  got_pnode:
 	if (pn != pd->pn_parent && !pn->pn_parent)


More information about the p4-projects mailing list