VFS/MFS communication MINIX

1,146 views
Skip to first unread message

Camila J.

unread,
Aug 9, 2015, 3:43:31 PM8/9/15
to minix3
Hi, i have to make an assignment in wich i have to send messages to the MFS server from the VFS server. I've been looking around on the internet, but haven't found anything on how to do that (this message passing from one server to the other). Can someone please help? 
Thanks. 

Jean-Baptiste Boric

unread,
Aug 9, 2015, 7:51:05 PM8/9/15
to minix3
Hi,

Have you checked the documentation section on the Minix 3 website? There should be enough documentation (even if partly outdated) available to get you started.

You can start by reading the message passing and VFS/FS protocol pages under the developers guide, or the OS: Design and Implementation 3rd edition book which explains thoroughly MINIX 3.1.0.

We'll be happy to awnser more specific questions, just remember that this mailing list has a policy not to do student's assignments for them.

Message has been deleted

Camila J.

unread,
Aug 11, 2015, 6:32:30 PM8/11/15
to minix3
Yes, i have read the documentation, but it wasn't very useful to me. I don't want anyone to do my assignments, i just need help to get started, really, because all the other tutorials and documentations i've read are from older versions of Minix, and their FS's servers are "united", there's only the FS, and not VFS and MFS and PFS like now. But thank you! Can you give me a light about how do I use a function that is on the MFS server?

Jean-Baptiste Boric

unread,
Aug 12, 2015, 4:46:17 AM8/12/15
to minix3
All Minix IPC messages are declared under minix/include/ipc.h, you'll need to add a new struct of exactly 56 bytes with what you want to transfer to the file server (or reuse one already existing, like mess_u8).

FS to VFS communication is abstracted by the fsdriver library, under minix/lib. You'll need to add a new request number to minix/include/fsdriver.h and either deal with the message in the library or add another callback for the file server to handle.

As of how to send a message from VFS to FS, you'll need to add a new message type in minix/include/minix/callnr.h, modify minix/include/ipc.h to add a new struct, send a message to VFS from a process (check minix/lib/libc/sys/read.c for an example) and add code to deal with it inside VFS.

If you need to transfer more than 56 bytes of data at once, you'll need to take a look at memory grants.

yago elias

unread,
Sep 3, 2015, 10:04:05 PM9/3/15
to minix3
It's very simple "camila j" ... you should look to the request.c file you'll see functions like:

/*===========================================================================*
 *            req_breadwrite                         *
 *===========================================================================*/
int req_breadwrite(
  endpoint_t fs_e,
  endpoint_t user_e,
  dev_t dev,
  u64_t pos,
  unsigned int num_of_bytes,
  char *user_addr,
  int rw_flag,
  u64_t *new_posp,
  unsigned int *cum_iop
)
{
  int r;
  cp_grant_id_t grant_id;
  message m;

  grant_id = cpf_grant_magic(fs_e, user_e, (vir_bytes) user_addr, num_of_bytes,
            (rw_flag == READING ? CPF_WRITE : CPF_READ));
  if(grant_id == -1)
      panic("req_breadwrite: cpf_grant_magic failed");

  /* Fill in request message */
  m.m_type = rw_flag == READING ? REQ_BREAD : REQ_BWRITE;
  m.REQ_DEV2 = dev;
  m.REQ_GRANT = grant_id;
  m.REQ_SEEK_POS_LO = ex64lo(pos);
  m.REQ_SEEK_POS_HI = ex64hi(pos);
  m.REQ_NBYTES = num_of_bytes;

  /* Send/rec request */
  r = fs_sendrec(fs_e, &m);
  cpf_revoke(grant_id);
  if (r != OK) return(r);

  /* Fill in response structure */
  *new_posp = make64(m.RES_SEEK_POS_LO, m.RES_SEEK_POS_HI);
  *cum_iop = m.RES_NBYTES;

  return(OK);
}

,,,

all you have to do , is understand how the servers comunicate, like, what kind of parameters they use in commom,,,
hint: you may need to search the message struct and see how it works... once you find it, you need to add a new type of message...
so...after creating your own request function in this file, go to the misc.c where you can place a call to this function...
Lets say u want to find a very important information for a file that only stands in mfs, like the inode struct... add your function on vfs and search about the filp functions... you'll that
there is a cool way to get the vnode,,, then pass to your request function whatever data you need in the other server... simple use a sendrec to complete this...

in the other server , just grab it with its only "in" message struct... i think its something like fs_in ,,, well search in the other functions on the misc.c file,,, they probably use it... good lucky "camila".
Reply all
Reply to author
Forward
0 new messages