Skip to content

Commit

Permalink
initial walk bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
James Wilson committed May 25, 2011
1 parent 298a436 commit 9c41b98
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion prefpane/Info.plist
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>300700</string>
<string>300702</string>
<key>NSMainNibFile</key>
<string>XsnmpPrefPanePref</string>
<key>NSPrefPaneIconFile</key>
Expand Down
4 changes: 2 additions & 2 deletions prefpane/XsnmpPrefPane.xcodeproj/project.pbxproj
Expand Up @@ -435,7 +435,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CURRENT_PROJECT_VERSION = 300700;
CURRENT_PROJECT_VERSION = 300702;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_GC = supported;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
Expand All @@ -456,7 +456,7 @@
i386,
ppc,
);
CURRENT_PROJECT_VERSION = 300700;
CURRENT_PROJECT_VERSION = 300702;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_GC = supported;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
Expand Down
10 changes: 7 additions & 3 deletions src/fsTable.c
Expand Up @@ -24,6 +24,7 @@ init_fsTable(void)

static struct timeval volume_cache_timestamp = { 0, 0 };
static int last_index_used = 0;
void update_volumes();

/** Initialize the fsTable table by defining its contents and how it's structured */
void
Expand Down Expand Up @@ -56,6 +57,7 @@ initialize_table_fsTable(void)
netsnmp_register_table_iterator( reg, iinfo );

/* Initialise the contents of the table here */
update_volumes();
}

/* Typical data structure for a row entry */
Expand Down Expand Up @@ -185,7 +187,7 @@ void update_volume_disk (struct fsTable_entry *entry)
size_t data_len = strlen(data);

char *writeable_str = NULL;
size_t writeablestr_len = 0;
size_t writeable_str_len = 0;
if (extract_string_from_regex(data, data_len, "Read-Only Volume:[ ]+(\\w+)$", &writeable_str, &writeable_str_len))
{
entry->fsWriteable = !extract_boolean_from_regex(data, data_len, "Read-Only Volume:[ ]+(\\w+)$");
Expand Down Expand Up @@ -300,7 +302,7 @@ void update_volumes()
entry->fsUsed = extract_uint_in_range(data + ovector[6], ovector[7] - ovector[6]);
entry->fsAvail = extract_uint_in_range(data + ovector[8], ovector[9] - ovector[8]);
entry->fsUtilization = extract_uint_in_range(data + ovector[10], ovector[11] - ovector[10]);

/* Update extra info on the disk from diskutil */
#ifdef HOST_MACOSX
if (entry->fsFilesystem && strstr(entry->fsFilesystem, "/dev/")) update_volume_disk(entry);
Expand Down Expand Up @@ -345,7 +347,9 @@ void update_volumes_if_necessary()
struct timeval now;
gettimeofday(&now, NULL);
if ((now.tv_sec - volume_cache_timestamp.tv_sec) > MAX_CACHE_TIMEOUT)
{ update_volumes(); }
{
update_volumes();
}
}

/** handles requests for the fsTable table */
Expand Down
3 changes: 2 additions & 1 deletion src/raidDriveTable.c
Expand Up @@ -17,6 +17,7 @@

static struct timeval cache_timestamp = { 0, 0 };
static int last_index_used = 0;
void update_drivelist();

#define MAX_CACHE_AGE 10
#define OVECCOUNT 90
Expand Down Expand Up @@ -60,6 +61,7 @@ initialize_table_raidDriveTable(void)
netsnmp_register_table_iterator( reg, iinfo );

/* Initialise the contents of the table here */
update_drivelist();
}

/* Typical data structure for a row entry */
Expand Down Expand Up @@ -223,7 +225,6 @@ void update_drivelist()

if (rc == PCRE_ERROR_NOMATCH)
{
x_printf ("update_drivelist no match found for regex");
if (options == 0) break;
ovector[1] = start_offset + 1;
continue; /* Go round the loop again */
Expand Down
4 changes: 2 additions & 2 deletions src/raidSetTable.c
Expand Up @@ -16,6 +16,7 @@

static struct timeval cache_timestamp = { 0, 0 };
static int last_index_used = 0;
void update_setlist();

#define MAX_CACHE_AGE 10
#define OVECCOUNT 90
Expand Down Expand Up @@ -59,9 +60,9 @@ initialize_table_raidSetTable(void)
netsnmp_register_table_iterator( reg, iinfo );

/* Initialise the contents of the table here */
update_setlist();
}

void update_setlist();
struct raidSetTable_entry *raidSetTable_head;

struct raidSetTable_entry* raidSetTable_get_head()
Expand Down Expand Up @@ -203,7 +204,6 @@ void update_setlist()

if (rc == PCRE_ERROR_NOMATCH)
{
x_printf ("update_setlist no match found for regex");
if (options == 0) break;
ovector[1] = start_offset + 1;
continue; /* Go round the loop again */
Expand Down
3 changes: 2 additions & 1 deletion src/raidVolumeTable.c
Expand Up @@ -17,6 +17,7 @@

static struct timeval cache_timestamp = { 0, 0 };
static int last_index_used = 0;
void update_volumelist();

#define MAX_CACHE_AGE 10
#define OVECCOUNT 90
Expand Down Expand Up @@ -60,6 +61,7 @@ initialize_table_raidVolumeTable(void)
netsnmp_register_table_iterator( reg, iinfo );

/* Initialise the contents of the table here */
update_volumelist();
}

/* Typical data structure for a row entry */
Expand Down Expand Up @@ -230,7 +232,6 @@ void update_volumelist()

if (rc == PCRE_ERROR_NOMATCH)
{
x_printf ("update_drivelist no match found for regex");
if (options == 0) break;
ovector[1] = start_offset + 1;
continue; /* Go round the loop again */
Expand Down
2 changes: 2 additions & 0 deletions src/xsanAffinityTable.c
Expand Up @@ -12,6 +12,7 @@
#include "util.h"

static struct timeval affinity_cache_timestamp = { 0, 0 };
void update_affinities();
#define MAX_CACHE_AGE 90

/** Initializes the xsanAffinityTable module */
Expand Down Expand Up @@ -54,6 +55,7 @@ initialize_table_xsanAffinityTable(void)
netsnmp_register_table_iterator( reg, iinfo );

/* Initialise the contents of the table here */
update_affinities();
}

/* Typical data structure for a row entry */
Expand Down
1 change: 0 additions & 1 deletion src/xsanVolumeTable.c
Expand Up @@ -414,7 +414,6 @@ void update_vollist_cvadmin ()

if (rc == PCRE_ERROR_NOMATCH)
{
x_debug ("update_vollist_cvadmin no match found for regex");
if (options == 0) break;
ovector[1] = start_offset + 1;
continue; /* Go round the loop again */
Expand Down

0 comments on commit 9c41b98

Please sign in to comment.