[openbeos] Re: kernel mime_table module

  • From: Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Sun, 09 Jan 2005 17:43:51 +0100

On 2005-01-09 at 17:06:45 [+0100], François Revol wrote:
> > > > No, it can't, since you generally can't get the name of a node.
> > > 
> > > The kernel can do this, or at least it could do this if we need to.
> > 
> > Unless the FS doesn't support hard links, this sounds impracticable,
> > since
> > you might simply have more than one name for a node, and the FS might
> > not
> > be able to get all (or even any) of them without potentially
> > iterating
> > through all the volume's entries.
> 
> Which is why the kernel's struct for an open fd (which has been open
> using a path or an entry ref at worst, _kopen_vnode_ should be banned),

We fortunately don't have a _kopen_vnode_(). :-)
More precisely we currently can open only directories per node_ref.

> should cache the parent folder dev/ino of the node.
> See previous post.

Yep, that will work.

> > > Actually, I think you're not wrong - but that's probably because
> > > the
> > > BNodeInfo class is a bit messed up. A BEntryInfo class would be
> > > what
> > > would better fit in here, and yet, that one doesn't exist :)
> > 
> > And I suppose, I wouldn't really like it either. I find it quite
> > reasonable
> > that MIME type, preferred app, icon and the like are only associated
> > with
> > the node, since the node makes up the whole contents (data and
> > attributes)
> > while file names are just names and many can exist for one node.
> 
> That's true, then only problem being if we want to sniff based on the
> extension, because the extension belongs to the entry, not the node
> (except on bfs but that's impl detail), which was the primary subject
> of that thread.

I wouldn't object to something like a BNodeInfo::GuessMimeType(BMimeType 
*), which would take the file name into account, if the data-based sniffing 
is inconclusive (just like the entry_ref version of 
BMimeType::GuessMimeType()).

CU, Ingo

Other related posts: