• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problems with dirent and nfs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with dirent and nfs


  • Subject: Re: Problems with dirent and nfs
  • From: Mike Mackovitch <email@hidden>
  • Date: Wed, 18 Mar 2009 08:20:35 -0700

On Wed, Mar 18, 2009 at 12:39:21PM +0000, email@hidden wrote:
> I'm using scandir to get directory entries for mounted volumes.
> In the returned directory entries I can use d_type to quickly identify
> directories.
>
> However when scanning an nfs mount I don't get this information. d_type
> is DT_UNKNOWN rather than DT_DIR.
>
> Any suggests for getting a correct d_type or any other way to quickly
> determine the type of each entry?

The NFSv2/v3 protocols do not return the "type" of the entries in their
READDIR results.  NFSv3 has a READDIRPLUS RPC that can also return the
attributes (including the type) of each entry but it's optional to
implement.  Thus, in general, you can't depend on d_type always being
set on NFS.

On MacOSX, you can use the "-o rdirplus" mount option to enable using
that RPC for NFSv3 (if the server supports it).  The mount option is
documented in the mount_nfs(8) man page.  Also, note that it may not
always be a good thing to enable because it can have a tendency to
flood the vnode/name caches with entries that do not get referenced.

In general, the only way to guarantee knowing the type of each entry is
to stat(2) it.

HTH
--macko
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Problems with dirent and nfs (From: email@hidden)

  • Prev by Date: Problems with dirent and nfs
  • Next by Date: Re: Problems with dirent and nfs
  • Previous by thread: Problems with dirent and nfs
  • Next by thread: Re: Problems with dirent and nfs
  • Index(es):
    • Date
    • Thread