```c /************************* references: http://derekmolloy.ie/writing-a-linux-kernel-module-part-2-a-character-device/ ************************/ #include<linux/mutex.h> #include<linux/err.h> #include<linux/init.h> #include<linux/module.h> #include<linux/device.h> #include<linux/kernel.h> #include<linux/fs.h> #include<asm/uaccess.h> #define DEVICE_NAME “yubochar” #define CLASS_NAME “yubo-c”
MODULE_LICENSE(“GPL”); MODULE_AUTHOR(“yu bo”); MODULE_DESCRIPTION(“a simple linux char driver for the test”); MODULE_VERSION(“0.1”); static int majornumber; static char message[256] = {0}; static short size_of_message; static int numberopens = 0; static struct class* yuboclass = NULL; static struct device* yubodevice = NULL; static DEFINE_MUTEX(yubochar_mutex); /*
* data is being sent from the device to the user.In this case is uses the copy_to_user() function to send the buffer string to the user and captures any
@parma filep A pointer to a file object *@parma buffer The pointer to the buffer to which this function writes the *data *@parma len The length of the b *@parma offset The offset if required */ static ssize_t dev_read(struct file *filep,char *buffer, size_t len, loff_t *offset){ int error_count = 0; / * copy_to_user has the format(to, *from, size) */ error_count = copy_to_user(buffer, message, size_of_message); if(error_count == 0){ printk(KERN_INFO “yubochar: Sent %d characters to the user\n”,size_of_message); /clear the position to the start/ return (size_of_message); } else{ printk(KERN_INFO “yubochar: Failed to send %d characters to the user\n”,error_count); return -EFAULT; } } /
} module_init(yubochar_init); module_exit(yubochar_exit);
今天在lkml上有人问greg,为什么我的patch没有回应,他回答说是在v4.5-rc1
期间,他不能做任何事情,那么,我的patch没有动静,是不是也因为这个原因呢?所以,我还是自己追踪kernel的版本释放的日期,探究其中的规律.
Date: 24 Jan 2016 here
应该由master新开branch,所有的开发及bug在新branch来做.当完成特定目标后,再把它合并到master.所以每个人可以从master拉一条新的branch来开发.
也就是新建的两个分支,都有各自的commit
git commit --amend
rebase
了` git rebase -i HEAD~3`
修改当前版本的倒数第三次的commit,接下来就会出现三行东西:
pick: *****
pick: *****
pick: *****
这时你要修改哪个,就把那行的pick改成edit,然后退出,这时通过git log
,你会发现git的最后一次提交是你选的那个了,这时再使用 git commit --amend
来对commit进行修改.修改完了你还要再回到最后一次,这时使用git rebase --continue
If you want to be sure that it only does a fast-forward, you can say git merge –ff-only origin/master.
这是一个引用块
int main()
{
int a,b;
}
#java
下载完JDK包后,路径配置我放到了 /etc/profile
export JAVA_HOME=/home/yubo/java/jdk1.8.0_31
export PATH=$PATH:$JAVA_HOME/bin
#tomcat
export CATALINA_HOME=~/apache-tomcat
export CLASSPATH=:$JAVA_HOME/lib:$CATALINA_HOME/lib
export PATH=$PATH:$CATALINA_HOME/bin
export PATH=E$
source /etc/profile
不要sudo
经测试,这个是可靠的
开启tomcat: yubo@debian:~/apache-tomcat/bin$ ./catalina.sh start 那么关闭应该是同样的情况
这里,而且要把已经建立的数据库删除才行.
把github的博客给搞乱了,将原来的博客目录完全删除掉,重新clone了. #showing your remotes
1. 将github上的git clone 到本地
2. git remote 此时会显示origin的url (git remote -v)
#Adding Remote Repositories
1.git remote
2.git remote add blog "your remote repositories's url" 我对于这句指令的理解是给你的远程仓库取一个自己的命名.
3.git remote -v #Adding&&committing 先把文章写出来,执行:
1. git add .
2. git commit -m "xx"
#Pushing to your Remotes
1. git push origin master
#Complentions: 我在另一个目录下面git clong,实现git merge? 也就是说,完全可以实现,现在就差分支了.我在一个工作,学习,完全可以同步推到github上了. #另外的技巧 我在本机的目录上,有两个地方可以写博客,暂且称之为A和B,那么当我在B中push新的博客后,A中就会落后博客内容.如果这时我在A中添加了新的内容,就会提示我出错:
当前目录落后...
这时我在网上搜到的方法是
git stash save your-file-name
然后我就git pull,好像因为github.io只允许拥有master,所以应该问题不大..
原文 #没有匹配的文件 有时候我在用git -rm file-name 时,它会抱怨说没有匹配的文件,这是因为我没有跟踪这个文件,也就是没有在git的日志文件中,此时可以直接使用简单的命令:
rm file-name
删除这个没有跟踪的文件.
#删除 git add file-name 但没有commit的文件 参考 #删除master的文件 比如我想删掉博客上的一篇文章,在本地(假设本地与master完全同步)执行
git rm file-name
其他的同push文章类同.