| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Downloads

Page history last edited by Manish 14 years, 4 months ago

NGFS ( Downloads )

 

 

All the source code, samples for downloads should be kept here.  You may wish to upload your non-working code too for others to review, debug. In that case please make sure you upload it under "sandbox" section. Only the working code should be kept under "working" section.

 

Following codes are tested and compiled with kernel 2.6.23.12. Get it from here.

 

Nidhi Mittal Hada (nidhimittal19@gmail.com) has contributed a lot in improving this. You can find the latest & improved working code below. All the code below is tested with kernel 2.6.28.7

Version 1 :

          contains a README --- which explains what all it does.  (MyFs2.zip)

 

Version 2 :

          1) Mount

          2) Unmount

         3) ls -al //readdir called

         4)touch nn   // lookup called ---- file NOT created (MyFs3.zip)

 

Version 3:

        mount unmount

        ls -al --- readdir is called

        cd ----

        touch kk (MyFs4.zip)

 

Version 4:

     1)mount

     2)unmount

     3)ls -al

     4)create a file using touch

     5)remove  a file too - rm kk

     6)Reading a file -cat kk

     7)writing a file - echo "text" > kk (MyFs5.zip)

 

Version 5:

     1) mount

     2) unmount

     3) ls -al

     4) create a file using touch

     5) remove  a file too - rm kk

     6) Reading a file -cat kk

     7) writing a file - echo "text" > kk

     8) force mount (new feature in this version)  (MyFs6.zip)

 

Version 6:

   1) mount

     2) unmount

     3) ls -al

     4) create a file using touch

     5) remove  a file too - rm kk

     6) Reading a file -cat kk

     7) writing a file - echo "text" > kk

     8) force mount (new feature in this version)

     9) df (MyFs7.zip)

 

Thanks a lot Nidhi for your contributions !!!

 

==============================================================

This is old stuff ....!!

 

 NOTE : If you get compilation errors regarding the inode->u.generic_ip, Replace it with inode->i_private and also you will need to add an extra member "struct vfs_mount *mnt" in the call of function "ngfs_get_super" and call get_sb_bdev as get_sb_bdev(fs, flags, dev_name, data, ngfs_fill_super,mnt); 

  See http://lkml.org/lkml/2006/7/2/168

 

