]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: port various pieces of code over to ROUND_UP() 27902/head
authorLennart Poettering <lennart@poettering.net>
Fri, 2 Jun 2023 14:40:29 +0000 (16:40 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 2 Jun 2023 14:43:39 +0000 (16:43 +0200)
There's probably more than we can convert to this.

src/basic/fs-util.c
src/libsystemd/sd-journal/journal-file.c
src/shared/calendarspec.c

index 04a6531dcbd362c1f1cea94a1fe0a5e451b39052..f5d2914be21612d1b876cccbf7074ec822913cf3 100644 (file)
@@ -770,7 +770,7 @@ int unlinkat_deallocate(int fd, const char *name, UnlinkDeallocateFlags flags) {
          * punch-hole/truncate this to release the disk space. */
 
         bs = MAX(st.st_blksize, 512);
-        l = DIV_ROUND_UP(st.st_size, bs) * bs; /* Round up to next block size */
+        l = ROUND_UP(st.st_size, bs); /* Round up to next block size */
 
         if (fallocate(truncate_fd, FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE, 0, l) >= 0)
                 return 0; /* Successfully punched a hole! ðŸ˜Š */
index d1f8ca381eb65623688b056dff215d08765583d6..f5d4823600340497583db96f84370d101f403638 100644 (file)
@@ -688,7 +688,7 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
         }
 
         /* Increase by larger blocks at once */
-        new_size = DIV_ROUND_UP(new_size, FILE_SIZE_INCREASE) * FILE_SIZE_INCREASE;
+        new_size = ROUND_UP(new_size, FILE_SIZE_INCREASE);
         if (f->metrics.max_size > 0 && new_size > f->metrics.max_size)
                 new_size = f->metrics.max_size;
 
index 628c6202e1e57ccf6bbdd48767face478462e70a..f17d97a2c101226ed3d956d69f4894127e33d070 100644 (file)
@@ -1151,7 +1151,7 @@ static int find_matching_component(
                 } else if (c->repeat > 0) {
                         int k;
 
-                        k = start + c->repeat * DIV_ROUND_UP(*val - start, c->repeat);
+                        k = start + ROUND_UP(*val - start, c->repeat);
 
                         if ((!d_set || k < d) && (stop < 0 || k <= stop)) {
                                 d = k;