Author: kib Date: Wed Oct 5 16:50:15 2011 New Revision: 226041 URL: http://svn.freebsd.org/changeset/base/226041
Log: Export devfs inode number allocator for the kernel consumers. Reviewed by: jhb MFC after: 2 weeks Modified: head/sys/fs/devfs/devfs_devs.c head/sys/sys/conf.h Modified: head/sys/fs/devfs/devfs_devs.c ============================================================================== --- head/sys/fs/devfs/devfs_devs.c Wed Oct 5 16:27:11 2011 (r226040) +++ head/sys/fs/devfs/devfs_devs.c Wed Oct 5 16:50:15 2011 (r226041) @@ -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: head/sys/sys/conf.h ============================================================================== --- head/sys/sys/conf.h Wed Oct 5 16:27:11 2011 (r226040) +++ head/sys/sys/conf.h Wed Oct 5 16:50:15 2011 (r226041) @@ -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 _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"