[PVFS2-CVS]
commit by neill in pvfs2/src/apps/admin: pvfs2-ls.c pvfs2-statfs.c
CVS commit program
cvs at parl.clemson.edu
Thu Jul 8 13:17:05 EDT 2004
Update of /projects/cvsroot/pvfs2/src/apps/admin
In directory parlweb:/tmp/cvs-serv12211/src/apps/admin
Modified Files:
pvfs2-ls.c pvfs2-statfs.c
Log Message:
- merging in the pvfs2-nm-nb-branch with the main tree
see ChangeLog for details, or browse the cvs history of the branch
for full details
Index: pvfs2-ls.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/admin/pvfs2-ls.c,v
diff -p -u -r1.50 -r1.51
--- pvfs2-ls.c 7 Jul 2004 15:38:53 -0000 1.50
+++ pvfs2-ls.c 8 Jul 2004 16:17:05 -0000 1.51
@@ -48,6 +48,7 @@ struct options
int list_all;
int list_no_owner;
int list_inode;
+ int list_use_si_units;
char *start[MAX_NUM_PATHS];
int num_starts;
};
@@ -321,7 +322,8 @@ void print_entry_attr(
if (opts->list_human_readable)
{
- PVFS_util_make_size_human_readable(size,scratch_size,16);
+ PVFS_util_make_size_human_readable(
+ size,scratch_size,16,opts->list_use_si_units);
}
else
{
@@ -576,6 +578,11 @@ int do_list(
} while(rd_response.pvfs_dirent_outcount != 0);
+ if (rd_response.pvfs_dirent_outcount)
+ {
+ free(rd_response.dirent_array);
+ rd_response.dirent_array = NULL;
+ }
return 0;
}
@@ -594,6 +601,7 @@ static struct options* parse_args(int ar
{
{"help",0,0,0},
{"human-readable",0,0,0},
+ {"si",0,0,0},
{"version",0,0,0},
{"numeric-uid-gid",0,0,0},
{"directory",0,0,0},
@@ -629,6 +637,11 @@ static struct options* parse_args(int ar
{
goto list_human_readable;
}
+ else if (strcmp("si", cur_option) == 0)
+ {
+ tmp_opts->list_use_si_units = 1;
+ break;
+ }
else if (strcmp("version", cur_option) == 0)
{
printf("%s\n", PVFS2_VERSION);
@@ -737,8 +750,10 @@ static void usage(int argc, char** argv)
"not list owner\n");
fprintf(stderr," -G, --no-group inhibit display "
"of group information\n");
- fprintf(stderr," -h, --human-readable print sizes in human "
- "readable format (e.g., 1K 234M 2G)\n");
+ fprintf(stderr," -h, --human-readable print sizes in human "
+ "readable format\n\t\t\t\t(e.g. 1K 234M 2G)\n");
+ fprintf(stderr," --si likewise, but use powers "
+ "of 1000, not 1024\n");
fprintf(stderr," -i, --inode print index number "
"of each file\n");
fprintf(stderr," -l use a long listing "
@@ -747,9 +762,10 @@ static void usage(int argc, char** argv)
"numeric UIDs and GIDs\n");
fprintf(stderr," -o like -l, but do not "
"list group information\n");
- fprintf(stderr," --help display this help and exit\n");
- fprintf(stderr," --version output version information "
+ fprintf(stderr," --help display this help "
"and exit\n");
+ fprintf(stderr," --version output version "
+ "information and exit\n");
return;
}
Index: pvfs2-statfs.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/admin/pvfs2-statfs.c,v
diff -p -u -r1.22 -r1.23
--- pvfs2-statfs.c 20 May 2004 17:27:47 -0000 1.22
+++ pvfs2-statfs.c 8 Jul 2004 16:17:05 -0000 1.23
@@ -29,6 +29,7 @@ struct options
char* mnt_point;
int mnt_point_set;
int human_readable;
+ int use_si_units;
};
static struct options *parse_args(int argc, char *argv[]);
@@ -100,10 +101,10 @@ int main(int argc, char **argv)
if (user_opts->human_readable) {
PVFS_util_make_size_human_readable(
(long long)resp_statfs.statfs_buf.bytes_available,
- scratch_size, SCRATCH_LEN);
+ scratch_size, SCRATCH_LEN, user_opts->use_si_units);
PVFS_util_make_size_human_readable(
(long long)resp_statfs.statfs_buf.bytes_total,
- scratch_total, SCRATCH_LEN);
+ scratch_total, SCRATCH_LEN, user_opts->use_si_units);
printf("\tbytes available: %s\n", scratch_size);
printf("\tbytes total: %s\n", scratch_size);
} else {
@@ -190,12 +191,12 @@ int main(int argc, char **argv)
{
PVFS_util_make_size_human_readable(
(long long)stat_array[i].ram_total_bytes,
- scratch_size,
- SCRATCH_LEN);
+ scratch_size, SCRATCH_LEN,
+ user_opts->use_si_units);
PVFS_util_make_size_human_readable(
(long long)stat_array[i].ram_free_bytes,
- scratch_total,
- SCRATCH_LEN);
+ scratch_total, SCRATCH_LEN,
+ user_opts->use_si_units);
printf("\tRAM total : %s\n", scratch_size);
printf("\tRAM free : %s\n", scratch_total);
printf("\tuptime : %d hours, %.2d minutes\n",
@@ -220,10 +221,12 @@ int main(int argc, char **argv)
{
PVFS_util_make_size_human_readable(
(long long)stat_array[i].bytes_available,
- scratch_size, SCRATCH_LEN);
+ scratch_size, SCRATCH_LEN,
+ user_opts->use_si_units);
PVFS_util_make_size_human_readable(
(long long)stat_array[i].bytes_total,
- scratch_total, SCRATCH_LEN);
+ scratch_total, SCRATCH_LEN,
+ user_opts->use_si_units);
printf("\tbytes available : %s\n", scratch_size);
printf("\tbytes total : %s\n", scratch_total);
}
@@ -269,7 +272,7 @@ static struct options* parse_args(int ar
/* getopt stuff */
extern char *optarg;
extern int optind, opterr, optopt;
- char flags[] = "hvm:";
+ char flags[] = "hHvm:";
int one_opt = 0;
int len = 0;
@@ -295,6 +298,10 @@ static struct options* parse_args(int ar
case('h'):
tmp_opts->human_readable = 1;
break;
+ case('H'):
+ tmp_opts->human_readable = 1;
+ tmp_opts->use_si_units = 1;
+ break;
case('m'):
len = strlen(optarg)+1;
tmp_opts->mnt_point = (char *) malloc(len + 1);
@@ -337,11 +344,8 @@ static struct options* parse_args(int ar
static void usage(int argc, char** argv)
{
fprintf(stderr, "\n");
- fprintf(stderr, "Usage : %s [-m fs_mount_point]\n",
- argv[0]);
- fprintf(stderr, "Example: %s -m /mnt/pvfs2\n",
- argv[0]);
- return;
+ fprintf(stderr, "Usage : %s [-m fs_mount_point] [-h,-H]\n", argv[0]);
+ fprintf(stderr, "Example: %s -m /mnt/pvfs2\n", argv[0]);
}
/*
More information about the PVFS2-CVS
mailing list