summaryrefslogtreecommitdiffstats
path: root/libmount
Commit message (Collapse)AuthorAgeFilesLines
...
* libmount: Set each optstr's to NULL if failedNamhyung Kim2013-09-261-3/+9
| | | | | | | | When mnt_split_optstr() failed in the middle, vfs, fs, user optstr's are freed but not reset. It can lead to double frees at the end of mnt_fs_{ap,pre}pend_options(). Signed-off-by: Namhyung Kim <namhyung@gmail.com>
* libmount: Free splitted optstr's when error occurredNamhyung Kim2013-09-261-1/+5
| | | | | | When strdup() failed, u, v and f optstr's should be freed. Signed-off-by: Namhyung Kim <namhyung@gmail.com>
* libmount: Get rid of an unnecessary checkNamhyung Kim2013-09-261-1/+1
| | | | | | | libmount_debug_mask was OR'ed to MNT_DEBUG_INIT so it should be non-null. Thus the check is pointless. Signed-off-by: Namhyung Kim <namhyung@gmail.com>
* pylibmount: rewrite to be py2/py3 universalOndrej Oprala2013-09-208-116/+203
| | | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: support --with-python[={2,3}]Karel Zak2013-09-201-2/+1Star
| | | | | | | | | | | | | | * we use pkg-config to get CGLAGS and LIBS, use package specific config (e.g. python-config) is non-sense. * default is to follow distribution and use pkg-config module name "python". This is probably symlink to python2.pc or python3.pc. * --with-python=2 forces to pkg-module "python2 >= 2" * --with-python=3 forces to pkg-module "python3 >= 3" Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: free username after checkDave Reisner2013-09-201-0/+2
| | | | | | | | | | | | | | | Leak reported by valgrind: ==14226== 7 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==14226== at 0x4C2757B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==14226== by 0x5534839: strdup (in /usr/lib/libc-2.18.so) ==14226== by 0x4E53FE0: mnt_get_username (utils.c:560) ==14226== by 0x4E456A5: mnt_context_prepare_umount (context_umount.c:413) ==14226== by 0x4E464F7: mnt_context_umount (context_umount.c:851) ==14226== by 0x403476: umount_one (umount.c:299) ==14226== by 0x402B34: main (umount.c:629) Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* libmount: use memmove when overlap possibleDave Reisner2013-09-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | When unmounting some mountpoints as an unprivileged user (via the 'user' option in fstab), the umount fails. Debug output of 'umount /opt' reveals: 17760: libmount: CXT: [0x22890e0]: do umount 17760: libmount: UTILS: moving to /opt parent 17760: libmount: CXT: current directory moved to / [last_component='opt'] 17760: libmount: CXT: [0x22890e0]: umount(2) [target='pt', flags=0x00000000] valgrind shows the problem: ==23544== Source and destination overlap in memcpy(0x58d1370, 0x58d1371, 4) ==23544== at 0x4C2BBC3: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==23544== by 0x4E537C3: mnt_chdir_to_parent (utils.c:168) ==23544== by 0x4E45E4C: mnt_context_do_umount (context_umount.c:601) ==23544== by 0x4E46513: mnt_context_umount (context_umount.c:855) ==23544== by 0x403476: umount_one (umount.c:299) ==23544== by 0x402B34: main (umount.c:629) ==23544== ref: https://bugs.archlinux.org/task/36968 Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* lib: rename time-util.c to timeutils.c, fix headersKarel Zak2013-09-101-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: move *swith() functions to private librarySami Kerola2013-08-294-36/+2Star
| | | | | | | | Avoid code dublication in libmount and time-util. Proposed-by: Karel Zak <kzak@redhat.com> Reference: http://markmail.org/message/h7zexvqsieqngtmx Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build-sys: add CFLAGS and LDFLAGS for daemons and shared libsKarel Zak2013-08-271-0/+2
| | | | | | | | This is necessary for paranoid security guys who believe that things like "-Wl,-z,relro" or "-Wl,-z,bind_now" is a way how to make the world a safer place... Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: improve helps strings formattingKarel Zak2013-08-221-218/+214Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: add debug messagesKarel Zak2013-08-225-6/+114
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup libmnt_fs list after mnt_table_remove_fs()Karel Zak2013-08-222-1/+13
| | | | | | | .. otherwise mnt_free_fs() will try to remove FS from non-existing list. Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: use libmount reference countingKarel Zak2013-08-225-26/+33
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add reference counter to libmnt_tableKarel Zak2013-08-2110-50/+100
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add reference counting to libmnt_cacheKarel Zak2013-08-216-30/+70
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add reference counting to libmount_fsKarel Zak2013-08-2110-41/+115
| | | | | | | | | | | | | | | | | | | | * mnt_new_fs() returns object with refcount=1 * mnt_free_fs() does not care about reference counter * new functions mnt_ref_fs() and mnt_unref_fs() * mnt_table_add_fs() and mnt_table_rem_fs() uses reference counter * libmmnt_context uses reference counter for internal FS (as it could be shared outside the context) * backwardly incompatible change: - FS could be deallocated after mnt_table_remove_fs() * it's recommended to use mnt_unref_fs() after mnt_table_add_fs() Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: remove Context_get_table()Karel Zak2013-08-211-29/+0Star
| | | | | | It's too problematic and too low-level to support it Py binding. Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: cleanup cxt usageKarel Zak2013-08-212-73/+15Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add function for context userdataKarel Zak2013-08-214-0/+46
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: remove unnecessary codeKarel Zak2013-08-201-1/+0Star
| | | | | | It's enough to call mnt_free_fs() to remove fs from the table. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add mnt_table_is_empty(), improve table list usageKarel Zak2013-08-205-9/+31
| | | | | | | | Currently you have to use mnt_table_remove_fs() + mnt_free_fs() to destroy the list in the table. This is complicated in same situations. This patch allows to use mnt_free_fs() only. Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: coding style changes, don't touch Context() statusKarel Zak2013-08-202-54/+50Star
| | | | | | | It's better to follow libmnt_context status than allow to play any nasty games with this important variables in Python. Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: use only public libmount API in tab.cKarel Zak2013-08-201-34/+42
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add mnt_table_{first,last}_fs()Karel Zak2013-08-204-0/+46
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add new function to docsKarel Zak2013-08-201-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add mnt_table_{set,get}_userdata()Karel Zak2013-08-203-0/+36
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add mnt_table_with_comments()Karel Zak2013-08-203-0/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: cleanup *_HELP strings formattingKarel Zak2013-08-201-136/+144
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: use mnt_fs_set_userdata() rather than ->userdataKarel Zak2013-08-201-12/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: fs.c - cleanup, remove libmount private stuffKarel Zak2013-08-201-81/+97
| | | | | | | | * remove unnecessary comments * cleanup up strings format * remove direct access to private libmount stuff Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: remove bindsrc from fs APIKarel Zak2013-08-201-41/+13Star
| | | | | | It's unnecessary and very low-level. Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: cleanup object namesKarel Zak2013-08-196-313/+315
| | | | | | | Cxt -> Context Tab -> Table Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: coding style changes in tab.cKarel Zak2013-08-191-22/+53
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: coding style changes in fs.cKarel Zak2013-08-191-57/+72
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: coding style changes in context.cKarel Zak2013-08-191-120/+201
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: install pylibmount intoKarel Zak2013-08-191-3/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: add regression testsOndrej Oprala2013-08-194-0/+394
| | | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* pylibmount: add __init__.pyOndrej Oprala2013-08-191-0/+2
| | | | | Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* pylibmount: basic codeOndrej Oprala2013-08-196-2/+3045
| | | | | | | | [kzak@redhat.com: - split to more patches - split to more .c files] Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: add pylibmountKarel Zak2013-08-192-1/+22
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: be robust when work with loopdev backing file pathsKarel Zak2013-08-052-18/+17Star
| | | | | | | | It's usually unnecessary as we compare devno and ino, but let's use absolute paths for situations when it's necessary to compare paths as strings. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: canonicalize for conversion from loopdev backing fileKarel Zak2013-08-051-1/+6
| | | | | | | | | | | | # mount foo.img /mnt # umount foo.img umount: foo.img: not mounted The loopdev code (and sysfs backing_file) uses absolute paths, but libmount does not canonicalize the path before lookup for the backing file. References: https://bugzilla.redhat.com/show_bug.cgi?id=950497 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix typosOndrej Oprala2013-08-0519-353/+354
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* libmount: add missing declarations to libmount.h.in and documentationOndrej Oprala2013-08-014-0/+18
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* libmount: change tailing to trailing in *_tailing_comments functionsOndrej Oprala2013-08-015-21/+21
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* libmount: fix memory leak [clang-analyzer]Karel Zak2013-07-091-1/+2
| | | | | Reported-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: use devno to check if the filesystem is mountedKarel Zak2013-07-081-1/+15
| | | | | | | | | | The device (for example LVM logical volume) could be renamed and then the device name from /proc/self/mountinfo does not match with reality. So, we also need to check devno. Unfortunately we cannot completely rely on devno, because for example btrfs uses psudo device numbers. References: https://bugzilla.redhat.com/show_bug.cgi?id=980463 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add functions to safely replace a fs tableOndrej Oprala2013-07-033-0/+112
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* libmount: add functions to handle comments in fs tablesOndrej Oprala2013-07-037-9/+356
| | | | | | Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>