From fee495136e7ee09755ee384ad0f818571859ffe1 Mon Sep 17 00:00:00 2001
From: Laurent Bercot
- int openwritenclose_unsafe_internal (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino, int dosync)
+ int openwritenclose_unsafe5 (char const *file, char const *s, size_t len, devino *devino, unsigned int options)
Writes the n bytes stored at s into file file.
The previous contents of file are destroyed even if the function
-fails. If dosync is nonzero, the new contents of file
-are synced to disk before the function returns. If dev and ino
-are not null, they're used to store the device and inode number of file.
+fails. If options has bit 0 set, the new contents of file
+are synced to disk before the function returns. If devino is not null,
+the device number of file is stored in devino→dev
+and its inode number in devino&arr;ino.
The function returns 1 if it succeeds, or 0 (and sets errno) if it fails.
- int openwritenclose_unsafe (char const *file, char const *s, size_t len)
-int openwritenclose_unsafe_sync (char const *file, char const *s, size_t len)
-int openwritenclose_unsafe_devino (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino)
-int openwritenclose_unsafe_devino_sync (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino)
-Trivial shortcuts around openwritenclose_unsafe_internal(). The
+ int openwritenclose_unsafe (char const *file, char const *s, size_t len)
+int openwritenclose_unsafe_sync (char const *file, char const *s, size_t len)
+Trivial shortcuts around openwritenclose_unsafe5(). The
reader can easily figure out what they do.
- int openwritenclose_suffix_internal (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino, int dosync, char const *suffix)
+ int openwritenclose_suffix6 (char const *file, char const *s, size_t len, devino *devino, unsigned int options, char const *suffix)
Writes the n bytes stored at s into file file,
by first writing into filesuffix and atomically renaming
filesuffix to file. IOW, the old contents of file
are preserved if the operation fails, and are atomically replaced with the
new contents if the operation succeeds.
-If dosync is nonzero, the new contents of filesuffix
-are synced to disk before the atomic replace. If dev and ino
-are not null, they're used to store the device and inode number of file.
+If options has bit 0 set, the new contents of filesuffix
+are synced to disk before the atomic replace. If devino is not null,
+the device number of file is stored in devino→dev
+and its inode number in devino&arr;ino.
The function returns 1 if it succeeds, or 0 (and sets errno) if it fails.
- int openwritenclose_suffix (char const *file, char const *s, size_t len, char const *suffix)
-int openwritenclose_suffix_sync (char const *file, char const *s, size_t len, char const *suffix)
-int openwritenclose_suffix_devino (char const *file, char const *s, size_t len, char const *suffix, dev_t *dev, ino_t *ino)
-int openwritenclose_suffix_devino_sync (char const *file, char const *s, size_t len, char const *suffix, dev_t *dev, ino_t *ino)
+ int openwritenclose_suffix (char const *file, char const *s, size_t len, char const *suffix)
+int openwritenclose_suffix_sync (char const *file, char const *s, size_t len, char const *suffix)
Trivial shortcuts around openwritenclose_suffix_internal(). The
reader can easily figure out what they do.
- int openwritevnclose_unsafe_internal (char const *file, struct iovec const *v, unsigned int vlen, dev_t *dev, ino_t *ino, int dosync)
-Like openwritenclose_unsafe_internal, but the content to
+ int openwritevnclose_unsafe5 (char const *file, struct iovec const *v, unsigned int vlen, devino *devino, int dosync)
+Like openwritenclose_unsafe5, but the content to
write is taken from a
scatter/gather array of vlen
elements instead of a single string.
- int openwritevnclose_unsafe (char const *file, struct iovec const *v, unsigned int vlen)
-int openwritevnclose_unsafe_sync (char const *file, struct iovec const *v, unsigned int vlen)
-int openwritevnclose_unsafe_devino (char const *file, struct iovec const *v, unsigned int vlen, dev_t *dev, ino_t *ino)
-int openwritevnclose_unsafe_devino_sync (char const *file, struct iovec const *v, unsigned int vlen, dev_t *dev, ino_t *ino)
-Trivial wrappers around openwritevnclose_unsafe_internal().
+ int openwritevnclose_unsafe (char const *file, struct iovec const *v, unsigned int vlen)
+int openwritevnclose_unsafe_sync (char const *file, struct iovec const *v, unsigned int vlen)
+Trivial wrappers around openwritevnclose_unsafe5().
- int openwritevnclose_suffix_internal (char const *file, struct iovec const *v, unsigned int vlen, dev_t *dev, ino_t *ino, int dosync, char const *suffix)
-Like openwritenclose_suffix_internal, but the content to
+ int openwritevnclose_suffix6 (char const *file, struct iovec const *v, unsigned int vlen, devino *devino, int dosync, char const *suffix)
+Like openwritenclose_suffix6, but the content to
write is taken from a
scatter/gather array of vlen
elements instead of a single string.
- int openwritevnclose_suffix (char const *file, struct iovec const *v, unsigned int vlen, char const *suffix)
-int openwritevnclose_suffix_sync (char const *file, struct iovec const *v, unsigned int vlen, char const *suffix)
-int openwritevnclose_suffix_devino (char const *file, struct iovec const *v, unsigned int vlen, char const *suffix, dev_t *dev, ino_t *ino)
-int openwritevnclose_suffix_devino_sync (char const *file, struct iovec const *v, unsigned int vlen, char const *suffix, dev_t *dev, ino_t *ino)
-Trivial wrappers around openwritevnclose_suffix_internal().
+ int openwritevnclose_suffix (char const *file, struct iovec const *v, unsigned int vlen, char const *suffix)
+int openwritevnclose_suffix_sync (char const *file, struct iovec const *v, unsigned int vlen, char const *suffix)
+Trivial wrappers around openwritevnclose_suffix6().