svn commit: samba r6345 - in trunk/source: include smbd

jra at samba.org jra at samba.org
Thu Apr 14 23:32:48 GMT 2005


Author: jra
Date: 2005-04-14 23:32:48 +0000 (Thu, 14 Apr 2005)
New Revision: 6345

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6345

Log:
Add a counter for the number of SMB operations per connection/file.
You will need to do a make clean after SVN updating this. Next will
come a smbcontrol message to dump this info. This should be interesting
to profile client activity.
Jeremy.

Modified:
   trunk/source/include/smb.h
   trunk/source/include/smb_macros.h
   trunk/source/smbd/process.c


Changeset:
Modified: trunk/source/include/smb.h
===================================================================
--- trunk/source/include/smb.h	2005-04-14 21:01:01 UTC (rev 6344)
+++ trunk/source/include/smb.h	2005-04-14 23:32:48 UTC (rev 6345)
@@ -412,6 +412,7 @@
 	int fnum;
 	struct connection_struct *conn;
 	int fd;
+	unsigned int num_smb_operations;
 	uint16 rap_print_jobid;
 	SMB_DEV_T dev;
 	SMB_INO_T inode;
@@ -533,6 +534,7 @@
 	time_t lastused;
 	BOOL used;
 	int num_files_open;
+	unsigned int num_smb_operations; /* Count of smb operations on this tree. */
 
 	BOOL case_sensitive;
 	BOOL case_preserve;

Modified: trunk/source/include/smb_macros.h
===================================================================
--- trunk/source/include/smb_macros.h	2005-04-14 21:01:01 UTC (rev 6344)
+++ trunk/source/include/smb_macros.h	2005-04-14 23:32:48 UTC (rev 6345)
@@ -90,6 +90,7 @@
 				return(ERROR_DOS(ERRDOS,ERRbadfid)); \
 			else if((fsp)->fd == -1) \
 				return(ERROR_DOS(ERRDOS,ERRbadaccess));\
+			(fsp)->num_smb_operations++;\
 			} while(0)
 
 #define CHECK_READ(fsp) if (!(fsp)->can_read) \

Modified: trunk/source/smbd/process.c
===================================================================
--- trunk/source/smbd/process.c	2005-04-14 21:01:01 UTC (rev 6344)
+++ trunk/source/smbd/process.c	2005-04-14 23:32:48 UTC (rev 6345)
@@ -958,8 +958,12 @@
 			return(ERROR_DOS(ERRSRV,ERRaccess));	    
 
 		/* load service specific parameters */
-		if (conn && !set_current_service(conn,SVAL(inbuf,smb_flg),(flags & (AS_USER|DO_CHDIR)?True:False)))
-			return(ERROR_DOS(ERRSRV,ERRaccess));
+		if (conn) {
+			if (!set_current_service(conn,SVAL(inbuf,smb_flg),(flags & (AS_USER|DO_CHDIR)?True:False))) {
+				return(ERROR_DOS(ERRSRV,ERRaccess));
+			}
+			conn->num_smb_operations++;
+		}
 
 		/* does this protocol need to be run as guest? */
 		if ((flags & AS_GUEST) && (!change_to_guest() || 



More information about the samba-cvs mailing list