]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: fix compilation without new API
authorKarel Zak <kzak@redhat.com>
Tue, 4 Oct 2022 09:59:52 +0000 (11:59 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 3 Jan 2023 11:58:42 +0000 (12:58 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/hook_mount.c
libmount/src/hooks.c
libmount/src/optlist.c

index 8d4e593d9a1d8b2e512c1e1710844e9493addcfb..7e0dd312f6920484b8672b8dededb75a11321f68 100644 (file)
  */
 
 #include "mountP.h"
-
 #include <inttypes.h>
 
+#ifdef UL_HAVE_MOUNT_API
+
 #define set_syscall_status(_cxt, _name, _x) __extension__ ({ \
                if (!(_x)) { \
                        (_cxt)->syscall_status = -errno; \
@@ -522,3 +523,4 @@ const struct libmnt_hookset hookset_mount =
 
        .deinit = hookset_deinit
 };
+#endif /* UL_HAVE_MOUNT_API */
index b95e6c426341687ee0af7eae0d5233e7c546bd2d..ef528276928ee9e98305d94db3484b5a504f4a82 100644 (file)
@@ -39,7 +39,9 @@ static const struct libmnt_hookset *hooksets[] =
 #endif
        &hookset_mkdir,
        &hookset_subdir,
+#ifdef UL_HAVE_MOUNT_API
        &hookset_mount,
+#endif
        &hookset_mount_legacy,
 #ifdef UL_HAVE_MOUNT_API
        &hookset_idmap,
index dfef48fd083246d82f50862760858b5e358de1c6..d8fdc8f19219154878c38467e2ffbb66ea7a2e1e 100644 (file)
@@ -775,9 +775,9 @@ static inline uint64_t flag_to_attr(unsigned long flag)
  * Like mnt_optlist_get_flags() for VFS flags, but converts classic MS_* flags to
  * new MOUNT_ATTR_*
  */
+#ifdef UL_HAVE_MOUNT_API
 int mnt_optlist_get_attrs(struct libmnt_optlist *ls, uint64_t *set, uint64_t *clr)
 {
-#ifdef UL_HAVE_MOUNT_API
        struct libmnt_iter itr;
        struct libmnt_opt *opt;
 
@@ -809,10 +809,16 @@ int mnt_optlist_get_attrs(struct libmnt_optlist *ls, uint64_t *set, uint64_t *cl
        DBG(OPTLIST, ul_debugobj(ls, "return attrs set=0x%08" PRIx64
                                      ", clr=0x%08" PRIx64, *set, *clr));
        return 0;
+}
 
-#endif
+#else
+int mnt_optlist_get_attrs(struct libmnt_optlist *ls __attribute__((__unused__)),
+                         uint64_t *set __attribute__((__unused__)),
+                         uint64_t *clr __attribute__((__unused__)))
+{
        return 0;
 }
+#endif /* UL_HAVE_MOUNT_API */
 
 int mnt_optlist_strdup_optstr(struct libmnt_optlist *ls, char **optstr,
                        const struct libmnt_optmap *map, unsigned int what)