コード例 #1
0
ファイル: procfs_dir.c プロジェクト: GNUHurdTR/hurd
struct node *
procfs_dir_make_node (const struct procfs_dir_ops *dir_ops, void *dir_hook)
{
  static const struct procfs_node_ops ops = {
    .get_contents = procfs_dir_get_contents,
    .lookup = procfs_dir_lookup,
    .cleanup_contents = procfs_cleanup_contents_with_free,
    .cleanup = procfs_dir_cleanup,
  };
  struct procfs_dir_node *dir;

  dir = malloc (sizeof *dir);
  if (! dir)
    {
      if (dir_ops->cleanup)
	dir_ops->cleanup (dir_hook);

      return NULL;
    }

  dir->ops = dir_ops;
  dir->hook = dir_hook;

  return procfs_make_node (&ops, dir);
}
コード例 #2
0
ファイル: rootdir.c プロジェクト: jeremie-koenig/procfs
static struct node *
rootdir_symlink_make_node (void *dir_hook, const void *entry_hook)
{
  struct node *np = procfs_make_node (entry_hook, dir_hook);
  if (np)
    procfs_node_chtype (np, S_IFLNK);
  return np;
}
コード例 #3
0
ファイル: rootdir.c プロジェクト: jeremie-koenig/procfs
static struct node *
rootdir_file_make_node (void *dir_hook, const void *entry_hook)
{
  /* The entry hook we use is actually a procfs_node_ops for the file to be
     created.  The hook associated to these newly created files (and passed
     to the generators above as a consequence) is always the same global
     ps_context, which we get from rootdir_make_node as the directory hook. */
  return procfs_make_node (entry_hook, dir_hook);
}