xfstests: eliminate warnings under dmapi/src/suite1/cmd (1)
authorAlex Elder <aelder@sgi.com>
Fri, 4 Mar 2011 19:38:01 +0000 (19:38 +0000)
committerAlex Elder <aelder@sgi.com>
Thu, 28 Apr 2011 17:36:29 +0000 (12:36 -0500)
Eliminate build warnings reported on files located under
dmapi/src/suite1/cmd/ (first of three).

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
13 files changed:
dmapi/src/suite1/cmd/create_userevent.c
dmapi/src/suite1/cmd/dm_handle.c
dmapi/src/suite1/cmd/downgrade_right.c
dmapi/src/suite1/cmd/get_allocinfo.c
dmapi/src/suite1/cmd/get_config_events.c
dmapi/src/suite1/cmd/get_dirattrs.c
dmapi/src/suite1/cmd/get_dmattr.c
dmapi/src/suite1/cmd/get_eventlist.c
dmapi/src/suite1/cmd/get_events.c
dmapi/src/suite1/cmd/get_fileattr.c
dmapi/src/suite1/cmd/get_mountinfo.c
dmapi/src/suite1/cmd/get_region.c
dmapi/src/suite1/cmd/getall_disp.c

index 3edb083e0ab8ca86a8a15812b42b975fd7952ebc..35cb2f27a7774b4b52b9dc390dd20c317a89bf15 100644 (file)
@@ -61,7 +61,8 @@ main(
        char            *name;
        int             opt;
 
-       if (Progname = strrchr(argv[0], '/')) {
+       Progname = strrchr(argv[0], '/');
+       if (Progname) {
                Progname++;
        } else {
                Progname = argv[0];
index ba177d12cdb2b948c7cc2f7d75a6042dc82292cf..6ad9a92c3c457e1f10af39797f8cdb7a1ec2ffb9 100644 (file)
@@ -80,7 +80,8 @@ main(
        char            fsbuffer3[100];
        int             fd;
 
-       if (Progname = strrchr(argv[0], '/')) {
+       Progname = strrchr(argv[0], '/');
+       if (Progname) {
                Progname++;
        } else {
                Progname = argv[0];
index 840e79793b10d169b01df6dce4d7893544c835e3..96a4bb7a805fe477552fa0e50eb79f3d7e405472 100644 (file)
@@ -75,7 +75,8 @@ main(
        char            *name;
        int             opt;
 
-       if (Progname = strrchr(argv[0], '/')) {
+       Progname = strrchr(argv[0], '/');
+       if (Progname) {
                Progname++;
        } else {
                Progname = argv[0];
index c568e0e05c3f5548e9811be1edff1c6dffca4f4b..35839642a244d82a963ada9d3a73d59663082edd 100644 (file)
@@ -155,7 +155,8 @@ main(
        char            *name;
        int             opt;
 
-       if (Progname = strrchr(argv[0], '/')) {
+       Progname = strrchr(argv[0], '/');
+       if (Progname) {
                Progname++;
        } else {
                Progname = argv[0];
@@ -236,7 +237,8 @@ print_alloc(
        char            *type = NULL;
        int             rc;
 
-       fprintf(stdout, "%s: starting offset %lld\n", pathname, startoff);
+       fprintf(stdout, "%s: starting offset %lld\n", pathname,
+               (long long) startoff);
 
        /* Allocate space for the number of extents requested by the user. */
 
@@ -283,21 +285,21 @@ print_alloc(
 
                        if (!Dflag) {
                                fprintf(stdout, "\t%d: [%lld..%lld]: %s", num,
-                                       extent[i].ex_offset / 512,
-                                       (extent[i].ex_offset +
+                                       (long long) extent[i].ex_offset / 512,
+                                       (long long) (extent[i].ex_offset +
                                        extent[i].ex_length - 1) / 512, type);
                                if ((extent[i].ex_offset % 512 != 0) ||
                                    (endoff % 512 != 0)) {
                                        fprintf(stdout, "\t[%lld..%lld]\n",
-                                               extent[i].ex_offset % 512,
-                                               (endoff-1) % 512);
+                                               (long long) extent[i].ex_offset % 512,
+                                               (long long) (endoff-1) % 512);
                                } else {
                                        fprintf(stdout, "\n");
                                }
                        } else {
                                fprintf(stdout, "%5s    %13lld  %13lld\n",
-                                       type, extent[i].ex_offset,
-                                       extent[i].ex_length);
+                                       type, (long long) extent[i].ex_offset,
+                                       (long long) extent[i].ex_length);
                        }
 
                        /* The ex_offset of the first extent should match the
@@ -310,13 +312,14 @@ print_alloc(
                        if (extent[i].ex_offset != endoff) {
                                fprintf(stderr, "new extent (%lld)is not "
                                        "adjacent to previous one (%lld)\n",
-                                       extent[i].ex_offset, endoff);
+                                       (long long) extent[i].ex_offset,
+                                       (long long) endoff);
                                return(1);
                        }
                        if (num && (extent[i].ex_offset % 512) != 0) {
                                fprintf(stderr, "non-initial ex_offset (%lld) "
                                        "is not a 512-byte multiple\n",
-                                       extent[i].ex_offset);
+                                       (long long) extent[i].ex_offset);
                                return(1);
                        }
 
@@ -343,7 +346,7 @@ print_alloc(
 
                if (rc && startoff != endoff) {
                        fprintf(stderr, "startoff is %lld, should be %lld\n",
-                               startoff, endoff);
+                               (long long) startoff, (long long) endoff);
                        return(1);
                }
 
index cdaf7c2f0528fb3d3c3848b22cc75cfa8bd16a81..d50eaa784be2c6d56839bb5413fd4ea7090b5369 100644 (file)
@@ -65,7 +65,8 @@ main(
        int             opt;
        int             i;
 
-       if (Progname = strrchr(argv[0], '/')) {
+       Progname = strrchr(argv[0], '/');
+       if (Progname) {
                Progname++;
        } else {
                Progname = argv[0];
@@ -104,7 +105,7 @@ main(
        }
 
        fprintf(stdout, "Events supported (0x%llx), nelemp %d:\n",
-               eventset, nelemp);
+               (unsigned long long) eventset, nelemp);
 
        for (i = 0; i < nelemp; i++) {
                if (!DMEV_ISSET(i, eventset))
index 8e2f4cbb75ceafecad728fe283d89e39d77afdaa..49ac356e9dda8b57bff7414a3d631545ce4ebae1 100644 (file)
@@ -43,8 +43,6 @@ char  *Progname;
 static void
 usage(void)
 {
-       int     i;
-
        fprintf(stderr, "usage:\t%s [-b buflen] [-l loc] [-s sid] [-1] [-q] dirpath\n",
                Progname);
        exit(1);
@@ -68,12 +66,12 @@ main(
        size_t          hlen;
        char            *name;
        int             opt;
-       int             i;
        int             ret;
        int             oneline = 0;
        int             quiet = 0;
 
-       if (Progname = strrchr(argv[0], '/')) {
+       Progname = strrchr(argv[0], '/');
+       if (Progname) {
                Progname++;
        } else {
                Progname = argv[0];
@@ -137,8 +135,8 @@ main(
                        exit(1);
                }
                if (!quiet) {
-                       fprintf(stdout, "ret = %d, rlenp is %d, loc is %lld\n", ret,
-                               rlenp, loc);
+                       fprintf(stdout, "ret = %d, rlenp is %zd, loc is %lld\n",
+                               ret, rlenp, (long long) loc);
                }
                if (rlenp > 0) {
                        dm_stat_t       *statp;
index 15fa6e266c913704fe430fec454c18e82e5cf56e..9c7eabba639b52d8ab6294c658b585aa4763d625 100644 (file)
@@ -61,7 +61,7 @@ main(
        dm_token_t      token = DM_NO_TOKEN;
        char            *object;
        dm_attrname_t   *attrnamep;
-       void            *bufp;
+       void            *bufp = NULL;
        size_t          buflen = 10000;
        size_t          rlenp;
        void            *hanp;
@@ -69,7 +69,8 @@ main(
        char            *name;
        int             opt;
 
-       if (Progname = strrchr(argv[0], '/')) {
+       Progname = strrchr(argv[0], '/');
+       if (Progname) {
                Progname++;
        } else {
                Progname = argv[0];
@@ -122,14 +123,14 @@ main(
            bufp, &rlenp)) {
                if (errno == E2BIG) {
                        fprintf(stderr, "dm_get_dmattr buffer too small, "
-                               "should be %d bytes\n", rlenp);
+                               "should be %zd bytes\n", rlenp);
                } else {
                        fprintf(stderr, "dm_get_dmattr failed, %s\n",
                                strerror(errno));
                }
                exit(1);
        }
-       fprintf(stdout, "rlenp is %d, value is '%s'\n", rlenp, (char*)bufp);
+       fprintf(stdout, "rlenp is %zd, value is '%s'\n", rlenp, (char*)bufp);
 
        dm_handle_free(hanp, hlen);
        exit(0);
index 420024d3f0520a3abcd928763c6fe33930e96a57..37ed8c46d1e235a062338041388c4746b045af91 100644 (file)
@@ -80,7 +80,8 @@ main(
        int             opt;
        int             i;
 
-       if (Progname = strrchr(argv[0], '/')) {
+       Progname = strrchr(argv[0], '/');
+       if (Progname) {
                Progname++;
        } else {
                Progname = argv[0];
@@ -147,12 +148,8 @@ main(
                return(1);
        }
 
-#ifdef VERITAS_21
-       fprintf(stdout, "Events on object %s (0x%x), nelemp %d:\n",
-#else
        fprintf(stdout, "Events on object %s (0x%llx), nelemp %d:\n",
-#endif
-               object, eventset, nelemp);
+               object, (unsigned long long) eventset, nelemp);
 
        for (i = 0; i < nelemp; i++) {
                if (!DMEV_ISSET(i, eventset))
index e518e11dc56291b7d38d9f92212c31b08f3bc227..55ae09b0e99dcd44d88052eacf8bd0c5285e2205 100644 (file)
@@ -60,14 +60,15 @@ main(
        dm_eventmsg_t   *msg;
        dm_sessid_t     sid;
        u_int           flags = 0;
-       void            *bufp;
+       void            *bufp = NULL;
        size_t          buflen = 10000;
        u_int           maxmsgs = 1;
        size_t          rlenp;
        char            *name;
        int             opt;
 
-       if (Progname = strrchr(argv[0], '/')) {
+       Progname = strrchr(argv[0], '/');
+       if (Progname) {
                Progname++;
        } else {
                Progname = argv[0];
@@ -109,14 +110,14 @@ main(
        if (dm_get_events(sid, maxmsgs, flags, buflen, bufp, &rlenp)) {
                if (errno == E2BIG) {
                        fprintf(stderr, "dm_get_events buffer too small, "
-                               "should be %d bytes\n", rlenp);
+                               "should be %zd bytes\n", rlenp);
                } else {
                        fprintf(stderr, "dm_get_events failed, (%d)%s\n",
                                errno, strerror(errno));
                }
                exit(1);
        }
-       fprintf(stdout, "rlenp=%d\n", rlenp);
+       fprintf(stdout, "rlenp=%zd\n", rlenp);
 
        if (rlenp == 0)
                return(0);
index ff03924f90da59d97946724a98be5fe3bdf5bb9d..e3ab024443d8ad05fd559242c684052fae29c12f 100644 (file)
@@ -59,7 +59,8 @@ main(
        int             opt;
        int             validate = 0;
 
-       if (Progname = strrchr(argv[0], '/')) {
+       Progname = strrchr(argv[0], '/');
+       if (Progname) {
                Progname++;
        } else {
                Progname = argv[0];
index 052b6ea7e684fb75a10c6bd473059ba5376792b6..bd0dc92cde04daaa71ec716142ba96c142d7286d 100644 (file)
@@ -76,7 +76,7 @@ main(
 {
        dm_sessid_t     sid = DM_NO_SESSION;
        char            *pathname;
-       void            *bufp;
+       void            *bufp = NULL;
        size_t          buflen = 10000;
        size_t          rlenp;
        void            *fshanp;
@@ -84,7 +84,8 @@ main(
        char            *name;
        int             opt;
 
-       if (Progname = strrchr(argv[0], '/')) {
+       Progname = strrchr(argv[0], '/');
+       if (Progname) {
                Progname++;
        } else {
                Progname = argv[0];
@@ -134,14 +135,14 @@ main(
            bufp, &rlenp)) {
                if (errno == E2BIG) {
                        fprintf(stderr, "dm_get_mountinfo buffer too small, "
-                               "should be %d bytes\n", rlenp);
+                               "should be %zd bytes\n", rlenp);
                } else {
                        fprintf(stderr, "dm_get_mountinfo failed, %s\n",
                                strerror(errno));
                }
                exit(1);
        }
-       fprintf(stdout, "rlenp is %d\n", rlenp);
+       fprintf(stdout, "rlenp is %zd\n", rlenp);
        print_one_mount_event(bufp);
 
        dm_handle_free(fshanp, fshlen);
index 6cafbd132294428326eeb2b2dfd69eee94cac975..997faab2863662dddbb237d7dfb3148489c9c4ca 100644 (file)
@@ -67,7 +67,8 @@ main(
        int             opt;
        int             i;
 
-       if (Progname = strrchr(argv[0], '/')) {
+       Progname = strrchr(argv[0], '/');
+       if (Progname) {
                Progname++;
        } else {
                Progname = argv[0];
@@ -121,12 +122,9 @@ main(
        fprintf(stdout, "%d regions\n", nelemp);
 
        for (i = 0; i < nelemp; i++) {
-#ifdef VERITAS_21
-               fprintf(stdout, "offset %d, size %d, flags 0x%x\n",
-#else
-               fprintf(stdout, "offset %lld, size %lld, flags 0x%x\n",
-#endif
-                       regbufp[i].rg_offset, regbufp[i].rg_size,
+               fprintf(stdout, "offset %lld, size %llu, flags 0x%x\n",
+                       (long long) regbufp[i].rg_offset,
+                       (unsigned long long) regbufp[i].rg_size,
                        regbufp[i].rg_flags);
        }
 
index a68fdfd28f2a31602d93275b65761cf7ca000d5f..ef676b25ffa562aa92a5a1629943ea2e444ec3cd 100644 (file)
@@ -58,7 +58,7 @@ main(
 {
        dm_dispinfo_t   *disp;
        dm_sessid_t     sid;
-       void            *bufp;
+       void            *bufp = NULL;
        size_t          buflen = 10000;
        void            *hanp;
        size_t          hlen;
@@ -67,7 +67,8 @@ main(
        char            *name;
        int             opt;
 
-       if (Progname = strrchr(argv[0], '/')) {
+       Progname = strrchr(argv[0], '/');
+       if (Progname) {
                Progname++;
        } else {
                Progname = argv[0];
@@ -103,14 +104,14 @@ main(
        if (dm_getall_disp(sid, buflen, bufp, &rlenp)) {
                if (errno == E2BIG) {
                        fprintf(stderr, "dm_getall_disp buffer too small, "
-                               "should be %d bytes\n", rlenp);
+                               "should be %zd bytes\n", rlenp);
                } else {
                        fprintf(stderr, "dm_getall_disp failed, %s\n",
                                strerror(errno));
                }
                exit(1);
        }
-       fprintf(stdout, "rlenp is %d\n", rlenp);
+       fprintf(stdout, "rlenp is %zd\n", rlenp);
        if (rlenp == 0)
                return(0);
 
@@ -121,11 +122,11 @@ main(
                if (hanp && hlen) {
                        hantoa(hanp, hlen, hans1);
                } else {
-                       sprintf(hans1, "<BAD HANDLE, hlen %d>", hlen);
+                       sprintf(hans1, "<BAD HANDLE, hlen %zd>", hlen);
                }
                printf("%-15s %s dm_eventset_t 0%llo\n",
                        "fshandle", hans1,
-                       disp->di_eventset);
+                       (unsigned long long) disp->di_eventset);
 
                disp = DM_STEP_TO_NEXT(disp, dm_dispinfo_t *);
        }