Beispiel #1
0
static int rtems_jffs2_mknod(
	const rtems_filesystem_location_info_t *parentloc,
	const char *name,
	size_t namelen,
	mode_t mode,
	dev_t dev
)
{
	struct _inode *dir_i = rtems_jffs2_get_inode_by_location(parentloc);
	int eno;

	switch (mode & S_IFMT) {
		case S_IFDIR:
			eno = -jffs2_mknod(dir_i, name, namelen, mode, NULL, 0);
			break;
		case S_IFREG:
			eno = -jffs2_create(dir_i, name, namelen, mode);
			break;
		default:
			eno = EINVAL;
			break;
	}

	return rtems_jffs2_eno_to_rv_and_errno(eno);
}
Beispiel #2
0
static int jffs2_whiteout(struct inode *old_dir, struct dentry *old_dentry)
{
	struct dentry *wh;
	int err;

	wh = d_alloc(old_dentry->d_parent, &old_dentry->d_name);
	if (!wh)
		return -ENOMEM;

	err = jffs2_mknod(old_dir, wh, S_IFCHR | WHITEOUT_MODE,
			  WHITEOUT_DEV);
	if (err)
		return err;

	d_rehash(wh);
	return 0;
}