xref: /freebsd/lib/libufs/ufs_disk_close.3 (revision f4f56ff43dbd30930f4b018e39ba2b9abf84551f)
1.\" Author:	Juli Mallett <jmallett@FreeBSD.org>
2.\" Date:	June 04, 2003
3.\" Description:
4.\" 	Manual page for libufs functions:
5.\"		ufs_disk_close(3)
6.\"		ufs_disk_fillout(3)
7.\"		ufs_disk_fillout_blank(3)
8.\"		ufs_disk_write(3)
9.\"
10.\" This file is in the public domain.
11.\"
12.\" $FreeBSD$
13.\"
14.Dd June 4, 2003
15.Dt UFS_DISK_CLOSE 3
16.Os
17.Sh NAME
18.Nm ufs_disk_close ,
19.Nm ufs_disk_fillout ,
20.Nm ufs_disk_fillout_blank ,
21.Nm ufs_disk_write
22.Nd open and close userland UFS disks
23.Sh LIBRARY
24.Lb libufs
25.Sh SYNOPSIS
26.In sys/param.h
27.In sys/mount.h
28.In ufs/ufs/ufsmount.h
29.In ufs/ufs/dinode.h
30.In ufs/ffs/fs.h
31.In libufs.h
32.Ft int
33.Fn ufs_disk_close "struct uufsd *disk"
34.Ft int
35.Fn ufs_disk_fillout "struct uufsd *disk" "const char *name"
36.Ft int
37.Fn ufs_disk_fillout_blank "struct uufsd *disk" "const char *name"
38.Ft int
39.Fn ufs_disk_write "struct uufsd *disk"
40.Sh DESCRIPTION
41The
42.Fn ufs_disk_close
43function closes a disk and frees internal memory related to it.
44It does not free the
45.Fa disk
46structure.
47.Pp
48The
49.Fn ufs_disk_fillout
50and
51.Fn ufs_disk_fillout_blank
52functions open a disk specified by
53.Fa name
54and populate the structure pointed to by
55.Fa disk .
56The disk is opened read-only.
57The specified
58.Fa name
59may be either a mountpoint, a device name or a filesystem image.
60The
61.Fn ufs_disk_fillout
62function assumes there is a valid superblock and will fail if not,
63whereas the
64.Fn ufs_disk_fillout_blank
65function makes no assumptions of that sort.
66.Pp
67The
68.Fn ufs_disk_write
69function attempts to re-open a disk as writable if it is not currently.
70.Sh ERRORS
71The function
72.Fn ufs_disk_close
73has no failure points.
74.Pp
75The function
76.Fn ufs_disk_fillout
77may fail for any of the reasons
78.Fn ufs_disk_fillout_blank
79might, as well as for any reason
80.Xr sbread 3
81might.
82.Pp
83The
84.Fn ufs_disk_fillout_blank
85may fail and set
86.Va errno
87for any of the errors specified for the library functions
88.Xr open 2 ,
89.Xr strdup 3 .
90Additionally, it may follow the
91.Xr libufs 3
92error methodologies in situations where no device could be found to
93open.
94.Pp
95The function
96.Fn ufs_disk_write
97may fail and set
98.Va errno
99for any of the errors specified for the library functions
100.Xr open 2
101and
102.Xr stat 2 .
103Namely, it will fail if the disk in question may not be written to.
104.Sh SEE ALSO
105.Xr open 2 ,
106.Xr getfsfile 3 ,
107.Xr libufs 3 ,
108.Xr sbread 3
109.Sh HISTORY
110These functions first appeared as part of
111.Xr libufs 3
112in
113.Fx 5.0 .
114.Sh AUTHORS
115.An Juli Mallett Aq Mt jmallett@FreeBSD.org
116