LCOV - code coverage report
Current view: top level - strace_git - ptp.c (source / functions) Hit Total Coverage
Test: strace-4.16.0.69.f1ea-dirty Code Coverage Lines: 0 56 0.0 %
Date: 2017-03-18 00:38:52 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 30 0.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Copyright (c) 2014 Stefan Sørensen <stefan.sorensen@spectralink.com>
       3                 :            :  * Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
       4                 :            :  * All rights reserved.
       5                 :            :  *
       6                 :            :  * Redistribution and use in source and binary forms, with or without
       7                 :            :  * modification, are permitted provided that the following conditions
       8                 :            :  * are met:
       9                 :            :  * 1. Redistributions of source code must retain the above copyright
      10                 :            :  *    notice, this list of conditions and the following disclaimer.
      11                 :            :  * 2. Redistributions in binary form must reproduce the above copyright
      12                 :            :  *    notice, this list of conditions and the following disclaimer in the
      13                 :            :  *    documentation and/or other materials provided with the distribution.
      14                 :            :  * 3. The name of the author may not be used to endorse or promote products
      15                 :            :  *    derived from this software without specific prior written permission.
      16                 :            :  *
      17                 :            :  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
      18                 :            :  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
      19                 :            :  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
      20                 :            :  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
      21                 :            :  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
      22                 :            :  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
      23                 :            :  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      24                 :            :  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
      25                 :            :  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
      26                 :            :  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      27                 :            :  */
      28                 :            : 
      29                 :            : #include "defs.h"
      30                 :            : #include <linux/ioctl.h>
      31                 :            : #include <linux/ptp_clock.h>
      32                 :            : 
      33                 :            : #include "xlat/ptp_flags_options.h"
      34                 :            : 
      35                 :            : int
      36                 :          0 : ptp_ioctl(struct tcb *const tcp, const unsigned int code,
      37                 :            :           const kernel_ulong_t arg)
      38                 :            : {
      39         [ #  # ]:          0 :         if (!verbose(tcp))
      40                 :          0 :                 return RVAL_DECODED;
      41                 :            : 
      42   [ #  #  #  #  :          0 :         switch (code) {
                   #  # ]
      43                 :            :         case PTP_EXTTS_REQUEST: {
      44                 :            :                 struct ptp_extts_request extts;
      45                 :            : 
      46                 :          0 :                 tprints(", ");
      47         [ #  # ]:          0 :                 if (umove_or_printaddr(tcp, arg, &extts))
      48                 :          0 :                         break;
      49                 :            : 
      50                 :          0 :                 tprintf("{index=%d, flags=", extts.index);
      51                 :          0 :                 printflags(ptp_flags_options, extts.flags, "PTP_???");
      52                 :          0 :                 tprints("}");
      53                 :          0 :                 break;
      54                 :            :         }
      55                 :            : 
      56                 :            :         case PTP_PEROUT_REQUEST: {
      57                 :            :                 struct ptp_perout_request perout;
      58                 :            : 
      59                 :          0 :                 tprints(", ");
      60         [ #  # ]:          0 :                 if (umove_or_printaddr(tcp, arg, &perout))
      61                 :          0 :                         break;
      62                 :            : 
      63                 :          0 :                 tprintf("{start={%" PRId64 ", %" PRIu32 "}"
      64                 :            :                            ", period={%" PRId64 ", %" PRIu32 "}"
      65                 :            :                            ", index=%d, flags=",
      66                 :          0 :                         (int64_t)perout.start.sec, perout.start.nsec,
      67                 :          0 :                         (int64_t)perout.period.sec, perout.period.nsec,
      68                 :            :                         perout.index);
      69                 :          0 :                 printflags(ptp_flags_options, perout.flags, "PTP_???");
      70                 :          0 :                 tprints("}");
      71                 :          0 :                 break;
      72                 :            :         }
      73                 :            : 
      74                 :            :         case PTP_ENABLE_PPS:
      75                 :          0 :                 tprintf(", %" PRI_kld, arg);
      76                 :          0 :                 break;
      77                 :            : 
      78                 :            :         case PTP_SYS_OFFSET: {
      79                 :            :                 struct ptp_sys_offset sysoff;
      80                 :            : 
      81         [ #  # ]:          0 :                 if (entering(tcp)) {
      82                 :          0 :                         tprints(", ");
      83         [ #  # ]:          0 :                         if (umove_or_printaddr(tcp, arg, &sysoff))
      84                 :          0 :                                 break;
      85                 :            : 
      86                 :          0 :                         tprintf("{n_samples=%u", sysoff.n_samples);
      87                 :          0 :                         return 1;
      88                 :            :                 } else {
      89                 :            :                         unsigned int n_samples, i;
      90                 :            : 
      91         [ #  # ]:          0 :                         if (syserror(tcp)) {
      92                 :          0 :                                 tprints("}");
      93                 :          0 :                                 break;
      94                 :            :                         }
      95                 :            : 
      96                 :          0 :                         tprints(", ");
      97         [ #  # ]:          0 :                         if (umove(tcp, arg, &sysoff) < 0) {
      98                 :          0 :                                 tprints("???}");
      99                 :          0 :                                 break;
     100                 :            :                         }
     101                 :            : 
     102                 :          0 :                         tprints("ts=[");
     103                 :          0 :                         n_samples = sysoff.n_samples > PTP_MAX_SAMPLES ?
     104                 :          0 :                                 PTP_MAX_SAMPLES : sysoff.n_samples;
     105         [ #  # ]:          0 :                         for (i = 0; i < 2 * n_samples + 1; ++i) {
     106         [ #  # ]:          0 :                                 if (i > 0)
     107                 :          0 :                                         tprints(", ");
     108                 :          0 :                                 tprintf("{%" PRId64 ", %" PRIu32 "}",
     109                 :          0 :                                         (int64_t)sysoff.ts[i].sec,
     110                 :            :                                         sysoff.ts[i].nsec);
     111                 :            :                         }
     112         [ #  # ]:          0 :                         if (sysoff.n_samples > PTP_MAX_SAMPLES)
     113                 :          0 :                                 tprints(", ...");
     114                 :          0 :                         tprints("]}");
     115                 :          0 :                         break;
     116                 :            :                 }
     117                 :            :         }
     118                 :            :         case PTP_CLOCK_GETCAPS: {
     119                 :            :                 struct ptp_clock_caps caps;
     120                 :            : 
     121         [ #  # ]:          0 :                 if (entering(tcp))
     122                 :          0 :                         return 0;
     123                 :            : 
     124                 :          0 :                 tprints(", ");
     125         [ #  # ]:          0 :                 if (umove_or_printaddr(tcp, arg, &caps))
     126                 :          0 :                         break;
     127                 :            : 
     128                 :          0 :                 tprintf("{max_adj=%d, n_alarm=%d, n_ext_ts=%d, n_per_out=%d, pps=%d}",
     129                 :            :                         caps.max_adj, caps.n_alarm, caps.n_ext_ts,
     130                 :            :                         caps.n_per_out, caps.pps);
     131                 :          0 :                 break;
     132                 :            :         }
     133                 :            : 
     134                 :            :         default:
     135                 :          0 :                 return RVAL_DECODED;
     136                 :            :         }
     137                 :            : 
     138                 :          0 :         return RVAL_DECODED | 1;
     139                 :            : }

Generated by: LCOV version 1.12