svn commit: r226577 - in stable/9/sys: fs/devfs sys

Konstantin Belousov kib at FreeBSD.org
Thu Oct 20 18:47:58 UTC 2011


Author: kib
Date: Thu Oct 20 18:47:58 2011
New Revision: 226577
URL: http://svn.freebsd.org/changeset/base/226577

Log:
  MFC r226041:
  Export devfs inode number allocator for the kernel consumers.
  
  Approved by:	re (bz)

Modified:
  stable/9/sys/fs/devfs/devfs_devs.c
  stable/9/sys/sys/conf.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/fs/devfs/devfs_devs.c
==============================================================================
--- stable/9/sys/fs/devfs/devfs_devs.c	Thu Oct 20 18:39:01 2011	(r226576)
+++ stable/9/sys/fs/devfs/devfs_devs.c	Thu Oct 20 18:47:58 2011	(r226577)
@@ -171,8 +171,7 @@ devfs_free(struct cdev *cdev)
 	cdp = cdev2priv(cdev);
 	if (cdev->si_cred != NULL)
 		crfree(cdev->si_cred);
-	if (cdp->cdp_inode > 0)
-		free_unr(devfs_inos, cdp->cdp_inode);
+	devfs_free_cdp_inode(cdp->cdp_inode);
 	if (cdp->cdp_maxdirent > 0) 
 		free(cdp->cdp_dirents, M_DEVFS2);
 	free(cdp, M_CDEVP);
@@ -394,7 +393,7 @@ devfs_delete(struct devfs_mount *dm, str
 	mac_devfs_destroy(de);
 #endif
 	if (de->de_inode > DEVFS_ROOTINO) {
-		free_unr(devfs_inos, de->de_inode);
+		devfs_free_cdp_inode(de->de_inode);
 		de->de_inode = 0;
 	}
 	if (DEVFS_DE_DROP(de))
@@ -685,6 +684,21 @@ devfs_destroy(struct cdev *dev)
 	devfs_generation++;
 }
 
+ino_t
+devfs_alloc_cdp_inode(void)
+{
+
+	return (alloc_unr(devfs_inos));
+}
+
+void
+devfs_free_cdp_inode(ino_t ino)
+{
+
+	if (ino > 0)
+		free_unr(devfs_inos, ino);
+}
+
 static void
 devfs_devs_init(void *junk __unused)
 {

Modified: stable/9/sys/sys/conf.h
==============================================================================
--- stable/9/sys/sys/conf.h	Thu Oct 20 18:39:01 2011	(r226576)
+++ stable/9/sys/sys/conf.h	Thu Oct 20 18:47:58 2011	(r226577)
@@ -301,6 +301,9 @@ int	devfs_set_cdevpriv(void *priv, cdevp
 void	devfs_clear_cdevpriv(void);
 void	devfs_fpdrop(struct file *fp);	/* XXX This is not public KPI */
 
+ino_t	devfs_alloc_cdp_inode(void);
+void	devfs_free_cdp_inode(ino_t ino);
+
 #define		UID_ROOT	0
 #define		UID_BIN		3
 #define		UID_UUCP	66


More information about the svn-src-stable-9 mailing list