public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] PPS: Implementing LinuxPPS API with new syscalls
@ 2007-06-05  7:25 Rodolfo Giometti
  2007-06-06 20:29 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Rodolfo Giometti @ 2007-06-05  7:25 UTC (permalink / raw)
  To: linux-kernel; +Cc: linuxpps, akpm

Hello,

after a little studing on new generic netlink interface and some
letters with Andrew Morton I decided to drop using the netlink API at
all and start using new specific syscalls.

Looking at current LinuxPPS API and at RFC2783 I think we need the
following syscalls:

   asmlinkage long sys_time_pps_find(int cmd, int __user *source,
                                          char __user *name, int namelen,
                                          char __user *path, int pathlen);
   asmlinkage long sys_time_pps_getparams(int source,
                                          struct pps_params __user *params);
   asmlinkage long sys_time_pps_setparams(int source,
                                          const struct pps_params __user *params);
   asmlinkage long sys_time_pps_getcap(int source, int __user *mode);
   asmlinkage long sys_time_pps_fetch(int source, const int tsformat,
                                          struct pps_info __user *info,
                                          const struct timespec __user *timeout);

In fact:

* the two LinuxPPS functions time_pps_findsource() and
time_pps_findpath() can be implemented with sys_time_pps_find()
specifying proper finding command into "cmd",

* the RFC2783 time_pps_create() and time_pps_destroy() are not needed
since no PPS sources are created or destryed from userspace. The former
can be simply implemented as follow:

   static int time_pps_create(int source, pps_handle_t *handle)
   {
           /* In LinuxPPS there are no differences between a PPS source and
            * a PPS handle so we return the same value. */
           *handle = source;
    
           return 0;
   }

while the latter is just a "return 0".

* the RFC2783 time_pps_kcbind() is not implemented into Linux so it is
just a "return -EOPNOTSUPP".

Also using syscalls the problem regarding the pps_handle_t type
disappears, even if the needed of using time_pps_findsource() or
time_pps_findpath() still remains.

Regarding the file timepps.h I think I should reintroduce it into the
kernel header files since it's needed to define new PPS types and new
syscalls wrappers for RFC2783 compatibility.

Comments? Suggestions? :)

Thanks a lot,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail:    giometti@enneenne.com
Linux Device Driver                             giometti@gnudd.com
Embedded Systems                     		giometti@linux.it
UNIX programming                     phone:     +39 349 2432127

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] PPS: Implementing LinuxPPS API with new syscalls
  2007-06-05  7:25 [RFC] PPS: Implementing LinuxPPS API with new syscalls Rodolfo Giometti
@ 2007-06-06 20:29 ` Andrew Morton
  2007-06-06 21:24   ` Rodolfo Giometti
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2007-06-06 20:29 UTC (permalink / raw)
  To: Rodolfo Giometti; +Cc: linux-kernel, linuxpps

On Tue, 5 Jun 2007 09:25:01 +0200 Rodolfo Giometti <giometti@enneenne.com> wrote:

> Hello,
> 
> after a little studing on new generic netlink interface and some
> letters with Andrew Morton I decided to drop using the netlink API at
> all and start using new specific syscalls.
> 
> Looking at current LinuxPPS API and at RFC2783 I think we need the
> following syscalls:
> 
>    asmlinkage long sys_time_pps_find(int cmd, int __user *source,
>                                           char __user *name, int namelen,
>                                           char __user *path, int pathlen);
>    asmlinkage long sys_time_pps_getparams(int source,
>                                           struct pps_params __user *params);
>    asmlinkage long sys_time_pps_setparams(int source,
>                                           const struct pps_params __user *params);
>    asmlinkage long sys_time_pps_getcap(int source, int __user *mode);
>    asmlinkage long sys_time_pps_fetch(int source, const int tsformat,
>                                           struct pps_info __user *info,
>                                           const struct timespec __user *timeout);

Could we please also see those structs which are being passed in and out of
the kernel?  It's a bit hard to understand the proposed interface without
that information.

They don't have to be 100% accurate - just an overview.

Hopefully each member of these structs has a little comment explaining what
it is, too...

