patch: Add recycle:minsize parameter
SATOH Fumiyasu
fumiya at samba.gr.jp
Fri Jan 12 15:54:30 GMT 2007
Hi!
How about the following patch?
At Fri, 07 Jul 2006 15:21:20 +0900,
I wrote:
>
> Hi,
>
> I want recycle:minsize parameter to ignore NULL (0 size)
> files by vfs_recycle.so. If you feel so good, please
> apply the following patch to SAMBA_3_0 tree.
>
> Index: SAMBA_3_0/source/modules/vfs_recycle.c
> ===================================================================
> --- SAMBA_3_0/source/modules/vfs_recycle.c (revision 16853)
> +++ SAMBA_3_0/source/modules/vfs_recycle.c (working copy)
> @@ -153,17 +153,28 @@ static const char **recycle_noversions(v
> 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;
> @@ -378,7 +389,7 @@ static int recycle_unlink(vfs_handle_str
> 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;
> @@ -423,6 +434,12 @@ static int recycle_unlink(vfs_handle_str
> rc = SMB_VFS_NEXT_UNLINK(handle, conn, 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, conn, file_name);
> + goto done;
> + }
>
> /* FIXME: this is wrong: moving files with rename does not change the disk space
> * allocation
--
-- Name: SATOH Fumiyasu / fumiyas @ osstech.co.jp
-- Business Home: http://www.OSSTech.co.jp
-- Personal Home: http://www.SFO.jp/blog/
More information about the samba-technical
mailing list