Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60545d0d authored by Al Viro's avatar Al Viro
Browse files

[O_TMPFILE] it's still short a few helpers, but infrastructure should be OK now...



Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent f9652e10
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
#define O_SYNC		(__O_SYNC|O_DSYNC)

#define O_PATH		040000000
#define O_TMPFILE	0100000000

#define F_GETLK		7
#define F_SETLK		8
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#define O_INVISIBLE	004000000 /* invisible I/O, for DMAPI/XDSM */

#define O_PATH		020000000
#define O_TMPFILE	040000000

#define F_GETLK64	8
#define F_SETLK64	9
+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#define O_SYNC		(__O_SYNC|O_DSYNC)

#define O_PATH		0x1000000
#define O_TMPFILE	0x2000000

#define F_GETOWN	5	/*  for sockets. */
#define F_SETOWN	6	/*  for sockets. */
+16 −0
Original line number Diff line number Diff line
@@ -2968,6 +2968,22 @@ void d_genocide(struct dentry *root)
	goto again;
}

void d_tmpfile(struct dentry *dentry, struct inode *inode)
{
	inode_dec_link_count(inode);
	BUG_ON(dentry->d_name.name != dentry->d_iname ||
		!hlist_unhashed(&dentry->d_alias) ||
		!d_unlinked(dentry));
	spin_lock(&dentry->d_parent->d_lock);
	spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
	dentry->d_name.len = sprintf(dentry->d_iname, "#%llu",
				(unsigned long long)inode->i_ino);
	spin_unlock(&dentry->d_lock);
	spin_unlock(&dentry->d_parent->d_lock);
	d_instantiate(dentry, inode);
}
EXPORT_SYMBOL(d_tmpfile);

/**
 * find_inode_number - check for dentry with name
 * @dir: directory to check
+24 −0
Original line number Diff line number Diff line
@@ -119,6 +119,29 @@ static int ext2_create (struct inode * dir, struct dentry * dentry, umode_t mode
	return ext2_add_nondir(dentry, inode);
}

static int ext2_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
{
	struct inode *inode = ext2_new_inode(dir, mode, NULL);
	if (IS_ERR(inode))
		return PTR_ERR(inode);

	inode->i_op = &ext2_file_inode_operations;
	if (ext2_use_xip(inode->i_sb)) {
		inode->i_mapping->a_ops = &ext2_aops_xip;
		inode->i_fop = &ext2_xip_file_operations;
	} else if (test_opt(inode->i_sb, NOBH)) {
		inode->i_mapping->a_ops = &ext2_nobh_aops;
		inode->i_fop = &ext2_file_operations;
	} else {
		inode->i_mapping->a_ops = &ext2_aops;
		inode->i_fop = &ext2_file_operations;
	}
	mark_inode_dirty(inode);
	d_tmpfile(dentry, inode);
	unlock_new_inode(inode);
	return 0;
}

static int ext2_mknod (struct inode * dir, struct dentry *dentry, umode_t mode, dev_t rdev)
{
	struct inode * inode;
@@ -398,6 +421,7 @@ const struct inode_operations ext2_dir_inode_operations = {
#endif
	.setattr	= ext2_setattr,
	.get_acl	= ext2_get_acl,
	.tmpfile	= ext2_tmpfile,
};

const struct inode_operations ext2_special_inode_operations = {
Loading