Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
posix-clock.h
Go to the documentation of this file.
1 /*
2  * posix-clock.h - support for dynamic clock devices
3  *
4  * Copyright (C) 2010 OMICRON electronics GmbH
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */
20 #ifndef _LINUX_POSIX_CLOCK_H_
21 #define _LINUX_POSIX_CLOCK_H_
22 
23 #include <linux/cdev.h>
24 #include <linux/fs.h>
25 #include <linux/poll.h>
26 #include <linux/posix-timers.h>
27 #include <linux/rwsem.h>
28 
29 struct posix_clock;
30 
58  struct module *owner;
59 
60  int (*clock_adjtime)(struct posix_clock *pc, struct timex *tx);
61 
62  int (*clock_gettime)(struct posix_clock *pc, struct timespec *ts);
63 
64  int (*clock_getres) (struct posix_clock *pc, struct timespec *ts);
65 
67  const struct timespec *ts);
68 
69  int (*timer_create) (struct posix_clock *pc, struct k_itimer *kit);
70 
71  int (*timer_delete) (struct posix_clock *pc, struct k_itimer *kit);
72 
74  struct k_itimer *kit, struct itimerspec *tsp);
75 
77  struct k_itimer *kit, int flags,
78  struct itimerspec *tsp, struct itimerspec *old);
79  /*
80  * Optional character device methods:
81  */
82  int (*fasync) (struct posix_clock *pc,
83  int fd, struct file *file, int on);
84 
85  long (*ioctl) (struct posix_clock *pc,
86  unsigned int cmd, unsigned long arg);
87 
88  int (*mmap) (struct posix_clock *pc,
89  struct vm_area_struct *vma);
90 
91  int (*open) (struct posix_clock *pc, fmode_t f_mode);
92 
93  uint (*poll) (struct posix_clock *pc,
94  struct file *file, poll_table *wait);
95 
96  int (*release) (struct posix_clock *pc);
97 
98  ssize_t (*read) (struct posix_clock *pc,
99  uint flags, char __user *buf, size_t cnt);
100 };
101 
117 struct posix_clock {
119  struct cdev cdev;
120  struct kref kref;
122  bool zombie;
124 };
125 
139 
150 
151 #endif