On 23/11/22 17:56, Karel Zak wrote:
On Wed, Nov 16, 2022 at 10:00:45AM +0800, Ian Kent wrote:
diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c
index 75f8e406b..293f0a8ed 100644
--- a/libmount/src/tab_parse.c
+++ b/libmount/src/tab_parse.c
@@ -762,6 +762,14 @@ int mnt_table_parse_stream(struct libmnt_table *tb, FILE *f, const char *filenam
if (rc == 0 && tb->fltrcb && tb->fltrcb(fs, tb->fltrcb_data))
rc = 1; /* filtered out by callback... */
+ if (mnt_table_ignore_autofs(tb)) {
if (rc == 0 && mnt_table_ignore_autofs(tb)) {
Don't waste time if already ignored or in case of error :-)
Will do in v2, thanks.
+/*
+ * mnt_table_enable_ignore_autofs:
+ * @tb: table
+ *
+ * Enable ignore autofs mount table entries on reading.
+ */
+int mnt_table_enable_ignore_autofs(struct libmnt_table *tb)
+{
+ if (!tb)
+ return -EINVAL;
+ tb->ignore_autofs = 1;
+ return 0;
+}
The library usually uses the same function to enable as well as disable:
int mnt_table_enable_ignore_autofs(struct libmnt_table *tb, int ignore)
{
if (tb)
return -EINVAL;
tb->ignore_autofs = ignore ? 1 : 0;
}
and mnt_context_enable_ignore_autofs() is the same.
Right, I wasn't sure about this.
I had something similar initially.
I'll change it for v2, what about the check-if-enabled function,
any conventions for those?
Ian