1 /* File operation contexts for the Midnight Commander
3 * Copyright (C) 1998 The Free Software Foundation
5 * Authors: Federico Mena <federico@nuclecu.unam.mx>
6 * Miguel de Icaza <miguel@nuclecu.unam.mx>
13 #include <sys/types.h>
17 /* This structure describes a context for file operations. It is used to update
18 * the progress windows and pass around options.
21 /* The estimated time of arrival in seconds */
24 /* Transferred bytes per second */
27 /* Transferred seconds */
30 /* Whether the panel total has been computed */
31 int progress_totals_computed
;
33 /* Counters for progress indicators */
35 double progress_bytes
;
37 /* The value of the "preserve Attributes" checkbox in the copy file dialog.
38 * We can't use the value of "ctx->preserve" because it can change in order
39 * to preserve file attributs when moving files across filesystem boundaries
40 * (we want to keep the value of the checkbox between copy operations).
44 /* Result from the recursive query */
47 /* Whether to do a reget */
50 /* Controls appending to files */
53 /* Whether to stat or lstat */
56 /* Pointer to the stat function we will use */
57 int (*stat_func
) (char *filename
, struct stat
*buf
);
59 /* Whether to recompute symlinks */
62 /* Preserve the original files' owner, group, permissions, and
63 * timestamps (owner, group only as root).
67 /* If running as root, preserve the original uid/gid (we don't want to
68 * try chwon for non root) preserve_uidgid = preserve && uid == 0
72 /* The bits to preserve in created files' modes on file copy */
75 /* The mask of files to actually operate on */
78 /* Regex for the file mask */
79 struct re_pattern_buffer rx
;
80 struct re_registers regs
;
82 /* Whether to dive into subdirectories for recursive operations */
83 int dive_into_subdirs
;
85 /* When moving directories cross filesystem boundaries delete the
86 * successfull copied files when all files below the directory and its
87 * subdirectories were processed.
89 * If erase_at_end is zero files will be deleted immediately after their
90 * successful copy (Note: this behaviour is not tested and at the moment
91 * it can't be changed at runtime).
95 /* PID of the child for background operations */
98 /* User interface data goes here */
104 FileOpContext
*file_op_context_new (void);
105 void file_op_context_destroy (FileOpContext
*ctx
);
114 extern char *op_names
[3];
121 } FileProgressStatus
;
131 /* First argument passed to real functions */
137 /* The following functions are implemented separately by each port */
139 void file_op_context_create_ui (FileOpContext
*ctx
, FileOperation op
, int with_eta
);
140 void file_op_context_destroy_ui (FileOpContext
*ctx
);
142 FileProgressStatus
file_progress_show (FileOpContext
*ctx
, long done
, long total
);
143 FileProgressStatus
file_progress_show_count (FileOpContext
*ctx
, long done
, long total
);
144 FileProgressStatus
file_progress_show_bytes (FileOpContext
*ctx
, double done
, double total
);
145 FileProgressStatus
file_progress_show_source (FileOpContext
*ctx
, char *path
);
146 FileProgressStatus
file_progress_show_target (FileOpContext
*ctx
, char *path
);
147 FileProgressStatus
file_progress_show_deleting (FileOpContext
*ctx
, char *path
);
149 void file_progress_set_stalled_label (FileOpContext
*ctx
, char *stalled_msg
);
151 FileProgressStatus
file_progress_real_query_replace (FileOpContext
*ctx
,
152 enum OperationMode mode
,
154 struct stat
*_s_stat
,
155 struct stat
*_d_stat
);