xref: /freebsd/lib/libufs/ufs_disk_close.3 (revision 772430dd67955850942d689714ab982da24257ba)
1e78ea9f7SJuli Mallett.\" Author:	Juli Mallett <jmallett@FreeBSD.org>
2e78ea9f7SJuli Mallett.\" Date:	June 04, 2003
3e78ea9f7SJuli Mallett.\" Description:
4e78ea9f7SJuli Mallett.\" 	Manual page for libufs functions:
5e78ea9f7SJuli Mallett.\"		ufs_disk_close(3)
6e78ea9f7SJuli Mallett.\"		ufs_disk_fillout(3)
7e78ea9f7SJuli Mallett.\"		ufs_disk_fillout_blank(3)
8e78ea9f7SJuli Mallett.\"		ufs_disk_write(3)
9e78ea9f7SJuli Mallett.\"
1027fd7478SJuli Mallett.\" This file is in the public domain.
1127fd7478SJuli Mallett.\"
12*772430ddSKirk McKusick.Dd November 17, 2023
13e78ea9f7SJuli Mallett.Dt UFS_DISK_CLOSE 3
14e78ea9f7SJuli Mallett.Os
15e78ea9f7SJuli Mallett.Sh NAME
16604f1c41SEdward Tomasz Napierala.Nm ufs_disk_close ,
17604f1c41SEdward Tomasz Napierala.Nm ufs_disk_fillout ,
18604f1c41SEdward Tomasz Napierala.Nm ufs_disk_fillout_blank ,
19604f1c41SEdward Tomasz Napierala.Nm ufs_disk_write
20e78ea9f7SJuli Mallett.Nd open and close userland UFS disks
21e78ea9f7SJuli Mallett.Sh LIBRARY
22e78ea9f7SJuli Mallett.Lb libufs
23e78ea9f7SJuli Mallett.Sh SYNOPSIS
24e78ea9f7SJuli Mallett.In sys/param.h
25e78ea9f7SJuli Mallett.In sys/mount.h
26e78ea9f7SJuli Mallett.In ufs/ufs/ufsmount.h
27e78ea9f7SJuli Mallett.In ufs/ufs/dinode.h
28e78ea9f7SJuli Mallett.In ufs/ffs/fs.h
29e78ea9f7SJuli Mallett.In libufs.h
30e78ea9f7SJuli Mallett.Ft int
31e78ea9f7SJuli Mallett.Fn ufs_disk_close "struct uufsd *disk"
32e78ea9f7SJuli Mallett.Ft int
33e78ea9f7SJuli Mallett.Fn ufs_disk_fillout "struct uufsd *disk" "const char *name"
34e78ea9f7SJuli Mallett.Ft int
35e78ea9f7SJuli Mallett.Fn ufs_disk_fillout_blank "struct uufsd *disk" "const char *name"
36e78ea9f7SJuli Mallett.Ft int
37e78ea9f7SJuli Mallett.Fn ufs_disk_write "struct uufsd *disk"
38e78ea9f7SJuli Mallett.Sh DESCRIPTION
39e78ea9f7SJuli MallettThe
40e78ea9f7SJuli Mallett.Fn ufs_disk_close
41e78ea9f7SJuli Mallettfunction closes a disk and frees internal memory related to it.
42e78ea9f7SJuli MallettIt does not free the
43e78ea9f7SJuli Mallett.Fa disk
44e78ea9f7SJuli Mallettstructure.
45e78ea9f7SJuli Mallett.Pp
46e78ea9f7SJuli MallettThe
47e78ea9f7SJuli Mallett.Fn ufs_disk_fillout
48e78ea9f7SJuli Mallettand
49e78ea9f7SJuli Mallett.Fn ufs_disk_fillout_blank
50e78ea9f7SJuli Mallettfunctions open a disk specified by
51e78ea9f7SJuli Mallett.Fa name
52e78ea9f7SJuli Mallettand populate the structure pointed to by
53e78ea9f7SJuli Mallett.Fa disk .
54*772430ddSKirk McKusickThe structure referenced by the
55*772430ddSKirk McKusick.Fa disk
56*772430ddSKirk McKusickpointer must be aligned to at least the alignment specified by
57*772430ddSKirk McKusick.Dv LIBUFS_ALIGN
58*772430ddSKirk McKusickthat is defined in the
59*772430ddSKirk McKusick.Lb libufs.h
60*772430ddSKirk McKusickheader file.
61e78ea9f7SJuli MallettThe disk is opened read-only.
62e78ea9f7SJuli MallettThe specified
63e78ea9f7SJuli Mallett.Fa name
64990b6d05SJuli Mallettmay be either a mountpoint, a device name or a filesystem image.
65e78ea9f7SJuli MallettThe
66e78ea9f7SJuli Mallett.Fn ufs_disk_fillout
67e78ea9f7SJuli Mallettfunction assumes there is a valid superblock and will fail if not,
68e78ea9f7SJuli Mallettwhereas the
69e78ea9f7SJuli Mallett.Fn ufs_disk_fillout_blank
70e78ea9f7SJuli Mallettfunction makes no assumptions of that sort.
71e78ea9f7SJuli Mallett.Pp
72e78ea9f7SJuli MallettThe
73e78ea9f7SJuli Mallett.Fn ufs_disk_write
74e78ea9f7SJuli Mallettfunction attempts to re-open a disk as writable if it is not currently.
75e78ea9f7SJuli Mallett.Sh ERRORS
76e78ea9f7SJuli MallettThe function
77e78ea9f7SJuli Mallett.Fn ufs_disk_close
78e78ea9f7SJuli Malletthas no failure points.
79e78ea9f7SJuli Mallett.Pp
80e78ea9f7SJuli MallettThe function
81e78ea9f7SJuli Mallett.Fn ufs_disk_fillout
82e78ea9f7SJuli Mallettmay fail for any of the reasons
83e78ea9f7SJuli Mallett.Fn ufs_disk_fillout_blank
84e78ea9f7SJuli Mallettmight, as well as for any reason
85e78ea9f7SJuli Mallett.Xr sbread 3
86e78ea9f7SJuli Mallettmight.
87e78ea9f7SJuli Mallett.Pp
88e78ea9f7SJuli MallettThe
89e78ea9f7SJuli Mallett.Fn ufs_disk_fillout_blank
90e78ea9f7SJuli Mallettmay fail and set
91e78ea9f7SJuli Mallett.Va errno
92e78ea9f7SJuli Mallettfor any of the errors specified for the library functions
93e78ea9f7SJuli Mallett.Xr open 2 ,
94dfa13bbfSJuli Mallett.Xr strdup 3 .
95e78ea9f7SJuli MallettAdditionally, it may follow the
96e78ea9f7SJuli Mallett.Xr libufs 3
97e78ea9f7SJuli Malletterror methodologies in situations where no device could be found to
98e78ea9f7SJuli Mallettopen.
99e78ea9f7SJuli Mallett.Pp
100e78ea9f7SJuli MallettThe function
101e78ea9f7SJuli Mallett.Fn ufs_disk_write
102e78ea9f7SJuli Mallettmay fail and set
103e78ea9f7SJuli Mallett.Va errno
104e78ea9f7SJuli Mallettfor any of the errors specified for the library functions
1055c8e5f24SRuslan Ermilov.Xr open 2
106e78ea9f7SJuli Mallettand
1075c8e5f24SRuslan Ermilov.Xr stat 2 .
108e78ea9f7SJuli MallettNamely, it will fail if the disk in question may not be written to.
109e78ea9f7SJuli Mallett.Sh SEE ALSO
1105c8e5f24SRuslan Ermilov.Xr open 2 ,
111e78ea9f7SJuli Mallett.Xr getfsfile 3 ,
112e78ea9f7SJuli Mallett.Xr libufs 3 ,
113e78ea9f7SJuli Mallett.Xr sbread 3
114e78ea9f7SJuli Mallett.Sh HISTORY
115e78ea9f7SJuli MallettThese functions first appeared as part of
116e78ea9f7SJuli Mallett.Xr libufs 3
117e78ea9f7SJuli Mallettin
118e78ea9f7SJuli Mallett.Fx 5.0 .
119e78ea9f7SJuli Mallett.Sh AUTHORS
1202b7af31cSBaptiste Daroussin.An Juli Mallett Aq Mt jmallett@FreeBSD.org
121