<div dir="ltr">Hi,<br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 26, 2015 at 4:47 PM, Alexey Kodanev <span dir="ltr"><<a href="mailto:alexey.kodanev@oracle.com" target="_blank">alexey.kodanev@oracle.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<span class=""><br>
On 11/26/2015 05:57 AM, Li Wang wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Signed-off-by: Li Wang <<a href="mailto:liwang@redhat.com" target="_blank">liwang@redhat.com</a>><br>
---<br>
</blockquote></span>
...<span class=""><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
-       if (write(fd, nr_hugepages,<br>
+       if ((unsigned int)write(fd, nr_hugepages,<br>
                  strlen(nr_hugepages)) != strlen(nr_hugepages))<br>
                tst_resm(TWARN | TERRNO, "write");<br>
        close(fd);<br>
@@ -271,7 +270,7 @@ static void cleanup(void)<br>
                tst_resm(TWARN | TERRNO, "open");<br>
        tst_resm(TINFO, "restore nr_overcommit_hugepages to %s.",<br>
                 nr_overcommit_hugepages);<br>
-       if (write(fd, nr_overcommit_hugepages, strlen(nr_overcommit_hugepages))<br>
+       if ((unsigned int)write(fd, nr_overcommit_hugepages, strlen(nr_overcommit_hugepages))<br>
            != strlen(nr_overcommit_hugepages))<br>
</blockquote>
<br></span>
It would be better to use ssize_t, that way you won't exceed 80c per line as well.<br>
<br>
if (write(fd, nr_overcommit_hugepages, strlen(nr_overcommit_hugepages))<br>
            != (ssize_t)strlen(nr_overcommit_hugepages))<span class=""><br></span></blockquote><div><br></div><div>good.<br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="">
<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                tst_resm(TWARN | TERRNO, "write");<br>
        close(fd);<br>
@@ -287,7 +286,7 @@ static void cleanup(void)<br>
        tst_rmdir();<br>
  }<br>
  -static void setup(void)<br>
+void setup(void)<br>
</blockquote>
<br></span>
forgot "static"?<br></blockquote><div><br></div><div>no, it will be conflict with the prototype in mem.h and get compiler error like:<br></div><div>-------<br>hugemmap05.c:253: error: static declaration of ‘cleanup’ follows non-static declaration<br>/mnt/tests/kernel/distribution/ltp/generic/ltp-full-20150903/testcases/kernel/mem/include/mem.h:100: note: previous declaration of ‘cleanup’ was here<br>hugemmap05.c:295: error: static declaration of ‘setup’ follows non-static declaration<br>/mnt/tests/kernel/distribution/ltp/generic/ltp-full-20150903/testcases/kernel/mem/include/mem.h:101: note: previous declaration of ‘setup’ was here<br>make: *** [hugemmap05] Error 1<br><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
...<span class=""><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c<br>
index 215c052..84af3ce 100644<br>
--- a/testcases/kernel/mem/lib/mem.c<br>
+++ b/testcases/kernel/mem/lib/mem.c<br>
@@ -314,6 +314,12 @@ static void verify(char **memory, char value, int proc,<br>
        free(s);<br>
  }<br>
  <br>
</blockquote></span>
...<span class=""><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+       if (access(PATH_HUGEPAGES, F_OK) == -1)<br>
</blockquote></span>
Could be<br>
if (access(PATH_HUGEPAGES, F_OK))<br>
       tss_brkm(...);<span class=""><br></span></blockquote><div><br></div><div>looks good.<br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="">
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+               tst_brkm(TCONF, NULL, "Huge page is not supported.");<br>
+<br>
        tst_tmpdir();<br>
        SAFE_FILE_SCANF(NULL, PATH_NR_HUGEPAGES, "%ld", &orig_hugepages);<br>
</blockquote>
<br></span>
Thanks,<br>
Alexey<br>
</blockquote></div><br></div><div class="gmail_extra">thanks for reviewing.<br clear="all"></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>Regards,<br></div>Li Wang<br></div><div>Email: <a href="mailto:liwang@redhat.com" target="_blank">liwang@redhat.com</a><br></div></div></div></div></div></div>
</div></div>