]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-fs: Added fs_get_root_driver()
authorTimo Sirainen <tss@iki.fi>
Mon, 27 May 2013 22:03:58 +0000 (01:03 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 27 May 2013 22:03:58 +0000 (01:03 +0300)
src/lib-fs/fs-api.c
src/lib-fs/fs-api.h

index 45fa37df9c83c519c35f732d255eb10d2c62b043..9b1d633f57644c1d7f7a526f5e8ce2ed8e787ac4 100644 (file)
@@ -140,6 +140,13 @@ void fs_deinit(struct fs **_fs)
        str_free(&last_error);
 }
 
+const char *fs_get_root_driver(struct fs *fs)
+{
+       while (fs->parent != NULL)
+               fs = fs->parent;
+       return fs->name;
+}
+
 struct fs_file *fs_file_init(struct fs *fs, const char *path, int mode_flags)
 {
        struct fs_file *file;
index 54c852cda2567da1dbbbd0463e7cf66c95649525..d2d9a1dd6122bfe7de3387d7d3f87efdbb67257c 100644 (file)
@@ -92,6 +92,9 @@ int fs_init(const char *driver, const char *args,
            struct fs **fs_r, const char **error_r);
 void fs_deinit(struct fs **fs);
 
+/* Returns the root fs's driver name (bypassing all wrapper fses) */
+const char *fs_get_root_driver(struct fs *fs);
+
 struct fs_file *fs_file_init(struct fs *fs, const char *path, int mode_flags);
 void fs_file_deinit(struct fs_file **file);