我的虚拟文件系统(linux)
1# 发表于 2005-11-15 17:34 只看该作者
http://www.chinaunix.net 作者:bierdaci 发表于:2004-05-25 18:59:33
不知道该不该发这里,是我从proc改来的,懂内核源码的交流交流
hello.c
[code:1:3adb123188]
#include "hello.h"
struct inode * hello_get_inode(struct super_block *, int, struct hello_dir_entry *);
/*这个函数是直接从linux复制过来的,作用就是显示目录里的文件名,没有这个
函数也行只是你用ls、dir命令看不到目录下的文件。*/
int hello_readdir(struct file * filp, void * dirent, filldir_t filldir)
{
printk("hello_readdir\n");
struct hello_dir_entry * de;
unsigned int ino;
int i;
struct inode *inode = filp->f_dentry->d_inode;
ino = inode->i_ino;
de = (struct hello_dir_entry *) inode->u.generic_ip;
if (!de)
return -EINVAL;
i = filp->f_pos;
switch (i) {
case 0:
if (filldir(dirent, ".", 1, i, ino, DT_DIR) < 0)
return 0;
i++;
filp->f_pos++;
/* fall through */
case 1:
if (filldir(dirent, "..", 2, i,
filp->f_dentry->d_parent->d_inode->i_ino,
DT_DIR) < 0)
return 0;
i++;
filp->f_pos++;
/* fall through */
default:
de = de->subdir;
i -= 2;
for (;;) {
if (!de)
return 1;
if (!i)
break;
de = de->next;
i--;
}
do {
if (filldir(dirent, de->name, de->namelen, filp->f_pos,
de->low_ino, de->mode >> 12) < 0)
return 0;
filp->f_pos++;
de = de->next;
} while (de);
}
return 1;
}
int hello_d_revalidate(struct dentry *res, int i){printk("d_revalidate\n");return 0;}
int hello_d_hash(struct dentry *res, struct qstr *name){printk("d_hash\n");return 0;}
int hello_d_compare(struct dentry *res, struct qstr *name, struct qstr *old)
{printk("d_compare\n");return 0;}
int hello_d_delete(struct dentry *res){printk("d_delete\n");return
相关文档:
总览
用iptables -ADC 来指定链的规
则
,-A添加 -D删除 -C 修改
iptables - [RI] chain rule num rule-specification[option]
用iptables - RI 通过规则的顺序指定
iptables -D chain rule num[option]
删除指定规则
iptables -[LFZ] [chain][option]
用iptables -LFZ 链名 [选项]
iptables -[NX] chain
用 -NX ......
1.监视内存
free -mt
total used free shared buffers cached
Mem: ......
来源:http://linux.chinaunix.net/ebook/doc/2009/09/17/1135830.shtml
本文介绍在centos 5.x环境下通过yum源的扩展使用munin、 monit、ntop工具来监管你的应用程序和服务器。题为懒人说说的是简便的安装方式而已,将强大的功能配置简单的应用起来是很重要的,可以节省时间并提高效率。
Monit:http:#www.tildeslas ......
实验环境:AS4最小化安装
实验目标:架设VSFTP服务器
这次我们来学习Linux系统中的 vsftp服务器的配置。
下面我们开始了!首先我们安装vsftp服务器端的软件。
vsftpd服务器的安装文件位于第1张安装光盘中。
使用rpm命名可顺利安装该软件包。
# rpm -ivh vsftpd-2.0.1-5.i386.r ......
Linux JDK and ANT install
linux JDK的安装
安装JDK
从sun网站上直接下载JDK:http:
//java.sun.com/j2se/1.4.2
/download.html提供了两个下载:
1、RPM in self-extracting file
(j2sdk-1_4_2_04-linux-i586.bin,
32.77 MB) 这个是自解压的文件,在linux上安装如下:
chmod u+x
./j2sdk-1_4_2_04-l ......