Skip to content

Add method to VFS in Minix.

Good Night,

First of all, what is VFS? VFS means Virtual File System. It is a layer that exists in a lot of OS and in Minix too, this layer takes care of the communication with the File System. It is a Master’s thesis in Computer Science from Balázs Gerófi and the name is “Design and implementation of the MINIX Virtual File system“.

But why to communicate with VFS server? Or why to add something on it? If you want to some tasks you need to do a SYSCALL to it. But sometimes the VFS server don’t do what you want. So you must add and change it to do it.

How to do this?

Edit “/usr/src/include/minix/callnr.h”. After this line “#define GETPGRP 63″ add this:
[code lang=”c”]
#define TESTCALL 64
[/code]

Then you need to change the VFS server and add what you want to do when it is called. Edit “/usr/src/servers/vfs/table.c”. You should replace the line “no_sys, /* 64 = unused */” with:
[code lang=”c”]
do_TESTCALL, /* 64 = unused */
[/code]

What happens? The method do_TESTCALL will be called when a syscall with number 64 is done.

Change the “/usr/src/servers/vfs/proto.h”. Add this:
[code lang=”c”]
/* do_TESTCALL EXAMPLE */
_PROTOTYPE( int do_TESTCALL, (void) );
[/code]

Now you have to create the method in “/usr/src/servers/vfs/read.c” (I did in this file and it worked). Add this:

[code lang=”c”]
/*===========================================================================*
*Trabalho: do_ver_contig *
*===========================================================================*/
PUBLIC int do_TESTCALL() {
message m;
printf(“Number received %d”, m_in.fd);
}
[/code]

But how to execute? How this works? How to compile?
Acess “/usr/src/tools/” and execute:

$ make libraries

(This process can take a long time)

In “/usr/src/tools” execute:

$ make hdboot

Reboot.

How to test and see if it is working? Create in your “/root” a file with this:
[code lang=”c”]
#include
#include
#include #include

int main(int argc, char *argv[]) {
int fd = 2;
message m;
m.m1_i1 = fd;
printf(“Number: %d”, fd);
_syscall(FS, 64, &m);
}
[/code]

Compile it, execute it and done!

This file do a _syscall to FS saying to execute method 64 and send by message the number 2. So the do_TESTCALL receive the parameter and show it on screen. Yes it is simple, but it is just an example about how to work with VFS server.

Example of code changed/add to VFS server

Creating a system library in Minix.

Best Regards,
Matheus

PS: It is a silly example, but it just show how to add some method to VFS Server. Probably in the next days I will show a real example.

Published inCLinux

1,034 Comments

  1. slot machines ontario united states, automatic poker
    dealer machine and casinos uk online blackjack fruit slots,
    or dollar 5 deposit online roo casino 309 login (Celia) united kingdom

  2. online gambling ads usa, casino paypal deposit usa and casino dusaes no deposit bonus codes, or remote how to
    open gambling business [Maritza] association uk

  3. australian south africa legal online gambling (Charlie) casino apps, casino bonus uk and united statesn pokies history,
    or best uk casino offers

  4. new zealandn casino guide 2021, apple pay seminole casino
    coconut creek promotions – Charli – canada and is playing poker
    for money illegal usa, or new zealandn casino guide app

  5. top new united statesn online casino, best online casinos
    new zealand and best casino site canada, or wwf blackjack lanza

    Here is my web site: roulette shots game rules (Michell)

  6. best online poker usa real money, is there a casino in sydney united states and united kingdom online casino no deposit bonus
    codes 2021, or how old to gamble in nc (Renee) many casinos are
    in usa

  7. casino gananoque ontario united kingdom, canadian blackjack online free
    and double up casino huron sd (Jessika) in united states near detroit, or free
    chip no deposit united states 2021

  8. best casino affiliate programs (Faustino) australia casino no deposit bonus,
    are there any legal online poker sites in australia
    and online casino canada no deposit sign up bonus, or canadian online gambling

  9. are there casinos in montreal australia, native united statesn south coast casino durban (Marco) issues and real money
    pokies online united states, or usa super casino

  10. best new zealand casino, gousaos quest free money on stake casino [Felica] spins no
    deposit and free spins no deposit keep your winnings uk, or best casino cities
    in united kingdom

  11. no deposit bingo bonus usa, free spins or no deposit
    bonus and online casino in south africa with no deposit (Malissa)
    sarnia ontario australia, or united kingdom poker 95 download

  12. new united statesn no deposit bonus casino 2021, best united kingdom online casino slots
    and slot machines sale united states, or casino online united kingdom free

    Also visit my blog: future of casinos (Laverne)

  13. Kai Kai

    australia casino online state united, casino united kingdom chance and united kingdom friendly online poker sites, or online
    casino bingo clash real money reviews – Kai, money
    canada paysafe

  14. captain cooks dragon quest 11 astuce casino roulette (Mayra) united
    kingdom review, online poker canada vpn and 25 free spins on registration no deposit usa, or uk
    bingo call

  15. online casino usa bonus, automatic poker dealer machine and united statesn casinos no deposit bonus, or new zealands best onlinecasinos gambling com

    Feel free to surf to my website … what hands can you split in blackjack (Brianne)

  16. prepaid visa for online gambling on god – Antonio – uk, united statesn bingo rules and the largest casino in australia, or
    online casino reviews united states

  17. crypto gambling usa, online gambling uk statistics and real top 10 apps to
    earn money by playing games (Luther) online casinos united states, or usa casino age restriction

  18. united statesn is bucky’s casino open, Heidi, no deposit free spins, play free slots united states and betway poker australia,
    or online slots no deposit bonus usa

Leave a Reply

Your email address will not be published. Required fields are marked *