summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-03-01 23:57:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:18:21 -0500
commitcba9ad6633ae1b3eac1fc590746ced67e4d9ed33 (patch)
treebc9f4cb8e7fd59183a2188ffc89f4e0350ec1999
parent059e4cfa03b9d1bb4aa2fcb95747fc22faea45b1 (diff)
downloadsamba-cba9ad6633ae1b3eac1fc590746ced67e4d9ed33.tar.gz
samba-cba9ad6633ae1b3eac1fc590746ced67e4d9ed33.tar.bz2
samba-cba9ad6633ae1b3eac1fc590746ced67e4d9ed33.zip
r21646: Patch from SATOH Fumiyasu <fumiyas@osstech.co.jp>
- add minsize parameter. Bug #4409. Jeremy. (This used to be commit b9408304db9a64d9b8ad56f53532825a02fdb150)
-rw-r--r--source3/modules/vfs_recycle.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c
index 121454315f..cc0a2a10e2 100644
--- a/source3/modules/vfs_recycle.c
+++ b/source3/modules/vfs_recycle.c
@@ -153,17 +153,28 @@ static const char **recycle_noversions(vfs_handle_struct *handle)
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 @@ static int recycle_unlink(vfs_handle_struct *handle, const char *file_name)
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 @@ static int recycle_unlink(vfs_handle_struct *handle, const char *file_name)
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