Thanks.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] PPS: Implementing LinuxPPS API with new syscalls
  2007-06-06 20:29 ` Andrew Morton
@ 2007-06-06 21:24   ` Rodolfo Giometti
  2007-06-07 10:14     ` Rodolfo Giometti
  0 siblings, 1 reply; 4+ messages in thread
From: Rodolfo Giometti @ 2007-06-06 21:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, linuxpps

On Wed, Jun 06, 2007 at 01:29:34PM -0700, Andrew Morton wrote:

> >    asmlinkage long sys_time_pps_find(int cmd, int __user *source,
> >                                           char __user *name, int namelen,
> >                                           char __user *path, int pathlen);

Try to find a PPS source into the system giving one of its feature.

With cmd==PPS_FIND_SRC we check for a PPS source with index number
equal to *source, if *source==-1 we just ask for the first PPS source
defined into the system.

With cmd=PPS_FIND_PATH we check for a PPS source with path name equal
to path.

Selected source is returned into *source and PPS source info are
placed into path and name arrays.

> >    asmlinkage long sys_time_pps_getparams(int source,
> >                                           struct pps_params __user *params);

struct pps_params {
        int api_version;                /* API version # */
        int mode;                       /* mode bits */
        union pps_timeu assert_off_tu;  /* offset compensation for assert */
        union pps_timeu clear_off_tu;   /* offset compensation for clear */
};

Given a PPS source index returns its parameters setting.

> >    asmlinkage long sys_time_pps_setparams(int source,
> >                                           const struct pps_params __user *params);

Sets PPS source parameters.

> >    asmlinkage long sys_time_pps_getcap(int source, int __user *mode);

Given a	PPS source index returns its functioning modes.

> >    asmlinkage long sys_time_pps_fetch(int source, const int tsformat,
> >                                           struct pps_info __user *info,
> >                                           const struct timespec __user *timeout);

struct pps_info {
        unsigned long assert_sequence;  /* seq. num. of assert event */
        unsigned long clear_sequence;   /* seq. num. of clear event */
        union pps_timeu assert_tu;      /* time of assert event */
        union pps_timeu clear_tu;       /* time of clear event */
        int current_mode;               /* current mode bits */
};

Given a PPS source index, a time format and, optionally, a timeout
time returns PPS time data.

Further info on these structs can be get on RFC 2783.

Apart sys_time_pps_find() the other syscalls derive directly from RFC
2783 suggestions.

I hope these info are enough... :)

Rodolfo

-- 

GNU/Linux Solutions                  e-mail:    giometti@enneenne.com
Linux Device Driver                             giometti@gnudd.com
Embedded Systems                     		giometti@linux.it
UNIX programming                     phone:     +39 349 2432127

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] PPS: Implementing LinuxPPS API with new syscalls
  2007-06-06 21:24   ` Rodolfo Giometti
@ 2007-06-07 10:14     ` Rodolfo Giometti
  0 siblings, 0 replies; 4+ messages in thread
From: Rodolfo Giometti @ 2007-06-07 10:14 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, linuxpps

On Wed, Jun 06, 2007 at 11:24:16PM +0200, Rodolfo Giometti wrote:
> On Wed, Jun 06, 2007 at 01:29:34PM -0700, Andrew Morton wrote:
> 
> > >    asmlinkage long sys_time_pps_find(int cmd, int __user *source,
> > >                                           char __user *name, int namelen,
> > >                                           char __user *path, int pathlen);
> 
> Try to find a PPS source into the system giving one of its feature.
> 
> With cmd==PPS_FIND_SRC we check for a PPS source with index number
> equal to *source, if *source==-1 we just ask for the first PPS source
> defined into the system.
> 
> With cmd=PPS_FIND_PATH we check for a PPS source with path name equal
> to path.
> 
> Selected source is returned into *source and PPS source info are
> placed into path and name arrays.

Maybe this syscall can be turned into something like:

   asmlinkage long sys_time_pps_ioctl(int cmd, void *ptr);

and data are passed through ptr pointer... obviously first implemented
commands will be PPS_FIND_SRC and PPS_FIND_PATH.

This allows future improvements...

Ciao,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail:    giometti@enneenne.com
Linux Device Driver                             giometti@gnudd.com
Embedded Systems                     		giometti@linux.it
UNIX programming                     phone:     +39 349 2432127

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-06-07 10:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-05  7:25 [RFC] PPS: Implementing LinuxPPS API with new syscalls Rodolfo Giometti
2007-06-06 20:29 ` Andrew Morton
2007-06-06 21:24   ` Rodolfo Giometti
2007-06-07 10:14     ` Rodolfo Giometti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox