summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-09-11 16:38:18 +0000
committerLaurent Bercot <ska@appnovation.com>2023-09-11 16:38:18 +0000
commitfee495136e7ee09755ee384ad0f818571859ffe1 (patch)
treeb74c70247fa674756e5bf0b2005d77fa0023a1e5
parent7334832e987d7b8d2d3a6c0a485233c8777b4b3d (diff)
downloadskalibs-fee495136e7ee09755ee384ad0f818571859ffe1.tar.xz
Rip off more obsolete bandaids
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r--doc/libstddjb/djbunix.html56
-rw-r--r--src/include/skalibs/djbunix.h16
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.
</p>
<p>
-<code> int openwritenclose_unsafe_internal (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino, int dosync) </code> <br />
+<code> int openwritenclose_unsafe5 (char const *file, char const *s, size_t len, devino *devino, unsigned int options) </code> <br>
Writes the <em>n</em> bytes stored at <em>s</em> into file <em>file</em>.
The previous contents of <em>file</em> are destroyed even if the function
-fails. If <em>dosync</em> is nonzero, the new contents of <em>file</em>
-are synced to disk before the function returns. If <em>dev</em> and <em>ino</em>
-are not null, they're used to store the device and inode number of <em>file</em>.
+fails. If <em>options</em> has bit 0 set, the new contents of <em>file</em>
+are synced to disk before the function returns. If <em>devino</em> is not null,
+the device number of <em>file</em> is stored in <em>devino&rarr;dev</em>
+and its inode number in <em>devino&arr;ino</em>.
The function returns 1 if it succeeds, or 0 (and sets errno) if it fails.
</p>
<p>
-<code> int openwritenclose_unsafe (char const *file, char const *s, size_t len) <br />
-int openwritenclose_unsafe_sync (char const *file, char const *s, size_t len) <br />
-int openwritenclose_unsafe_devino (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino) <br />
-int openwritenclose_unsafe_devino_sync (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino) </code> <br />
-Trivial shortcuts around <tt>openwritenclose_unsafe_internal()</tt>. The
+<code> int openwritenclose_unsafe (char const *file, char const *s, size_t len) <br>
+int openwritenclose_unsafe_sync (char const *file, char const *s, size_t len) </code> <br>
+Trivial shortcuts around <tt>openwritenclose_unsafe5()</tt>. The
reader can easily figure out what they do.
</p>
<p>
-<code> int openwritenclose_suffix_internal (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino, int dosync, char const *suffix) </code> <br />
+<code> int openwritenclose_suffix6 (char const *file, char const *s, size_t len, devino *devino, unsigned int options, char const *suffix) </code> <br>
Writes the <em>n</em> bytes stored at <em>s</em> into file <em>file</em>,
by first writing into <em>filesuffix</em> and atomically renaming
<em>filesuffix</em> to <em>file</em>. IOW, the old contents of <em>file</em>
are preserved if the operation fails, and are atomically replaced with the
new contents if the operation succeeds.
-If <em>dosync</em> is nonzero, the new contents of <em>filesuffix</em>
-are synced to disk before the atomic replace. If <em>dev</em> and <em>ino</em>
-are not null, they're used to store the device and inode number of <em>file</em>.
+If <em>options</em> has bit 0 set, the new contents of <em>filesuffix</em>
+are synced to disk before the atomic replace. If <em>devino</em> is not null,
+the device number of <em>file</em> is stored in <em>devino&rarr;dev</em>
+and its inode number in <em>devino&arr;ino</em>.
The function returns 1 if it succeeds, or 0 (and sets errno) if it fails.
</p>
<p>
-<code> int openwritenclose_suffix (char const *file, char const *s, size_t len, char const *suffix) <br />
-int openwritenclose_suffix_sync (char const *file, char const *s, size_t len, char const *suffix) <br />
-int openwritenclose_suffix_devino (char const *file, char const *s, size_t len, char const *suffix, dev_t *dev, ino_t *ino) <br />
-int openwritenclose_suffix_devino_sync (char const *file, char const *s, size_t len, char const *suffix, dev_t *dev, ino_t *ino) </code> <br />
+<code> int openwritenclose_suffix (char const *file, char const *s, size_t len, char const *suffix) <br>
+int openwritenclose_suffix_sync (char const *file, char const *s, size_t len, char const *suffix) </code> <br>
Trivial shortcuts around <tt>openwritenclose_suffix_internal()</tt>. The
reader can easily figure out what they do.
</p>
<p>
-<code> int openwritevnclose_unsafe_internal (char const *file, struct iovec const *v, unsigned int vlen, dev_t *dev, ino_t *ino, int dosync) </code> <br />
-Like <tt>openwritenclose_unsafe_internal</tt>, but the content to
+<code> int openwritevnclose_unsafe5 (char const *file, struct iovec const *v, unsigned int vlen, devino *devino, int dosync) </code> <br>
+Like <tt>openwritenclose_unsafe5</tt>, but the content to
write is taken from a
<a href="siovec.html">scatter/gather array</a> of <em>vlen</em>
elements instead of a single string.
</p>
<p>
-<code> int openwritevnclose_unsafe (char const *file, struct iovec const *v, unsigned int vlen) <br />
-int openwritevnclose_unsafe_sync (char const *file, struct iovec const *v, unsigned int vlen) <br />
-int openwritevnclose_unsafe_devino (char const *file, struct iovec const *v, unsigned int vlen, dev_t *dev, ino_t *ino) <br />
-int openwritevnclose_unsafe_devino_sync (char const *file, struct iovec const *v, unsigned int vlen, dev_t *dev, ino_t *ino) </code> <br />
-Trivial wrappers around <tt>openwritevnclose_unsafe_internal()</tt>.
+<code> int openwritevnclose_unsafe (char const *file, struct iovec const *v, unsigned int vlen) <br>
+int openwritevnclose_unsafe_sync (char const *file, struct iovec const *v, unsigned int vlen) </code> <br>
+Trivial wrappers around <tt>openwritevnclose_unsafe5()</tt>.
</p>
<p>
-<code> 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) </code> <br />
-Like <tt>openwritenclose_suffix_internal</tt>, but the content to
+<code> int openwritevnclose_suffix6 (char const *file, struct iovec const *v, unsigned int vlen, devino *devino, int dosync, char const *suffix) </code> <br>
+Like <tt>openwritenclose_suffix6</tt>, but the content to
write is taken from a
<a href="siovec.html">scatter/gather array</a> of <em>vlen</em>
elements instead of a single string.
</p>
<p>
-<code> int openwritevnclose_suffix (char const *file, struct iovec const *v, unsigned int vlen, char const *suffix) <br />
-int openwritevnclose_suffix_sync (char const *file, struct iovec const *v, unsigned int vlen, char const *suffix) <br />
-int openwritevnclose_suffix_devino (char const *file, struct iovec const *v, unsigned int vlen, char const *suffix, dev_t *dev, ino_t *ino) <br />
-int openwritevnclose_suffix_devino_sync (char const *file, struct iovec const *v, unsigned int vlen, char const *suffix, dev_t *dev, ino_t *ino) </code> <br />
-Trivial wrappers around <tt>openwritevnclose_suffix_internal()</tt>.
+<code> int openwritevnclose_suffix (char const *file, struct iovec const *v, unsigned int vlen, char const *suffix) <br>
+int openwritevnclose_suffix_sync (char const *file, struct iovec const *v, unsigned int vlen, char const *suffix) </code> <br>
+Trivial wrappers around <tt>openwritevnclose_suffix6()</tt>.
</p>
<h3> Filesystem deletion </h3>
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 *) ;