|
Packit |
8480eb |
/* ----------------------------------------------------------------------- *
|
|
Packit |
8480eb |
*
|
|
Packit |
8480eb |
* repl_list.h - header file for replicated mount server selection
|
|
Packit |
8480eb |
*
|
|
Packit |
8480eb |
* Copyright 2004 Jeff Moyer <jmoyer@redaht.com> - All Rights Reserved
|
|
Packit |
8480eb |
* Copyright 2004-2006 Ian Kent <raven@themaw.net> - All Rights Reserved
|
|
Packit |
8480eb |
*
|
|
Packit |
8480eb |
* This program is free software; you can redistribute it and/or modify
|
|
Packit |
8480eb |
* it under the terms of the GNU General Public License as published by
|
|
Packit |
8480eb |
* the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
|
|
Packit |
8480eb |
* USA; either version 2 of the License, or (at your option) any later
|
|
Packit |
8480eb |
* version; incorporated herein by reference.
|
|
Packit |
8480eb |
*
|
|
Packit |
8480eb |
* ----------------------------------------------------------------------- */
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#ifndef _REPLICATED_H
|
|
Packit |
8480eb |
#define _REPLICATED_H
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#define PROXIMITY_ERROR 0x0000
|
|
Packit |
8480eb |
#define PROXIMITY_LOCAL 0x0001
|
|
Packit |
8480eb |
#define PROXIMITY_SUBNET 0x0002
|
|
Packit |
8480eb |
#define PROXIMITY_NET 0x0004
|
|
Packit |
8480eb |
#define PROXIMITY_OTHER 0x0008
|
|
Packit |
8480eb |
#define PROXIMITY_UNSUPPORTED 0x0010
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#define NFS2_SUPPORTED 0x0010
|
|
Packit |
8480eb |
#define NFS3_SUPPORTED 0x0020
|
|
Packit |
8480eb |
#define NFS4_SUPPORTED 0x0040
|
|
Packit |
5ceea8 |
#define NFS_VERS_DEFAULT (NFS3_SUPPORTED)
|
|
Packit |
5ceea8 |
#define NFS_VERS_MASK (NFS2_SUPPORTED|NFS3_SUPPORTED)
|
|
Packit |
5ceea8 |
#define NFS4_VERS_DEFAULT (NFS4_SUPPORTED)
|
|
Packit |
8480eb |
#define NFS4_VERS_MASK (NFS4_SUPPORTED)
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#define NFS2_REQUESTED NFS2_SUPPORTED
|
|
Packit |
8480eb |
#define NFS3_REQUESTED NFS3_SUPPORTED
|
|
Packit |
8480eb |
#define NFS4_REQUESTED NFS4_SUPPORTED
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#define TCP_SUPPORTED 0x0001
|
|
Packit |
8480eb |
#define UDP_SUPPORTED 0x0002
|
|
Packit |
8480eb |
#define TCP_REQUESTED TCP_SUPPORTED
|
|
Packit |
8480eb |
#define UDP_REQUESTED UDP_SUPPORTED
|
|
Packit |
8480eb |
#define TCP6_REQUESTED 0x0100
|
|
Packit |
8480eb |
#define UDP6_REQUESTED 0x0200
|
|
Packit |
5ceea8 |
#define NFS_PROTO_DEFAULT (TCP_SUPPORTED|UDP_SUPPORTED)
|
|
Packit |
8480eb |
#define NFS_PROTO_MASK (TCP_SUPPORTED|UDP_SUPPORTED)
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#define NFS2_TCP_SUPPORTED NFS2_SUPPORTED
|
|
Packit |
8480eb |
#define NFS3_TCP_SUPPORTED NFS3_SUPPORTED
|
|
Packit |
8480eb |
#define NFS4_TCP_SUPPORTED NFS4_SUPPORTED
|
|
Packit |
8480eb |
#define NFS2_UDP_SUPPORTED (NFS2_SUPPORTED << 8)
|
|
Packit |
8480eb |
#define NFS3_UDP_SUPPORTED (NFS3_SUPPORTED << 8)
|
|
Packit |
8480eb |
#define NFS4_UDP_SUPPORTED (NFS4_SUPPORTED << 8)
|
|
Packit |
8480eb |
#define TCP_SELECTED_MASK 0x00FF
|
|
Packit |
8480eb |
#define UDP_SELECTED_MASK 0xFF00
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#define IS_ERR(supported) (0x8000 & supported)
|
|
Packit |
8480eb |
#define ERR(supported) (IS_ERR(supported) ? (~supported + 1) : supported)
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#define RPC_TIMEOUT 5
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
struct host {
|
|
Packit |
8480eb |
char *name;
|
|
Packit |
ddb570 |
int ent_num;
|
|
Packit |
8480eb |
struct sockaddr *addr;
|
|
Packit |
8480eb |
size_t addr_len;
|
|
Packit |
8480eb |
unsigned int rr;
|
|
Packit |
8480eb |
char *path;
|
|
Packit |
8480eb |
unsigned int version;
|
|
Packit |
8480eb |
unsigned int options;
|
|
Packit |
8480eb |
unsigned int proximity;
|
|
Packit |
8480eb |
unsigned int weight;
|
|
Packit |
8480eb |
unsigned long cost;
|
|
Packit |
8480eb |
struct host *next;
|
|
Packit |
8480eb |
};
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
void seed_random(void);
|
|
Packit |
ddb570 |
struct host *new_host(const char *, int, struct sockaddr *, size_t,
|
|
Packit |
8480eb |
unsigned int, unsigned int, unsigned int);
|
|
Packit |
8480eb |
void free_host_list(struct host **);
|
|
Packit |
8480eb |
int parse_location(unsigned, struct host **, const char *, unsigned int);
|
|
Packit |
8480eb |
int prune_host_list(unsigned, struct host **, unsigned int, int);
|
|
Packit |
8480eb |
void dump_host_list(struct host *);
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#endif
|
|
Packit |
8480eb |
|