[PVFS2-CVS]
commit by pcarns in pvfs2/src/apps/admin: pvfs2-perf-mon-example.c
pvfs2-ping.c pvfs2-set-debugmask.c pvfs2-set-eventmask.c
pvfs2-set-mode.c pvfs2-statfs.c
CVS commit program
cvs at parl.clemson.edu
Tue Mar 9 15:32:39 EST 2004
Update of /projects/cvsroot/pvfs2/src/apps/admin
In directory parlweb:/tmp/cvs-serv26865/src/apps/admin
Modified Files:
pvfs2-perf-mon-example.c pvfs2-ping.c pvfs2-set-debugmask.c
pvfs2-set-eventmask.c pvfs2-set-mode.c pvfs2-statfs.c
Log Message:
converted remaining src/apps/admin/ tools to use PVFS_util_resolve()
Index: pvfs2-perf-mon-example.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/admin/pvfs2-perf-mon-example.c,v
diff -p -u -r1.14 -r1.15
--- pvfs2-perf-mon-example.c 9 Mar 2004 04:19:00 -0000 1.14
+++ pvfs2-perf-mon-example.c 9 Mar 2004 20:32:39 -0000 1.15
@@ -40,7 +40,6 @@ int main(int argc, char **argv)
PVFS_fs_id cur_fs;
const PVFS_util_tab* tab;
struct options* user_opts = NULL;
- int mnt_index = -1;
char pvfs_path[PVFS_NAME_MAX] = {0};
PVFS_sysresp_init resp_init;
int i,j;
@@ -71,27 +70,6 @@ int main(int argc, char **argv)
return(-1);
}
- /* see if the destination resides on any of the file systems
- * listed in the pvfstab; find the pvfs fs relative path
- */
- for(i=0; i<tab->mntent_count; i++)
- {
- ret = PVFS_util_remove_dir_prefix(user_opts->mnt_point,
- tab->mntent_array[i].mnt_dir, pvfs_path, PVFS_NAME_MAX);
- if(ret == 0)
- {
- mnt_index = i;
- break;
- }
- }
-
- if(mnt_index == -1)
- {
- fprintf(stderr, "Error: could not find filesystem for %s in pvfstab\n",
- user_opts->mnt_point);
- return(-1);
- }
-
memset(&resp_init, 0, sizeof(resp_init));
ret = PVFS_sys_initialize(*tab, GOSSIP_NO_DEBUG, &resp_init);
if(ret < 0)
@@ -100,7 +78,14 @@ int main(int argc, char **argv)
return(-1);
}
- cur_fs = resp_init.fsid_list[mnt_index];
+ /* translate local path into pvfs2 relative path */
+ ret = PVFS_util_resolve(user_opts->mnt_point,
+ &cur_fs, pvfs_path, PVFS_NAME_MAX);
+ if(ret < 0)
+ {
+ PVFS_perror("PVFS_util_resolve", ret);
+ return(-1);
+ }
creds.uid = getuid();
creds.gid = getgid();
Index: pvfs2-ping.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/admin/pvfs2-ping.c,v
diff -p -u -r1.31 -r1.32
--- pvfs2-ping.c 9 Mar 2004 04:19:00 -0000 1.31
+++ pvfs2-ping.c 9 Mar 2004 20:32:39 -0000 1.32
@@ -43,10 +43,8 @@ int main(int argc, char **argv)
PVFS_fs_id cur_fs;
const PVFS_util_tab* tab;
struct options* user_opts = NULL;
- int mnt_index = -1;
char pvfs_path[PVFS_NAME_MAX] = {0};
PVFS_sysresp_init resp_init;
- int i;
PVFS_credentials creds;
PVFS_sysresp_lookup resp_lookup;
@@ -60,9 +58,6 @@ int main(int argc, char **argv)
return(-1);
}
- printf("\n(1) Searching for %s in pvfstab...\n",
- user_opts->fs_path_real);
-
tab = PVFS_util_parse_pvfstab(NULL);
if (!tab)
{
@@ -71,39 +66,7 @@ int main(int argc, char **argv)
return(-1);
}
- /* see if the destination resides on any of the file systems
- * listed in the pvfstab; find the pvfs fs relative path
- */
- for(i = 0; i < tab->mntent_count; i++)
- {
- ret = PVFS_util_remove_dir_prefix(
- user_opts->fs_path_hack, tab->mntent_array[i].mnt_dir,
- pvfs_path, PVFS_NAME_MAX);
- if (ret == 0)
- {
- mnt_index = i;
- break;
- }
- }
-
- if (mnt_index == -1)
- {
- fprintf(stderr, "Failure: could not find filesystem for %s "
- "in pvfstab\n", user_opts->fs_path_real);
- return(-1);
- }
- else
- {
- printf(" Found matching file system at mnt tab "
- "entry %d\n", mnt_index);
- }
-
- print_mntent(tab->mntent_array, tab->mntent_count);
-
- creds.uid = getuid();
- creds.gid = getgid();
-
- printf("\n(2) Initializing system interface and retrieving "
+ printf("\n(1) Initializing system interface and retrieving "
"configuration from server...\n");
memset(&resp_init, 0, sizeof(resp_init));
ret = PVFS_sys_initialize(*tab, GOSSIP_NO_DEBUG, &resp_init);
@@ -115,15 +78,23 @@ int main(int argc, char **argv)
return(-1);
}
- cur_fs = PINT_config_get_fs_id_by_fs_name(
- PINT_get_server_config_struct(),
- tab->mntent_array[mnt_index].pvfs_fs_name);
- if (cur_fs == (PVFS_fs_id)0)
+ printf("\n(2) Searching for %s in pvfstab...\n",
+ user_opts->fs_path_real);
+
+ /* translate local path into pvfs2 relative path */
+ ret = PVFS_util_resolve(user_opts->fs_path_hack,
+ &cur_fs, pvfs_path, PVFS_NAME_MAX);
+ if(ret < 0)
{
- fprintf(stderr, "Failure: could not get fs configuration "
- "for %s.\n", tab->mntent_array[mnt_index].pvfs_fs_name);
+ fprintf(stderr, "Failure: could not find filesystem for %s "
+ "in pvfstab\n", user_opts->fs_path_real);
return(-1);
}
+
+ print_mntent(tab->mntent_array, tab->mntent_count);
+
+ creds.uid = getuid();
+ creds.gid = getgid();
/* dump some key parts of the config file */
ret = print_config(cur_fs);
Index: pvfs2-set-debugmask.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/admin/pvfs2-set-debugmask.c,v
diff -p -u -r1.13 -r1.14
--- pvfs2-set-debugmask.c 9 Mar 2004 04:19:00 -0000 1.13
+++ pvfs2-set-debugmask.c 9 Mar 2004 20:32:39 -0000 1.14
@@ -40,10 +40,8 @@ int main(int argc, char **argv)
PVFS_fs_id cur_fs;
const PVFS_util_tab* tab;
struct options* user_opts = NULL;
- int mnt_index = -1;
char pvfs_path[PVFS_NAME_MAX] = {0};
PVFS_sysresp_init resp_init;
- int i;
PVFS_credentials creds;
/* look at pvfstab */
@@ -63,27 +61,6 @@ int main(int argc, char **argv)
return(-1);
}
- /* see if the destination resides on any of the file systems
- * listed in the pvfstab; find the pvfs fs relative path
- */
- for(i=0; i<tab->mntent_count; i++)
- {
- ret = PVFS_util_remove_dir_prefix(user_opts->mnt_point,
- tab->mntent_array[i].mnt_dir, pvfs_path, PVFS_NAME_MAX);
- if(ret == 0)
- {
- mnt_index = i;
- break;
- }
- }
-
- if(mnt_index == -1)
- {
- fprintf(stderr, "Error: could not find filesystem for %s in pvfstab\n",
- user_opts->mnt_point);
- return(-1);
- }
-
memset(&resp_init, 0, sizeof(resp_init));
ret = PVFS_sys_initialize(*tab, GOSSIP_NO_DEBUG, &resp_init);
if(ret < 0)
@@ -92,7 +69,15 @@ int main(int argc, char **argv)
return(-1);
}
- cur_fs = resp_init.fsid_list[mnt_index];
+ /* translate local path into pvfs2 relative path */
+ ret = PVFS_util_resolve(user_opts->mnt_point,
+ &cur_fs, pvfs_path, PVFS_NAME_MAX);
+ if(ret < 0)
+ {
+ fprintf(stderr, "Error: could not find filesystem for %s in pvfstab\n",
+ user_opts->mnt_point);
+ return(-1);
+ }
creds.uid = getuid();
creds.gid = getgid();
Index: pvfs2-set-eventmask.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/admin/pvfs2-set-eventmask.c,v
diff -p -u -r1.5 -r1.6
--- pvfs2-set-eventmask.c 9 Mar 2004 04:19:00 -0000 1.5
+++ pvfs2-set-eventmask.c 9 Mar 2004 20:32:39 -0000 1.6
@@ -41,10 +41,8 @@ int main(int argc, char **argv)
PVFS_fs_id cur_fs;
const PVFS_util_tab* tab;
struct options* user_opts = NULL;
- int mnt_index = -1;
char pvfs_path[PVFS_NAME_MAX] = {0};
PVFS_sysresp_init resp_init;
- int i;
PVFS_credentials creds;
/* look at command line arguments */
@@ -64,27 +62,6 @@ int main(int argc, char **argv)
return(-1);
}
- /* see if the destination resides on any of the file systems
- * listed in the pvfstab; find the pvfs fs relative path
- */
- for(i=0; i<tab->mntent_count; i++)
- {
- ret = PVFS_util_remove_dir_prefix(user_opts->mnt_point,
- tab->mntent_array[i].mnt_dir, pvfs_path, PVFS_NAME_MAX);
- if(ret == 0)
- {
- mnt_index = i;
- break;
- }
- }
-
- if(mnt_index == -1)
- {
- fprintf(stderr, "Error: could not find filesystem for %s in pvfstab\n",
- user_opts->mnt_point);
- return(-1);
- }
-
memset(&resp_init, 0, sizeof(resp_init));
ret = PVFS_sys_initialize(*tab, GOSSIP_NO_DEBUG, &resp_init);
if(ret < 0)
@@ -93,7 +70,15 @@ int main(int argc, char **argv)
return(-1);
}
- cur_fs = resp_init.fsid_list[mnt_index];
+ /* translate local path into pvfs2 relative path */
+ ret = PVFS_util_resolve(user_opts->mnt_point,
+ &cur_fs, pvfs_path, PVFS_NAME_MAX);
+ if(ret < 0)
+ {
+ fprintf(stderr, "Error: could not find filesystem for %s in pvfstab\n",
+ user_opts->mnt_point);
+ return(-1);
+ }
creds.uid = getuid();
creds.gid = getgid();
Index: pvfs2-set-mode.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/admin/pvfs2-set-mode.c,v
diff -p -u -r1.6 -r1.7
--- pvfs2-set-mode.c 9 Mar 2004 04:19:00 -0000 1.6
+++ pvfs2-set-mode.c 9 Mar 2004 20:32:39 -0000 1.7
@@ -39,10 +39,8 @@ int main(int argc, char **argv)
PVFS_fs_id cur_fs;
const PVFS_util_tab* tab;
struct options* user_opts = NULL;
- int mnt_index = -1;
char pvfs_path[PVFS_NAME_MAX] = {0};
PVFS_sysresp_init resp_init;
- int i;
PVFS_credentials creds;
/* look at command line arguments */
@@ -62,27 +60,6 @@ int main(int argc, char **argv)
return(-1);
}
- /* see if the destination resides on any of the file systems
- * listed in the pvfstab; find the pvfs fs relative path
- */
- for(i=0; i<tab->mntent_count; i++)
- {
- ret = PVFS_util_remove_dir_prefix(user_opts->mnt_point,
- tab->mntent_array[i].mnt_dir, pvfs_path, PVFS_NAME_MAX);
- if(ret == 0)
- {
- mnt_index = i;
- break;
- }
- }
-
- if(mnt_index == -1)
- {
- fprintf(stderr, "Error: could not find filesystem for %s in pvfstab\n",
- user_opts->mnt_point);
- return(-1);
- }
-
memset(&resp_init, 0, sizeof(resp_init));
ret = PVFS_sys_initialize(*tab, GOSSIP_NO_DEBUG, &resp_init);
if(ret < 0)
@@ -91,7 +68,15 @@ int main(int argc, char **argv)
return(-1);
}
- cur_fs = resp_init.fsid_list[mnt_index];
+ /* translate local path into pvfs2 relative path */
+ ret = PVFS_util_resolve(user_opts->mnt_point,
+ &cur_fs, pvfs_path, PVFS_NAME_MAX);
+ if(ret < 0)
+ {
+ fprintf(stderr, "Error: could not find filesystem for %s in pvfstab\n",
+ user_opts->mnt_point);
+ return(-1);
+ }
creds.uid = getuid();
creds.gid = getgid();
Index: pvfs2-statfs.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/admin/pvfs2-statfs.c,v
diff -p -u -r1.17 -r1.18
--- pvfs2-statfs.c 9 Mar 2004 04:19:00 -0000 1.17
+++ pvfs2-statfs.c 9 Mar 2004 20:32:39 -0000 1.18
@@ -42,7 +42,6 @@ int main(int argc, char **argv)
PVFS_fs_id cur_fs;
const PVFS_util_tab* tab;
struct options *user_opts = NULL;
- int mnt_index = -1;
char pvfs_path[PVFS_NAME_MAX] = {0};
PVFS_sysresp_init resp_init;
PVFS_sysresp_statfs resp_statfs;
@@ -72,27 +71,6 @@ int main(int argc, char **argv)
return(-1);
}
- /* see if the destination resides on any of the file systems
- * listed in the pvfstab; find the pvfs fs relative path
- */
- for(i=0; i<tab->mntent_count; i++)
- {
- ret = PVFS_util_remove_dir_prefix(user_opts->mnt_point,
- tab->mntent_array[i].mnt_dir, pvfs_path, PVFS_NAME_MAX);
- if(ret == 0)
- {
- mnt_index = i;
- break;
- }
- }
-
- if(mnt_index == -1)
- {
- fprintf(stderr, "Error: could not find filesystem for %s in pvfstab\n",
- user_opts->mnt_point);
- return(-1);
- }
-
memset(&resp_init, 0, sizeof(resp_init));
ret = PVFS_sys_initialize(*tab, GOSSIP_NO_DEBUG, &resp_init);
if(ret < 0)
@@ -101,13 +79,13 @@ int main(int argc, char **argv)
return(-1);
}
- cur_fs = PINT_config_get_fs_id_by_fs_name(
- PINT_get_server_config_struct(),
- tab->mntent_array[mnt_index].pvfs_fs_name);
- if (cur_fs == (PVFS_fs_id)0)
+ /* translate local path into pvfs2 relative path */
+ ret = PVFS_util_resolve(user_opts->mnt_point,
+ &cur_fs, pvfs_path, PVFS_NAME_MAX);
+ if(ret < 0)
{
- fprintf(stderr, "Failure: could not get fs configuration "
- "for %s.\n", tab->mntent_array[mnt_index].pvfs_fs_name);
+ fprintf(stderr, "Error: could not find filesystem for %s in pvfstab\n",
+ user_opts->mnt_point);
return(-1);
}
More information about the PVFS2-CVS
mailing list