]> Zhao Yanbai Git Server - minix.git/commitdiff
Message types for VFS bread, bwrite & bpeek
authorLionel Sambuc <lionel@minix3.org>
Thu, 1 May 2014 11:45:58 +0000 (13:45 +0200)
committerLionel Sambuc <lionel@minix3.org>
Mon, 28 Jul 2014 15:05:29 +0000 (17:05 +0200)
These two request are handled by the same function in some FSes, which
prevents us from using two different kinds of messages.

Change-Id: Ib2fc80bdd56ef67db6b4c51cf8963353a761aab1

include/minix/ipc.h
lib/libminixfs/cache.c
servers/ext2/read.c
servers/iso9660fs/read.c
servers/mfs/read.c
servers/vfs/request.c

index f0715624dadd1e548246842264070fa889b81ca1..7c0a1ae3b5f1961047e60a5a30e6b621c7ca43f0 100644 (file)
@@ -146,6 +146,26 @@ typedef struct {
 } mess_sigcalls;
 _ASSERT_MSG_SIZE(mess_sigcalls);
 
+typedef struct {
+       dev_t device;
+       off_t seek_pos;
+
+       cp_grant_id_t grant;
+       size_t nbytes;
+
+       uint8_t data[32];
+} mess_vfs_fs_breadwrite;
+_ASSERT_MSG_SIZE(mess_vfs_fs_breadwrite);
+
+typedef struct {
+       off_t seek_pos;
+
+       size_t nbytes;
+
+       uint8_t data[44];
+} mess_fs_vfs_breadwrite;
+_ASSERT_MSG_SIZE(mess_fs_vfs_breadwrite);
+
 typedef struct {
        ino_t inode;
 
@@ -547,6 +567,8 @@ typedef struct {
        mess_sigcalls m_sigcalls;
        mess_vfs_fs_newnode m_vfs_fs_newnode;
        mess_fs_vfs_newnode m_fs_vfs_newnode;
+       mess_vfs_fs_breadwrite m_vfs_fs_breadwrite;
+       mess_fs_vfs_breadwrite m_fs_vfs_breadwrite;
        mess_vfs_fs_chmod m_vfs_fs_chmod;
        mess_fs_vfs_chmod m_fs_vfs_chmod;
        mess_vfs_fs_chown m_vfs_fs_chown;
index d61e7a42781d72101d9297d66024dbfed2a2b1d2..f503f8cc3ba6ac139e568ded1e42be1bdfa69cfd 100644 (file)
@@ -936,9 +936,9 @@ int lmfs_rdwt_err(void)
 int lmfs_do_bpeek(message *m)
 {
        block_t startblock, b, limitblock;
-       dev_t dev = m->REQ_DEV;
-       off_t extra, pos = m->REQ_SEEK_POS;
-       size_t len = m->REQ_NBYTES;
+       dev_t dev = m->m_vfs_fs_breadwrite.device;
+       off_t extra, pos = m->m_vfs_fs_breadwrite.seek_pos;
+       size_t len = m->m_vfs_fs_breadwrite.nbytes;
        struct buf *bp;
 
        assert(m->m_type == REQ_BPEEK);
index 244baab1f8a74455dd2f54e2b5c6e0e9025eefba..130a82710a1e48c93dc9203b06784b3c82d57d98 100644 (file)
@@ -159,13 +159,13 @@ int fs_breadwrite(void)
 
   /* Get the values from the request message */
   rw_flag = (fs_m_in.m_type == REQ_BREAD ? READING : WRITING);
-  gid = (cp_grant_id_t) fs_m_in.REQ_GRANT;
-  position = fs_m_in.REQ_SEEK_POS;
-  nrbytes = (size_t) fs_m_in.REQ_NBYTES;
+  gid = fs_m_in.m_vfs_fs_breadwrite.grant;
+  position = fs_m_in.m_vfs_fs_breadwrite.seek_pos;
+  nrbytes = fs_m_in.m_vfs_fs_breadwrite.nbytes;
 
-  block_size = get_block_size(fs_m_in.REQ_DEV);
+  block_size = get_block_size(fs_m_in.m_vfs_fs_breadwrite.device);
 
-  rip.i_block[0] = (block_t) fs_m_in.REQ_DEV;
+  rip.i_block[0] = (block_t) fs_m_in.m_vfs_fs_breadwrite.device;
   rip.i_mode = I_BLOCK_SPECIAL;
   rip.i_size = 0;
 
@@ -190,12 +190,12 @@ int fs_breadwrite(void)
          position += chunk;    /* position within the file */
   }
 
-  fs_m_out.RES_SEEK_POS = position;
+  fs_m_out.m_fs_vfs_breadwrite.seek_pos = position;
 
   if (rdwt_err != OK) r = rdwt_err;     /* check for disk error */
   if (rdwt_err == END_OF_FILE) r = OK;
 
-  fs_m_out.RES_NBYTES = cum_io;
+  fs_m_out.m_fs_vfs_breadwrite.nbytes = cum_io;
 
   return(r);
 }
index a6f152ae146082f9a206bfd135ae4e686f2041b5..c5717d90b72015fbad961d297e6d56c45786160e 100644 (file)
@@ -95,9 +95,9 @@ int fs_bread(void)
   r = OK;
   
   rw_flag = (fs_m_in.m_type == REQ_BREAD ? READING : WRITING);
-  gid = fs_m_in.REQ_GRANT;
-  position = fs_m_in.REQ_SEEK_POS;
-  nrbytes = (unsigned) fs_m_in.REQ_NBYTES;
+  gid = fs_m_in.m_vfs_fs_breadwrite.grant;
+  position = fs_m_in.m_vfs_fs_breadwrite.seek_pos;
+  nrbytes = fs_m_in.m_vfs_fs_breadwrite.nbytes;
   block_size = v_pri.logical_block_size_l;
   dir = v_pri.dir_rec_root;
 
@@ -125,12 +125,12 @@ int fs_bread(void)
     position += chunk; /* position within the file */
   }
   
