亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? access.c

?? ldd1的源代碼
?? C
字號:
/* * access.c -- the files with access control on open * * $Id: access.c,v 1.13 2001/01/24 00:00:15 corbet Exp $ */ #ifndef __KERNEL__#  define __KERNEL__#endif#ifndef MODULE#  define MODULE#endif#define __NO_VERSION__#include <linux/module.h> /* get MOD_DEC_USE_COUNT, not the version string */#include <linux/version.h> /* need it for conditionals in scull.h */#include <linux/kernel.h> /* printk() */#include <linux/malloc.h> /* kmalloc() */#include <linux/fs.h>     /* everything... */#include <linux/errno.h>  /* error codes */#include <linux/types.h>  /* size_t */#include <linux/fcntl.h>#include <linux/tty.h>    /* current->tty */#include "scull.h"        /* local definitions *//* * These devices fall back on the main scull operations. They only * differ in the implementation of open() and close() *//* * The following deals with some of the 2.2 API changes. */#ifdef LINUX_20extern int scull_lseek_20(struct inode *ino, struct file *f, off_t offset,                int whence);extern int scull_read_20(struct inode *ino, struct file *f, char *buf,                int count);extern int scull_write_20(struct inode *ino, struct file *f, const char *buf,                int count);#define scull_llseek scull_lseek_20#define scull_read   scull_read_20#define scull_write  scull_write_20#endif/************************************************************************ * * The first device is the single-open one, *  it has an hw structure and an open count */Scull_Dev scull_s_device;int scull_s_count = 0;spinlock_t scull_s_lock;int scull_s_open(struct inode *inode, struct file *filp){    Scull_Dev *dev = &scull_s_device; /* device information */    int num = NUM(inode->i_rdev);    if (!filp->private_data && num > 0)        return -ENODEV; /* not devfs: allow 1 device only */    spin_lock(&scull_s_lock);    if (scull_s_count) {        spin_unlock(&scull_s_lock);        return -EBUSY; /* already open */    }    scull_s_count++;    spin_unlock(&scull_s_lock);    /* then, everything else is copied from the bare scull device */    if ( (filp->f_flags & O_ACCMODE) == O_WRONLY)        scull_trim(dev);    if (!filp->private_data)        filp->private_data = dev;    MOD_INC_USE_COUNT;    return 0;          /* success */}int scull_s_release(struct inode *inode, struct file *filp){    scull_s_count--; /* release the device */    MOD_DEC_USE_COUNT;    return 0;}#ifdef LINUX_20void scull_s_release_20(struct inode *ino, struct file *f){    scull_s_release(ino, f);}#define scull_s_release scull_s_release_20#define llseek lseek#endif/* * The other operations for the single-open device come from the bare device */struct file_operations scull_sngl_fops = {    llseek:     scull_llseek,    read:       scull_read,    write:      scull_write,    ioctl:      scull_ioctl,    open:       scull_s_open,    release:    scull_s_release,};/************************************************************************ * * Next, the "uid" device. It can be opened multiple times by the * same user, but access is denied to other users if the device is open */Scull_Dev scull_u_device;int scull_u_count = 0;uid_t scull_u_owner = 0;spinlock_t scull_u_lock;int scull_u_open(struct inode *inode, struct file *filp){    Scull_Dev *dev = &scull_u_device; /* device information */    int num = NUM(inode->i_rdev);    if (!filp->private_data && num > 0)        return -ENODEV; /* not devfs: allow 1 device only */    spin_lock(&scull_u_lock);    if (scull_u_count &&         (scull_u_owner != current->uid) &&  /* allow user */        (scull_u_owner != current->euid) && /* allow whoever did su */                    !capable(CAP_DAC_OVERRIDE)) { /* still allow root */            spin_unlock(&scull_u_lock);            return -EBUSY;   /* -EPERM would confuse the user */    }    if (scull_u_count == 0)        scull_u_owner = current->uid; /* grab it */    scull_u_count++;    spin_unlock(&scull_u_lock);    /* then, everything else is copied from the bare scull device */    if ( (filp->f_flags & O_ACCMODE) == O_WRONLY)        scull_trim(dev);    if (!filp->private_data)        filp->private_data = dev;    MOD_INC_USE_COUNT;    return 0;          /* success */}int scull_u_release(struct inode *inode, struct file *filp){    scull_u_count--; /* nothing else */    MOD_DEC_USE_COUNT;    return 0;}#ifdef LINUX_20void scull_u_release_20(struct inode *ino, struct file *f){    scull_u_release(ino, f);}#define scull_u_release scull_u_release_20#endif/* * The other operations for the device come from the bare device */struct file_operations scull_user_fops = {    llseek:     scull_llseek,    read:       scull_read,    write:      scull_write,    ioctl:      scull_ioctl,    open:       scull_u_open,    release:    scull_u_release,};/************************************************************************ * * Next, the device with blocking-open based on uid */Scull_Dev scull_w_device;int scull_w_count = 0;uid_t scull_w_owner = 0;static DECLARE_WAIT_QUEUE_HEAD(scull_w_wait);spinlock_t scull_w_lock;int scull_w_open(struct inode *inode, struct file *filp){    Scull_Dev *dev = &scull_w_device; /* device information */    int num = NUM(inode->i_rdev);    if (!filp->private_data && num > 0)        return -ENODEV; /* not devfs: allow 1 device only */    spin_lock(&scull_w_lock);    while (scull_w_count &&       (scull_w_owner != current->uid) &&  /* allow user */      (scull_w_owner != current->euid) && /* allow whoever did su */      !capable(CAP_DAC_OVERRIDE)) {        spin_unlock(&scull_w_lock);        if (filp->f_flags & O_NONBLOCK) return -EAGAIN;         interruptible_sleep_on(&scull_w_wait);        if (signal_pending(current)) /* a signal arrived */          return -ERESTARTSYS; /* tell the fs layer to handle it */        /* else, loop */        spin_lock(&scull_w_lock);    }    if (scull_w_count == 0)        scull_w_owner = current->uid; /* grab it */    scull_w_count++;    spin_unlock(&scull_w_lock);    /* then, everything else is copied from the bare scull device */    if ( (filp->f_flags & O_ACCMODE) == O_WRONLY)        scull_trim(dev);    if (!filp->private_data)        filp->private_data = dev;    MOD_INC_USE_COUNT;    return 0;          /* success */}int scull_w_release(struct inode *inode, struct file *filp){    scull_w_count--;    if (scull_w_count == 0)        wake_up_interruptible(&scull_w_wait); /* awake other uid's */    MOD_DEC_USE_COUNT;    return 0;}#ifdef LINUX_20void scull_w_release_20(struct inode *ino, struct file *f){    scull_w_release(ino, f);}#define scull_w_release scull_w_release_20#endif/* * The other operations for the device come from the bare device */struct file_operations scull_wusr_fops = {    llseek:     scull_llseek,    read:       scull_read,    write:      scull_write,    ioctl:      scull_ioctl,    open:       scull_w_open,    release:    scull_w_release,};/************************************************************************ * * Finally the `cloned' private device. This is trickier because it * involves list management, and dynamic allocation. */devfs_handle_t scull_priv_handle;    /* only used if devfs is there */struct scull_listitem {    Scull_Dev device;    int key;    struct scull_listitem *next;    };struct scull_listitem *scull_c_head;spinlock_t scull_c_lock;int scull_c_open(struct inode *inode, struct file *filp){    int key;    int num = NUM(inode->i_rdev);    struct scull_listitem *lptr, *prev;    /* if private_data is null we rely on "num", and 1 device only is there */    if (!filp->private_data && num > 0) return -ENODEV;    if (!current->tty) {        PDEBUG("Process \"%s\" has no ctl tty\n",current->comm);        return -EINVAL;    }    key = MINOR(current->tty->device);    /* look for a device in the linked list; if missing create it */    prev = NULL;    spin_lock(&scull_c_lock);    for (lptr = scull_c_head; lptr && (lptr->key != key); lptr = lptr->next)        prev=lptr;    if (!lptr) { /* not found */        lptr = kmalloc(sizeof(struct scull_listitem), GFP_KERNEL);        if (!lptr) {            spin_unlock(&scull_c_lock);            return -ENOMEM;        }        memset(lptr, 0, sizeof(struct scull_listitem));        lptr->key = key;        scull_trim(&(lptr->device)); /* initialize it */        sema_init(&(lptr->device.sem), 1);        if (prev)            prev->next = lptr;        else            scull_c_head = lptr; /* the first one */    }    spin_unlock(&scull_c_lock);    /* then, everything else is copied from the bare scull device */    if ( (filp->f_flags & O_ACCMODE) == O_WRONLY)        scull_trim(&(lptr->device));    filp->private_data = &(lptr->device);    MOD_INC_USE_COUNT;    return 0;          /* success */}int scull_c_release(struct inode *inode, struct file *filp){    /*     * Nothing to do, because the device is persistent.     * A `real' cloned device should be freed on last close     */    MOD_DEC_USE_COUNT;    return 0;}#ifdef LINUX_20void scull_c_release_20(struct inode *ino, struct file *f){    scull_c_release(ino, f);}#define scull_c_release scull_c_release_20#endif/* * The other operations for the device come from the bare device */struct file_operations scull_priv_fops = {    llseek:   scull_llseek,    read:     scull_read,    write:    scull_write,    ioctl:    scull_ioctl,    open:     scull_c_open,    release:  scull_c_release,};/************************************************************************ * * And the init and cleanup functions come last */int scull_access_init(void){    /* assign quantum and quantumset */    scull_s_device.quantum = scull_quantum;    scull_s_device.qset    = scull_qset;    scull_u_device.quantum = scull_quantum;    scull_u_device.qset    = scull_qset;    scull_w_device.quantum = scull_quantum;    scull_w_device.qset    = scull_qset;    /* Initialize spinlocks */    spin_lock_init(&scull_s_lock);    spin_lock_init(&scull_u_lock);    spin_lock_init(&scull_w_lock);    spin_lock_init(&scull_c_lock);    /* and semaphores (used by read and write) */    sema_init(&scull_s_device.sem, 1);    sema_init(&scull_u_device.sem, 1);    sema_init(&scull_w_device.sem, 1);#ifdef CONFIG_DEVFS_FS    /* finally, create the devfs entry points */    scull_s_device.handle =        devfs_register(scull_devfs_dir, "single",                       DEVFS_FL_AUTO_DEVNUM,                       0, 0, S_IFCHR | S_IRUGO | S_IWUGO,                       &scull_sngl_fops,                       &scull_s_device);    scull_u_device.handle =        devfs_register(scull_devfs_dir, "user",                       DEVFS_FL_AUTO_DEVNUM,                       0, 0, S_IFCHR | S_IRUGO | S_IWUGO,                       &scull_user_fops,                       &scull_u_device);    scull_w_device.handle =        devfs_register(scull_devfs_dir, "wuser",                       DEVFS_FL_AUTO_DEVNUM,                       0, 0, S_IFCHR | S_IRUGO | S_IWUGO,                       &scull_wusr_fops,                       &scull_w_device);    scull_priv_handle =        devfs_register(scull_devfs_dir, "priv",                       DEVFS_FL_AUTO_DEVNUM,                       0, 0, S_IFCHR | S_IRUGO | S_IWUGO,                       &scull_priv_fops,                       &scull_priv_fops); /* any non-null value */#endif        return 0;}/* * This is called by cleanup_module or on failure. * It is required to never fail, even if nothing was initialized first */void scull_access_cleanup(void){    struct scull_listitem *lptr, *prev;    scull_trim(&scull_s_device); /* disallocate it */    scull_trim(&scull_u_device); /* disallocate it */    scull_trim(&scull_w_device); /* disallocate it */    /* all the cloned devices */    prev=NULL;    for (lptr = scull_c_head; lptr; lptr = lptr->next) {        scull_trim(&(lptr->device));        if (prev) kfree(prev);        prev=lptr;    }    if (prev) kfree(prev);    scull_c_head = NULL; /* overkill: we're unloading anyways */    /* remove devfs entry points */    devfs_unregister(scull_s_device.handle);    devfs_unregister(scull_u_device.handle);    devfs_unregister(scull_w_device.handle);    devfs_unregister(scull_priv_handle);    return;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品欧美一区二区久久| 国产精品综合久久| 成人欧美一区二区三区白人 | 日本黄色一区二区| 成人av电影在线网| 国产成人鲁色资源国产91色综| 国产一区在线视频| 精品一区二区在线播放| 久久成人免费网| 国产一区二区伦理片| 国产成人精品午夜视频免费| 国产成人欧美日韩在线电影| 国产东北露脸精品视频| 粉嫩av一区二区三区在线播放| 国产凹凸在线观看一区二区| 成人综合在线视频| 99精品视频中文字幕| 色吧成人激情小说| 欧美综合色免费| 精品视频一区二区不卡| 欧美日韩精品一区二区天天拍小说| 欧美精品在线视频| 欧美成人精精品一区二区频| 久久一夜天堂av一区二区三区| 国产亚洲婷婷免费| 国产精品国产三级国产普通话99 | 美女在线一区二区| 紧缚捆绑精品一区二区| 成人av在线资源网| 欧美在线观看一区二区| 欧美一级二级在线观看| 国产日产欧美精品一区二区三区| 国产精品天美传媒| 亚洲妇女屁股眼交7| 日本在线观看不卡视频| 国产乱一区二区| 色婷婷综合久久久中文一区二区| 欧美精品精品一区| 久久色.com| 一级日本不卡的影视| 丁香六月综合激情| 欧美系列亚洲系列| 精品成人佐山爱一区二区| 国产精品视频你懂的| 亚洲va欧美va人人爽| 国产精品原创巨作av| 在线视频欧美区| 精品嫩草影院久久| 日韩毛片在线免费观看| 伦理电影国产精品| 91网站最新地址| 91精品国产综合久久久久久久 | 在线不卡a资源高清| 精品久久久影院| 亚洲视频一区二区在线| 美女一区二区视频| 色综合色狠狠综合色| 日韩三级免费观看| 综合久久一区二区三区| 一区二区三区av电影| 91麻豆国产自产在线观看| 亚洲精品视频免费观看| 日本三级韩国三级欧美三级| av网站免费线看精品| 久久奇米777| 日本不卡一区二区三区| 色一情一伦一子一伦一区| 久久精品欧美日韩| 亚洲一区视频在线观看视频| 色久综合一二码| 欧美午夜寂寞影院| 日韩欧美中文一区二区| 亚洲自拍偷拍图区| 国产精品素人视频| 国产欧美视频一区二区三区| 亚洲制服丝袜在线| 激情图片小说一区| 成人国产精品免费观看| 欧美大片拔萝卜| 丝袜美腿一区二区三区| 99综合电影在线视频| 久久综合色天天久久综合图片| 国产欧美日本一区视频| 亚洲欧洲日韩av| 国产精品系列在线观看| 精品久久一二三区| 日韩电影在线一区| 欧美三级日本三级少妇99| 成人免费一区二区三区视频 | 狠狠久久亚洲欧美| 欧美一区二区三区视频| 视频一区二区三区入口| 日本精品一区二区三区高清 | 91美女片黄在线观看91美女| 国产无遮挡一区二区三区毛片日本| 全部av―极品视觉盛宴亚洲| 欧美欧美欧美欧美| 亚洲成av人片在线| 欧美三级蜜桃2在线观看| 亚洲视频一区二区在线| 91老师片黄在线观看| 自拍av一区二区三区| yourporn久久国产精品| 国产精品美女一区二区| 成人免费毛片app| 国产精品麻豆欧美日韩ww| 国产不卡高清在线观看视频| 国产精品亲子乱子伦xxxx裸| 福利电影一区二区三区| 国产精品欧美精品| 91在线视频播放| 夜夜操天天操亚洲| 欧美日韩一区二区三区视频| 偷窥国产亚洲免费视频| 日韩午夜在线观看| 精品无码三级在线观看视频| 精品乱人伦小说| 国产高清在线精品| 中文字幕巨乱亚洲| 91女厕偷拍女厕偷拍高清| 一个色综合av| 91精品国产高清一区二区三区 | 一区二区三区四区激情| 欧美三级三级三级| 美国十次综合导航| 国产免费观看久久| 色香蕉久久蜜桃| 国产精品一二三在| 蜜桃久久av一区| 顶级嫩模精品视频在线看| 视频一区在线播放| 亚洲国产成人在线| 精品国产一区二区三区四区四| 色悠久久久久综合欧美99| 国产精品亚洲一区二区三区在线| 亚州成人在线电影| 一区二区三区四区蜜桃| **性色生活片久久毛片| 欧美激情一区二区三区蜜桃视频| 欧美成人欧美edvon| 日韩欧美中文字幕公布| 欧美v日韩v国产v| 精品国偷自产国产一区| 日韩精品最新网址| 久久午夜老司机| 欧美刺激午夜性久久久久久久| 日韩视频一区二区在线观看| 欧美区一区二区三区| 欧美在线观看视频一区二区三区| 久久99热狠狠色一区二区| 亚洲精品国产精华液| 亚洲精品国产无天堂网2021| 亚洲精品国产精品乱码不99| 亚洲精品免费一二三区| 亚洲电影视频在线| 日韩二区三区在线观看| 蜜桃视频一区二区三区| 成人精品国产福利| 亚洲18女电影在线观看| 日韩精品一二三| 国产不卡免费视频| av动漫一区二区| 91精品中文字幕一区二区三区| 日韩精品一区二区三区蜜臀| 中文字幕在线一区| 成人一区二区视频| 亚洲精品国产视频| 欧美xxxxx牲另类人与| 自拍偷拍国产精品| 精品影视av免费| 欧美专区亚洲专区| 午夜精品在线视频一区| 日韩视频国产视频| 一本在线高清不卡dvd| 日产精品久久久久久久性色| 国产亚洲一本大道中文在线| 色欲综合视频天天天| 秋霞电影一区二区| 日韩伦理电影网| 制服丝袜国产精品| 不卡一区二区中文字幕| 亚洲第一福利视频在线| 26uuu亚洲婷婷狠狠天堂| 亚洲一区视频在线观看视频| 成人免费看片app下载| 日韩视频免费观看高清在线视频| 亚洲欧美色一区| 国产成人一级电影| 久久综合色一综合色88| 一本到不卡精品视频在线观看| 久久婷婷色综合| 国产精品的网站| 久久综合久久综合久久综合| 欧美日韩精品综合在线| 色综合久久久久久久久| 波多野结衣的一区二区三区| 国产一区二区免费在线| 精品一区二区三区影院在线午夜| 丝袜美腿一区二区三区| 天天做天天摸天天爽国产一区|