summaryrefslogtreecommitdiffstats
path: root/lib/libufs/getino.3
blob: 541ef50a42b4ce35fc955861d40898e13a1a7c3c (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
113
114
115
116
117
.\" Author:	Juli Mallett <jmallett@FreeBSD.org>
.\" Date:	June 04, 2003
.\" Description:
.\" 	Manual page for libufs functions:
.\"		getino(3)
.\"		putino(3)
.\"
.\" This file is in the public domain.
.\"
.\" $FreeBSD$
.\"
.Dd June 04, 2003
.Dt GETINO 3
.Os
.Sh NAME
.Nm getino , putino
.Nd get and put inodes to and from UFS disks
.Sh LIBRARY
.Lb libufs
.Sh SYNOPSIS
.In sys/types.h
.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 getino "struct uufsd *disk" "void *dino" "ino_t inode"
.Ft int
.Fn putino "struct uufsd *disk" "void *dino" "ino_t inode"
.Sh DESCRIPTION
The
.Fn getino
and
.Fn putino
functions provide the ability to put an inode to disk or read an
inode from disk for
.Xr libufs 3
consumers.
The
.Fn getino
function reads the inode specified by
.Fa inode ,
and puts a pointer to an inode with the correct type into the memory
pointed to by
.Fa dino .
It maintains a cache of nearby inodes, and may simply return pointers
into memory that are in said cache.
The pointer it returns may be modified as if it were of the type
.Dq struct ufs1_dinode
or
.Dq struct ufs2_dinode
depending on whether the disk being operated on is UFS1 or UFS2,
respectively.
.Pp
The
.Fn putino
function puts an inode specified to be
.Fa inode
to disk, given memory passed in the
.Fa dino
pointer, in exactly the same manner as an inode is retrieved into
.Fa dino
by
.Fn getino .
Calls to
.Fn putino
immediately invalidate the inode cache.
.Pp
Both functions return 0 on success and -1 on error.
.Sh ERRORS
The function
.Fn getino
may fail and set
.Va errno
for any of the errors specified for the library functions
.Xr bread 3
and
.Xr malloc 3 .
Additionally, error may be returned if the inode format cannot be
determined.
Error reporting conventions for
.Xr libufs 3
functions are followed.
.Pp
The function
.Fn putino
may fail and set
.Va errno
for any of the errors specified for the library functions
.Xr bwrite 3 .
Additionally, error may be returned if the inode format cannot be
determined, or if the
.Fa dino
parameter is
.Dv NULL .
In the latter case, where
.Fa dino
is unusable,
.Va errno
is set to
.Er EDOOFUS .
Error reporting conventions for
.Xr libufs 3
functions are followed.
.Sh SEE ALSO
.Xr bread 3 ,
.Xr bwrite 3 ,
.Xr libufs 3
.Sh HISTORY
These functions first appeared as part of
.Xr libufs 3
in
.Fx 5.1 .
.Sh AUTHORS
.An Juli Mallett Aq jmallett@FreeBSD.org
OpenPOWER on IntegriCloud