提交 ad992686 创建 作者: Nickolai Zeldovich's avatar Nickolai Zeldovich

c++-only header files

上级 21d8da79
......@@ -26,9 +26,9 @@ extern "C" {
#include "kernel.h"
#include "spinlock.h"
#include "condvar.h"
#include "buf.h"
}
#include "buf.hh"
#include "cpputil.hh"
#include "ns.hh"
......
......@@ -11,7 +11,7 @@ extern "C" {
#include "condvar.h"
}
#include "file.h"
#include "file.hh"
extern "C" {
#include "amd64.h"
......
......@@ -11,7 +11,7 @@ extern "C" {
#include "fs.h"
}
#include "file.h"
#include "file.hh"
extern "C" {
#include "elf.h"
......
......@@ -6,7 +6,7 @@ extern "C" {
#include "fs.h"
}
#include "file.h"
#include "file.hh"
extern "C" {
#include "stat.h"
......
#ifdef __cplusplus
#include "cpputil.hh"
#include "ns.hh"
u64 namehash(const strbuf<DIRSIZ>&);
#endif
struct file {
enum { FD_NONE, FD_PIPE, FD_INODE, FD_SOCKET } type;
......@@ -30,11 +28,7 @@ struct inode {
struct condvar cv;
struct spinlock lock;
char lockname[16];
#ifdef __cplusplus
xns<strbuf<DIRSIZ>, u32, namehash> *dir;
#else
void *dir;
#endif
short type; // copy of disk inode
short major;
......
......@@ -19,11 +19,11 @@ extern "C" {
#include "condvar.h"
#include "queue.h"
#include "proc.h"
#include "buf.h"
#include "fs.h"
}
#include "file.h"
#include "buf.hh"
#include "file.hh"
extern "C" {
#include "cpu.h"
......
extern "C" {
#include "types.h"
#include "kernel.h"
#include "spinlock.h"
......@@ -6,16 +7,18 @@
#include "proc.h"
#include "vm.h"
#include "fs.h"
#include "file.h"
#include "wq.h"
#include "ipc.h"
}
#include "file.hh"
static void
pread_work(struct work *w, void *a0, void *a1, void *a2, void *a3)
{
struct inode *ip = a0;
void *kshared = a1;
struct ipcctl *ipc = kshared;
struct inode *ip = (inode*) a0;
void *kshared = (void*) a1;
struct ipcctl *ipc = (ipcctl*) kshared;
size_t count = (uptr)a2;
off_t off = (uptr)a3;
int r;
......@@ -26,7 +29,7 @@ pread_work(struct work *w, void *a0, void *a1, void *a2, void *a3)
//cprintf("1: %p %p %lu %lu\n", ip, buf, count, off);
ilock(ip, 0);
r = readi(ip, kshared+PGSIZE, off, count);
r = readi(ip, ((char*)kshared)+PGSIZE, off, count);
iunlock(ip);
ipc->result = r;
......@@ -41,11 +44,11 @@ pread_allocwork(struct inode *ip, void *buf, size_t count, off_t off)
{
struct work *w = allocwork();
if (w == NULL)
return NULL;
return 0;
//cprintf("0: %p %p %lu %lu\n", ip, buf, count, off);
w->rip = pread_work;
w->rip = (void*) pread_work;
w->arg0 = ip;
w->arg1 = buf;
w->arg2 = (void*)count;
......@@ -63,7 +66,7 @@ sys_kernlet(int fd, size_t count, off_t off)
if(fd < 0 || fd >= NOFILE || (f=myproc()->ofile[fd]) == 0)
return -1;
if(f->type != FD_INODE)
if(f->type != file::FD_INODE)
return -1;
fetchadd(&f->ip->ref, 1);
......
......@@ -11,9 +11,10 @@ extern "C" {
#include "proc.h"
#include "amd64.h"
#include "traps.h"
#include "buf.h"
}
#include "buf.hh"
extern u8 _fs_img_start[];
extern u64 _fs_img_size;
......
......@@ -22,7 +22,7 @@ extern "C" {
#include "fs.h"
}
#include "file.h"
#include "file.hh"
extern "C" {
#include "net.h"
......
......@@ -9,7 +9,7 @@ extern "C" {
#include "fs.h"
}
#include "file.h"
#include "file.hh"
extern "C" {
#include "cpu.h"
......
......@@ -6,7 +6,7 @@ extern "C" {
#include "fs.h"
}
#include "file.h"
#include "file.hh"
extern "C" {
#include "prof.h"
......
......@@ -6,7 +6,7 @@ extern "C" {
#include "kernel.h"
}
#include "file.h"
#include "file.hh"
extern "C" {
#include "bits.h"
......
......@@ -12,7 +12,7 @@ extern "C" {
#include "fs.h"
}
#include "file.h"
#include "file.hh"
#if LOCKSTAT
static int lockstat_enable;
......
......@@ -10,7 +10,7 @@ extern "C" {
#include "fs.h"
}
#include "file.h"
#include "file.hh"
extern "C" {
#include "fcntl.h"
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论