- 代碼: 選擇全部
int scull_open(struct inode *inode, struct file *filp)
{
struct scull_dev *dev; /* device information */
dev = container_of(inode->i_cdev, struct scull_dev, cdev);
filp->private_data = dev; /* for other methods */
/* now trim to 0 the length of the device if open was write-only */
if ( (filp->f_flags & O_ACCMODE) = = O_WRONLY) {
scull_trim(dev); /* ignore errors */
}
return 0; /* success */
}
以上是linux device drivers裡,所給得code
可是呢,我現在不知要如何去測試他是否是正確的
請問要如何寫測試呢?
感謝您的回答....