Skip to content

Commit ffde7d1

Browse files
committed
- Unbreak ndmpd server on FreeBSD HEAD(12) and FreeBSD Stable(11).
1 parent 85b78dd commit ffde7d1

20 files changed

Lines changed: 112 additions & 168 deletions

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ TLM_SRCS = tlm/tlm_util.c \
3030
tlm/tlm_info.c \
3131
tlm/tlm_hardlink.c
3232

33-
#LDADD = -lmd -lpthread -lc
34-
LDADD = -lmd -lpthread -lc -lzfs -lzfs_core -lnvpair -lumem -lbsm
33+
LDADD = -lmd -lpthread -lc
3534
MAN=
3635
CFLAGS += -I. -I./include
37-
CFLAGS+= -DEMC_MODEL
3836

3937
PREFIX ?= /usr/local
4038
DSTDIR = ${PREFIX}/sbin

include/ndmp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright 2009 Sun Microsystems, Inc.
3+
* Copyright 2017 Marcelo Araujo <araujo@FreeBSD.org>.
34
* All rights reserved.
45
*
56
* Use is subject to license terms.
@@ -1259,7 +1260,7 @@ typedef enum ndmp_connect_reason ndmp_connect_reason;
12591260
struct ndmp_notify_connected_request {
12601261
ndmp_connect_reason reason;
12611262
u_short protocol_version;
1262-
const char *text_reason;
1263+
char *text_reason;
12631264
};
12641265
typedef struct ndmp_notify_connected_request ndmp_notify_connected_request;
12651266

include/ndmp.x

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Copyright 1996, 1997 PDC, Network Appliance.
33
* Copyright 2009 Sun Microsystems, Inc.
4+
* Copyright 2015 Marcelo Araujo <araujo@FreeBSD.org>.
45
* All rights reserved.
56
*
67
* Use is subject to license terms.

include/ndmpd.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright 2009 Sun Microsystems, Inc.
3-
* Copyright 2015 Marcelo Araujo <araujo@FreeBSD.org>.
3+
* Copyright 2017 Marcelo Araujo <araujo@FreeBSD.org>.
44
* All rights reserved.
55
*
66
* Use is subject to license terms.
@@ -47,7 +47,6 @@
4747
#include <sys/socket.h>
4848
#include <string.h> /* memset */
4949
#include <unistd.h> /* close */
50-
#include <stdio.h>
5150

5251
/* free() */
5352
#include <stdlib.h>
@@ -319,6 +318,5 @@ int ndmp_run(u_long port, ndmp_con_handler_func_t con_handler_func);
319318
void connection_handler(ndmp_connection_t *connection);
320319
bool_t file_exists(const char * filename);
321320
int startNDMPD(void);
322-
static char * getline_ndmpd(FILE *fp, char *line, int llen);
323321

324322
#endif /* _NDMPD_H_ */

include/ndmpd_fhistory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright 2009 Sun Microsystems, Inc.
3+
* Copyright 2017 Marcelo Araujo <araujo@FreeBSD.org>.
34
* All rights reserved.
45
*
56
* Use is subject to license terms.
@@ -60,6 +61,5 @@ int ndmpd_fhnode_v3_cb(lbr_fhlog_call_backs_t *cbp, char *dir, char *file,
6061
struct stat *stp, u_longlong_t off);
6162
int ndmpd_path_restored_v3(lbr_fhlog_call_backs_t *cbp, char *name,
6263
struct stat *st, u_longlong_t ll_idx);
63-
char *get_bk_path_v3(ndmpd_module_params_t *params);
6464

6565
#endif /* _NDMPD_FHISTORY_H */

include/ndmpd_prop.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright 2009 Sun Microsystems, Inc.
3+
* Copyright 2017 Marcelo Araujo <araujo@FreeBSD.org>.
34
* All rights reserved.
45
*
56
* Use is subject to license terms.
@@ -123,8 +124,6 @@ int ndmpd_load_prop(const char *);
123124
char *ndmpd_get_prop(ndmpd_cfg_id_t id);
124125
char *ndmpd_get_prop_default(ndmpd_cfg_id_t id, char *dflt);
125126
int ndmpd_get_prop_yorn(ndmpd_cfg_id_t id);
126-
void print_prop(void);
127-
void setup(char *line);
128127