Working

 

      The codes below have been tested but still may not have taken enough care and may cause the kernel to crash on some systems. Better use UML (User Mode Linux) or VMware to test it.

  1.  Learn how to register your filesystem with the kernel. Make sure you read the MUST_README. 
  2. Here is the next working version of ngfs. It actually mounts your "ngfs" and you will be able to see it running the mount command. You will also be able to see some debugging info in "dmesg" which i just added to debug.

              Output something as after mounting

          [root@windce7 myfs]# mount

           /dev/hda2 on / type ext3 (rw)

           /home/katiyar/myfs/test_mount on /home/katiyar/myfs/test type ngfs (rw,loop=/dev/loop0)

           To test it perform the following commands

  •  dd if=/dev/zero of=test_mount bs=4096 count=10
  • ./mkngfs test_mount 4096
  • insmod ngfs.ko
  • mount -t ngfs /home/katiyar/myfs/test_mount test -o loop

      Download  mount_v1.tar.gz    ----- edited by Manish, Aug 22, 07

 

     3. With this version you can cleanly do a mount, unmount, cd , ls , ls -al, ls -ali (in the mounted directory). Some debugging info is there too in "dmesg" which might help you understand what is going on. you will not be able to create any new files. Will add that support soon. Also don't worry about the timestamp of the files shown in the output of "ls -al" as we dont keep a note of timestamp in our filesystem, you will see anything random there. See the physical layout of NGFS

     Download ngfs.zip      ----- edited by Manish, Sept 01, 07

 

     4. Working version which also supports creating new __FILES__ in the directory. Download nngfs_v1.tar.gz

                                                                                                                                      ---- edited by Manish, 26 Jan, 08

     5. Added the support for removing files. Download nngfs_v2.tar.gz

         Following commands are supported -- mount, umount, cd, ls (with options), touch, rm (with options) . Following commands dont work as of now but will be added soon ( mkdir, read or write to files, cat etc. )

                                                                                                                                                                                                                                                                                           ---- edited by Manish 30th Jan, 08

    6. Added support for read and writes to file. Download nngfs_v2_wr.tar.gz

        All the previous commands are supported. Additionally you can read and write using cat, echo , vi , redirection operators , here documents, etc. There is a small problem while writing files in vi when you press

       :w You might get messages like :

                    "test"

                         E297: Write error in swap file

                        "test" E667: Fsync failed

       Just press :w! and then :q!. Your data should be written by now. cat it from the command line, mount umount the filesystem to verify.

                                                                                                                                                                             ----------- edited by Manish Feb 22, 08

 

    7. Did some cleanup and organization of the code, and added the check so that you cannot create files greater than blocksize. Download nngfs_without_utils.tar.gz

       [root@localhost mount]# ls -l

         total 0

              -rwxr-xr-x 1 root root 4093 Mar  7 14:45 manish

        [root@localhost mount]# echo "ab" >> manish

          -bash: echo: write error: No space left on device

        [root@localhost mount]# echo "a" >> manish

        [root@localhost mount]# ls -l

         total 0

              -rwxr-xr-x 1 root root 4095 Mar  7 14:49 manish

 

        The download names having "without_utils" don't have the mkngfs utility in them. You need to download them from earlier sources ( 6 above) . Since it wasn't changing much I decided not to upload everytime

         I upload a new version.

                                                                                                                --------- edited by Manish, Mar 08, 08

 

     8. Added "-o force" option to mount. Now if you crash before doing clean unmount error will be thrown during remount. To test this first you will need to rebuild your fs to this as this involves on-disk change in superblock . Download nngfs_with_utils.tar.gz

 

                                                                                                                                                                                                                                      -- edited by Manish, Mar 15, 08

 

    9. Added support for "df" command. Below is a sample output with 4 files in my filesystem. Note the output shows 7 blocks to be used. Breakup is as follows.

          4 -- User files

          1-- Root directory

          1 -- Superblock info

          1 -- Inode info.

 

    [root@localhost neat]# ls mount

        a  katiyar  katiyarl  manish

   [root@localhost neat]# df -k -B 4096

       Filesystem           4K-blocks      Used Available Use% Mounted on

     /root/fs/changed/neat/myfs

                            32         7        25  22% /root/fs/changed/neat/mount

        Download nngfs_without_utils_v1.tar.gz                                                                                                                                                              -- edited by Manish, Mar 22,08

 

Sandbox

 

      If you are downloading from here chances are that most of the code under this will crash your kernel. It is your discretion to download, test and fix it. Will appreciate if you send the fixes though :-)

  1. Ok.....here goes the next version. Doesn't do anything useful other than i have added a utility to create NGFS filesystem and then there is the kernel module which loads, registers the filesystem and while mounting gives error :-) ...... I am still working on it to fix. As before the files are arranged as below
  • init.c      -- Main kernel module. Download its Makefile and how to build it from above.
  • utils/super.c  -- Functions to create the NGFS file system
  • utils/mkngfs.c -- Entry point for the mkngfs utility.

        Note that mkngfs right now just creates the super block ( not the root inode) and that also in a very raw fashion. We will optimize it later. Some functions like "ngfs_read_inode" are still incomplete. Perform the below steps to test.

  • Build init.c using the above Makefile
  • Build utils by issuing "make"
  • Create a filesystem by

               a) dd if=/dev/zero of=test_ngfs bs=512 count=10

               b) insmod ngfs.ko

               c) mkdir test

               d) mount -t ngfs test_ngfs /home/katiyar/test -o loop

               e) After this you should see an error message in reading root inode in your "dmesg".

      Download source

                                      ----- edited by Manish , August 21,07

 

    2. One more working version based on kernel version 2.6.23.11. Rewritten everything once again pretty much based on older version. specially the inode format (i_private). Can do mount, unmount, cd , ls -ali. It has lots of dirty debugging statements. Trying to use caches for inode allocation but isnt working right now. Fixing it. Download the source

                                                               --------- edited by Manish, December 29, 07

 

    3. Download this if you need to understand how to implement read and write in a basic filesystem. Note that it currently doesnt work. you will have to fix certain things. nngfs_sb_v2.tar.gz

                                                                                                                                                                                                       -------- edited by Manish Feb 9 , 08

Comments (0)

You don't have permission to comment on this page.