mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-11 09:18:25 +03:00
o More fs fiddling. Another check point commit.
This commit is contained in:
parent
0a91d145ba
commit
6a57fa079e
@ -21,6 +21,29 @@
|
||||
|
||||
/* Heavily based upon ramfs */
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/fs.h>
|
||||
|
||||
static int dmfs_lv_create(struct inode *dir, struct dentry *dentry, int mode)
|
||||
{
|
||||
struct inode *inode;
|
||||
|
||||
if (dentry->d_name.name[0] == '.')
|
||||
return -EPERM;
|
||||
|
||||
if (dentry->d_name.len == 6 &&
|
||||
memcmp(dentry->d_name.name, "ACTIVE", 6) == 0)
|
||||
return -EPERM;
|
||||
|
||||
inode = dmfs_create_table(dir, dentry, mode)
|
||||
if (!IS_ERR(inode)) {
|
||||
d_instantiate(dentry, inode);
|
||||
dget(dentry);
|
||||
return 0;
|
||||
}
|
||||
return PTR_ERR(inode);
|
||||
}
|
||||
|
||||
static int dmfs_lv_unlink(struct inode *dir, struct dentry *dentry)
|
||||
{
|
||||
|
||||
@ -69,7 +92,7 @@ static struct dmfs_lv_file_operations = {
|
||||
};
|
||||
|
||||
static struct dmfs_lv_inode_operations = {
|
||||
create: dmfs_create_file,
|
||||
create: dmfs_lv_create,
|
||||
lookup: dmfs_lv_lookup,
|
||||
link: dmfs_lv_link,
|
||||
unlink: dmfs_lv_unlink,
|
||||
|
@ -89,6 +89,13 @@ static int dmfs_root_rmdir(struct inode *dir, struct dentry *dentry)
|
||||
{
|
||||
int ret = -ENOTEMPTY;
|
||||
|
||||
/*
|
||||
* FIXME: Checks need to be more complicated than this...
|
||||
* Need to take into account removing "virtual" files but must
|
||||
* not allow removal whilst tables are still existing. Also we
|
||||
* should check for the block device being closed.
|
||||
*/
|
||||
|
||||
if (empty(dentry)) {
|
||||
struct inode *inode = dentry->d_inode;
|
||||
|
||||
|
@ -24,16 +24,25 @@
|
||||
|
||||
static ssize_t dmfs_table_read(struct file *file, char *buf, size_t size, loff_t *pos)
|
||||
{
|
||||
down(&inode->i_sem);
|
||||
|
||||
up(&inode->i_sem);
|
||||
}
|
||||
|
||||
static ssize_t dmfs_table_write(struct file *file, const char *buf, size_t size, loff_t *pos)
|
||||
{
|
||||
down(&inode->i_sem);
|
||||
|
||||
up(&inode->i_sem);
|
||||
}
|
||||
|
||||
static int dmfs_table_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct dentry *dentry = file->f_dentry;
|
||||
|
||||
if (dentry->name[0] == '.')
|
||||
return -EPERM;
|
||||
|
||||
if (dentry->name.len == 6 && memcmp("ACTIVE", dentry->name.name, 6) == 0)
|
||||
return -EPERM;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user