debug /servers/vfs/

66 views
Skip to first unread message

Hassan Murat

unread,
Apr 13, 2012, 3:32:43 PM4/13/12
to minix3
Hi folks,

I'm new to minix3.
I want to debug mount.c under /usr/src/servers/vfs/ .
But it did not seem to work if I try a simple printf("test"); or a
fprintf(stdout, "test");

I also tried to write in an existing file:

/***************CODE************************/
FILE *fp;

if ((fp=fopen("/home/meinlog/log","a"))!=NULL)
{
fprintf(fp, "VFS: get work\n");
fclose(fp);
}

/***************CODE************************/

thanks

Tomas Hruby

unread,
Apr 13, 2012, 4:16:58 PM4/13/12
to min...@googlegroups.com
On Fri, Apr 13, 2012 at 12:32 PM, Hassan Murat <kalea...@gmail.com> wrote:
> Hi folks,
>
> I'm new to minix3.
> I want to debug mount.c under /usr/src/servers/vfs/ .
> But it did not seem to work if I try a simple printf("test"); or a

printf works. The output should go to the logs or the first console or
the serial console depending on how you configure it.

> fprintf(stdout, "test");
>
> I also tried to write in an existing file:
>
>  /***************CODE************************/
>  FILE *fp;
>
>  if ((fp=fopen("/home/meinlog/log","a"))!=NULL)
>  {
>          fprintf(fp, "VFS: get work\n");
>          fclose(fp);
>  }
>
>  /***************CODE************************/

opening a file from a server which implements opening files sonds
strange, doesn't it? It should not work.

T.

pikpik

unread,
Apr 13, 2012, 4:19:06 PM4/13/12
to minix3
Hi,
Try putting a "printf" statement within the server's executing code,
such as on line 116 of VFS' mount.c [1]. When you execute the "mount"
command as root, you should see the message appear in on the system's
console and in /var/log/messages.

I hope this helps,
pikpik

1. http://git.minix3.org/?p=minix.git&a=blob&f=servers/vfs/mount.c&h=ebf0d1f1e05df8bf92a085f1b992e963d26d8507&hb=HEAD#l116

Hassan Murat

unread,
Apr 13, 2012, 6:23:47 PM4/13/12
to min...@googlegroups.com
Hello,
After putting the printf() statement under /usr/src/servers/vfs/mount.c (line 116 and 157) I recompiled the system under /usr/src/tools with make clean and make image. After that I reboot the system but it did not work.

By the way, I work with minix 3.1.8 under vmware player.
I also added a serial port with a output file on windows to my virtual machine but this also did not work.

thanks



--
You received this message because you are subscribed to the Google Groups "minix3" group.
To post to this group, send email to min...@googlegroups.com.
To unsubscribe from this group, send email to minix3+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/minix3?hl=en.


Hassan Murat

unread,
Apr 13, 2012, 6:28:56 PM4/13/12
to min...@googlegroups.com
Excuse me I forgot it.
The printf() statement is also not under /usr/log/messages.

Tomas Hruby

unread,
Apr 13, 2012, 7:13:54 PM4/13/12
to min...@googlegroups.com
> After putting the printf() statement under /usr/src/servers/vfs/mount.c
> (line 116 and 157) I recompiled the system under /usr/src/tools with make

diff would be much more helpfull. Who knows what is line 116 and 157
in a past version. It is hard to say whether the code is actually
executed. In general, printf works and you should see the results in
one the sinks.

T.

pikpik

unread,
Apr 13, 2012, 11:23:07 PM4/13/12
to minix3
Hi,

On Apr 13, 6:23 pm, Hassan Murat wrote:

> By the way, I work with minix 3.1.8 under vmware player.

I'm sorry, I should have asked which release you were using.

pikpik

Hassan Murat

unread,
Apr 13, 2012, 11:47:16 PM4/13/12
to min...@googlegroups.com
It's still frustrating.
It did not work.

Tomas Hruby

unread,
Apr 14, 2012, 1:58:27 AM4/14/12
to min...@googlegroups.com
On Fri, Apr 13, 2012 at 8:47 PM, Hassan Murat <kalea...@gmail.com> wrote:
> It's still frustrating.
> It did not work.

Come on man, give us some more info so we can help you. A patch with
your changes would help. How much changes did you make? I suppose you
need the print because you are hunting for a bug which you introduced.

Better still, put the print in some code which is ~100% executed like
in the main() function right after sef_startup(). You should see some
output.

T.

Hassan Murat

unread,
Apr 14, 2012, 8:15:52 AM4/14/12
to min...@googlegroups.com
Hello Thomas,

After searching I found something useful in google groups.

I followed the instructions from "sancho1980":

.......
-i configured my vmware so that all serial output is sent to a local
file on my host
-i recompiled the system, and as a first statement in kernel/main.c, i
placed the following statement: "do_serial_debug = 1;"
-i also added a statement in announce() to show me the value in
"do_serial_debug"
-in the minix 3 boot monitor, i set "ctty 0"
-then, when booting, the output of the boot monitor is indeed sent to
the local file specified in my vmware settings (so serial redirection
works)

........

After rebooting the system I found my printf() statements in the log file under windows.
But only the printf() statements which was in "/vfs/main.c" or /mfs/main.c

My problem is I want to understand the communication between the vfs and fs.
I know there is a master thesis from "Balazs Gerofi" but there is not concrete written, which files are involved in this information exchange between vfs and fs.

Thanks a lot

Antoine LECA

unread,
Apr 15, 2012, 7:31:18 AM4/15/12
to min...@googlegroups.com
Hassan Murat wrote:
> But only the printf() statements which was in "/vfs/main.c" or /mfs/main.c

Things are looking good then ;-) If you are able to have a printf() in
vfs/main, you can easily add another printf() in the switch(call_nr), in
the case it is actually MOUNT (do not forget to also execute the
"default" actions.)

Another place where you can probably insert a printf() in do_mount.


Antoine

Hassan Murat

unread,
Apr 15, 2012, 7:47:05 AM4/15/12
to min...@googlegroups.com
Thanks  Antoine. I will do that. 

Tomas Hruby

unread,
Apr 16, 2012, 12:00:17 AM4/16/12
to min...@googlegroups.com
Some of he VFS code is executed _very_ frequently! If you put the
printf there, the system gets pretty much stuck since it is only
printing. So be careful. If you are just trying to understand the
code, reading it and understanding it tells you more and faster.

T.

Reply all
Reply to author
Forward
0 new messages