Lines Matching full:dm
334 devfs_rmdir_empty(struct devfs_mount *dm, struct devfs_dirent *de) in devfs_rmdir_empty() argument
338 sx_assert(&dm->dm_lock, SX_XLOCKED); in devfs_rmdir_empty()
344 if ((de->de_flags & DE_DOOMED) != 0 || de == dm->dm_rootdir) in devfs_rmdir_empty()
361 devfs_delete(dm, de, DEVFS_DEL_NORECURSE); in devfs_rmdir_empty()
362 devfs_delete(dm, de_dot, DEVFS_DEL_NORECURSE); in devfs_rmdir_empty()
363 devfs_delete(dm, de_dotdot, DEVFS_DEL_NORECURSE); in devfs_rmdir_empty()
374 * The caller needs to hold the dm for the duration of the call since
375 * dm->dm_lock may be temporary dropped.
378 devfs_delete(struct devfs_mount *dm, struct devfs_dirent *de, int flags) in devfs_delete() argument
393 devfs_dir_unref_de(dm, dd); in devfs_delete()
403 sx_unlock(&dm->dm_lock); in devfs_delete()
408 sx_xlock(&dm->dm_lock); in devfs_delete()
429 devfs_rmdir_empty(dm, dd); in devfs_delete()
436 * The caller needs to hold the dm for the duration of the call.
440 devfs_purge(struct devfs_mount *dm, struct devfs_dirent *dd) in devfs_purge() argument
444 sx_assert(&dm->dm_lock, SX_XLOCKED); in devfs_purge()
458 devfs_dir_unref_de(dm, dd); in devfs_purge()
460 devfs_delete(dm, de, DEVFS_DEL_NORECURSE); in devfs_purge()
462 devfs_purge(dm, de); in devfs_purge()
464 devfs_delete(dm, de, DEVFS_DEL_NORECURSE); in devfs_purge()
469 devfs_delete(dm, dd, DEVFS_DEL_NORECURSE); in devfs_purge()
479 devfs_metoo(struct cdev_priv *cdp, struct devfs_mount *dm) in devfs_metoo() argument
484 siz = (dm->dm_idx + 1) * sizeof *dep; in devfs_metoo()
487 if (dm->dm_idx <= cdp->cdp_maxdirent) { in devfs_metoo()
500 cdp->cdp_maxdirent = dm->dm_idx; in devfs_metoo()
506 * The caller needs to hold the dm for the duration of the call.
509 devfs_populate_loop(struct devfs_mount *dm, int cleanup) in devfs_populate_loop() argument
518 sx_assert(&dm->dm_lock, SX_XLOCKED); in devfs_populate_loop()
531 dm->dm_idx <= cdp->cdp_maxdirent && in devfs_populate_loop()
532 cdp->cdp_dirents[dm->dm_idx] != NULL) { in devfs_populate_loop()
533 de = cdp->cdp_dirents[dm->dm_idx]; in devfs_populate_loop()
534 cdp->cdp_dirents[dm->dm_idx] = NULL; in devfs_populate_loop()
544 devfs_delete(dm, de, 0); in devfs_populate_loop()
569 if (dm->dm_idx <= cdp->cdp_maxdirent && in devfs_populate_loop()
570 cdp->cdp_dirents[dm->dm_idx] != NULL) { in devfs_populate_loop()
571 de = cdp->cdp_dirents[dm->dm_idx]; in devfs_populate_loop()
579 if (dm->dm_idx > cdp->cdp_maxdirent) in devfs_populate_loop()
580 devfs_metoo(cdp, dm); in devfs_populate_loop()
582 dd = dm->dm_rootdir; in devfs_populate_loop()
591 de = devfs_vmkdir(dm, s, q - s, dd, 0); in devfs_populate_loop()
595 de = devfs_vmkdir(dm, s, q - s, dd, 0); in devfs_populate_loop()
619 while (dt != dm->dm_rootdir && in devfs_populate_loop()
638 mac_devfs_create_device(cdp->cdp_c.si_cred, dm->dm_mount, in devfs_populate_loop()
643 devfs_rules_apply(dm, de); in devfs_populate_loop()
646 KASSERT(cdp->cdp_dirents[dm->dm_idx] == NULL, in devfs_populate_loop()
648 cdp->cdp_dirents[dm->dm_idx] = de; in devfs_populate_loop()
659 devfs_populate_needed(struct devfs_mount *dm) in devfs_populate_needed() argument
662 return (dm->dm_generation != devfs_generation); in devfs_populate_needed()
666 * The caller needs to hold the dm for the duration of the call.
669 devfs_populate(struct devfs_mount *dm) in devfs_populate() argument
673 sx_assert(&dm->dm_lock, SX_XLOCKED); in devfs_populate()
674 if (!devfs_populate_needed(dm)) in devfs_populate()
677 while (devfs_populate_loop(dm, 0)) in devfs_populate()
679 dm->dm_generation = gen; in devfs_populate()
683 * The caller needs to hold the dm for the duration of the call.
686 devfs_cleanup(struct devfs_mount *dm) in devfs_cleanup() argument
689 sx_assert(&dm->dm_lock, SX_XLOCKED); in devfs_cleanup()
690 while (devfs_populate_loop(dm, 1)) in devfs_cleanup()
692 devfs_purge(dm, dm->dm_rootdir); in devfs_cleanup()