VFS recycle hack (Home folder's suite...)

Eddy PELAIC eddy.pelaic at univ-paris5.fr
Tue Dec 4 10:57:47 GMT 2007


Hi,

I would like to add a option to the VFS recycle bin.

I want to cut the path between the base of a share path and the 
repository path.

exemple

[share]/username/repository/

in this exemple "username/repository" because I don't want to have this 
path in the recycle for each file/folder.

I can add option name for recycle ex: cutpath but I can't use wildcards 
like "%U/Trash", there are no substitution of %U,


at this time I put in vfs_recycle.c some code:

static const char **recycle_cutpath(vfs_handle_struct *handle)
{
    const char **tmp_lp;
   
    tmp_lp = lp_parm_const_string(SNUM(handle->conn), "recycle", 
"cutpath", NULL);

    DEBUG(10, ("recycle: cutpath = %s ...\n", tmp_lp?*tmp_lp:""));
   
    return tmp_lp;
}


and in :  static int recycle_unlink(...)


I add after if (matchparam(recycle_exclude(handle), base)), to see if it 
match the path of file/folder :

if ( matchparam(recycle_cutpath(handle), file_name) ){
        DEBUG( 10, ("CUT PATH OK %s\n", file_name) );
       
    }
    else{
        DEBUG( 10, ("CUT PATH NOT OK %s\n", file_name) );
    }
}

at this time, I just changed

if (recycle_keep_dir_tree(handle) == True) {
        /* asprintf(&temp_name, "%s/%s", repository, path_name); */
        asprintf(&temp_name, "%s", repository);
    } else {
        temp_name = SMB_STRDUP(repository);
        DEBUG( 10, (" temp_name : %s \n", temp_name));
    }
}


but in this case all files are put in the Trash at the same level when 
Keep Tree == true.

an idea to use the wild card in VFS recycle...?

@+
Edo...

-- 
Eddy PELAIC

Service informatique
Faculté de chirurgie dentaire 
Université Paris Descartes
1, rue Maurice Arnoux
92120
Montrouge

Tel: 01 58 07 67 13
mail: eddy.pelaic at univ-paris5.fr 



More information about the samba-technical mailing list