lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <4BDD5910.1040604@grandegger.com> Date: Sun, 02 May 2010 12:50:56 +0200 From: Wolfgang Grandegger <wg@...ndegger.com> To: Richard Cochran <richardcochran@...il.com> CC: netdev@...r.kernel.org Subject: Re: [PATCH 1/3] ptp: Added a brand new class driver for ptp clocks. Hi Richard, Richard Cochran wrote: > This patch adds an infrastructure for hardware clocks that implement > IEEE 1588, the Precision Time Protocol (PTP). A class driver offers a > registration method to particular hardware clock drivers. Each clock is > exposed to user space as a character device with ioctls that allow tuning > of the PTP clock. > > Signed-off-by: Richard Cochran <richard.cochran@...cron.at> > --- ... > diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c > new file mode 100644 > index 0000000..a5acac4 > --- /dev/null > +++ b/drivers/ptp/ptp_clock.c ... > +static int ptp_open(struct inode *inode, struct file *fp) > +{ > + struct ptp_clock *ptp; > + ptp = container_of(inode->i_cdev, struct ptp_clock, cdev); > + > + if (mutex_lock_interruptible(&ptp->mux)) > + return -ERESTARTSYS; > + > + fp->private_data = ptp; > + > + return 0; > +} ... > +static int ptp_release(struct inode *inode, struct file *fp) > +{ > + struct ptp_clock *ptp = fp->private_data; > + mutex_unlock(&ptp->mux); > + return 0; > +} As long as the device is in use by an application, no other can access it, because the mutex is locked. Other application may want to read the PTP clock time while ptpd is running, though. Wolfgang. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists