summaryrefslogtreecommitdiff
path: root/libmount/src/mountP.h
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2014-06-12 12:04:01 +0100
committerRichard Maw <richard.maw@codethink.co.uk>2014-06-12 12:04:01 +0100
commitc5c1033c5c7deda8abe3448ec81bbb33c72219e0 (patch)
tree6e5cef29b85161eea8a7488a029f5a32f982c6ab /libmount/src/mountP.h
parent462008f79be9e195670b202cb43827b8aeb1e60b (diff)
parent2fb567c080e1762ec6a2147564f03068f55d4f14 (diff)
downloadutil-linux-baserock/morph.tar.gz
Merge branch 'baserock/richardmaw/yakshave/util-linux-blkid' into baserock/morphbaserock/morph
Reviewed-by: Lars Wirzenius Reviewed-by: Sam Thursfield
Diffstat (limited to 'libmount/src/mountP.h')
-rw-r--r--libmount/src/mountP.h34
1 files changed, 22 insertions, 12 deletions
diff --git a/libmount/src/mountP.h b/libmount/src/mountP.h
index e064a6849..9362c0042 100644
--- a/libmount/src/mountP.h
+++ b/libmount/src/mountP.h
@@ -55,6 +55,13 @@
# include <stdio.h>
# include <stdarg.h>
+# define WARN_REFCOUNT(m, o, r) \
+ do { \
+ if ((MNT_DEBUG_ ## m) & libmount_debug_mask && r != 0) \
+ fprintf(stderr, "%d: libmount: %8s: [%p]: *** deallocates with refcount=%d\n", \
+ getpid(), # m, o, r); \
+ } while (0)
+
# define ON_DBG(m, x) do { \
if ((MNT_DEBUG_ ## m) & libmount_debug_mask) { \
x; \
@@ -100,6 +107,7 @@ mnt_debug_h(void *handler, const char *mesg, ...)
}
#else /* !CONFIG_LIBMOUNT_DEBUG */
+# define WARN_REFCOUNT(m,o,r) do { ; } while (0)
# define ON_DBG(m,x) do { ; } while (0)
# define DBG(m,x) do { ; } while (0)
# define DBG_FLUSH do { ; } while(0)
@@ -129,13 +137,11 @@ extern int mnt_run_test(struct libmnt_test *tests, int argc, char *argv[]);
#endif
/* utils.c */
-extern int endswith(const char *s, const char *sx)
- __attribute__((nonnull));
-extern int startswith(const char *s, const char *sx)
- __attribute__((nonnull));
-
extern char *stripoff_last_component(char *path);
+extern int mnt_valid_tagname(const char *tagname);
+extern int append_string(char **a, const char *b);
+
extern int is_file_empty(const char *name);
extern int mkdir_p(const char *path, mode_t mode);
@@ -200,12 +206,13 @@ struct libmnt_iter {
/*
- * This struct represents one entry in mtab/fstab/mountinfo file.
+ * This struct represents one entry in a mtab/fstab/mountinfo file.
* (note that fstab[1] means the first column from fstab, and so on...)
*/
struct libmnt_fs {
struct list_head ents;
+ int refcount; /* reference counter */
int id; /* mountinfo[1]: ID */
int parent; /* mountinfo[2]: parent */
dev_t devno; /* mountinfo[3]: st_dev */
@@ -240,6 +247,8 @@ struct libmnt_fs {
int flags; /* MNT_FS_* flags */
pid_t tid; /* /proc/<tid>/mountinfo otherwise zero */
+ char *comment; /* fstab comment */
+
void *userdata; /* library independent data */
};
@@ -261,7 +270,11 @@ struct libmnt_fs {
*/
struct libmnt_table {
int fmt; /* MNT_FMT_* file format */
- int nents; /* number of valid entries */
+ int nents; /* number of entries */
+ int refcount; /* reference counter */
+ int comms; /* enable/disable comment parsing */
+ char *comm_intro; /* First comment in file */
+ char *comm_tail; /* Last comment in file */
struct libmnt_cache *cache; /* canonicalized paths/tags cache */
@@ -273,6 +286,7 @@ struct libmnt_table {
struct list_head ents; /* list of entries (libmnt_fs) */
+ void *userdata;
};
extern struct libmnt_table *__mnt_new_table_from_file(const char *filename, int fmt);
@@ -373,17 +387,13 @@ struct libmnt_context
#define MNT_FL_FORK (1 << 12)
#define MNT_FL_NOSWAPMATCH (1 << 13)
-#define MNT_FL_EXTERN_FS (1 << 15) /* cxt->fs is not private */
-#define MNT_FL_EXTERN_FSTAB (1 << 16) /* cxt->fstab is not private */
-#define MNT_FL_EXTERN_CACHE (1 << 17) /* cxt->cache is not private */
-
#define MNT_FL_MOUNTDATA (1 << 20)
#define MNT_FL_TAB_APPLIED (1 << 21) /* mtab/fstab merged to cxt->fs */
#define MNT_FL_MOUNTFLAGS_MERGED (1 << 22) /* MS_* flags was read from optstr */
#define MNT_FL_SAVED_USER (1 << 23)
#define MNT_FL_PREPARED (1 << 24)
#define MNT_FL_HELPER (1 << 25) /* [u]mount.<type> */
-#define MNT_FL_LOOPDEV_READY (1 << 26) /* /dev/loop<N> initialized by library */
+#define MNT_FL_LOOPDEV_READY (1 << 26) /* /dev/loop<N> initialized by the library */
#define MNT_FL_MOUNTOPTS_FIXED (1 << 27)
/* default flags */