Linux下读硬盘序列号的程序
Linux下读硬盘序列号的程序
/*
* gethddsn.c
*
* Get serial number of ide hard disk.
* example: my Maxtor 15G 's s/n is K306S04C.
*
* Compile with: gcc -O2 gethddsn.c
*
* Xiaoming DONG <xmdong@263.net>
* Aug 24, 2000
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h> /* ioperm() */
#include <asm/io.h> /* outb(), inb() */
/* get serial number */
int gethddsn(char *ide)
{
unsigned int ide_info[257];
unsigned int info_off;
unsigned long loop2=0;
int loop, loop1=0;
if (ioperm(0x1f6, 1, 1)) {
perror("ioperm"); exit(-1);
}
outb(0xa0, 0x1f6);
if (ioperm(0x1f7, 1, 1)) {
perror("ioperm"); exit(-1);
}
outb(0xec, 0x1f7);
do {
if (ioperm(0x1f7, 1, 1)) {
perror("ioperm"); exit(-1);
}
} while (inb(0x1f7) != 0x58 && loop2++ < 0xffff);
for (info_off=0; info_off != 256; info_off++) {
if (ioperm(0x1f0, 2, 1)) {
perror("ioperm"); exit(-1);
}
ide_info[info_off] = inw(0x1f0);
}
for (loop=10, loop1=0; loop<=19; loop++)
{
ide[loop1++] = (char)(ide_info[loop] / 256);
ide[loop1++] = (char)(ide_info[loop] % 256);
}
ide[loop1] = 0;
if (loop1 > 40) printf("*error*\n");
return 0;
}
void main() /* print hard disk number */
{
static char serial[41];
gethddsn(serial);
printf("IDE hard disk s/n: %s\n", serial);
}
/* end of gethddsn.c */
相关文档:
总览
用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 ......
系统中能够随机(不需要按顺序)访问固定大小数据片(chunks
)的设备被称作块设备,这些数据片就称作块。最常见的
块设备
是硬盘,除此以外,还有软盘驱动器、CD-ROM
驱动器和闪存等等许多
其他
块设备。注意,它们都是以安装文件系统的方式使用的——这也是块设备一般的访问方式
。
另一种基本的设备类 ......
近几年,嵌入式行业迅猛发展,嵌入式技术无处不在,从随身携带的mp3、手机、PDA到家庭之中的智能电视、智能冰箱、机顶盒,再到工业生产、娱乐中的机器人,无不采用嵌入式技术。这导致嵌入式人才需求也迅速增加,嵌入式开发已成为当前最热门最有发展前途的行业之一。嵌入式开发人员的薪资也水涨船高,在北京,嵌入式初级工程 ......
在TimesTen的优化中,如果涉及到 Replication 或者Cache Group的话,那么针对 TCP/IP相关的参数的优化对性能是有益的。因为它们俩都是通过TCP/IP协议进行数据交互的。在安装文档(install.pdf)的39页有具体的说明:
For replication, TCP send and receive buffers should be increased to a minimum of 512KB. To ......
2007-11-09
LInux下如何安装ffmpeg
关键字: linux ffmpeg
终于装上了,把过程记录一下
首先要安装各种解码器
1、lame
lame-3.97.tar.gz
Url:http://sourceforge.net/project/showfiles.php?group_id=290&package_id=309
安装方法如下:
Java代码
tar -zxvf lame-3.97.tar.gz   ......