mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
o Again, please ignore this for the time being.
This commit is contained in:
parent
749e7c1bb4
commit
8424428faf
@ -21,16 +21,26 @@
|
||||
|
||||
/* Heavily based upon ramfs */
|
||||
|
||||
static int dmfs_create(struct inode *dir, struct dentry *dentry, int mode)
|
||||
{
|
||||
return dmfs_create_file(dir, dentry, mode);
|
||||
}
|
||||
|
||||
static int dmfs_unlink(struct inode *dir, struct dentry *dentry)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static int dmfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
|
||||
{
|
||||
struct inode *inode = old_dentry->d_inode;
|
||||
|
||||
if (!S_ISREG(inode->i_mode))
|
||||
return -EPERM;
|
||||
|
||||
if (dentry->d_parent != old_dentry->d_parent)
|
||||
return -EPERM;
|
||||
|
||||
inode->i_ctime = CURRENT_TIME;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dentry *dmfs_lookup(struct inode *dir, struct dentry *dentry)
|
||||
{
|
||||
d_add(dentry, NULL);
|
||||
@ -46,6 +56,7 @@ static int dmfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int dmfs_dir_sync(struct file *file, struct dentry *dentry, int datasync)
|
||||
{
|
||||
return 0;
|
||||
@ -57,9 +68,10 @@ static struct dm_dir_file_operations = {
|
||||
fsync: dmfs_dir_sync,
|
||||
};
|
||||
|
||||
static struct dm_root_inode_operations = {
|
||||
create: dmfs_dir_create,
|
||||
static struct dm_dir_inode_operations = {
|
||||
create: dmfs_create_file,
|
||||
lookup: dmfs_dir_lookup,
|
||||
link: dmfs_dir_link,
|
||||
unlink: dmfs_dir_unlink,
|
||||
rename: dmfs_dir_rename,
|
||||
};
|
||||
@ -75,7 +87,7 @@ struct inode *dmfs_create_dir(struct inode *dir, struct dentry *dentry, int mode
|
||||
inode->i_blksize = PAGE_CACHE_SIZE;
|
||||
inode->i_blocks = 0;
|
||||
inode->i_rdev = NODEV;
|
||||
inode->i_atime = inode->i_ctime = inode->i_ctime = CURRENT_TIME;
|
||||
inode->i_atime = inode->i_ctime = inode->i_mtime = CURRENT_TIME;
|
||||
inode->i_fop = &dmfs_dir_file_operations;
|
||||
inode->i_op = &dmfs_dir_dir_operations;
|
||||
}
|
||||
|
74
driver/device-mapper/dmfs-file.c
Normal file
74
driver/device-mapper/dmfs-file.c
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* dmfs-file.c
|
||||
*
|
||||
* Copyright (C) 2001 Sistina Software
|
||||
*
|
||||
* This software is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU CC; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
static ssize_t dmfs_read(struct file *file, char *buf, size_t size, loff_t *pos)
|
||||
{
|
||||
}
|
||||
|
||||
static ssize_t dmfs_write(struct file *file, const char *buf, size_t size, loff_t *pos)
|
||||
{
|
||||
}
|
||||
|
||||
static int dmfs_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct dentry *dentry = file->f_dentry;
|
||||
|
||||
if (dentry->name.len == 6 && memcmp("ACTIVE", dentry->name.name, 6) == 0)
|
||||
return -EPERM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dmfs_file_sync(struct file *file, struct dentry *dentry, int datasync)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dm_file_file_operations = {
|
||||
/* llseek: generic_file_llseek, */
|
||||
read: dmfs_read,
|
||||
write: dmfs_write,
|
||||
open: dmfs_open,
|
||||
fsync: dmfs_file_sync,
|
||||
};
|
||||
|
||||
static struct dm_file_inode_operations = {
|
||||
};
|
||||
|
||||
int dmfs_create_file(struct inode *dir, struct dentry *dentry, int mode)
|
||||
{
|
||||
struct inode *inode = new_inode(dir->i_sb);
|
||||
|
||||
if (inode) {
|
||||
inode->i_mode = mode | S_IFREG;
|
||||
inode->i_uid = current->fsuid;
|
||||
inode->i_gid = current->fsgid;
|
||||
inode->i_blksize = PAGE_CACHE_SIZE;
|
||||
inode->i_blocks = 0;
|
||||
inode->i_rdev = NODEV;
|
||||
inode->i_atime = inode->i_ctime = inode->i_mtime = CURRENT_TIME;
|
||||
inode->i_fop = &dmfs_file_file_operations;
|
||||
inode->i_op = &dmfs_file_inode_operations;
|
||||
}
|
||||
|
||||
return inode;
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ struct inode *dmfs_create_root(struct super_block *sb, int mode)
|
||||
inode->i_blksize = PAGE_CACHE_SIZE;
|
||||
inode->i_blocks = 0;
|
||||
inode->i_rdev = NODEV;
|
||||
inode->i_atime = inode->i_ctime = inode->i_ctime = CURRENT_TIME;
|
||||
inode->i_atime = inode->i_ctime = inode->i_mtime = CURRENT_TIME;
|
||||
inode->i_fop = &dmfs_root_file_operations;
|
||||
inode->i_op = &dmfs_root_dir_operations;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user