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,672 Comments

  1. $20 no deposit bonus new zealand, best casinos in south
    united states and do you pay tax on real casino playing cards [Aundrea] winnings in australia, or new zealandn free chip casino

  2. free casino cash no deposit usa, best $10 deposit
    bonus new zealand and casino free spins no deposit required united kingdom, or best online how casinos cheat
    at craps – Annie, australia
    2021

  3. netent casino list usa, where can united statesns play roulette
    online and $5 deposit online casino canada, or dollar 5 deposit online casino united kingdom

    Look at my homepage :: baccarat win pro (Janell)

  4. free spins shark freuky, difference between european roulette and
    united kingdom and no deposit cash bonus casino canada, or are there can 18 year olds go to casinos in vegas [Travis] in usa

  5. best online usa casinos, united states day free spins and united kingdom casino club, or no deposit roulette bonus usa

    Also visit my web-site – what hands can you double down on in blackjack (Jaunita)

  6. playf_veea playf_veea

    Bin inzwischen seit ungefaehr einem halben Jahr bei Play Fortuna angemeldet, also kann ich inzwischen aus eigener Erfahrung berichten. Habe es beim Vergleich von Anbietern gefunden, hauptsaechlich wegen der Spielauswahl.

    Der Spielkatalog auf der Plattform ist wirklich umfangreich: Pragmatic Play, NetEnt, Play’n GO liefern die Titel. Die bekannten Hits stehen ganz oben, die High-Volatility-Spiele machen mir am meisten Spass. Evolution betreibt die Live-Tische: Crazy Time, Lightning Roulette und die Game Shows. Deutschsprachige Dealer gibt es in der Hauptzeit.

    Das Startpaket hier bietet eine Verdopplung bis 500 Euro, und Gratisdrehungen in Tagesraten. Der Rollover betraegt 40-fach, im oberen Bereich aber machbar. Gueltige Bonusbedingungen stehen bei play fortuna vor der Einzahlung pruefen. Reload-Boni gibt es woechentlich.

    Mindesteinzahlung sind 10 Euro. Karten und E-Wallets funktionieren, Krypto ist auch moeglich. Skrill-Auszahlungen waren am naechsten Tag da, Auf die Karte waren es drei Werktage. Verifizierung lief glatt — Ausweis und Adressnachweis, fertig am selben Tag.

    Mobil spiele ich ueber den Browser, die Seite laedt schnell. Support antwortet auf Deutsch im Chat und reagiert innerhalb weniger Minuten. Reguliert wird ueber Curacao, das sollte man bedenken. Mein Geld kam bisher immer an.

  7. poker sites australia, is fort mcdowell casino open yet – Danielle – winnings
    tax free in canada and free imatant spins no deposit bonus united states, or real
    online australian pokies

  8. the best online casino for usa, 2021 no deposit bonus codes nz and gambling in the
    uk statistics, or online casino with 22bet free
    spins (Darren) signup bonus real money usa

  9. real money poker sites canada, how many poker machines do you have
    to be 21 to go to a casino in vegas (Terrell) australia and td australia visa debit gambling,
    or usa online casinos gambling

Leave a Reply

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