#endif
int shctx_init(struct shared_context **orig_shctx,
- int maxblocks, int blocksize, int maxobjsz, int extra, int shared);
+ int maxblocks, int blocksize, unsigned int maxobjsz,
+ int extra, int shared);
struct shared_block *shctx_row_reserve_hot(struct shared_context *shctx,
struct shared_block *last, int data_len);
void shctx_row_inc_hot(struct shared_context *shctx, struct shared_block *first);
struct list avail; /* list for active and free blocks */
struct list hot; /* list for locked blocks */
unsigned int nbav; /* number of available blocks */
- int max_obj_size; /* maximum object size. */
+ unsigned int max_obj_size; /* maximum object size (in bytes). */
void (*free_block)(struct shared_block *first, struct shared_block *block);
short int block_size;
unsigned char data[0];
* and 0 if cache is already allocated.
*/
int shctx_init(struct shared_context **orig_shctx, int maxblocks, int blocksize,
- int maxobjsz, int extra, int shared)
+ unsigned int maxobjsz, int extra, int shared)
{
int i;
struct shared_context *shctx;
LIST_INIT(&shctx->hot);
shctx->block_size = blocksize;
- shctx->max_obj_size = maxobjsz;
+ shctx->max_obj_size = maxobjsz == (unsigned int)-1 ? 0 : maxobjsz;
/* init the free blocks after the shared context struct */
cur = (void *)shctx + sizeof(struct shared_context) + extra;