moving files that are being used / code stuff

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

Am i making sense? and could this be usefull?

make it more clear so others can understand
0
No votes
yeah, it can be usefull. But don't use fuse
0
No votes
Useless, waste of time / aready available
0
No votes
see how it goes / i'll help
0
No votes
You don't understand anything about filesystems
0
No votes
 
Total votes : 0

moving files that are being used / code stuff

Postby chan_0x0c » Wed Nov 15, 2006 11:07 am

In a nutshell, I want to move the location where the file resides,
while it's being used by another process.

Before I proceed to actual codeing, I would like any feed back to make sure
I'm not 're-inventing-the-wheel'.

Any comments, rangeing from
I know something called <insert code base/app name here> that does what you want to do ...
or
you know, your idea's good/bad, but it won't happen...etc, etc
to
You dumb #*$@%, it's aredy in <stuff here> ,
is all greatly appreceated.

Since a quick web search didn't turn up what i wanted, I intend to have something like this.

Moving a file, or a mount point is not really possible, if the file that resides in there
is being used by a another process.
And I do not have the option of killing off the process using the file.
There are genuine situations and reasons where you
are required to keep the process alive.
dynamically moving the filesystem when the space is short is one,
While still keeping the system alive.
And although there is XEN, or user mode linux, that's not really
generic in this case, as I don't really want/need the 'migrate the system' thing.
just a ability to move a sub directory is fine, as long as its cheap (in resource terms)
I wish i can change the phycal disk that the file resides, while the file is being used.

something like (pusudocode)

/*when reading*/
if( file_size_limited_or_not_stream_or_any_special_file ){
copy (file_from_here , now_location_of_file_there);
flag_file_migration_ready = true;
/*fuse_get_context() stuff to clean up*/
/*mmap() and dup() problems, haven't really thought about a solution yet */
/*we'l manage somehow*/
}else{/*havent thought about yet*/}

/* elsewhere in the code, overwriting the read method */
return int read( pointer){
if(flag_file_migration_ready){
return read( new_file_location, pointer)
}else{
return read( old_file_location, pointer)
}
}

that's just for ro file, and i haven't thought really deap about mem map or read/write.
there's also the primission thing, but we'll see how it turns out.
chan_0x0c
 
Posts: 3
Joined: Wed Nov 15, 2006 10:11 am

Return to Programming

Who is online

Users browsing this forum: Bing [Bot] and 0 guests