|
From: Paul M. <le...@us...> - 2001-10-06 21:00:46
|
Update of /cvsroot/linuxconsole/ruby/linux/fs/gfxfs
In directory usw-pr-cvs1:/tmp/cvs-serv14922/gfxfs
Added Files:
Makefile dir.c file.c inode.c super.c
Log Message:
GfxFS updates.
--- NEW FILE: Makefile ---
#
# Makefile for the Linux graphics filesystem routines.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (not a .c file).
#
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := gfxfs.o
obj-y := super.o inode.o file.o dir.o
obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
--- NEW FILE: dir.c ---
/*
* fs/gfxfs/dir.c
*
* gfxfs directory operations
*
* Copyright (C) 2001 Paul Mundt <pm...@mv...>
*
* Released under the terms of the GNU GPL v2.0.
*
*/
#include <linux/gfxfs_fs.h>
/* FIXME: Keep things happy for now, add our own later */
struct file_operations gfxfs_dir_ops = {
read: generic_read_dir,
};
/* Ditto */
struct inode_operations gfxfs_dir_inode_ops = {
/* Empty for now */
};
--- NEW FILE: file.c ---
/*
* fs/gfxfs/file.c
*
* gfxfs file operations
*
* Copyright (C) 2001 Paul Mundt <pm...@mv...>
*
* Released under the terms of the GNU GPL v2.0.
*
*/
#include <linux/gfxfs_fs.h>
/*
* FIXME: Use generic routines for now, add our own later.
*/
struct file_operations gfxfs_file_ops = {
mmap: generic_file_mmap,
llseek: generic_file_llseek,
};
--- NEW FILE: inode.c ---
/*
* fs/gfxfs/inode.c
*
* gfxfs inode operations
*
* Copyright (C) 2001 Paul Mundt <pm...@mv...>
*
* Released under the terms of the GNU GPL v2.0.
*
*/
#include <linux/locks.h>
#include <linux/gfxfs_fs.h>
#include <asm/uaccess.h>
void gfxfs_read_inode(struct inode *inode)
{
inode->i_atime = inode->i_ctime = inode->i_mtime = CURRENT_TIME;
}
struct inode *gfxfs_get_inode(struct super_block *sb, int mode, int dev)
{
struct inode *inode = new_inode(sb);
if (!inode) {
printk(KERN_WARNING "gfxfs: Unable to get new inode\n");
return NULL;
}
inode->i_mode = mode;
inode->i_uid = current->fsuid;
inode->i_gid = current->fsgid;
inode->i_blksize = PAGE_CACHE_SIZE;
inode->i_blocks = 0;
inode->i_rdev = NODEV;
gfxfs_read_inode(inode);
switch (mode & S_IFMT) {
case S_IFREG:
inode->i_fop = &gfxfs_file_ops;
break;
case S_IFDIR:
inode->i_op = &gfxfs_dir_inode_ops;
inode->i_fop = &gfxfs_dir_ops;
break;
default:
init_special_inode(inode, mode, dev);
break;
}
return inode;
}
--- NEW FILE: super.c ---
/*
* fs/gfxfs/super.c
*
* gfxfs superblock operations
*
* Copyright (C) 2001 Paul Mundt <pm...@mv...>
*
* Released under the terms of the GNU GPL v2.0.
*
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/gfxfs_fs.h>
#include <linux/pagemap.h>
#include <linux/dcache.h>
static struct vfsmount *gfxfs_mnt;
static int gfxfs_statfs(struct super_block *sb, struct statfs *buf)
{
buf->f_type = GFXFS_SUPER_MAGIC;
buf->f_bsize = PAGE_CACHE_SIZE;
buf->f_namelen = NAME_MAX;
return 0;
}
static struct super_operations gfxfs_super_ops = {
statfs: gfxfs_statfs,
};
static struct super_block *gfxfs_read_super(struct super_block *sb,
void *data, int silent)
{
struct inode *root_inode;
sb->s_blocksize = PAGE_CACHE_SIZE;
sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
sb->s_magic = GFXFS_SUPER_MAGIC;
sb->s_op = &gfxfs_super_ops;
root_inode = gfxfs_get_inode(sb, S_IFDIR | 0755, 0);
if (!root_inode) {
printk(KERN_WARNING "gfxfs: Unable to get root inode\n");
return NULL;
}
sb->s_root = d_alloc_root(root_inode);
if (!sb->s_root) {
printk(KERN_WARNING "gfxfs: Unable to get root dentry\n");
iput(root_inode);
return NULL;
}
return sb;
}
static DECLARE_FSTYPE(gfxfs_fs_type, "gfxfs", gfxfs_read_super, FS_SINGLE);
static int __init init_gfxfs_fs(void)
{
int ret = register_filesystem(&gfxfs_fs_type);
if (!ret) {
gfxfs_mnt = kern_mount(&gfxfs_fs_type);
ret = PTR_ERR(gfxfs_mnt);
if (!IS_ERR(gfxfs_mnt)) {
ret = 0;
}
}
return ret;
}
static void __exit exit_gfxfs_fs(void)
{
kern_umount(gfxfs_mnt);
unregister_filesystem(&gfxfs_fs_type);
}
EXPORT_NO_SYMBOLS;
MODULE_AUTHOR("Paul Mundt <pm...@mv...>");
MODULE_DESCRIPTION("graphics file system");
MODULE_LICENSE("GPL");
module_init(init_gfxfs_fs);
module_exit(exit_gfxfs_fs);
|