[lkml]   [1996]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Drawbacks of implementing undelete entirely in user space
In article <>,
Darren J Moffat <> wrote:
>> them. I think I've got things right. Anybody care to comment?
>Looks good to me, and works fine, well done.
>I've modified it a bit so that instead of calling fsuser() it checks to
>see if the ext2 undeletable flag is set on the file. It then moves the
>file to .wastebasket and removes the flag so that some user process can
>then delete it to free up space. Since the u flag is inherited from the
>parent directory setting it on user dirs and important system dirs is easy
>without having a hole partition setup for it, so that tmp files created by
>compilers et al don't get stuffed in .wastebasket
>I've also polished of the patch by adding a config option and help text.
>Maybe something better should be done about files in .wastebasket with
>duplicate names, I've left your solution of adding a version no.

How about moving the deleted file into a directory .wastebasket/XXXXX,
where XXXXX is the inode number of the directory the file was in at
the moment it was deleted. If that directory has the same permissions
as the original, you do not even need special tools to undelete or
"empty trash".. a shell script or perl script will do! Also, this works
recursively and you can restore everything if you undelete in reverse

Ofcourse the directory structure under .wastbasket stays at max
1 level deep. In every directory you can then type "lsrm" and it
will just do something like

stat(&st, ".");
getmountpoint(buf, ".");
sprintf(buf2, "ls %s/.wastebasket/%d", buf, st.st_ino);

+ Miquel van Smoorenburg + Cistron Internet Services + Living is a |
| (SP6) | Independent Dutch ISP | horizontal |
+ + + fall +

 \ /
  Last update: 2005-03-22 13:37    [W:0.067 / U:6.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site