Re: [PATCH] mount: Automagically detect and loop-mount regular files.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2010-03-15 at 13:41 -0400, Adam Jackson wrote:

> On Mon, 2010-03-15 at 17:32 +0100, Karel Zak wrote:
> > On Fri, Jan 08, 2010 at 04:40:51PM -0500, Adam Jackson wrote:
> > > --- a/mount/mount.c
> > > +++ b/mount/mount.c
> > > @@ -1075,6 +1075,12 @@ loop_check(const char **spec, const char **type, int *flags,
> > >    *loop = ((*flags & MS_LOOP) || *loopdev || opt_offset || opt_sizelimit || opt_encryption);
> > >    *loopfile = *spec;
> > >  
> > > +  if (!*loop) {
> > > +    struct stat st_buf;
> > > +    stat(*spec, &st_buf);
> > > +    *loop = S_ISREG(st_buf.st_mode);
> > > +  }
> > 
> >  Applied a little different version (see below). 
> >  
> >  The problem with this feature is that mount(2) syscall allows to use
> >  regular files (or whatever) as the source argument. The interpretation
> >  of the source argument completely depends on filesystem driver. So you
> >  can create FS that is able to mount regular files...
> 
> That's... a little bizarre.  But very orthogonal, I suppose.  And I
> can't imagine a sane filesystem that would behave differently when
> pointed at a block device as at a regular file containing the same bits,
> so this is probably safe.
> 
I've at least seen fuse modules out there in the wild that expect the
source to be a filename.  But fuse doesn't come under "sane" I guess ;)

Scott
-- 
Scott James Remnant
scott@xxxxxxxxxx

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux