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