diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-08-29 19:02:37 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-08-29 19:02:37 +0000 |
commit | 8408122222bda77347e46dedafc12abcd2b45e1e (patch) | |
tree | f2f29a1c3194f5da885334375813c858d9534894 /src/common/util.h | |
parent | 91f83cfc2d380aa76fd049d13cf9fb097fecaab6 (diff) | |
download | tor-8408122222bda77347e46dedafc12abcd2b45e1e.tar.gz tor-8408122222bda77347e46dedafc12abcd2b45e1e.zip |
r14831@catbus: nickm | 2007-08-29 14:17:42 -0400
Refactor write_chunks_to_file_impl: break out the "pick a temporary name if it makes sense, and open the right filename" logic and the "close the file and unlink or rename if necessary" logic. This will let us write big files in a smarter way than "Build a big string" or "make a list of chunks", once we get around to using it.
svn:r11300
Diffstat (limited to 'src/common/util.h')
-rw-r--r-- | src/common/util.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/util.h b/src/common/util.h index 80d4aad743..0b7dfc6cb1 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -213,6 +213,11 @@ file_status_t file_status(const char *filename); * directory; see that function's documentation for details. */ typedef enum { CPD_NONE, CPD_CREATE, CPD_CHECK } cpd_check_t; int check_private_dir(const char *dirname, cpd_check_t check); +typedef struct open_file_t open_file_t; +int start_writing_to_file(const char *fname, int open_flags, int mode, + open_file_t **data_out); +int finish_writing_to_file(open_file_t *file_data); +int abort_writing_to_file(open_file_t *file_data); int write_str_to_file(const char *fname, const char *str, int bin); int write_bytes_to_file(const char *fname, const char *str, size_t len, int bin); |