svn commit: samba r21646 - in branches: SAMBA_3_0/source/modules SAMBA_3_0_25/source/modules

jra at samba.org jra at samba.org
Thu Mar 1 23:57:38 GMT 2007


Author: jra
Date: 2007-03-01 23:57:37 +0000 (Thu, 01 Mar 2007)
New Revision: 21646

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

Log:
Patch from SATOH Fumiyasu <fumiyas at osstech.co.jp>
- add minsize parameter. Bug #4409.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/modules/vfs_recycle.c
   branches/SAMBA_3_0_25/source/modules/vfs_recycle.c


Changeset:
Modified: branches/SAMBA_3_0/source/modules/vfs_recycle.c
===================================================================
--- branches/SAMBA_3_0/source/modules/vfs_recycle.c	2007-03-01 23:03:46 UTC (rev 21645)
+++ branches/SAMBA_3_0/source/modules/vfs_recycle.c	2007-03-01 23:57:37 UTC (rev 21646)
@@ -153,17 +153,28 @@
 	return tmp_lp;
 }
 
-static int recycle_maxsize(vfs_handle_struct *handle)
+static SMB_OFF_T recycle_maxsize(vfs_handle_struct *handle)
 {
-	int maxsize;
+	SMB_OFF_T maxsize;
 	
-	maxsize = lp_parm_int(SNUM(handle->conn), "recycle", "maxsize", -1);
+	maxsize = lp_parm_ulong(SNUM(handle->conn), "recycle", "maxsize", 0);
 
-	DEBUG(10, ("recycle: maxsize = %d\n", maxsize));
+	DEBUG(10, ("recycle: maxsize = %lu\n", maxsize));
 	
 	return maxsize;
 }
 
+static SMB_OFF_T recycle_minsize(vfs_handle_struct *handle)
+{
+	SMB_OFF_T minsize;
+	
+	minsize = lp_parm_ulong(SNUM(handle->conn), "recycle", "minsize", 0);
+
+	DEBUG(10, ("recycle: minsize = %lu\n", minsize));
+	
+	return minsize;
+}
+
 static mode_t recycle_directory_mode(vfs_handle_struct *handle)
 {
 	int dirmode;
@@ -381,7 +392,7 @@
 	const char *base;
 	char *repository = NULL;
 	int i = 1;
-	int maxsize;
+	SMB_OFF_T maxsize, minsize;
 	SMB_OFF_T file_size; /* space_avail;	*/
 	BOOL exist;
 	int rc = -1;
@@ -431,6 +442,12 @@
 		rc = SMB_VFS_NEXT_UNLINK(handle, file_name);
 		goto done;
 	}
+	minsize = recycle_minsize(handle);
+	if(minsize > 0 && file_size < minsize) {
+		DEBUG(3, ("recycle: File %s lowers minimum recycle size, purging... \n", file_name));
+		rc = SMB_VFS_NEXT_UNLINK(handle, file_name);
+		goto done;
+	}
 
 	/* FIXME: this is wrong: moving files with rename does not change the disk space
 	 * allocation

Modified: branches/SAMBA_3_0_25/source/modules/vfs_recycle.c
===================================================================
--- branches/SAMBA_3_0_25/source/modules/vfs_recycle.c	2007-03-01 23:03:46 UTC (rev 21645)
+++ branches/SAMBA_3_0_25/source/modules/vfs_recycle.c	2007-03-01 23:57:37 UTC (rev 21646)
@@ -153,17 +153,28 @@
 	return tmp_lp;
 }
 
-static int recycle_maxsize(vfs_handle_struct *handle)
+static SMB_OFF_T recycle_maxsize(vfs_handle_struct *handle)
 {
-	int maxsize;
+	SMB_OFF_T maxsize;
 	
-	maxsize = lp_parm_int(SNUM(handle->conn), "recycle", "maxsize", -1);
+	maxsize = lp_parm_ulong(SNUM(handle->conn), "recycle", "maxsize", 0);
 
-	DEBUG(10, ("recycle: maxsize = %d\n", maxsize));
+	DEBUG(10, ("recycle: maxsize = %lu\n", maxsize));
 	
 	return maxsize;
 }
 
+static SMB_OFF_T recycle_minsize(vfs_handle_struct *handle)
+{
+	SMB_OFF_T minsize;
+	
+	minsize = lp_parm_ulong(SNUM(handle->conn), "recycle", "minsize", 0);
+
+	DEBUG(10, ("recycle: minsize = %lu\n", minsize));
+	
+	return minsize;
+}
+
 static mode_t recycle_directory_mode(vfs_handle_struct *handle)
 {
 	int dirmode;
@@ -381,7 +392,7 @@
 	const char *base;
 	char *repository = NULL;
 	int i = 1;
-	int maxsize;
+	SMB_OFF_T maxsize, minsize;
 	SMB_OFF_T file_size; /* space_avail;	*/
 	BOOL exist;
 	int rc = -1;
@@ -431,6 +442,12 @@
 		rc = SMB_VFS_NEXT_UNLINK(handle, file_name);
 		goto done;
 	}
+	minsize = recycle_minsize(handle);
+	if(minsize > 0 && file_size < minsize) {
+		DEBUG(3, ("recycle: File %s lowers minimum recycle size, purging... \n", file_name));
+		rc = SMB_VFS_NEXT_UNLINK(handle, file_name);
+		goto done;
+	}
 
 	/* FIXME: this is wrong: moving files with rename does not change the disk space
 	 * allocation



More information about the samba-cvs mailing list