X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Flr_reader.c;h=f1072a2b91b1c113f28d97f636bd98a8d0d6f150;hb=refs%2Fchanges%2F64%2F39564%2F6;hp=69d09f6035ef4546ce40686c5e9b36b66217a3da;hpb=72057a3af19ee02d9a686bd7e7d074917e381310;p=fs%2Flustre-release.git diff --git a/lustre/utils/lr_reader.c b/lustre/utils/lr_reader.c index 69d09f6..f1072a2 100644 --- a/lustre/utils/lr_reader.c +++ b/lustre/utils/lr_reader.c @@ -59,16 +59,16 @@ #include #include -#include -#include +#include +#include +#include char *progname; -static struct option const longopts[] = { - { "help", no_argument, 0, 'h' }, - { "client", no_argument, 0, 'c' }, - { "reply", no_argument, 0, 'r' }, - { 0, 0, 0, 0} -}; +static struct option const long_opts[] = { + { .val = 'c', .name = "client", .has_arg = no_argument }, + { .val = 'h', .name = "help", .has_arg = no_argument }, + { .val = 'r', .name = "reply", .has_arg = no_argument }, + { .name = NULL } }; /* Executes the command \a cmd and returns command status. */ @@ -86,10 +86,10 @@ int run_command(char *cmd, size_t cmdsz) fd = mkstemp(log); if (fd >= 0) { close(fd); - strncat(cmd, " >", 2); - strncat(cmd, log, strlen(log)); + strncat(cmd, " >", cmdsz); + strncat(cmd, log, cmdsz); } - strncat(cmd, " 2>&1", 5); + strncat(cmd, " 2>&1", cmdsz - strlen(cmd)); /* Can't use popen because we need the rv of the command */ rc = system(cmd); @@ -136,7 +136,7 @@ int main(int argc, char *const argv[]) int opt_reply = 0; progname = argv[0]; - while ((c = getopt_long(argc, argv, "chr", longopts, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "chr", long_opts, NULL)) != -1) { switch (c) { case 'c': opt_client = 1; @@ -209,9 +209,11 @@ int main(int argc, char *const argv[]) printf(" feature_compat: %#x\n", lsd.lsd_feature_compat); printf(" feature_incompat: %#x\n", lsd.lsd_feature_incompat); printf(" feature_rocompat: %#x\n", lsd.lsd_feature_rocompat); - printf(" last_transaction: %llu\n", lsd.lsd_last_transno); + printf(" last_transaction: %llu\n", + (unsigned long long)lsd.lsd_last_transno); printf(" target_index: %u\n", lsd.lsd_osd_index); - printf(" mount_count: %llu\n", lsd.lsd_mount_count); + printf(" mount_count: %llu\n", + (unsigned long long)lsd.lsd_mount_count); /* read client information */ if (opt_client) { @@ -259,8 +261,9 @@ int main(int argc, char *const argv[]) printf("\n %.40s:\n", lcd.lcd_uuid); printf(" generation: %u\n", lcd.lcd_generation); printf(" last_transaction: %llu\n", - lcd.lcd_last_transno); - printf(" last_xid: %llu\n", lcd.lcd_last_xid); + (unsigned long long)lcd.lcd_last_transno); + printf(" last_xid: %llu\n", + (unsigned long long)lcd.lcd_last_xid); printf(" last_result: %u\n", lcd.lcd_last_result); printf(" last_data: %u\n", lcd.lcd_last_data); @@ -275,9 +278,9 @@ int main(int argc, char *const argv[]) lcd.lcd_last_close_data = __le32_to_cpu(lcd.lcd_last_close_data); printf(" last_close_transation: %llu\n", - lcd.lcd_last_close_transno); + (unsigned long long)lcd.lcd_last_close_transno); printf(" last_close_xid: %llu\n", - lcd.lcd_last_close_xid); + (unsigned long long)lcd.lcd_last_close_xid); printf(" last_close_result: %u\n", lcd.lcd_last_close_result); printf(" last_close_data: %u\n", @@ -375,10 +378,13 @@ int main(int argc, char *const argv[]) printf(" %lld:\n", slot); printf(" client_generation: %u\n", lrd.lrd_client_gen); - printf(" last_transaction: %llu\n", lrd.lrd_transno); - printf(" last_xid: %llu\n", lrd.lrd_xid); + printf(" last_transaction: %lluu\n", + (unsigned long long)lrd.lrd_transno); + printf(" last_xid: %llu\n", + (unsigned long long)lrd.lrd_xid); printf(" last_result: %u\n", lrd.lrd_result); - printf(" last_data: %llu\n\n", lrd.lrd_data); + printf(" last_data: %llu\n\n", + (unsigned long long)lrd.lrd_data); } }