Mercurial > gnulib
comparison lib/fsusage.c @ 40:df153a752270
merge with 3.4.1
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Mon, 29 Mar 1993 05:09:24 +0000 |
parents | 2d78b0003b93 |
children | 7031c61568a0 |
comparison
equal
deleted
inserted
replaced
39:a887f9ed7b42 | 40:df153a752270 |
---|---|
54 #endif | 54 #endif |
55 | 55 |
56 /* Return the number of TOSIZE-byte blocks used by | 56 /* Return the number of TOSIZE-byte blocks used by |
57 BLOCKS FROMSIZE-byte blocks, rounding up. */ | 57 BLOCKS FROMSIZE-byte blocks, rounding up. */ |
58 | 58 |
59 #define adjust_blocks(blocks, fromsize, tosize) \ | 59 static long |
60 (((fromsize) == (tosize)) \ | 60 adjust_blocks (blocks, fromsize, tosize) |
61 ? (blocks) /* E.g., from 512 to 512. */ \ | 61 long blocks; |
62 : (((fromsize) > (tosize)) \ | 62 int fromsize, tosize; |
63 /* E.g., from 2048 to 512. */ \ | 63 { |
64 ? (blocks) * ((fromsize) / (tosize)) \ | 64 if (fromsize == tosize) /* E.g., from 512 to 512. */ |
65 /* E.g., from 256 to 512. */ \ | 65 return blocks; |
66 : ((blocks) + 1) / ((tosize) / (fromsize)))) | 66 else if (fromsize > tosize) /* E.g., from 2048 to 512. */ |
67 return blocks * (fromsize / tosize); | |
68 else /* E.g., from 256 to 512. */ | |
69 return (blocks + 1) / (tosize / fromsize); | |
70 } | |
67 | 71 |
68 /* Fill in the fields of FSP with information about space usage for | 72 /* Fill in the fields of FSP with information about space usage for |
69 the filesystem on which PATH resides. | 73 the filesystem on which PATH resides. |
70 DISK is the device on which PATH is mounted, for space-getting | 74 DISK is the device on which PATH is mounted, for space-getting |
71 methods that need to know it. | 75 methods that need to know it. |