File: rmtab.h

package info (click to toggle)
redhat-cluster 3.1.8-1.2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,608 kB
  • ctags: 6,306
  • sloc: ansic: 62,895; sh: 1,626; makefile: 1,143; perl: 765
file content (101 lines) | stat: -rw-r--r-- 2,250 bytes parent folder | download | duplicates (4)
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
/** @file
 * Header for rmtab.c.
 */
/*
 * Author: Lon H. Hohberger <lhh at redhat.com>
 */
#ifndef _RMTAB_H
#define _RMTAB_H

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>

/* Shamelessly ripped from nfs-utils */
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 64
#endif

#ifndef _PATH_RMTAB
#define _PATH_RMTAB "/var/lib/nfs/rmtab"
#endif

/* private types */
#ifndef MSG_RMTAB_UPDATE
#define MSG_RMTAB_UPDATE 978
#endif

#ifndef MSG_RMTAB_BOOT
#define MSG_RMTAB_BOOT 603
#endif

/* Just a mem-size trim for now */
#define __MAXPATHLEN 1024

/**
 * rmtab node list entry.
 *
 * This contains all the information necessary to reconstruct a line in
 * /var/lib/nfs/rmtab.
 */
typedef struct _rmtab_node {
	struct _rmtab_node *rn_next;	/**< Next pointer */
	char *rn_hostname;		/**< Mount entry hostname */
	char *rn_path;			/**< Export mounted */
	uint32_t rn_count;		/**< Number of times export is
					     mounted. */
} rmtab_node;


/*
 * list addition (insert)
 */
int __rmtab_insert(rmtab_node **head, rmtab_node *rnew);
rmtab_node *rmtab_insert(rmtab_node **head, rmtab_node *pre, char *host,
			 char *path, int count);

/*
 * list deletion/removal/etc.
 */
rmtab_node *__rmtab_remove(rmtab_node **head, rmtab_node *entry);
rmtab_node *rmtab_remove(rmtab_node **head, char *host, char *path);
void rmtab_kill(rmtab_node **head);

/*
 * diff/merge functions
 */
int rmtab_diff(rmtab_node *old, rmtab_node *new, rmtab_node **diff);
int rmtab_merge(rmtab_node **head, rmtab_node *patch);

/*
 * Read/write/import/export...
 */
int rmtab_import(rmtab_node **head, FILE *fp);
int rmtab_export(rmtab_node *head, FILE *fp);

int rmtab_read(rmtab_node **head, char *filename);
int rmtab_write_atomic(rmtab_node *head, char *filename);

/*
 * Translation to/from network block [array] style
 */
int rmtab_pack(char *dest, rmtab_node *head);
int rmtab_unpack(rmtab_node **dest, char *src, size_t srclen);

/*
 * utility functions
 */
int rmtab_cmp_min(rmtab_node *left, rmtab_node *right);
int rmtab_cmp(rmtab_node *left, rmtab_node *right);
size_t rmtab_pack_size(rmtab_node *head);
int rmtab_move(rmtab_node **dest, rmtab_node **src);

/*
 * DEBUG junk
 */
#ifdef DEBUG
int rmtab_dump(rmtab_node *head);
#endif

#endif