-  fs_m_out.RES_SEEK_POS = position; 
+  fs_m_out.m_fs_vfs_breadwrite.seek_pos = position;
   
   if (rdwt_err != OK) r = rdwt_err;    /* check for disk error */
   if (rdwt_err == END_OF_FILE) r = OK;
 
-  fs_m_out.RES_NBYTES = cum_io;
+  fs_m_out.m_fs_vfs_breadwrite.nbytes = cum_io;
   
   return(r);
 }
index f3a0533b3ef4d70a8df53d03bd772c9a6f2d6baa..f947cf57d7386c9f6da8502307b45ae9981b7beb 100644 (file)
@@ -160,13 +160,13 @@ int fs_breadwrite(void)
   
   r = OK;
 
-  target_dev = fs_m_in.REQ_DEV;
+  target_dev = fs_m_in.m_vfs_fs_breadwrite.device;
   
   /* Get the values from the request message */ 
   rw_flag = (fs_m_in.m_type == REQ_BREAD ? READING : WRITING);
-  gid = (cp_grant_id_t) fs_m_in.REQ_GRANT;
-  position = fs_m_in.REQ_SEEK_POS;
-  nrbytes = (size_t) fs_m_in.REQ_NBYTES;
+  gid = fs_m_in.m_vfs_fs_breadwrite.grant;
+  position = fs_m_in.m_vfs_fs_breadwrite.seek_pos;
+  nrbytes = fs_m_in.m_vfs_fs_breadwrite.nbytes;
   
   block_size = get_block_size(target_dev);
 
@@ -199,12 +199,12 @@ int fs_breadwrite(void)
          position += chunk;    /* position within the file */
   }
   
-  fs_m_out.RES_SEEK_POS = position; 
+  fs_m_out.m_fs_vfs_breadwrite.seek_pos = position;
   
   if (lmfs_rdwt_err() != OK) r = lmfs_rdwt_err();      /* check for disk error */
   if (lmfs_rdwt_err() == END_OF_FILE) r = OK;
 
-  fs_m_out.RES_NBYTES = cum_io;
+  fs_m_out.m_fs_vfs_breadwrite.nbytes = cum_io;
   
   return(r);
 }
index c93795b63ece9a2c41f5286cdb355ecb0a100b31..d3bf60f13128ccea33733dbb894e94c30114e62f 100644 (file)
@@ -42,10 +42,10 @@ static int req_breadwrite_actual(endpoint_t fs_e, endpoint_t user_e, dev_t dev,
 
   /* Fill in request message */
   m.m_type = rw_flag == READING ? REQ_BREAD : REQ_BWRITE;
-  m.REQ_DEV = dev;
-  m.REQ_GRANT = grant_id;
-  m.REQ_SEEK_POS = pos;
-  m.REQ_NBYTES = num_of_bytes;
+  m.m_vfs_fs_breadwrite.device = dev;
+  m.m_vfs_fs_breadwrite.grant = grant_id;
+  m.m_vfs_fs_breadwrite.seek_pos = pos;
+  m.m_vfs_fs_breadwrite.nbytes = num_of_bytes;
 
   /* Send/rec request */
   r = fs_sendrec(fs_e, &m);
@@ -53,8 +53,8 @@ static int req_breadwrite_actual(endpoint_t fs_e, endpoint_t user_e, dev_t dev,
   if (r != OK) return(r);
 
   /* Fill in response structure */
-  *new_pos = m.RES_SEEK_POS;
-  *cum_iop = m.RES_NBYTES;
+  *new_pos = m.m_fs_vfs_breadwrite.seek_pos;
+  *cum_iop = m.m_fs_vfs_breadwrite.nbytes;
 
   return(OK);
 }
@@ -92,9 +92,9 @@ int req_bpeek(endpoint_t fs_e, dev_t dev, off_t pos, unsigned int num_of_bytes)
 
   /* Fill in request message */
   m.m_type = REQ_BPEEK;
-  m.REQ_DEV = dev;
-  m.REQ_SEEK_POS = pos;
-  m.REQ_NBYTES = num_of_bytes;
+  m.m_vfs_fs_breadwrite.device = dev;
+  m.m_vfs_fs_breadwrite.seek_pos = pos;
+  m.m_vfs_fs_breadwrite.nbytes = num_of_bytes;
 
   /* Send/rec request */
   return fs_sendrec(fs_e, &m);