X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fmake-file.h;h=a2bcc76eb11bdda3ec0917844f0c9b11c1175ced;hb=f5c08530fe57a5a1a0bd1b6d82ad2fd446068d93;hp=19d33ebe76bfc070b0f28aed4c11bc61c89b7111;hpb=707848060e414fe93458834446dd7cdbf800667f;p=pspp
diff --git a/src/data/make-file.h b/src/data/make-file.h
index 19d33ebe76..a2bcc76eb1 100644
--- a/src/data/make-file.h
+++ b/src/data/make-file.h
@@ -1,5 +1,5 @@
/* PSPP - a program for statistical analysis.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -14,41 +14,34 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
-#ifndef MKFILE_H
-#define MKFILE_H
+#ifndef MAKE_FILE_H
+#define MAKE_FILE_H
+#include
+#include
+#include
-/* Creates a temporary file and stores its name in *FILE_NAME and
- a file descriptor for it in *FD. Returns success. Caller is
- responsible for freeing *FILE_NAME. */
-int make_temp_file (int *fd, char **file_name);
-
-
-/* Creates a temporary file and stores its name in *FILE_NAME and
- a file stream for it in *FP. Returns success. Caller is
- responsible for freeing *FILE_NAME. */
-int make_unique_file_stream (FILE **fp, char **file_name) ;
-
+struct file_handle;
/* Prepares to atomically replace a (potentially) existing file
- by a new file, by creating a temporary file with the given
- PERMISSIONS bits in the same directory as *FILE_NAME.
+ by a new file., by creating a temporary file with the given
+ PERMISSIONS bits.
Special files are an exception: they are not atomically
replaced but simply opened for writing.
- If successful, stores the temporary file's name in *TMP_NAME
- and a stream for it opened according to MODE (which should be
+ If successful, stores a stream for it opened according to MODE (which should be
"w" or "wb") in *FP. Returns a ticket that can be used to
commit or abort the file replacement. If neither action has
yet been taken, program termination via signal will cause
- *TMP_FILE to be unlinked.
+ all resources to be released. The return value must not be
+ explicitly freed.
+
+ The caller is responsible for closing *FP */
- The caller is responsible for closing *FP, but *TMP_NAME is
- owned by the callee. */
-struct replace_file *replace_file_start (const char *file_name,
+struct replace_file *replace_file_start (const struct file_handle *fh,
const char *mode, mode_t permissions,
- FILE **fp, char **tmp_name);
+ FILE **fp);
/* Commits or aborts the replacement of a (potentially) existing
file by a new file, using the ticket returned by