Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/kevent_nullmnt Rename variables to be more de...



details:   https://anonhg.NetBSD.org/src/rev/e6a3e9d1d748
branches:  trunk
changeset: 365888:e6a3e9d1d748
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun May 01 03:18:41 2022 +0000

description:
Rename variables to be more descriptive of their local meaning rather
than referring to external usage.

diffstat:

 tests/lib/libc/kevent_nullmnt/h_nullmnt.c |  24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diffs (65 lines):

diff -r 3e3253f8db76 -r e6a3e9d1d748 tests/lib/libc/kevent_nullmnt/h_nullmnt.c
--- a/tests/lib/libc/kevent_nullmnt/h_nullmnt.c Sun May 01 00:25:42 2022 +0000
+++ b/tests/lib/libc/kevent_nullmnt/h_nullmnt.c Sun May 01 03:18:41 2022 +0000
@@ -7,7 +7,7 @@
 #include <sys/time.h>
 
 /*
- * External set-up code is expected to do the equivalent of
+ * External test set-up code is expected to do the equivalent of
  *     cd $TOPDIR
  *     mkdir realdir
  *     mkdir nulldir
@@ -29,7 +29,7 @@
 
 int main(int argc, char **argv)
 {
-       int realfile, nullfile;
+       int watch_file, write_file;
        int kq, nev, rsize;
        struct timespec timeout;
        struct kevent eventlist;
@@ -39,14 +39,14 @@
        if (argc <= 2)
                errx(EXIT_FAILURE, "insufficient args %d", argc);
 
-       realfile = open(argv[1], O_RDONLY);
-       if (realfile == -1)
-               err(EXIT_FAILURE, "failed to open realfile %s",
+       watch_file = open(argv[1], O_RDONLY);
+       if (watch_file == -1)
+               err(EXIT_FAILURE, "failed to open watch_file %s",
                    argv[1]);
 
-       nullfile = open(argv[2], O_WRONLY, O_APPEND);
-       if (nullfile == -1)
-               err(EXIT_FAILURE, "failed to open nullfile %s",
+       write_file = open(argv[2], O_WRONLY, O_APPEND);
+       if (write_file == -1)
+               err(EXIT_FAILURE, "failed to open write_file %s",
                    argv[2]);
 
        if ((kq = kqueue()) == -1)
@@ -55,18 +55,18 @@
        timeout.tv_sec = 5;
        timeout.tv_nsec = 0;
 
-       EV_SET(&eventlist, realfile,
+       EV_SET(&eventlist, watch_file,
            EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR,
            NOTE_WRITE | NOTE_EXTEND, 0, 0);
        if (kevent(kq, &eventlist, 1, NULL, 0, NULL) == -1)
                err(EXIT_FAILURE, "Failed to set eventlist for fd %d",
-                   realfile);
+                   watch_file);
 
-       rsize = read(realfile, &inbuf, sizeof(inbuf));
+       rsize = read(watch_file, &inbuf, sizeof(inbuf));
        if (rsize)
                errx(EXIT_FAILURE, "Ooops we got %d bytes of data!\n", rsize);
 
-       write(nullfile, &outbuf, sizeof(outbuf) - 1);
+       write(write_file, &outbuf, sizeof(outbuf) - 1);
 
        nev = kevent(kq, NULL, 0, &eventlist, 1, &timeout);
        if (nev == -1)



Home | Main Index | Thread Index | Old Index