-struct devnode
-{
- devfstype_t dn_type;
- int dn_flags;
- u_short dn_mode;
- uid_t dn_uid;
- gid_t dn_gid;
- struct timespec dn_atime;/* time of last access */
- struct timespec dn_mtime;/* time of last modification */
- struct timespec dn_ctime;/* time file changed */
- int (***dn_ops)(void *);/* yuk... pointer to pointer(s) to funcs */
- int dn_links;/* how many file links does this node have? */
- struct devfsmount * dn_dvm; /* the mount structure for this 'plane' */
- struct vnode * dn_vn; /* address of last vnode that represented us */
- int dn_len; /* of any associated info (e.g. dir data) */
- devdirent_t * dn_linklist;/* circular list of hardlinks to this node */
- devnode_t * dn_nextsibling; /* the list of equivalent nodes */
- devnode_t * * dn_prevsiblingp;/* backpointer for the above */
- devnode_type_t dn_typeinfo;
- int dn_delete; /* mark for deletion */
- int dn_change;
- int dn_update;
- int dn_access;
- int dn_lflags;
+#define DEV_MAX_VNODE_RETRY 8 /* Max number of retries when we try to
+ * get a vnode for the devnode */
+struct devnode {
+ devfstype_t dn_type;
+ /*
+ * Number of vnodes that point to this devnode. Note, we do not
+ * add another reference for a lookup which finds an existing
+ * vnode; a reference is added when a vnode is created and removed
+ * when a vnode is reclaimed. A devnode will not be freed while
+ * there are outstanding references. A refcount can be added to
+ * prevent the free of a devnode in situations where there is not
+ * guaranteed to be a vnode holding a ref, but it is important to
+ * make sure that a deferred delete eventually happens if it is
+ * blocked behind that reference.
+ */
+ os_ref_atomic_t dn_refcount;
+ u_short dn_mode;
+ uid_t dn_uid;
+ gid_t dn_gid;
+ struct timespec dn_atime;/* time of last access */
+ struct timespec dn_mtime;/* time of last modification */
+ struct timespec dn_ctime;/* time file changed */
+ int(***dn_ops)(void *);/* yuk... pointer to pointer(s) to funcs */
+ int dn_links;/* how many file links does this node have? */
+ struct devfsmount * dn_dvm; /* the mount structure for this 'plane' */
+ struct vnode * dn_vn;/* address of last vnode that represented us */
+ int dn_len;/* of any associated info (e.g. dir data) */
+ devdirent_t * dn_linklist;/* circular list of hardlinks to this node */
+ devnode_t * dn_nextsibling;/* the list of equivalent nodes */
+ devnode_t * * dn_prevsiblingp;/* backpointer for the above */
+ devnode_type_t dn_typeinfo;
+ int dn_change;
+ int dn_update;
+ int dn_access;
+ int dn_lflags;
+ ino_t dn_ino;
+ int (*dn_clone)(dev_t dev, int action);/* get minor # */
+ struct label * dn_label; /* security label */