NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/48426



The following reply was made to PR kern/48426; it has been noted by GNATS.

From: Dimitris Karagkasidis <dimitris%gatoni.gr@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/48426
Date: Thu, 24 Apr 2014 10:23:47 +0200

 This is a multi-part message in MIME format.
 --------------070904040207080408090901
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 Converting the signed integers to unsigned in `struct nfsstats` is the
 first thing that pops in mind. This would both solve the presentation
 issue in /usr/bin/nfsstat and would also be "theoretically" correct,
 since there is no need to store negative values in NFS stat counters.
 
 IMHO it doesn't makes sense to increase the size of `struct nfsstats`
 and potentially introduce issues to other parts of the code, just so
 the NFS stat counters wrap at values higher than 4294967295?
 
 
 Index: nfs.h
 ===================================================================
 RCS file: /cvsroot/src/sys/nfs/nfs.h,v
 retrieving revision 1.73
 diff -u -r1.73 nfs.h
 --- nfs.h      1 Mar 2013 18:26:10 -0000       1.73
 +++ nfs.h      23 Apr 2014 23:14:57 -0000
 @@ -238,39 +238,39 @@
    * Stats structure
    */
   struct nfsstats {
 -      int     attrcache_hits;
 -      int     attrcache_misses;
 -      int     lookupcache_hits;
 -      int     lookupcache_misses;
 -      int     direofcache_hits;
 -      int     direofcache_misses;
 -      int     biocache_reads;
 -      int     read_bios;
 -      int     read_physios;
 -      int     biocache_writes;
 -      int     write_bios;
 -      int     write_physios;
 -      int     biocache_readlinks;
 -      int     readlink_bios;
 -      int     biocache_readdirs;
 -      int     readdir_bios;
 -      int     rpccnt[NFSSTATS_NPROCS];
 -      int     rpcretries;
 -      int     srvrpccnt[NFSSTATS_NPROCS];
 -      int     srvrpc_errs;
 -      int     srv_errs;
 -      int     rpcrequests;
 -      int     rpctimeouts;
 -      int     rpcunexpected;
 -      int     rpcinvalid;
 -      int     srvcache_inproghits;
 -      int     srvcache_idemdonehits;
 -      int     srvcache_nonidemdonehits;
 -      int     srvcache_misses;
 -      int     __srvnqnfs_leases;      /* unused */
 -      int     __srvnqnfs_maxleases;   /* unused */
 -      int     __srvnqnfs_getleases;   /* unused */
 -      int     srvvop_writes;
 +      unsigned int    attrcache_hits;
 +      unsigned int    attrcache_misses;
 +      unsigned int    lookupcache_hits;
 +      unsigned int    lookupcache_misses;
 +      unsigned int    direofcache_hits;
 +      unsigned int    direofcache_misses;
 +      unsigned int    biocache_reads;
 +      unsigned int    read_bios;
 +      unsigned int    read_physios;
 +      unsigned int    biocache_writes;
 +      unsigned int    write_bios;
 +      unsigned int    write_physios;
 +      unsigned int    biocache_readlinks;
 +      unsigned int    readlink_bios;
 +      unsigned int    biocache_readdirs;
 +      unsigned int    readdir_bios;
 +      unsigned int    rpccnt[NFSSTATS_NPROCS];
 +      unsigned int    rpcretries;
 +      unsigned int    srvrpccnt[NFSSTATS_NPROCS];
 +      unsigned int    srvrpc_errs;
 +      unsigned int    srv_errs;
 +      unsigned int    rpcrequests;
 +      unsigned int    rpctimeouts;
 +      unsigned int    rpcunexpected;
 +      unsigned int    rpcinvalid;
 +      unsigned int    srvcache_inproghits;
 +      unsigned int    srvcache_idemdonehits;
 +      unsigned int    srvcache_nonidemdonehits;
 +      unsigned int    srvcache_misses;
 +      unsigned int    __srvnqnfs_leases;      /* unused */
 +      unsigned int    __srvnqnfs_maxleases;   /* unused */
 +      unsigned int    __srvnqnfs_getleases;   /* unused */
 +      unsigned int    srvvop_writes;
   };
   
   /*
 
 
 
 --------------070904040207080408090901
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
 <html>
   <head>
 
     <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
   </head>
   <body bgcolor="#FFFFFF" text="#000000">
     <meta http-equiv="content-type" content="text/html;
       charset=ISO-8859-1">
     <pre style="color: rgb(0, 0, 0); font-style: normal; font-variant: normal; 
font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 
auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; 
word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; 
white-space: pre-wrap;">Converting the signed integers to unsigned in `struct 
nfsstats` is the
 first thing that pops in mind. This would both solve the presentation
 issue in /usr/bin/nfsstat and would also be "theoretically" correct,
 since there is no need to store negative values in NFS stat counters.
 
 IMHO it doesn't makes sense to increase the size of `struct nfsstats`
 and potentially introduce issues to other parts of the code, just so
 the NFS stat counters wrap at values higher than 4294967295?
 
 
 Index: nfs.h
 ===================================================================
 RCS file: /cvsroot/src/sys/nfs/nfs.h,v
 retrieving revision 1.73
 diff -u -r1.73 nfs.h
 --- nfs.h      1 Mar 2013 18:26:10 -0000       1.73
 +++ nfs.h      23 Apr 2014 23:14:57 -0000
 @@ -238,39 +238,39 @@
   * Stats structure
   */
  struct nfsstats {
 -      int     attrcache_hits;
 -      int     attrcache_misses;
 -      int     lookupcache_hits;
 -      int     lookupcache_misses;
 -      int     direofcache_hits;
 -      int     direofcache_misses;
 -      int     biocache_reads;
 -      int     read_bios;
 -      int     read_physios;
 -      int     biocache_writes;
 -      int     write_bios;
 -      int     write_physios;
 -      int     biocache_readlinks;
 -      int     readlink_bios;
 -      int     biocache_readdirs;
 -      int     readdir_bios;
 -      int     rpccnt[NFSSTATS_NPROCS];
 -      int     rpcretries;
 -      int     srvrpccnt[NFSSTATS_NPROCS];
 -      int     srvrpc_errs;
 -      int     srv_errs;
 -      int     rpcrequests;
 -      int     rpctimeouts;
 -      int     rpcunexpected;
 -      int     rpcinvalid;
 -      int     srvcache_inproghits;
 -      int     srvcache_idemdonehits;
 -      int     srvcache_nonidemdonehits;
 -      int     srvcache_misses;
 -      int     __srvnqnfs_leases;      /* unused */
 -      int     __srvnqnfs_maxleases;   /* unused */
 -      int     __srvnqnfs_getleases;   /* unused */
 -      int     srvvop_writes;
 +      unsigned int    attrcache_hits;
 +      unsigned int    attrcache_misses;
 +      unsigned int    lookupcache_hits;
 +      unsigned int    lookupcache_misses;
 +      unsigned int    direofcache_hits;
 +      unsigned int    direofcache_misses;
 +      unsigned int    biocache_reads;
 +      unsigned int    read_bios;
 +      unsigned int    read_physios;
 +      unsigned int    biocache_writes;
 +      unsigned int    write_bios;
 +      unsigned int    write_physios;
 +      unsigned int    biocache_readlinks;
 +      unsigned int    readlink_bios;
 +      unsigned int    biocache_readdirs;
 +      unsigned int    readdir_bios;
 +      unsigned int    rpccnt[NFSSTATS_NPROCS];
 +      unsigned int    rpcretries;
 +      unsigned int    srvrpccnt[NFSSTATS_NPROCS];
 +      unsigned int    srvrpc_errs;
 +      unsigned int    srv_errs;
 +      unsigned int    rpcrequests;
 +      unsigned int    rpctimeouts;
 +      unsigned int    rpcunexpected;
 +      unsigned int    rpcinvalid;
 +      unsigned int    srvcache_inproghits;
 +      unsigned int    srvcache_idemdonehits;
 +      unsigned int    srvcache_nonidemdonehits;
 +      unsigned int    srvcache_misses;
 +      unsigned int    __srvnqnfs_leases;      /* unused */
 +      unsigned int    __srvnqnfs_maxleases;   /* unused */
 +      unsigned int    __srvnqnfs_getleases;   /* unused */
 +      unsigned int    srvvop_writes;
  };
  
  /*
 </pre>
     <br class="Apple-interchange-newline">
   </body>
 </html>
 
 --------------070904040207080408090901--
 



Home | Main Index | Thread Index | Old Index