lkml.org 
[lkml]   [1996]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Drawbacks of implementing undelete entirely in user space
Date
On Mon, 24 Jun 1996, Miquel van Smoorenburg wrote:

> 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
> order.

Well, if you're going to do it, why not do it so:

1) Have one .wastebasket (or whatever) at the root of each physical
partition. This way, you can manage the disk consumption where it really
matters, on a per-partition level, and you can do it far more easily than
with 100s of .wastebaskets spread throughout the system.

You would want it per-fs so that you could simply link a file to the
.wastebasket directory and unlink it from it's old location, rather than
having actually to move it.

2) Assign the files minimalist names and rather keep a database of time
"deleted", original location, owner, group, permission, and size.
This would be much more amenable to different expiration algorithms and
would allow very fast tools for processing the information. You could
still access this with non-setuid perl scripts.

> Of course the directory structure under .wastbasket stays at max
> 1 level deep.

# ls -l .wastebasket

total 486909
drwxr-xr-x 2 tlewis tlewis 1024 Jun 9 15:12 important
drwxr-xr-x 2 root wheel 1024 Jun 9 15:12 Very_Important
drwxr-xr-x 2 betty veronica 4096 Jun 9 15:12 Oh-God-this-is-SO...

> 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);
> system(buf2);

I've got it! To build a time machine, all you have to do is propel your
vehicle faster than the speed of light! Of course, there are still
details, but that's the easy part, so I'll leave that to the programmers.

8^)

_____________________________________________________________________
Todd Graham Lewis Core Engineering Mindspring Enterprises
tlewis@mindspring.com (Standard Disclaimers) (800) 719 4664, x2804


\
 
 \ /
  Last update: 2005-03-22 13:37    [from the cache]
©2003-2011 Jasper Spaans