Skip to content

Commit

Permalink
Merge branch 'autofs-not-counting' of https://github.com/odubaj/sysstat
Browse files Browse the repository at this point in the history
… into odubaj-autofs-not-counting
  • Loading branch information
sysstat committed Mar 16, 2019
2 parents 960e29f + 084d536 commit a9794e1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
17 changes: 15 additions & 2 deletions count.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,8 @@ __nr_t get_usb_nr(void)
__nr_t get_filesystem_nr(void)
{
FILE *fp;
char line[512], fs_name[MAX_FS_LEN], mountp[256];
char *pos = 0;
char line[512], fs_name[MAX_FS_LEN], mountp[256], type[128];
char *pos = 0, *pos2 = 0;
__nr_t fs = 0;
int skip = 0, skip_next = 0;
struct statvfs buf;
Expand All @@ -491,6 +491,19 @@ __nr_t get_filesystem_nr(void)
if (pos == NULL)
continue;

/*
* Find second field separator position,
* read filesystem type,
* if filesystem type is autofs, skip it
*/
pos2 = strchr(pos + 1, ' ');
if (pos2 == NULL)
continue;

sscanf(pos2 + 1, "%127s", type);
if(strcmp(type, "autofs") == 0)
continue;

/* Read filesystem name and mount point */
sscanf(line, "%127s", fs_name);
sscanf(pos + 1, "%255s", mountp);
Expand Down
17 changes: 15 additions & 2 deletions rd_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -2464,10 +2464,10 @@ __nr_t read_bus_usb_dev(struct stats_pwr_usb *st_pwr_usb, __nr_t nr_alloc)
__nr_t read_filesystem(struct stats_filesystem *st_filesystem, __nr_t nr_alloc)
{
FILE *fp;
char line[512], fs_name[128], mountp[256];
char line[512], fs_name[128], mountp[256], type[128];
int skip = 0, skip_next = 0;
char *pos = 0;
__nr_t fs_read = 0;
__nr_t fs_read = 0, *pos2 = 0;
struct stats_filesystem *st_filesystem_i;
struct statvfs buf;

Expand All @@ -2491,6 +2491,19 @@ __nr_t read_filesystem(struct stats_filesystem *st_filesystem, __nr_t nr_alloc)
if (pos == NULL)
continue;

/*
* Find second field separator position,
* read filesystem type,
* if filesystem type is autofs, skip it
*/
pos2 = strchr(pos + 1, ' ');
if (pos2 == NULL)
continue;

sscanf(pos2 + 1, "%127s", type);
if(strcmp(type, "autofs") == 0)
continue;

/* Read current filesystem name */
sscanf(line, "%127s", fs_name);
/*
Expand Down

0 comments on commit a9794e1

Please sign in to comment.