[Ardour-Dev] GTK+ (concepts and advice)

Paul Davis paul at linuxaudiosystems.com
Mon Jun 16 13:01:50 PDT 2008


On Mon, 2008-06-16 at 20:19 +0000, John Emmas wrote:
> ----- Original Message ----- 
> From: "Paul Davis" <paul at linuxaudiosystems.com>
> Subject: Re: [Ardour-Dev] GTK+ (concepts and advice)
> >
> > there are really smart (and really fast) ways to do the "copying" on a
> > POSIX system that do not exist on Windows.
> >
> Interesting....  how complicated is it to use this feature and how much
> faster is it - and why is "copying" in inverted commas??  :-)
> 
> At the moment, I'm using bog standard fopen to do the copying but if there
> was a faster method, it might be a significant step towards implementing
> 'Save As'.

if the destination directory/folder is on the same filesystem as the
"original", then you can offer the user the option of creating a "hard
link" to the data file. this means that even if you delete the
"original" session, the data files will continue to exist (though they
will be accessible via one path (the new one), and not two). since most
linux users now tend to use their disks as one big huge partition, there
is a high likelihood that this is an option in many situations.

ardour already does this "silently" if you opt to embed (rather than
import) external files into a session. rather than make a copy, it will
make a hard link if possible.

"hard links" are different from "symbolic links" in POSIX; MS tried to
introduce "links" with Vista but only added the "symbolic" kind, once
again reinforcing the old adage "those who don't understand unix are
condemned to reinvent it ... poorly".

<background>
files in a POSIX filesystem are not named paths, but things called
"inodes". a path represents an inode, but you can have more than one
path doing that. when you create a new file in a directory, you are
creating an inode, and then a path entry within the file that *is* the
directory. the path points to the inode, and the process increments the
"link count" of the inode. you can then use the "ln" command to create
other paths that also point to the same inode, which increments the link
count once more. removing 1 or more of the paths that point to the inode
has no impact on the existence of the inode until the last one is
removed. note also that opening the inode from within an application
also increments the link count for the inode, which makes it possible
(for example) to remove a file from the filesystem while an application
has it open with essentially no effect on the application - the inode is
not deleted until the link count drops to zero, which will happen when
the application closes the file). you can see link counts with the ls -l
command.
</background>

--p






More information about the Ardour-Dev mailing list