Example #1
0
/* This function is called when user commands like chmod, chgrp and
   chown are executed. System calls like trunc() results in a call
   to this function.  */
static int
jffs_setattr(struct dentry *dentry, struct iattr *iattr)
{
	struct inode *inode = dentry->d_inode;
	struct jffs_raw_inode raw_inode;
	struct jffs_control *c;
	struct jffs_fmcontrol *fmc;
	struct jffs_file *f;
	struct jffs_node *new_node;
	int update_all;
	int res = 0;
	int recoverable = 0;

	lock_kernel();

	if ((res = inode_change_ok(inode, iattr))) 
		goto out;

	c = (struct jffs_control *)inode->i_sb->s_fs_info;
	fmc = c->fmc;

	D3(printk (KERN_NOTICE "notify_change(): down biglock\n"));
	mutex_lock(&fmc->biglock);

	f = jffs_find_file(c, inode->i_ino);

	ASSERT(if (!f) {
		printk("jffs_setattr(): Invalid inode number: %lu\n",
		       inode->i_ino);
		D3(printk (KERN_NOTICE "notify_change(): up biglock\n"));
		mutex_unlock(&fmc->biglock);
		res = -EINVAL;
		goto out;
	});
Example #2
0
/* This function is called when user commands like chmod, chgrp and
   chown are executed. System calls like trunc() results in a call
   to this function.  */
static int
jffs_setattr(struct dentry *dentry, struct iattr *iattr)
{
	struct inode *inode = dentry->d_inode;
	struct jffs_raw_inode raw_inode;
	struct jffs_control *c;
	struct jffs_fmcontrol *fmc;
	struct jffs_file *f;
	struct jffs_node *new_node;
	int update_all;
	int res;
	int recoverable = 0;

	if ((res = inode_change_ok(inode, iattr)))
		return res;

	c = (struct jffs_control *)inode->i_sb->u.generic_sbp;
	fmc = c->fmc;

	D3(printk (KERN_NOTICE "notify_change(): down biglock\n"));
	down(&fmc->biglock);

	f = jffs_find_file(c, inode->i_ino);

	ASSERT(if (!f) {
		printk("jffs_setattr(): Invalid inode number: %lu\n",
		       inode->i_ino);
		D3(printk (KERN_NOTICE "notify_change(): up biglock\n"));
		up(&fmc->biglock);
		return -EINVAL;
	});