File: node.h

package info (click to toggle)
xfsdump 3.2.0-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,012 kB
  • sloc: ansic: 45,797; sh: 3,449; makefile: 512
file content (64 lines) | stat: -rw-r--r-- 2,132 bytes parent folder | download | duplicates (3)
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
/*
 * Copyright (c) 2000-2001 Silicon Graphics, Inc.
 * All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it would be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write the Free Software Foundation,
 * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
#ifndef NODE_H
#define NODE_H

/* node.[ch] - abstract pool of nodes
 *
 * operators alloc, free, map, and unmap nodes.
 */

typedef size32_t nh_t;
#define NH_NULL	SIZE32MAX

/* node_init - creates a new node abstraction.
 * user reserves one byte per node for use by the node abstraction
 */
extern bool_t node_init(int fd,		/* backing store */
		         off64_t off,		/* offset into backing store */
		         size_t nodesz,		/* node size */
		         ix_t nodehkix,		/* my housekeeping byte */
		         size_t alignsz,	/* node alignment requirement */
		         size64_t vmsz,		/* abstractions's share of VM */
		         size64_t dir_nondir);	/* num of dirs + nondirs */

/* node_sync - syncs up with existing node abstraction persistent state
 */
extern bool_t node_sync(int fd, off64_t off);

/* node_alloc - allocates a node, returning a handle.
 * returns NULL handle if no space left.
 */
extern nh_t node_alloc(void);

/* node_map - returns a pointer to the node identified by the node handle.
 * pointer remains valid until node_unmap called.
 */
extern void *node_map(nh_t node_handle);

/* node_unmap - unmaps the node.
 * SIDE-EFFECT: sets *nodepp to 0.
 */
extern void node_unmap(nh_t node_handle, void **nodepp);

/* node_free - frees a previously allocated node.
 * SIDE-EFFECT: sets *node_handlep to NODE_HANDLE_NULL.
 */
extern void node_free(nh_t *node_handlep);

#endif /* NODE_H */