129128
#ifdef __cplusplus
130129
}

include/ndmpd_tar_v3.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright 2009 Sun Microsystems, Inc.
3+
* Copyright 2017 Marcelo Araujo <araujo@FreeBSD.org>.
34
* All rights reserved.
45
*
56
* Use is subject to license terms.
@@ -55,7 +56,6 @@
5556

5657
extern bool_t ndmp_ignore_ctime;
5758
extern bool_t ndmp_include_lmtime;
58-
extern int multiple_dest_restore;
5959

6060
/* Defined */
6161
ndmp_error ndmp_restore_get_params_v3(ndmpd_session_t *session,
@@ -67,7 +67,5 @@ int ndmp_send_recovery_stat_v3(ndmpd_module_params_t *params,
6767

6868
void setWriteBufDone(tlm_buffers_t *bufs);
6969
void setReadBufDone(tlm_buffers_t *bufs);
70-
char ** setupsels(ndmpd_session_t *session, ndmpd_module_params_t *params,
71-
ndmp_lbr_params_t *nlp, int index);
7270

7371
#endif /* _NDMPD_TAR_V3_ */

include/ndmpd_util.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright 2009 Sun Microsystems, Inc.
3+
* Copyright 2017 Marcelo Araujo <araujo@FreeBSD.org>.
34
* All rights reserved.
45
*
56
* Use is subject to license terms.
@@ -65,11 +66,6 @@
6566
#define IN_ADDR(x) \
6667
(*(struct in_addr *)&x)
6768

68-
/*
69-
* Mutex to protect Nlp
70-
*/
71-
extern mutex_t nlp_mtx;
72-
7369
/* defined in ndmpd_func */
7470
extern int ndmp_full_restore_path;
7571
extern int ndmp_ver;
@@ -108,7 +104,7 @@ void ndmp_session_ref(ndmpd_session_t *session);
108104
void ndmp_session_unref(ndmpd_session_t *session);
109105

110106
char *ndmp_new_job_name(char *jname);
111-
int ndmp_get_cur_bk_time(ndmp_lbr_params_t *nlp, time_t *tp);
107+
int ndmp_get_cur_bk_time(ndmp_lbr_params_t *nlp, time_t *tp, char *jname);
112108
long ndmp_buffer_get_size(ndmpd_session_t *session);
113109
void ndmpd_get_file_entry_type(int mode, ndmp_file_type *ftype);
114110
char *ndmp_get_relative_path(char *base, char *fullpath);
@@ -120,7 +116,7 @@ void ndmp_lbr_cleanup(ndmpd_session_t *session);
120116

121117
bool_t ndmp_valid_v3addr_type(ndmp_addr_type type);
122118
int ndmp_connect_sock_v3(u_long addr, u_short port);
123-
const char **ndmpd_make_exc_list(void);
119+
char **ndmpd_make_exc_list(void);
124120

125121
bool_t fs_is_valid_logvol(char *path);
126122
char *ndmpd_mk_temp(char *buf);
@@ -149,7 +145,7 @@ void ndmp_copy_addr_v4(ndmp_addr_v4 *dst, ndmp_addr_v4 *src);
149145
int ndmp_lbr_init(ndmpd_session_t *session);
150146
void ndmp_copy_addr_v3(ndmp_addr_v3 *dst, ndmp_addr_v3 *src);
151147

152-
const char *cctime(time_t *t);
148+
char *cctime(time_t *t);
153149

154150
char *ndmp_base64_encode(char *);
155151
char *ndmp_base64_decode(char *);

include/tlm_util.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright 2009 Sun Microsystems, Inc.
3+
* Copyright 2017 Marcelo Araujo <araujo@FreeBSD.org>.
34
* All rights reserved.
45
*
56
* Use is subject to license terms.
@@ -69,6 +70,7 @@ int cstack_pop(cstack_t *stk, void **data, int *len);
6970
int cstack_top(cstack_t *stk, void **data, int *len);
7071
bool_t match(char *patn, char *str);
7172
int match_ci(char *patn, char *str);
73+
static bool_t parse_match(char line, char *seps);
7274
char *parse(char **line, char *seps);
7375
int oct_atoi(char *p);
7476
char *strupr(char *s);

out/test_tool/ndmpc

100644100755
File mode changed.

0 commit comments

Comments
 (0)