示例#1
0
文件: main.c 项目: wieck/minix
/*===========================================================================*
 *		            sef_cb_init_fresh                                *
 *===========================================================================*/
static int sef_cb_init_fresh(int type, sef_init_info_t *info)
{
    /* Initialize the pipe file server. */
    int i;
    struct passwd *pw;

    /* Initialize main loop parameters. */
    exitsignaled = 0;	/* No exit request seen yet. */
    busy = 0;		/* Server is not 'busy' (i.e., inodes in use). */

    /* Init inode table */
    for (i = 0; i < PFS_NR_INODES; ++i) {
        inode[i].i_count = 0;
    }

    init_inode_cache();
    uds_init();
    buf_pool();


    /* Drop root privileges */
    if ((pw = getpwnam(SERVICE_LOGIN)) == NULL) {
        printf("PFS: unable to retrieve uid of SERVICE_LOGIN, "
               "still running as root");
    } else if (setuid(pw->pw_uid) != 0) {
        panic("unable to drop privileges");
    }

    SELF_E = getprocnr();

    return(OK);
}
示例#2
0
文件: main.c 项目: DragonQuan/minix3
/*===========================================================================*
 *		            sef_cb_init_fresh                                *
 *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
{
/* Initialize the Minix file server. */
  int i;

  /* Defaults */
  opt.use_orlov = TRUE;
  opt.mfsalloc = FALSE;
  opt.use_reserved_blocks = FALSE;
  opt.block_with_super = 0;
  opt.use_prealloc = FALSE;

  /* If we have been given an options string, parse options from there. */
  for (i = 1; i < env_argc - 1; i++)
	if (!strcmp(env_argv[i], "-o"))
		optset_parse(optset_table, env_argv[++i]);

  may_use_vmcache = 1;

  /* Init inode table */
  for (i = 0; i < NR_INODES; ++i) {
	inode[i].i_count = 0;
	cch[i] = 0;
  }

  init_inode_cache();

  SELF_E = getprocnr();

  /* just a small number before we find out the block size at mount time */
  buf_pool(10);
  fs_block_size = _MIN_BLOCK_SIZE;

  return(OK);
}
示例#3
0
static int __init init_unionfs_fs(void)
{
	int err;
	printk("Registering unionfs " UNIONFS_VERSION "\n");

	fist_set_debug_value(init_debug);

#ifdef FIST_MALLOC_DEBUG
	atomic_set(&unionfs_malloc_counter, 0);
	atomic_set(&unionfs_mallocs_outstanding, 0);
#endif				/* FIST_MALLOC_DEBUG */

	if ((err = init_filldir_cache()))
		goto out;
	if ((err = init_inode_cache()))
		goto out;
	if ((err = init_dentry_cache()))
		goto out;
	err = register_filesystem(&unionfs_fs_type);
      out:
	if (err) {
		destroy_filldir_cache();
		destroy_inode_cache();
		destroy_dentry_cache();
	}
	return err;
}
示例#4
0
/*
 * register dumpfs with vfs layer.
 */
static int
__init init_dumpfs(void)
{
	int	err;
	err = init_inode_cache();
	if (err < 0) {
		printk(KERN_INFO "Failed Register dumpfs filesystem %d", err);
		return err;
	}
	if ((err = register_filesystem(&dumpfs_type))) {
		printk(KERN_INFO "Failed to register filesystem %d", err);
	}
	printk(KERN_INFO "Register dumpfs filesystem %d", err);
	
	return (err);
}
示例#5
0
文件: main.c 项目: Hooman3/minix
/*===========================================================================*
 *		            sef_cb_init_fresh                                *
 *===========================================================================*/
static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
/* Initialize the Minix file server. */
  int i;

  lmfs_may_use_vmcache(1);

  /* Init inode table */
  for (i = 0; i < NR_INODES; ++i) {
	inode[i].i_count = 0;
	cch[i] = 0;
  }
	
  init_inode_cache();

  lmfs_buf_pool(DEFAULT_NR_BUFS);

  return(OK);
}
示例#6
0
文件: main.c 项目: Spenser309/CS551
/*===========================================================================*
 *		            sef_cb_init_fresh                                *
 *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
{
/* Initialize the Minix file server. */
  int i, r;

  /* Defaults */
  opt.use_orlov = TRUE;
  opt.mfsalloc = FALSE;
  opt.use_reserved_blocks = FALSE;
  opt.block_with_super = 0;
  opt.use_prealloc = FALSE;

  /* If we have been given an options string, parse options from there. */
  for (i = 1; i < env_argc - 1; i++)
	if (!strcmp(env_argv[i], "-o"))
		optset_parse(optset_table, env_argv[++i]);

  may_use_vmcache = 1;

  /* Init inode table */
  for (i = 0; i < NR_INODES; ++i) {
	inode[i].i_count = 0;
	cch[i] = 0;
  }

  init_inode_cache();

  /* Init driver mapping */
  for (i = 0; i < NR_DEVICES; ++i)
	driver_endpoints[i].driver_e = NONE;

  SELF_E = getprocnr();
  buf_pool(DEFAULT_NR_BUFS);
  fs_block_size = _MIN_BLOCK_SIZE;

  fs_m_in.m_type = FS_READY;

  if ((r = send(VFS_PROC_NR, &fs_m_in)) != OK) {
	panic("Error sending login to VFS: %d", r);
  }

  return(OK);
}
示例#7
0
文件: main.c 项目: boostsup/minix3
/*===========================================================================*
 *				init_server                                  *
 *===========================================================================*/
PRIVATE void init_server(void)
{
   int i;

   /* Init inode table */
   for (i = 0; i < NR_INODES; ++i) {
	   inode[i].i_count = 0;
	   cch[i] = 0;
   }
	
   init_inode_cache();

   /* Init driver mapping */
   for (i = 0; i < NR_DEVICES; ++i) 
       driver_endpoints[i].driver_e = NONE;
	
   SELF_E = getprocnr();
   buf_pool();
   fs_block_size = _MIN_BLOCK_SIZE;
}
示例#8
0
/*===========================================================================*
 *		            sef_cb_init_fresh                                *
 *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
{
/* Initialize the pipe file server. */
  int i;

  /* Initialize main loop parameters. */
  exitsignaled = 0;	/* No exit request seen yet. */
  busy = 0;		/* Server is not 'busy' (i.e., inodes in use). */

  /* Init inode table */
  for (i = 0; i < NR_INODES; ++i) {
	inode[i].i_count = 0;
  }
	
  init_inode_cache();
  uds_init();

  SELF_E = getprocnr();
  buf_pool();

  driver_announce();

  return(OK);
}