获取linux的文件系统相关信息的知识点
在 struct mntent 中的成员与 /etc/fstab 文件中的条目是直接对应的。它的内容如下:
struct mntent {
char *mnt_fsname; /* 挂载的文件系统的名字 */
char *mnt_dir; /* 挂载点 */
char *mnt_type; /* 文件系统类型:ufs、nfs 等 */
char *mnt_opts; /* 选项,以逗号为分隔符 */
int mnt_freq; /* Dump 的频率(以天为单位) */
int mnt_passno; /* fsck检查的次序 */
};
FILE *setmntent(const char *filename, const char *type);
struct mntent *getmntent(FILE *filep);
int addmntent(FILE *filep, const struct mntent *mnt);
int endmntent(FILE *filep);
char *hasmntopt(const struct mntent *mnt, const char *opt);
setmntent() 是打开包含挂载点项目的文件, 其中的 filename 参数是要打开的文件名, type 参数就像 fopen() 的第二个参数, 代表只读、只写, 或读写皆可的存取模式 。返回FILE*。
getmntent() 则是循序读取整个档案,传回指向 static struct mntent 结构的指针,结构中会填入适当的值。
addmntent() 可以在已开启档案的末端加上资讯,它原本是给 mount 使用的。
endmntent() 的功用是关闭打开的文件。这不能只是呼叫 fclose() 而已,因为可能还有其它与FILE * 有关的内部资料结构需要清理。
hasmntopt() 是个比较特殊的函式。它会扫描第一个参数所传入的struct mntent,找出它的挂载选项是否符合第二个引数。假如找到选项就传回符合的子字符串的位址;否则传回NULL。
/etc/fstab、/etc/mtab 和 /proc/mounts 其中任何一个, 都可以在程序中使用 getmntent() 这组函数来读取
eg:
#include <mntent.h>
struct mntent* mnt;
FILE* fp;
fp = setmntent("/dev/mmc/mmcblk0", "r");
if ( !fp )
{
return FALSE;
}
if(mnt=getmntent(fp) )
{
#if 1
printf("woosoori[%s:%d] mnt->mnt_fsname=%s\n",__FUNCTION__,__LINE__, mnt->mnt_fsname);
printf("woosoori[%s:%d] mnt
相关文档:
安装前准备好两个分区A 和B,分区 A 用来存放下载来的 Fedora 10 的ISO镜像文件,分区 B 用来安装 Fedora 10 .。
注意:存放镜像文件的分区必须为 Fat32 格式,否则无法进行安装。(本人已测试过)
解压 Fedora-10-i386-netinst.iso 此ISO 文件,将解压出来的 isolinux 和 images 两个文件夹与 Fedora 10 的 ISO 镜像文 ......
半年前的消息了。。呵呵。
首先访问:www.scootersoftware.com/
在download下面找到对应的安装包,新的版本哦。
或者用wget也行拉。看看版本的。
下载后安装就行了。
然后呢,
根据网上说的,删除掉 ~ 下面的 .beyondcompare 就能和谐掉30天的试用期。不过,每个30天来一次..
rm -rf ~/.beyondcompare
呵呵。不错啦 ......
1.Linux 内核简介 现在让我们从一个比较高的高度来审视一下 GNU/Linux 操作系统的体系结构。您可以从两个层次上来考虑操作系统,如图 1 所示。 图 1. GNU/Linux 操作系统的基本体系结构 最上面是用户(或应用程序)空间。这是用户应用程序执行的地方。用户空间之下是内核空间,Linux 内核正是位于这里。 GNU C Lib ......
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
我们说句大白话,所谓“游说者”(
lobbist
,
lobber
)就是古代的“說客”,只是人们平日不好意思这么说而已。当今,甘愿做一名
Linux
游说者是很光荣的事情。此话当真? ......
#insmod ./driver_xx.ko
此时#cat /proc/devices 能看到 driver_xx 设备
#mknod /dev/mygpio c 230 0 (230是主设备号,0是子设备号)
{这里可以修改设备名称,但是要和测试程序中一致 fd_pio = open(“/dev/mygpio”, O_RDWR);
最好和register_chrdev(MY_PIO_MAJOR, "mygpio", &my_pio_fops)中的一致}
使 ......