1 #ifndef _OFD_ACCESS_BATCH_H_
2 #define _OFD_ACCESS_BATCH_H_
5 #include <linux/types.h>
6 #include <libcfs/util/list.h>
9 extern FILE *debug_file;
10 extern FILE *trace_file;
12 #define DEBUG(fmt, args...) \
14 if (debug_file != NULL) \
15 fprintf(debug_file, "DEBUG %s:%d: "fmt, \
16 __func__, __LINE__, ##args); \
19 #define TRACE(fmt, args...) \
21 if (trace_file != NULL) \
22 fprintf(trace_file, "TRACE "fmt, ##args); \
25 #define DEBUG_D(x) DEBUG("%s = %"PRIdMAX"\n", #x, (intmax_t)x)
26 #define DEBUG_P(x) DEBUG("%s = %p\n", #x, x)
27 #define DEBUG_S(x) DEBUG("%s = '%s'\n", #x, x)
28 #define DEBUG_U(x) DEBUG("%s = %"PRIuMAX"\n", #x, (uintmax_t)x)
30 #define ERROR(fmt, args...) \
31 fprintf(stderr, "%s: "fmt, program_invocation_short_name, ##args)
33 #define FATAL(fmt, args...) \
35 ERROR("FATAL: "fmt, ##args); \
41 extern unsigned long keepalive_interval;
43 struct alr_batch *alr_batch_create(unsigned int shift);
44 void alr_batch_destroy(struct alr_batch *alrb);
45 int alr_batch_add(struct alr_batch *alrb, const char *obd_name,
46 const struct lu_fid *pfid, time_t time, __u64 begin, __u64 end,
47 __u32 size, __u32 segment_count, __u32 flags);
48 int alr_batch_print(struct alr_batch *alrb, FILE *file,
49 pthread_mutex_t *file_mutex, int fraction);
52 * The code is inspired by the kernel list implementation. Hence, this has
53 * a weird param order to be consistent with the kernel list_replace_init().
55 static inline void list_replace_init(struct list_head *old_node,
56 struct list_head *new_node)
58 list_add(new_node, old_node);
59 list_del_init(old_node);
62 #endif /* _OFD_ACCESS_BATCH_H_ */