Merge tag 'for-4.5' of git://git.osdn.jp/gitroot/uclinux-h8/linux
[cascardo/linux.git] / kernel / bpf / inode.c
index 5a8a797..f2ece3c 100644 (file)
@@ -187,11 +187,31 @@ static int bpf_mkobj(struct inode *dir, struct dentry *dentry, umode_t mode,
        }
 }
 
+static int bpf_link(struct dentry *old_dentry, struct inode *dir,
+                   struct dentry *new_dentry)
+{
+       if (bpf_dname_reserved(new_dentry))
+               return -EPERM;
+
+       return simple_link(old_dentry, dir, new_dentry);
+}
+
+static int bpf_rename(struct inode *old_dir, struct dentry *old_dentry,
+                     struct inode *new_dir, struct dentry *new_dentry)
+{
+       if (bpf_dname_reserved(new_dentry))
+               return -EPERM;
+
+       return simple_rename(old_dir, old_dentry, new_dir, new_dentry);
+}
+
 static const struct inode_operations bpf_dir_iops = {
        .lookup         = simple_lookup,
        .mknod          = bpf_mkobj,
        .mkdir          = bpf_mkdir,
        .rmdir          = simple_rmdir,
+       .rename         = bpf_rename,
+       .link           = bpf_link,
        .unlink         = simple_unlink,
 };