Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Sep 2014 21:46:15 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r271290 - in stable/8/sys: fs/devfs sys
Message-ID:  <201409082146.s88LkFjF006523@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Mon Sep  8 21:46:14 2014
New Revision: 271290
URL: http://svnweb.freebsd.org/changeset/base/271290

Log:
  MFC 226041:
  Export devfs inode number allocator for the kernel consumers.

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

Modified: stable/8/sys/fs/devfs/devfs_devs.c
==============================================================================
--- stable/8/sys/fs/devfs/devfs_devs.c	Mon Sep  8 21:10:51 2014	(r271289)
+++ stable/8/sys/fs/devfs/devfs_devs.c	Mon Sep  8 21:46:14 2014	(r271290)
@@ -147,8 +147,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);
@@ -304,7 +303,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))
@@ -560,6 +559,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/8/sys/sys/conf.h
==============================================================================
--- stable/8/sys/sys/conf.h	Mon Sep  8 21:10:51 2014	(r271289)
+++ stable/8/sys/sys/conf.h	Mon Sep  8 21:46:14 2014	(r271290)
@@ -304,6 +304,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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409082146.s88LkFjF006523>