patch-2.4.0-test9 linux/fs/attr.c
Next file: linux/fs/bfs/inode.c
Previous file: linux/fs/adfs/super.c
Back to the patch index
Back to the overall index
- Lines: 49
- Date:
Fri Sep 22 14:21:18 2000
- Orig file:
v2.4.0-test8/linux/fs/attr.c
- Orig date:
Mon May 8 14:31:13 2000
diff -u --recursive --new-file v2.4.0-test8/linux/fs/attr.c linux/fs/attr.c
@@ -9,6 +9,8 @@
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/smp_lock.h>
+#include <linux/dnotify.h>
+#include <linux/fcntl.h>
/* Taken over from the old code... */
@@ -79,6 +81,28 @@
mark_inode_dirty(inode);
}
+static int setattr_mask(unsigned int ia_valid)
+{
+ unsigned long dn_mask = 0;
+
+ if (ia_valid & ATTR_UID)
+ dn_mask |= DN_ATTRIB;
+ if (ia_valid & ATTR_GID)
+ dn_mask |= DN_ATTRIB;
+ if (ia_valid & ATTR_SIZE)
+ dn_mask |= DN_MODIFY;
+ /* both times implies a utime(s) call */
+ if ((ia_valid & (ATTR_ATIME|ATTR_MTIME)) == (ATTR_ATIME|ATTR_MTIME))
+ dn_mask |= DN_ATTRIB;
+ else if (ia_valid & ATTR_ATIME)
+ dn_mask |= DN_ACCESS;
+ else if (ia_valid & ATTR_MTIME)
+ dn_mask |= DN_MODIFY;
+ if (ia_valid & ATTR_MODE)
+ dn_mask |= DN_ATTRIB;
+ return dn_mask;
+}
+
int notify_change(struct dentry * dentry, struct iattr * attr)
{
struct inode *inode = dentry->d_inode;
@@ -101,5 +125,10 @@
inode_setattr(inode, attr);
}
unlock_kernel();
+ if (!error) {
+ unsigned long dn_mask = setattr_mask(ia_valid);
+ if (dn_mask)
+ inode_dir_notify(dentry->d_parent->d_inode, dn_mask);
+ }
return error;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)