virtual int callback();
virtual void create();
- virtual StoreEntry * get
- (const cache_key *);
+ virtual StoreEntry * get(const cache_key *);
- virtual void get
- (String const, STOREGETCLIENT, void * cbdata);
+ virtual void get(String const, STOREGETCLIENT, void * cbdata);
virtual void init();
{
public:
- SwapDir(char const *aType) : theType (aType), cur_size (0), max_size(0), max_objsize (-1), cleanLog(NULL) {
+ SwapDir(char const *aType) : theType (aType), cur_size(0), max_size(0), max_objsize (-1), cleanLog(NULL) {
fs.blksize = 1024;
path = NULL;
}
/* official Store interface functions */
virtual void diskFull();
- virtual StoreEntry * get
- (const cache_key *);
+ virtual StoreEntry * get(const cache_key *);
- virtual void get
- (String const, STOREGETCLIENT, void * cbdata);
+ virtual void get(String const, STOREGETCLIENT, void * cbdata);
virtual size_t maxSize() const { return max_size;}
char const *theType;
public:
- int cur_size;
- int max_size;
+ size_t cur_size;
+ size_t max_size;
char *path;
int index; /* This entry's index into the swapDirs array */
int64_t max_objsize;
CossSwapDir::statfs(StoreEntry & sentry) const
{
storeAppendPrintf(&sentry, "\n");
- storeAppendPrintf(&sentry, "Maximum Size: %d KB\n", max_size);
- storeAppendPrintf(&sentry, "Current Size: %d KB\n", cur_size);
+ storeAppendPrintf(&sentry, "Maximum Size: %Zu KB\n", max_size);
+ storeAppendPrintf(&sentry, "Current Size: %Zu KB\n", cur_size);
storeAppendPrintf(&sentry, "Percent Used: %0.2f%%\n",
- 100.0 * cur_size / max_size);
+ (100.0 * (double)cur_size / (double)max_size) );
storeAppendPrintf(&sentry, "Number of object collisions: %d\n", (int) numcollisions);
#if 0
/* is this applicable? I Hope not .. */
void
CossSwapDir::dump(StoreEntry &entry)const
{
- storeAppendPrintf(&entry, " %d", max_size >> 10);
+ storeAppendPrintf(&entry, " %Zu", (max_size >> 10));
dumpOptions(&entry);
}
void
UFSSwapDir::parseSizeL1L2()
{
- int i;
- int size;
-
- i = GetInteger();
- size = i << 10; /* Mbytes to kbytes */
-
- if (size <= 0)
+ int i = GetInteger();
+ if (i <= 0)
fatal("UFSSwapDir::parseSizeL1L2: invalid size value");
+ size_t size = i << 10; /* Mbytes to kbytes */
+
/* just reconfigure it */
if (reconfiguring) {
if (size == max_size)
int x;
storeAppendPrintf(&sentry, "First level subdirectories: %d\n", l1);
storeAppendPrintf(&sentry, "Second level subdirectories: %d\n", l2);
- storeAppendPrintf(&sentry, "Maximum Size: %d KB\n", max_size);
- storeAppendPrintf(&sentry, "Current Size: %d KB\n", cur_size);
+ storeAppendPrintf(&sentry, "Maximum Size: %Zu KB\n", max_size);
+ storeAppendPrintf(&sentry, "Current Size: %Zu KB\n", cur_size);
storeAppendPrintf(&sentry, "Percent Used: %0.2f%%\n",
- 100.0 * cur_size / max_size);
+ (double)(100.0 * cur_size) / (double)max_size);
storeAppendPrintf(&sentry, "Filemap bits in use: %d of %d (%d%%)\n",
map->n_files_in_map, map->max_n_files,
Math::intPercent(map->n_files_in_map, map->max_n_files));
walker = repl->PurgeInit(repl, max_scan);
while (1) {
- if (cur_size < (int) minSize()) /* cur_size should be unsigned */
+ if (cur_size < minSize())
break;
if (removed >= max_remove)
void
UFSSwapDir::dump(StoreEntry & entry) const
{
- storeAppendPrintf(&entry, " %d %d %d",
- max_size >> 10,
- l1,
- l2);
+ storeAppendPrintf(&entry, " %Zu %d %d", (max_size >> 10), l1, l2);
dumpOptions(&entry);
}
void
SwapDir::updateSize(int64_t size, int sign)
{
- int blks = (size + fs.blksize - 1) / fs.blksize;
- int k = (blks * fs.blksize >> 10) * sign;
+ int64_t blks = (size + fs.blksize - 1) / fs.blksize;
+ int64_t k = ((blks * fs.blksize) >> 10) * sign;
cur_size += k;
store_swap_size += k;
(long int) maxSize());
storeAppendPrintf(&output, "Current Store Swap Size: %8lu KB\n",
store_swap_size);
+ // XXX : below capacity display calculation breaks with int overflow on 64-bit systems
storeAppendPrintf(&output, "Current Capacity : %d%% used, %d%% free\n",
Math::intPercent((int) store_swap_size, (int) maxSize()),
Math::intPercent((int) (maxSize() - store_swap_size), (int) maxSize()));