/* * /dev/null code */ int null_lseek(struct inode *inode, struct file *filp, off_t offset, int origin) { debugmem("null_lseek()\n"); filp->f_pos = 0; return 0; }
/* * generally useful code... */ int memory_lseek(struct inode *inode, register struct file *filp, loff_t offset, unsigned int origin) { loff_t tmp = offset; debugmem("mem_lseek()\n"); switch (origin) { case 1: tmp += filp->f_pos; case 0: break; default: return -EINVAL; } if (tmp < 0) return -EINVAL; if (tmp != filp->f_pos) { filp->f_pos = tmp; #ifdef BLOAT_FS filp->f_reada = 0; filp->f_version = ++event; #endif } return 0; }
/* * /dev/zero code */ size_t zero_read(struct inode *inode, struct file *filp, char *data, int len) { debugmem("zero_read()\n"); fmemset(data, current->mm.dseg, 0, (size_t) len); filp->f_pos += len; return (size_t)len; }
int hdebug(HConnect *c) { char *scorestr, *op; u8int score[VtScoreSize]; if(hsethtml(c) < 0) return -1; hprint(&c->hout, "<h1>venti debug</h1>\n"); op = hargstr(c, "op", ""); if(!op[0]){ hprint(&c->hout, "no op\n"); return 0; } if(strcmp(op, "amap") == 0){ debugamap(c); return 0; } if(strcmp(op, "mem") == 0){ debugmem(c); return 0; } if(strcmp(op, "read") == 0){ scorestr = hargstr(c, "score", ""); if(vtparsescore(scorestr, nil, score) < 0){ hprint(&c->hout, "bad score %s: %r\n", scorestr); return 0; } debugread(c, score); return 0; } hprint(&c->hout, "unknown op %s", op); return 0; }
/* * /dev/full code */ size_t full_read(struct inode *inode, struct file *filp, char *data, int len) { debugmem("full_read()\n"); filp->f_pos += len; return len; }
size_t null_read(struct inode *inode, struct file *filp, char *data, int len) { debugmem("null_read()\n"); return 0; }