All of lore.kernel.org
 help / color / mirror / Atom feed
* opening files
@ 2003-11-06 14:01 luc deschenaux
  2003-11-07 22:53 ` Jan Hudec
  0 siblings, 1 reply; 2+ messages in thread
From: luc deschenaux @ 2003-11-06 14:01 UTC (permalink / raw)
  To: linux-fsdevel

maybe somebody did it already, knows where i need to do it, or has 
something to say about it; so while i start looking how to implement the 
functionality described below, i post a message here

When booting from a livecd, the empty directory tree is duplicated in a 
tmpfs partition and all the cdrom files are linked in it

If a process need to open a file with write permission you have to 
remove the link in ramdisk and replace it with the real file from the cd 
at user level

I'm looking to patch the kernel or libraries so that when a process try 
to open such linked file with write permission, the kernel or library 
replace the link in ramdisk with the real file from cd before opening it 
and returning the file descriptor instead of a "permission denied" error.

infos and suggestions welcome

regards,

Luc


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: opening files
  2003-11-06 14:01 opening files luc deschenaux
@ 2003-11-07 22:53 ` Jan Hudec
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Hudec @ 2003-11-07 22:53 UTC (permalink / raw)
  To: luc deschenaux; +Cc: linux-fsdevel

On Thu, Nov 06, 2003 at 15:01:05 +0100, luc deschenaux wrote:
> maybe somebody did it already, knows where i need to do it, or has 
> something to say about it; so while i start looking how to implement the 
> functionality described below, i post a message here
> 
> When booting from a livecd, the empty directory tree is duplicated in a 
> tmpfs partition and all the cdrom files are linked in it
> 
> If a process need to open a file with write permission you have to 
> remove the link in ramdisk and replace it with the real file from the cd 
> at user level
> 
> I'm looking to patch the kernel or libraries so that when a process try 
> to open such linked file with write permission, the kernel or library 
> replace the link in ramdisk with the real file from cd before opening it 
> and returning the file descriptor instead of a "permission denied" error.
> 
> infos and suggestions welcome

It's doable from a library and it even does not need to make any links
at all. You can use the LD_PRELOAD mechanizm to replace the open
function with version that would:
  * Look if the file exists in tmpfs.
  * If write permissions are needed, copy it; otherwise just replace
    the name by appropriate name on the CD.
  * Open the file.

In kernel, you could write a "cow" filesystem driver. It is however much
more complicated than replacing libc's open call. It might be useful to
look at umlinux ubd (user block device) driver.

It might be that union mounts solve this or are at least some help.
However, I am not sure they are implemented (in 2.6; no such thing in
2.4) and what they can actualy do.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-11-07 22:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-06 14:01 opening files luc deschenaux
2003-11-07 22:53 ` Jan Hudec

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.