00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __EST_OPS_H__
00010 #define __EST_OPS_H__
00011
00012
00013 #include "global.h"
00014 #include "waa.h"
00015 #include "props.h"
00016 #include "options.h"
00017
00023 int ops__build_path(char **path,
00024 struct estat *sts);
00026 int ops__calc_path_len(struct estat *sts);
00028 int ops__stat_to_action(struct estat *sts, struct sstat_t *new);
00029
00033 int ops__find_entry_byname(struct estat *dir,
00034 char *name,
00035 struct estat **sts, int ignored_too);
00037 int ops__find_entry_byinode(struct estat *dir,
00038 dev_t dev,
00039 ino_t inode,
00040 struct estat **sts);
00042 #define UNKNOWN_INDEX (-1)
00043
00045 int ops__delete_entry(struct estat *dir,
00046 struct estat *sts,
00047 int index_byinode,
00048 int index_byname);
00053 int ops__allocate(int needed, struct estat **where, int *count);
00055 int ops__free_entry(struct estat **sts_p);
00057 int ops__free_marked(struct estat *dir, int fast_mode);
00059 int ops__new_entries(struct estat *dir,
00060 int count,
00061 struct estat **new_entries);
00062
00065 int ops__save_1entry(struct estat *sts,
00066 ino_t parent_ino,
00067 int filehandle);
00069 int ops__load_1entry(char **where, struct estat *sts, char **filename,
00070 ino_t *parent_i);
00072 int ops__update_single_entry(struct estat *sts, struct sstat_t *output);
00074 int ops__update_filter_set_bits(struct estat *sts);
00075
00078 int ops__string_to_dev(struct estat *sts, char *data, char **info);
00081 char *ops__dev_to_waa_string(struct estat *sts);
00084 char *ops__dev_to_filedata(struct estat *sts);
00086 int ops__read_special_entry(apr_file_t *a_stream,
00087 char **data,
00088 int max, ssize_t *real_len,
00089 char *filename,
00090 apr_pool_t *pool);
00091
00093 int ops__link_to_string(struct estat *sts, char *filename,
00094 char **erg);
00095
00097 char *ops__get_filename(char *path);
00098
00100 void ops__copy_single_entry(struct estat *src, struct estat *dest);
00101
00103 int ops__traverse(struct estat *parent, char *relative_path,
00104 int flags, int sts_flags,
00105 struct estat **ret);
00106
00109 void ops__set_todo_bits(struct estat *sts);
00112 int ops__are_children_interesting(struct estat *dir);
00113
00115 int ops__apply_group(struct estat *sts, hash_t *props,
00116 apr_pool_t *pool);
00117
00120 int ops__make_shadow_entry(struct estat *sts, int flags);
00121 #define SHADOWED_BY_REMOTE (1)
00122 #define SHADOWED_BY_LOCAL (2)
00123
00124
00125 #ifdef ENABLE_RELEASE
00126 static inline void DEBUGP_dump_estat(struct estat *sts UNUSED) { }
00127 #else
00128 void DEBUGP_dump_estat(struct estat *sts);
00129 #endif
00130
00131 inline static int ops__allowed_by_filter(struct estat *sts)
00132 {
00133 #ifdef ENABLE_DEBUG
00134 BUG_ON(!sts->do_filter_allows_done,
00135 "%s: do_filter_allows not done", sts->name);
00136 #endif
00137 return sts->do_filter_allows;
00138 }
00139
00140 inline static int ops__calc_filter_bit(struct estat *sts)
00141 {
00142 sts->do_filter_allows_done=1;
00143
00144 sts->do_filter_allows =
00145 opt__get_int(OPT__FILTER) == FILTER__ALL ||
00146
00147 (sts->entry_status & opt__get_int(OPT__FILTER));
00148
00149 return sts->do_filter_allows;
00150 }
00151
00158 typedef int (*ops__correlate_fn1_t)(struct estat *, struct estat **);
00159 typedef int (*ops__correlate_fn2_t)(struct estat *, struct estat *);
00161 int ops__correlate_dirs(struct estat *dir_A, struct estat *dir_B,
00162 ops__correlate_fn1_t only_A,
00163 ops__correlate_fn2_t both,
00164 ops__correlate_fn1_t only_B,
00165 ops__correlate_fn2_t for_every);
00170 extern const char link_spec[],
00171 cdev_spec[],
00172 bdev_spec[];
00173
00174 #define ops__mark_childchanged(start, field) \
00175 do { \
00176 register struct estat *_s=(start); \
00177 while (_s && !(_s->field & FS_CHILD_CHANGED)) \
00178 { \
00179 _s->field |= FS_CHILD_CHANGED; \
00180 _s=_s->parent; \
00181 } \
00182 } while (0)
00183
00184 #define ops__mark_parent_cc(changed_entry, field) \
00185 ops__mark_childchanged(changed_entry->parent, field)
00186
00187 #define ops__mark_changed_parentcc(changed_entry, field) \
00188 do { \
00189 changed_entry->field |= FS_CHANGED; \
00190 ops__mark_parent_cc(changed_entry, field); \
00191 } while (0)
00192
00193
00195 static inline int ops__should_entry_be_written_in_list(struct estat *sts)
00196 {
00197 if (sts->to_be_ignored) return 0;
00198 if (sts->flags & RF_DONT_WRITE) return 0;
00199 return 1;
00200 }
00201
00202 static inline int ops__has_children(struct estat *sts)
00203 {
00204 return S_ISDIR(sts->st.mode) && sts->entry_count;
00205 }
00206
00207
00208 #endif