Minix system call, please anybody can HELP??

Discussion in 'Programming' started by Lock_John, Jun 1, 2008.

  1. #1
    Hello to the forum.

    I have to do a project, in minix 3 for my university course.
    There are 3 problems in total.

    First problem
    -We have to implement a system call, into the fs(file system).This system call will be taking a file name (char * name) as input.It returns to the process tha called it, the first i-node of the file.


    Second problem
    - -We have to implement a system call, into the fs(file system).This system call will be taking a file name (char * name) as input. It returns to the process tha called it, the percentage of "breaking into many pieces" , of the blocks of the file. As percentage of "breaking into pieces" we consider the number of blocks that are not continuous in relation with the total number of blocks of the file.
    example:
    A file is stored in the blocks: 1001, 1002, 1003,1050,1420,1421,1422. The blocks 1003,1050,1420 are not continuous. The percentage of "breaking into pieces" is 3/7 = 42.8% .


    Third problem
    -We have to implement a system call, into the fs(file system).This system call will be taking a file name (char * name) as input. It transfers the blocks of the file to some point of the storing unit in order to minimize the "breaking into pieces" of the blocks of the file.(or to completely disappear).


    Please for any possible solutions/ changes to the necessay files of th minix code.
    For now, i only can implement simple NEW SYSTEM CALL, which types a message int he screen (the classic "hello world or "i am a system call" example...).
    I follow this procedure:

    1.I add the prorotype in /usr/src/servers/pm/misc.c , example: _PROTOTYPE(int do_hello,(void));

    2.at the end of the file /usr/src/servers/pm/misc.c I add the code:
    PUBLIC int do_hello()
    {
    printf("I am a system call \n");
    return o;
    }

    3.Then I compile the servers
    In the directory /usr/src/servers/ I give the commands "make image" and "make install"

    4.Then I create a user definition function, by adding " #define HELLO 69" in the files /usr/src/include/minix/callnr.h" and "/usr.include/minix/callnr.h".

    5.I make a new directory (example: project) and there I create the files hello.h and test.c

    6.Then I go to /usr/src/ and I give the command "make libraries"

    7.Then I compile the kernel.I go to /usr/src/tools and give the commands : "make hdboot" and "make install"

    8.At the end, I return to the directory "project" and I type "shutdown"


    IN order to check that it works ok, I go to the VMWARE options, and I select "reset".
    Finally I compile my program, with cc test.c and then I execute it with ./a.out and.....I hope to see "HELLO"!!!!


    Excuse me for the long message.

    I am anxiously waiting for any help, ideas ,how to implement tha problems I refer to.(the 3 problems at the top of tis post).
    Anyone who could tell me which files to change and how, please....
    Thank you in advance, for your effort/ attention.

    Good afternoon.
     
    Lock_John, Jun 1, 2008 IP