On Sun, Jan 19, 2003 at 08:07:06PM +0530, Vamsi Krishna wrote: > hi, > why does the kernel register sock_fs_type file system while doing a > network initialization ?. > and i want to know if kernel internally has sperate file systems ?. > can some one explain about the functions "register_filesystem" and > "kern_mount" Well... all kinds of things in unix, that need any kind of a handle use a file handle for that purpose. That keeps the API neat and simle. Internaly, each file handle is represented by a file structure that holds state of uses's access to that resource. That structure in turns points to a dentry, that, together with inode, describes the resource itself. Each inode and dentry (for real filesystems they represent the actual file and it's name in filesystem respectively) belong's to a filesystem driver, that implement various syscalls for that particular file type. Each instance of a filesystem is described in a superblock structure. A filesystem driver is registered using the register_filesystem function, that is it provides a function to fill in it's superblock. Now a filesystem get's mounted. That's where kern_mount comes to play. It allocates the superblock, fills common fields and asks the filesystem driver to fill the rest. Then the superblock is either put into a vfsmount and thus connected to the virtual tree, or it remains hidden for some special purpose. Now, since sockets are manipulated using file handles, it's a filesystem driver, that provides the functions. It's the one called sockfs. It's registered when network is initialized and it's allocated a suberblock. Then, when a socket is created, an inode and file handles are created in that superblock to present the socket to the user. ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@ucw.cz> -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/