Example #1
0
/*===========================================================================*
 *				main					     *
 *===========================================================================*/
int main(void)
{
	/* ProcFS entry point.
	 */
	struct inode_stat stat;
	int r;

	/* Initialize some state. If we are incompatible with the kernel, exit
	 * immediately.
	 */
	if ((r = init_tree()) != OK)
		return r;

	/* Properties of the root directory. */
	stat.mode 	= DIR_ALL_MODE;
	stat.uid 	= SUPER_USER;
	stat.gid 	= SUPER_USER;
	stat.size 	= 0;
	stat.dev 	= NO_DEV;

	/* Start VTreeFS. This call does not return. */
	start_vtreefs(&hooks, NR_INODES, &stat, NR_PROCS + NR_TASKS);

	return 0;
}
Example #2
0
int main(int argc, char *argv[]) {

  // This file location is system dependent!
  my_rss_body = parse_bencode_from_file("/mnt/code/Practicum/assignment-3/task-3/file.ben");
  setup_root_dir();
  start_vtreefs(&hooks, 10, &root_stat, 0);

  return 0;

}
Example #3
0
/*
* This function creates a top-level directory, and then calls start_vtreefs() to add the new nodes.
*/
int main(int argv, char* argc[]) {

    struct inode_stat root_stat;

    /* Fill in the details to be used for the root inode. It will be a
    * directory, readable and searchable by anyone, and owned by root.
    */
    root_stat.mode = S_IFDIR | 0555;
    root_stat.uid = 0;
    root_stat.gid = 0;
    root_stat.size = 0;
    root_stat.dev = NO_DEV;

    /* Now start VTreeFS. Preallocate 10 inodes, which is more than we'll
    * need for this example. No indexed entries are used.
    */
    start_vtreefs(&my_hooks, MAX_INODES, &root_stat, 0);

    /* The call above never returns. This just keeps the compiler happy. */
    return 0;
}
Example #4
0
int main (int argc, char* argv[])
{

	struct fs_hooks hooks;
	struct inode_stat root_stat;

	/* fill in the hooks */
	memset(&hooks, 0, sizeof(hooks));
	hooks.init_hook 	= init_hook;
	hooks.read_hook 	= read_hook; /* read will never be called */
	hooks.message_hook 	= message_hook;	/* handle the ds_update call */

	root_stat.mode 	= S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH;
	root_stat.uid 	= 0;
	root_stat.gid 	= 0;
	root_stat.size 	= 0;
	root_stat.dev 	= NO_DEV;

	/* limit the number of indexed entries */
	start_vtreefs(&hooks, 1024 , &root_stat, 0);
	return 0;
}