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