本文整理汇总了C++中F_ENTER函数的典型用法代码示例。如果您正苦于以下问题:C++ F_ENTER函数的具体用法?C++ F_ENTER怎么用?C++ F_ENTER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了F_ENTER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: citty_ioctl_tiocgicount
static int citty_ioctl_tiocgicount(struct tty_struct *tty, struct file *file,
unsigned int cmd, unsigned long arg)
{
struct citty_port *citty = tty->driver_data;
F_ENTER();
if (cmd == TIOCGICOUNT) {
struct async_icount cnow = citty->icount;
struct serial_icounter_struct icount;
icount.cts = cnow.cts;
icount.dsr = cnow.dsr;
icount.rng = cnow.rng;
icount.dcd = cnow.dcd;
icount.rx = cnow.rx;
icount.tx = cnow.tx;
icount.frame = cnow.frame;
icount.overrun = cnow.overrun;
icount.parity = cnow.parity;
icount.brk = cnow.brk;
icount.buf_overrun = cnow.buf_overrun;
if (copy_to_user((void __user *)arg, &icount, sizeof(icount)))
return -EFAULT;
return 0;
}
F_LEAVE();
return -ENOIOCTLCMD;
}
示例2: citty_close
static void citty_close(struct tty_struct *tty, struct file *file)
{
struct citty_port *citty = NULL;
int index = tty->index;
F_ENTER();
down(&sem_lock_tty[index]);
citty = citty_table[index];
/* Modified by Rovin Yu: release citty and related resource */
if (citty) {
if (!citty->port->count) {
/* port was never opened */
goto exit;
}
--citty->port->count;
PDEBUG("citty_close: index is %d, count is %d\n",
index, citty->port->count);
if (citty->port->count <= 0) {
citty_table[index] = NULL;
kfree(citty);
}
}
exit:
up(&sem_lock_tty[index]);
F_LEAVE();
}
示例3: citty_ioctl
/* the real citty_ioctl function.
* The above is done to get the small functions*/
static int citty_ioctl(struct tty_struct *tty,
unsigned int cmd, unsigned long arg)
{
struct file *file = NULL;
F_ENTER();
switch (cmd) {
case TIOCGSERIAL:
return citty_ioctl_tiocgserial(tty, file, cmd, arg);
case TIOCMIWAIT:
return citty_ioctl_tiocmiwait(tty, file, cmd, arg);
case TIOCGICOUNT:
return citty_ioctl_tiocgicount(tty, file, cmd, arg);
case TCSETS:
return citty_ioctl_tcsets(tty, file, cmd, arg);
case TCGETS: /* 0x5401 ioctls.h */
return citty_ioctl_tcgets(tty, file, cmd, arg);
case TCSETSF: /* 0x5404 */
case TCSETAF: /* 0x5408 */
return 0; /* has to return zero for qtopia to work */
default:
PDEBUG("citty_ioctl cmd: %d.\n", cmd);
return -ENOIOCTLCMD; /* for PPPD to work? */
break;
}
F_LEAVE();
}
示例4: cctdev_open
int cctdev_open(struct inode *inode, struct file *filp)
{
struct cctdev_dev *dev; /* device information */
F_ENTER();
dev = container_of(inode->i_cdev, struct cctdev_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) {
if (down_interruptible(&dev->sem))
return -ERESTARTSYS;
up(&dev->sem);
}
*/
/* used to keep track of how many readers */
down(&dev->sem);
if (filp->f_mode & FMODE_READ)
dev->nreaders++;
if (filp->f_mode & FMODE_WRITE)
dev->nwriters++;
up(&dev->sem);
F_LEAVE();
return nonseekable_open(inode, filp); /* success */
}
示例5: citty_write_room
static int citty_write_room(struct tty_struct *tty)
{
struct citty_port *citty = NULL;
int index = tty->index;
int room = -EINVAL;
F_ENTER();
down(&sem_lock_tty[index]);
citty = citty_table[index];
if (!citty) {
up(&sem_lock_tty[index]);
return -ENODEV;
}
if (!citty->port->count) {
PDEBUG("citty_write_room: no port is open.");
/* port was not opened */
goto exit;
}
/* calculate how much room is left in the device */
/* CHECKPOINT */
/* room = CITTY_BUF_SIZE * spacefree( &txCittyBuf ); */
room = CITTY_BUF_SIZE * spacefree(&txCittyBuf[tty->index]);
exit:
up(&sem_lock_tty[index]);
F_LEAVE();
return room;
}
示例6: cci_init_buffer
void cci_init_buffer(struct buf_struct *buffer)
{
int i;
F_ENTER();
for (i = 0; i < NUM_CITTY_BUF; i++) {
buffer->pBuf[i] = kmalloc(CITTY_BUF_SIZE, GFP_KERNEL);
if (!buffer->pBuf[i])
printk(KERN_ERR "Failed to allocate memory.\n");
buffer->iBufIn = 0;
buffer->iBufOut = 0;
}
sema_init(&(buffer->gSem), 1);
/* init the queue */
init_waitqueue_head(&(buffer->gInq));
init_waitqueue_head(&(buffer->gOutq));
F_LEAVE();
}
示例7: do_close
static void do_close(struct cidatatty_port *cidatatty)
{
unsigned long flags;
F_ENTER();
down(&cidatatty->sem_lock_tty);
spin_lock_irqsave(&cidatatty->port_lock, flags);
if (!cidatatty->port.count) {
/* port was never opened */
goto exit;
}
--cidatatty->port.count;
if (cidatatty->port.count <= 0) {
/* The port is being closed by the last user. */
/* Do any hardware specific stuff here */
if (cidatatty->port.tty->index == PSDTTYINDEX)
unregisterRxCallBack(PDP_PPP);
else if (cidatatty->port.tty->index == CSDTTYINDEX)
unregisterRxCallBack(CSD_RAW);
else if (cidatatty->port.tty->index == IMSTTYINDEX)
unregisterRxCallBack(IMS_RAW);
}
exit:
spin_unlock_irqrestore(&cidatatty->port_lock, flags);
up(&cidatatty->sem_lock_tty);
PDEBUG("Leaving do_close: ");
}
示例8: citty_exit
static void __exit citty_exit(void)
{
struct citty_serial *citty;
int i;
F_ENTER();
for (i = 0; i < CITTY_TTY_MINORS; ++i)
tty_unregister_device(citty_tty_driver, i);
tty_unregister_driver(citty_tty_driver);
put_tty_driver(citty_tty_driver);
/* free the memory */
for (i = 0; i < CITTY_TTY_MINORS; ++i)
{
down(&sem[i]);
citty = citty_table[i];
if (citty)
{
kfree(citty);
citty_table[i] = NULL;
//cci_free_buffer(&txCittyBuf[i]);
}
up(&sem[i]);
cci_free_buffer(&txCittyBuf[i]); //Modified by Rovin to move here
}
/* clean up for the cctdev stuff */
cctdev_cleanup_module();
F_LEAVE();
}
示例9: cidatatty_exit
static void __exit cidatatty_exit(void)
{
struct cidatatty_port *cidatatty;
int i;
F_ENTER();
/* unregister device */
for (i = 0; i < CIDATATTY_TTY_MINORS; ++i) {
cidatatty = cidatatty_table[i].data_port;
if (cidatatty) {
/* close the port */
while (cidatatty->port.count)
do_close(cidatatty);
cidatatty_table[i].data_port = NULL;
tty_port_destroy(&cidatatty->port);
kfree(cidatatty);
}
tty_unregister_device(cidatatty_tty_driver, i);
}
/* unregister driver */
tty_unregister_driver(cidatatty_tty_driver);
cctdatadev_cleanup_module();
F_LEAVE();
}
示例10: citty_ioctl
static int citty_ioctl(struct tty_struct *tty, struct file *file,
unsigned int cmd, unsigned long arg)
#endif
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
struct file *file = NULL;
#endif
F_ENTER();
switch (cmd)
{
case TIOCGSERIAL:
return citty_ioctl_tiocgserial(tty, file, cmd, arg);
case TIOCMIWAIT:
return citty_ioctl_tiocmiwait(tty, file, cmd, arg);
case TIOCGICOUNT:
return citty_ioctl_tiocgicount(tty, file, cmd, arg);
case TCSETS:
return citty_ioctl_tcsets(tty, file, cmd, arg);
case TCGETS: //0x5401 ioctls.h
return citty_ioctl_tcgets(tty, file, cmd, arg);
case TCSETSF: //0x5404
case TCSETAF: //0x5408
return 0; //has to return zero for qtopia to work
default:
PDEBUG("citty_ioctl cmd: %d.\n", cmd);
return -ENOIOCTLCMD; // for PPPD to work?
break;
}
F_LEAVE();
}
示例11: citty_exit
static void __exit citty_exit(void)
{
struct citty_port *citty = NULL;
int i;
F_ENTER();
/* unregister devices */
for (i = 0; i < CITTY_TTY_MINORS; ++i) {
down(&sem_lock_tty[i]);
citty = citty_table[i];
if (citty) {
citty_table[i] = NULL;
kfree(citty);
}
up(&sem_lock_tty[i]);
tty_port_destroy(&citty_port_table[i]);
tty_unregister_device(citty_tty_driver, i);
cci_free_buffer(&txCittyBuf[i]);
}
/* unregister driver */
tty_unregister_driver(citty_tty_driver);
put_tty_driver(citty_tty_driver);
/* clean up for the cctdev stuff */
cctdev_cleanup_module();
F_LEAVE();
}
示例12: cctdev_poll
unsigned int cctdev_poll(struct file *filp, poll_table *wait)
{
struct cctdev_dev *dev = filp->private_data;
int minor_num;
unsigned int mask = 0;
F_ENTER();
minor_num = MINOR(dev->cdev.dev);
down(&txCittyBuf[minor_num].gSem);
poll_wait(filp, &txCittyBuf[minor_num].gInq, wait);
if (txCittyBuf[minor_num].iBufOut != txCittyBuf[minor_num].iBufIn)
mask |= POLLIN | POLLRDNORM;
mask |= POLLOUT | POLLWRNORM;
up(&txCittyBuf[minor_num].gSem);
F_LEAVE();
return mask;
}
示例13: citty_init
static int __init citty_init(void)
{
int retval;
int i;
F_ENTER();
/* allocate the tty driver */
citty_tty_driver = alloc_tty_driver(CITTY_TTY_MINORS);
if (!citty_tty_driver)
return -ENOMEM;
/* initialize the tty driver */
citty_tty_driver->owner = THIS_MODULE;
citty_tty_driver->driver_name = "citty_tty";
citty_tty_driver->name = "citty";
citty_tty_driver->major = CITTY_TTY_MAJOR;
citty_tty_driver->type = TTY_DRIVER_TYPE_SERIAL;
citty_tty_driver->subtype = SERIAL_TYPE_NORMAL;
citty_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
citty_tty_driver->init_termios = tty_std_termios;
/* B115200 | CS8 | CREAD | HUPCL | CLOCAL; */
citty_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | CLOCAL;
citty_tty_driver->init_termios.c_iflag = IGNBRK | IGNCR | IGNPAR;
citty_tty_driver->init_termios.c_oflag = 0;
citty_tty_driver->init_termios.c_lflag = 0;
tty_set_operations(citty_tty_driver, &serial_ops);
/* register the tty driver */
retval = tty_register_driver(citty_tty_driver);
if (retval) {
printk(KERN_ERR "failed to register citty tty driver");
put_tty_driver(citty_tty_driver);
citty_tty_driver = NULL;
return retval;
}
/* register tty devices */
for (i = 0; i < CITTY_TTY_MINORS; ++i) {
/* Init buffer */
cci_init_buffer(&txCittyBuf[i]);
sema_init(&sem_lock_tty[i], 1);
tty_port_init(&citty_port_table[i]);
tty_port_register_device(&citty_port_table[i],
citty_tty_driver, i, NULL);
}
printk(KERN_INFO DRIVER_DESC " " DRIVER_VERSION "\n");
cctdev_init_module();
F_LEAVE();
return retval;
}
示例14: cctdev_write
/*******************************************************************
* FUNCTION: cctdev_write
*
* DESCRIPTION: Once data come, push it to the tty port
*
*
* RETURNS: utlFAILED or utlSUCCESS
*
*******************************************************************/
ssize_t cctdev_write(struct file *filp, const char __user *buf, size_t count,
loff_t *f_pos)
{
struct cctdev_dev *dev = filp->private_data;
int minor_num;
int c;
char *tbuf = NULL;
/* send the data to the tty layer for users to read.
* This doesn't
* actually push the data through unless tty->low_latency is set */
struct citty_port *citty = NULL;
struct tty_struct *tty = NULL;
F_ENTER();
/* Extract Minor Number */
minor_num = MINOR(dev->cdev.dev);
PDEBUG("cctdev_write: minor_num:%d\n", minor_num);
mutex_lock(&mutex_lock_tty[minor_num]);
/*
* get the serial object associated with this tty pointer
* always give the data to the first open Dev.
*/
citty = citty_table[minor_num];
PDEBUG("cctdev_write: citty: 0x%x, minor_num:%d\n",
(unsigned long)citty, minor_num);
if (!citty) {
PDEBUG("Warning: citty is NULL.\n");
mutex_unlock(&mutex_lock_tty[minor_num]);
return -ENODEV;
}
tty = citty->port->tty;
if (!tty) {
mutex_unlock(&mutex_lock_tty[minor_num]);
return -ENODEV;
}
tbuf = memdup_user(buf, count);
if (IS_ERR(tbuf)) {
pr_warn("%s: memdup_user returned error[%ld]\n",
__func__, PTR_ERR(tbuf));
mutex_unlock(&mutex_lock_tty[minor_num]);
return PTR_ERR(tbuf);
}
c = tty->ldisc->ops->receive_buf2(tty, tbuf, NULL, count);
kfree(tbuf);
mutex_unlock(&mutex_lock_tty[minor_num]);
return c;
}
示例15: cidatatty_close
static void cidatatty_close(struct tty_struct *tty, struct file *file)
{
struct cidatatty_port *cidatatty = tty->driver_data;
F_ENTER();
if (cidatatty)
do_close(cidatatty);
F_LEAVE();
}