/share/man/man9/g_wither_geom.9

https://bitbucket.org/freebsd/freebsd-head/ · Unknown · 86 lines · 86 code · 0 blank · 0 comment · 0 complexity · d6f58a7742f78e45d4b0ceb1a3fdddf0 MD5 · raw file

  1. .\"
  2. .\" Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>
  3. .\" All rights reserved.
  4. .\"
  5. .\" Redistribution and use in source and binary forms, with or without
  6. .\" modification, are permitted provided that the following conditions
  7. .\" are met:
  8. .\" 1. Redistributions of source code must retain the above copyright
  9. .\" notice, this list of conditions and the following disclaimer.
  10. .\" 2. Redistributions in binary form must reproduce the above copyright
  11. .\" notice, this list of conditions and the following disclaimer in the
  12. .\" documentation and/or other materials provided with the distribution.
  13. .\"
  14. .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
  15. .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  16. .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  17. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
  18. .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  19. .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  20. .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  21. .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  23. .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. .\"
  25. .\" $FreeBSD$
  26. .\"
  27. .Dd January 16, 2004
  28. .Dt G_WITHER_GEOM 9
  29. .Os
  30. .Sh NAME
  31. .Nm g_wither_geom
  32. .Nd "destroy geom and related providers and consumers when you get a chance"
  33. .Sh SYNOPSIS
  34. .In geom/geom.h
  35. .Ft void
  36. .Fn g_wither_geom "struct g_geom *gp" "int error"
  37. .Sh DESCRIPTION
  38. The
  39. .Fn g_wither_geom
  40. function tells GEOM that geom
  41. .Fa gp
  42. is to be destroyed.
  43. GEOM sets an error on each provider of the given geom (in the
  44. orphaning process) and waits for a chance to destroy the geom.
  45. If the access count of any possessed consumer goes to 0, the consumer will be
  46. detached and destroyed automatically.
  47. If the last consumer attached to any possessed provider will be detached,
  48. the provider will be destroyed.
  49. If there are no more providers nor consumers, the geom will be
  50. destroyed.
  51. .Pp
  52. This is an automatic
  53. .Dq garbage collect
  54. to avoid duplicated code in all classes.
  55. Before it is called, field
  56. .Va softc
  57. should be disposed of and set to
  58. .Dv NULL .
  59. Note that the
  60. .Fn g_wither_geom
  61. function gives no guarantee that the geom will be immediately destroyed, mostly
  62. because the access counts of the geom's consumers and providers may not be 0.
  63. That is why calling this function for every geom from a given class is not enough
  64. to be sure that the class can be unloaded.
  65. .Sh RESTRICTIONS/CONDITIONS
  66. The argument
  67. .Fa error
  68. must be nonzero.
  69. .Pp
  70. The topology lock has to be held.
  71. .Sh SEE ALSO
  72. .Xr geom 4 ,
  73. .Xr DECLARE_GEOM_CLASS 9 ,
  74. .Xr g_access 9 ,
  75. .Xr g_attach 9 ,
  76. .Xr g_bio 9 ,
  77. .Xr g_consumer 9 ,
  78. .Xr g_data 9 ,
  79. .Xr g_event 9 ,
  80. .Xr g_geom 9 ,
  81. .Xr g_provider 9 ,
  82. .Xr g_provider_by_name 9
  83. .Sh AUTHORS
  84. .An -nosplit
  85. This manual page was written by
  86. .An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .