Exemplo n.º 1
0
static fni_handle try_open (fni_access access       /* fnilib access handle */
                          , char const *  const fn /* file name             */
                          , char const *  const md /* mode of opening       */
                          , fni_list      const fl /* list of directories   */
                          , char const *  const rf /* relative file name    */
                          , void (* const free_fn)(void *)
                                                 /* function to free memory */
                           )
{
  fni_handle opened;
  fni_style old_style;

  /* try host style first */
  old_style = fni_set_style (access, host_style);
  
  opened = simple_open (access, fn, md, fl, rf, free_fn);

  /* Now try the unix style if we must */
  if (opened == NULL)
  {
    if (fni_set_style (access, unix_style) != unix_style)
      opened = simple_open (access, fn, md, fl, rf, free_fn);
  }

  /* Reset style of file names */
  fni_set_style (access, old_style);
  
  return (opened);
}
Exemplo n.º 2
0
static int fs_open(struct inode *inode, struct file *filp)
{
	int ret;
	struct fs_base *base;

	ret = simple_open(inode, filp);
	if (ret)
		return ret;

	if (!filp->private_data)
		return -ENOENT;

	base = filp->private_data;
	kref_get(&base->refcount);

	return ret;
}
Exemplo n.º 3
0
static int fs_match_open(struct inode *inode, struct file *filp)
{
	int ret;
	struct fs_base *base;
	struct fs_debugfs_match_header_ctx *ctx;

	ret = simple_open(inode, filp);
	if (ret)
		return ret;

	if (!filp->private_data)
		return -ENOENT;

	ctx = filp->private_data;
	base = ctx->base;
	kref_get(&base->refcount);

	return ret;
}