[Vm-dev] Extending primitiveDirectoryEntry

Alistair Grant akgrant0710 at gmail.com
Fri Apr 21 09:53:54 UTC 2017

Hi Esteban,

Thanks for your reply.

On Fri, Apr 21, 2017 at 11:28:09AM +0200, Esteban Lorenzano wrote:
> Hi Alistair, 
> in the past we extended dir_EntryLookup because a lot of important
> information was missing. With time, I realised that maybe it would
> have been better to add an extra primitive to get extended properties.
> st_dev is not very used but I understand it can be good to have access
> to it. 
> Then, my question now is: wouldn't be better to add an "extended
> properties??? primitive, to answer st_dev and others?
> Esteban

I'm not sure I'm knowledgable enough to answer this one.  Which
attributes do you consider core and which are extended?

The only thing I can say at the moment is that dir_(Entry)Lookup really
only does one thing, get the stat structure and return (most) of the
information, and that st_dev is an integer, so it is quite lightweight
to include.

>From that perspective (and not knowing much else), it doesn't seem to
make much sense to split it in two.

Unless you're saying you'd like to split it in to:

- Does the entry exist (just return a boolean)?
- Return information about the entry

I guess that would depend on how often the first is called without the
second soon(ish) after, and the additional cost of including the information
in the first place.

I'll try and have a look at the message flow leading to dir_Lookup and


> > On 21 Apr 2017, at 10:32, Alistair Grant <akgrant0710 at gmail.com> wrote:
> > 
> > 
> > Hi All,
> > 
> > I'm in the process of making FileReference>>moveTo: work across devices.
> > To make the implementation a bit cleaner on Linux it would be nice to
> > know whether the source and destination reside on the same disk
> > filesystem.  This can be determined by comparing stat.st_dev for the
> > source file and destination directory.
> > 
> > dir_EntryLookup() in sqUnixFile.c is exposed as primitiveDirectoryEntry
> > and used by FilePluginPrims>>lookupDirectory:filename:
> > 
> > It basically does a stat() on the supplied file and returns most of the
> > resulting information.  Unfortunately st_dev isn't returned.
> > 
> > Would there be any objection to me extending the Pharo version of
> > dir_EntryLookup() to include st_dev?
> > 
> > Thanks,
> > Alistair
> > 

More information about the Vm-dev mailing list