]> git.decadent.org.uk Git - nfs-utils.git/blob - utils/statd/statd.h
Support "-P path" in statd as alternate to /var/lib/nfs
[nfs-utils.git] / utils / statd / statd.h
1 /* 
2  * Copyright (C) 1995-1997, 1999 Jeffrey A. Uphoff
3  * Modified by Olaf Kirch, Dec. 1996.
4  *
5  * NSM for Linux.
6  */
7
8 #include "config.h"
9 #include "sm_inter.h"
10 #include "system.h"
11 #include "log.h"
12
13 /*
14  * Paths and filenames.
15  */
16 #if defined(NFS_STATEDIR)
17 # define DEFAULT_DIR_BASE       NFS_STATEDIR "/"
18 #else
19 # define DEFAULT_DIR_BASE       "/var/lib/nfs/"
20 #endif
21
22 #define DEFAULT_SM_DIR          DEFAULT_DIR_BASE "sm"
23 #define DEFAULT_SM_BAK_DIR      DEFAULT_DIR_BASE "sm.bak"
24 #define DEFAULT_SM_STAT_PATH    DEFAULT_DIR_BASE "state"
25
26 /* Added to support run-time specification of state directory path.
27  * j_carlos_gomez@yahoo.com
28  */
29
30 extern char * DIR_BASE;
31 extern char *  SM_DIR;
32 extern char *  SM_BAK_DIR;
33 extern char *  SM_STAT_PATH;
34
35 /*
36  * Status definitions.
37  */
38 #define STAT_FAIL       stat_fail
39 #define STAT_SUCC       stat_succ
40
41 /*
42  * Function prototypes.
43  */
44 extern void     change_state(void);
45 extern void     do_regist(u_long, void (*)());
46 extern void     my_svc_run(void);
47 extern void     notify_hosts(void);
48 extern void     shuffle_dirs(void);
49 extern int      process_notify_list(void);
50 extern int      process_reply(FD_SET_TYPE *);
51 extern char *   xstrdup(const char *);
52 extern void *   xmalloc(size_t);
53 extern void     xunlink (char *, char *, short int);
54
55 /*
56  * Host status structure and macros.
57  */
58 stat_chge               SM_stat_chge;
59 #define MY_NAME         SM_stat_chge.mon_name
60 #define MY_STATE        SM_stat_chge.state
61
62 /*
63  * Some timeout values.  (Timeout values are in whole seconds.)
64  */
65 #define CALLBACK_TIMEOUT         3 /* For client call-backs. */
66 #define NOTIFY_TIMEOUT           5 /* For status-change notifications. */
67 #define SELECT_TIMEOUT          10 /* Max select() timeout when work to do. */
68 #define MAX_TRIES                5 /* Max number of tries for any host. */
69
70 /*
71  * Modes of operation - Lon
72  */
73 extern int run_mode;
74 #define MODE_NODAEMON 1         /* No-daemon/foreground mode. */
75 #define MODE_LOG_STDERR 2       /* in foreground mode, log to stderr */
76 /*#define MODE_NOTIFY_ONLY 4*/  /* Send SM_NOTIFY to everyone monitored on
77                                    a single interface/alias */
78 /* LH - notify_only mode would be for notifying hosts on an IP alias
79  * that just came back up, for ex, when failing over a HA service to
80  * another host.... */
81
82 /*
83  * Program name and version pointers -- See statd.c for the reasoning
84  * as to why they're global.
85  */
86 extern char *name_p;            /* program basename */
87 extern char *version_p;         /* program version */