Commits

iru  committed bc0c6b9

VOP_{READ,WRITE}, Debug off

  • Participants
  • Parent commits e23d6c0

Comments (0)

Files changed (7)

 #define DRET() DBG("<<<\n")
 
 #define printvp(x) do{\
-	printf("%s: ", __FUNCTION__);\
-	_printvp((x));\
+	if(Debug){\
+		printf("%s: ", __FUNCTION__);\
+		_printvp((x));\
+	}\
 }while(0)
 
 #define nelem(a) (sizeof(a) / sizeof(*a))
 #include "o9fs_extern.h"
 
 enum{
-	Debug = 1,
+	Debug = 0,
 };
 
 void
 		len = f->iounit;
 	if (len > fs->msize)
 		len = fs->msize - O9FS_IOHDRSZ;
+
 	O9FS_PBIT32(p + Minhd + 4 + 8, len);
 	p += Minhd + 4 + 8 + 4;
+	if (type == O9FS_TWRITE)
+		p += len;
+	n = p - fs->outbuf;
 
-	n = p - fs->outbuf;
 	O9FS_PBIT32(fs->outbuf, n);
 	n = o9fs_mio(fs, n);
 	if (n <= 0) {
 	}
 
 	n = O9FS_GBIT32(fs->inbuf + Minhd);
-	DBG("read %ld bytes\n", n);
 	DRET();
 	return n;
 }

File o9fs_convM2D.c

 #include "o9fs_extern.h"
 
 enum{
-	Debug = 1,
+	Debug = 0,
 };
 
 int

File o9fs_convM2S.c

 #include "o9fs_extern.h"
 
 enum{
-	Debug = 1,
+	Debug = 0,
 };
 
 u_char*

File o9fs_convS2M.c

 #include "o9fs_extern.h"
 
 enum{
-	Debug = 1,
+	Debug = 0,
 };
 
 u_char*
 #include "o9fs_extern.h"
 
 enum{
-	Debug = 1,
+	Debug = 0,
 };
 
 extern struct vnodeopv_desc o9fs_vnodeop_opv_desc;

File o9fs_vnops.c

 #include "o9fs_extern.h"
 
 enum{
-	Debug = 1,
+	Debug = 0,
 };
 
 int o9fs_open(void *);
 	struct o9fid *f;
 	struct o9fs *fs;
 	uint32_t n;
-	int64_t len;
 
 	ap = v;
 	vp = ap->a_vp;
 	if (uio->uio_resid == 0)
 		return 0;
 
-	len = uio->uio_resid;
-	n = o9fs_rdwr2(fs, f, O9FS_TREAD, len, uio->uio_offset);
+	n = o9fs_rdwr2(fs, f, O9FS_TREAD, uio->uio_resid, uio->uio_offset);
 	if (n > 0)
 		return uiomove(fs->inbuf + Minhd + 4, n, uio);
 	return n;
 	struct vop_read_args *ap;
 	struct vnode *vp;
 	struct uio *uio;
-	struct o9fsfid *f;
+	struct o9fid *f;
+	struct o9fs *fs;
 	int ioflag, error, msize;
-	char *buf;
-	long n;
+	uint32_t n;
 	int64_t len;
 	off_t offset;
+	DIN();
 
-	DBG("write: enter\n");
 	ap = v;
 	vp = ap->a_vp;
 	uio = ap->a_uio;
 	ioflag = ap->a_ioflag;
-	f = VTO9(vp);
+	f = VTO92(vp);
+	fs = VFSTOO9FS(vp->v_mount);
 	error = n = 0;
 
-	DBG("write: vp=%p v_type=%d\n", vp, vp->v_type); 
-
 	if (uio->uio_offset < 0 || vp->v_type != VREG) {
-		DBG("write: return EINVAL\n");
+		DRET();
 		return EINVAL;
 	}
 
 	if (ioflag & IO_APPEND) {
 		struct stat st;
 		if(vn_stat(vp, &st, curproc) == 0)
-			uio->uio_offset = offset = st.st_size;
+			offset = st.st_size;
 	}
 
 	len = uio->uio_resid;
-	msize = VFSTOO9FS(vp->v_mount)->msize - O9FS_IOHDRSZ;
-	if (len > msize)
-		len = msize;
-	buf = malloc(len, M_O9FS, M_WAITOK);
-
-	error = uiomove(buf, len, uio);
-	n = o9fs_rdwr(VFSTOO9FS(vp->v_mount), O9FS_TWRITE, f, buf, len, offset);
-	if (n < 0)
+	error = uiomove(fs->outbuf + Minhd + 4 + 8 + 4, len, uio);
+	n = o9fs_rdwr2(fs, f, O9FS_TWRITE, len, offset);
+	if (n < 0) {
+		DRET();
 		return -1;
-	free(buf, M_O9FS);
-	DBG("write: return\n");
+	}
+	f->offset = offset + n;
+	DRET();
 	return error;
 }