From fee495136e7ee09755ee384ad0f818571859ffe1 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 11 Sep 2023 16:38:18 +0000 Subject: Rip off more obsolete bandaids Signed-off-by: Laurent Bercot --- doc/libstddjb/djbunix.html | 56 +++++++++++++++++++------------------------ src/include/skalibs/djbunix.h | 16 ------------- 2 files changed, 25 insertions(+), 47 deletions(-) diff --git a/doc/libstddjb/djbunix.html b/doc/libstddjb/djbunix.html index 6989be7..39b100c 100644 --- a/doc/libstddjb/djbunix.html +++ b/doc/libstddjb/djbunix.html @@ -504,76 +504,70 @@ size. Returns 1 if it succeeds and 0 (and sets errno) if it fails.

- 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().

Filesystem deletion

diff --git a/src/include/skalibs/djbunix.h b/src/include/skalibs/djbunix.h index bcce139..68ec3b7 100644 --- a/src/include/skalibs/djbunix.h +++ b/src/include/skalibs/djbunix.h @@ -95,50 +95,34 @@ extern int openreadfileclose (char const *, stralloc *, size_t) ; #define writenclose_unsafe(fd, s, n) writenclose_unsafe5(fd, s, (n), 0, 0) #define writenclose_unsafe_sync(fd, s, n) writenclose_unsafe5(fd, s, (n), 0, 1) -#define writenclose_unsafe_devino(fd, s, n, dev, ino) writenclose_unsafe_internal(fd, s, n, dev, (ino), 0) -#define writenclose_unsafe_devino_sync(fd, s, n, dev, ino) writenclose_unsafe_internal(fd, s, n, dev, (ino), 1) extern int writenclose_unsafe5 (int, char const *, size_t, devino *, unsigned int) ; #define openwritenclose_unsafe(f, s, n) openwritenclose_unsafe5(f, s, (n), 0, 0) #define openwritenclose_unsafe_sync(f, s, n) openwritenclose_unsafe5(f, s, (n), 0, 1) -#define openwritenclose_unsafe_devino(f, s, n, dev, ino) openwritenclose_unsafe_internal(f, s, n, dev, (ino), 0) -#define openwritenclose_unsafe_devino_sync(f, s, n, dev, ino) openwritenclose_unsafe_internal(f, s, n, dev, (ino), 1) extern int openwritenclose_unsafe5 (char const *, char const *, size_t, devino *, unsigned int) ; #define openwritenclose_suffix(f, s, n, t) openwritenclose_suffix6(f, s, n, 0, 0, t) #define openwritenclose_suffix_sync(f, s, n, t) openwritenclose_suffix6(f, s, n, 0, 1, t) -#define openwritenclose_suffix_devino(f, s, n, t, dev, ino) openwritenclose_suffix_internal(f, s, n, dev, (ino), 0, t) -#define openwritenclose_suffix_devino_sync(f, s, n, t, dev, ino) openwritenclose_suffix_internal(f, s, n, dev, (ino), 1, t) extern int openwritenclose_suffix6 (char const *, char const *, size_t, devino *, unsigned int, char const *) ; #define openwritenclose(f, s, n) openwritenclose5(f, s, (n), 0, 0) #define openwritenclose_sync(f, s, n) openwritenclose5(f, s, (n), 0, 1) -#define openwritenclose_devino(f, s, n, dev, ino) openwritenclose_internal(f, s, n, dev, (ino), 0) -#define openwritenclose_devino_sync(f, s, n, dev, ino) openwritenclose_internal(f, s, n, dev, (ino), 1) extern int openwritenclose5 (char const *, char const *, size_t, devino *, unsigned int) ; #define writenvclose_unsafe(fd, v, n) writevnclose_unsafe5(fd, v, (n), 0, 0) #define writevnclose_unsafe_sync(fd, v, n) writevnclose_unsafe5(fd, v, (n), 0, 1) -#define writevnclose_unsafe_devino(fd, v, n, dev, ino) writevnclose_unsafe_internal(fd, v, n, dev, (ino), 0) -#define writevnclose_unsafe_devino_sync(fd, v, n, dev, ino) writevnclose_unsafe_internal(fd, v, n, dev, (ino), 1) extern int writevnclose_unsafe5 (int, struct iovec const *, unsigned int, devino *, unsigned int) ; #define openwritevnclose_unsafe(f, v, n) openwritevnclose_unsafe5(f, v, (n), 0, 0) #define openwritevnclose_unsafe_sync(f, v, n) openwritevnclose_unsafe5(f, v, (n), 0, 1) -#define openwritevnclose_unsafe_devino(f, v, n, dev, ino) openwritevnclose_unsafe_internal(f, v, n, dev, (ino), 0) -#define openwritevnclose_unsafe_devino_sync(f, v, n, dev, ino) openwritevnclose_unsafe_internal(f, v, n, dev, (ino), 1) extern int openwritevnclose_unsafe5 (char const *, struct iovec const *, unsigned int, devino *, unsigned int) ; #define openwritevnclose_suffix(f, v, n, t) openwritevnclose_suffix6(f, v, n, 0, 0, t) #define openwritevnclose_suffix_sync(f, v, n, t) openwritevnclose_suffix6(f, v, n, 0, 1, t) -#define openwritevnclose_suffix_devino(f, v, n, t, dev, ino) openwritevnclose_suffix_internal(f, v, n, dev, (ino), 0, t) -#define openwritevnclose_suffix_devino_sync(f, v, n, t, dev, ino) openwritevnclose_suffix_internal(f, v, n, dev, (ino), 1, t) extern int openwritevnclose_suffix6 (char const *, struct iovec const *, unsigned int, devino *, unsigned int, char const *) ; #define openwritevnclose(f, v, n) openwritevnclose5(f, v, (n), 0, 0) #define openwritevnclose_sync(f, v, n) openwritevnclose5(f, v, (n), 0, 1) -#define openwritevnclose_devino(f, v, n, dev, ino) openwritevnclose_internal(f, v, n, dev, (ino), 0) -#define openwritevnclose_devino_sync(f, v, n, dev, ino) openwritevnclose_internal(f, v, n, dev, (ino), 1) extern int openwritevnclose5 (char const *, struct iovec const *, unsigned int, devino *, unsigned int) ; extern int rm_rf (char const *) ; -- cgit v1.2.3