<div dir="ltr"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+int tst_ismount(const char *path)<br>
+{<br>
+ char line[256];<br>
+ FILE *file;<br>
+ int ret = -1; </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
+ file = SAFE_FOPEN(NULL, "/proc/mounts", "r");<br>
+<br>
+ while (fgets(line, sizeof(line), file)) {<br>
+ if (strstr(line, path) != NULL) {<br>
+ ret = 0;<br>
+ break;<br>
+ }<br>
+ }<br>
+<br>
+ SAFE_FCLOSE(NULL, file);<br>
+<br>
+ if (ret) {<br>
+ errno = ENOENT;<br>
+ tst_resm(TWARN, "No device is mounted at %s", path);<br>
+ }<br>
+<br>
+ return ret;<br></blockquote><div> </div><div><span class="gmail_default" style="font-size:small"></span>Sorry, I think the return value should be '1' if it has been mounted already.</div><div class="gmail_default"><br></div><div class="gmail_default">e.g</div><div class="gmail_default">These codes will make people confused about whether it's mounted successfully or not.</div><div class="gmail_default"><br></div><div class="gmail_default">if (tst_ismount(MNTPOINT))<br></div><div><span class="gmail_default" style="font-size:small"> tst_brk(TBROK | TERRNO, "device not mounted");</span></div><div><span class="gmail_default" style="font-size:small"></span> </div><div><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></blockquote><div> </div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>