if(bp->bf_busy == BF_BUSY) /* do not free BF_SUPERBLOCK */
bp->bf_busy = BF_FREE;
- if (dirty > 1) { // immediate writeback
+ if (dirty > 1) { /* immediate writeback */
if (bdwrite(bp) == -1)
udata.u_error = EIO;
bp->bf_dirty = false;
/* FIXME: this can generate a lot of d_flush calls when you have
plenty of buffers */
- for (bp = bufpool; bp < bufpool + NBUFS; ++bp) {
+ for (bp = bufpool; bp < bufpool_end; ++bp) {
if ((bp->bf_dev != NO_DEVICE) && bp->bf_dirty)
bdput(bp);
}
{
bufptr bp;
- for (bp = bufpool; bp < bufpool + NBUFS; ++bp) {
+ for (bp = bufpool; bp < bufpool_end; ++bp) {
if (bp->bf_dev == dev && bp->bf_blk == blk)
return bp;
}
{
bufptr bp;
- for (bp = bufpool; bp < bufpool + NBUFS; ++bp) {
+ for (bp = bufpool; bp < bufpool_end; ++bp) {
if (bp->bf_dev == dev) {
bdput(bp);
bp->bf_dev = NO_DEVICE;
/* Try to find a non-busy buffer and write out the data if it is dirty */
oldest = NULL;
oldtime = 0;
- for (bp = bufpool; bp < bufpool + NBUFS; ++bp) {
+ for (bp = bufpool; bp < bufpool_end; ++bp) {
if (bufclock - bp->bf_time >= oldtime && bp->bf_busy == BF_FREE) {
oldest = bp;
oldtime = bufclock - bp->bf_time;
bufptr j;
kprintf("\ndev\tblock\tdirty\tbusy\ttime clock %d\n", bufclock);
- for (j = bufpool; j < bufpool + NBUFS; ++j)
+ for (j = bufpool; j < bufpool_end; ++j)
kprintf("%d\t%u\t%d\t%d\t%u\n", j->bf_dev, j->bf_blk,
j->bf_dirty, j->bf_busy, j->bf_time);
}
extern uint16_t swap_dev; /* Device number used for swap */
extern struct blkbuf bufpool[NBUFS];
+#ifndef CONFIG_DYNAMIC_BUFPOOL
+#define bufpool_end (bufpool + NBUFS) /* Define so its a compile time const */
+#else
+extern struct blkbuf *bufpool_end;
+#endif
+
extern struct p_tab ptab[PTABSIZE];
extern struct p_tab *ptab_end;
extern struct oft of_tab[OFTSIZE]; /* Open File Table */
uint8_t ticks_per_dsecond;
inoptr root;
uint16_t waitno;
-time_t tod; // time of day
+time_t tod; /* Time of day */
ticks_t ticks;
int16_t acct_fh = -1; /* Accounting file handle */
{ 254, 0 } /* 180 sets of 5 seconds per 15 minutes */
};
+#ifndef CONFIG_DYNAMIC_BUFPOOL
struct blkbuf bufpool[NBUFS];
+#endif
struct p_tab ptab[PTABSIZE];
struct p_tab *ptab_end; /* Points to first byte off end */