search for: get_blkid_tag

Displaying 20 results from an estimated 53 matches for "get_blkid_tag".

2011 Dec 05
1
[PATCH] blkid: split the RHEL5 which can't support some options
...d.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 73 insertions(+), 7 deletions(-) diff --git a/daemon/blkid.c b/daemon/blkid.c index a7fd6bc..8c2cdc6 100644 --- a/daemon/blkid.c +++ b/daemon/blkid.c @@ -84,18 +84,42 @@ do_vfs_uuid (const char *device) return get_blkid_tag (device, "UUID"); } -char ** -do_blkid(const char *device) +/* RHEL5 blkid doesn't have the -p(partition info) option and the + * -i(I/O limits) option so we must test for these options the first + * time the function is called. + */ +static int +test_blkid_p_opt(void) +{ + static...
2017 Jul 14
0
[PATCH 04/27] daemon: Reimplement ‘vfs_type’ API in OCaml.
...i \ utils.mli SOURCES_ML = \ types.ml \ utils.ml \ sysroot.ml \ + mountable.ml \ chroot.ml \ + blkid.ml \ file.ml \ callbacks.ml \ daemon.ml diff --git a/daemon/blkid.c b/daemon/blkid.c index 1fe5ff93a..7757b5ad0 100644 --- a/daemon/blkid.c +++ b/daemon/blkid.c @@ -69,12 +69,6 @@ get_blkid_tag (const char *device, const char *tag) } char * -do_vfs_type (const mountable_t *mountable) -{ - return get_blkid_tag (mountable->device, "TYPE"); -} - -char * do_vfs_label (const mountable_t *mountable) { CLEANUP_FREE char *type = do_vfs_type (mountable); diff --git a/daemon/...
2015 Jan 14
2
[PATCH] daemon: use btrfs(1) to get btrfs labels
...onst mountable_t *mountable) char * do_vfs_label (const mountable_t *mountable) { + CLEANUP_FREE char *type = do_vfs_type (mountable); + + if (type && STREQ (type, "btrfs") && optgroup_btrfs_available ()) + return btrfs_get_label (mountable->device); + return get_blkid_tag (mountable->device, "LABEL"); } diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 150c089..cf1507d 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -44,6 +44,30 @@ optgroup_btrfs_available (void) return prog_exists (str_btrfs) && filesystem_available ("btrfs&quot...
2015 Jul 02
1
[PATCH v6] New API: set_uuid_random
...daemon/daemon.h @@ -223,6 +223,7 @@ extern int sync_disks (void); /* Confirmed this is true up to ext4 from the Linux sources. */ #define EXT2_LABEL_MAX 16 extern int fstype_is_extfs (const char *fstype); +extern int ext_set_uuid_random (const char *device); /*-- in blkid.c --*/ extern char *get_blkid_tag (const char *device, const char *tag); @@ -265,6 +266,7 @@ extern int copy_xattrs (const char *src, const char *dest); /* Documented in xfs_admin(8). */ #define XFS_LABEL_MAX 12 extern int xfs_set_uuid (const char *device, const char *uuid); +extern int xfs_set_uuid_random (const char *device);...
2015 Jan 15
1
[PATCH 2/2] daemon: use ntfslabel(1) to get ntfs labels
...f (type) { if (STREQ (type, "btrfs") && optgroup_btrfs_available ()) return btrfs_get_label (mountable->device); + if (STREQ (type, "ntfs") && optgroup_ntfsprogs_available ()) + return ntfs_get_label (mountable->device); } return get_blkid_tag (mountable->device, "LABEL"); diff --git a/daemon/daemon.h b/daemon/daemon.h index 4ee1a40..9405ce6 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -265,6 +265,9 @@ extern char *debug_bmap_device (const char *subcmd, size_t argc, char *const *co /*-- in btrfs.c --*/ extern char...
2013 Jan 24
3
[REVIEW ONLY] Mountable patches
These 3 patches implement support for APIs which must accept a mountable, but don't update apis which must return mountables. Matt
2015 Jul 01
0
[PATCH v5 3/3] New API: set_uuid_random
...emon/daemon.h @@ -223,6 +223,7 @@ extern int sync_disks (void); /* Confirmed this is true up to ext4 from the Linux sources. */ #define EXT2_LABEL_MAX 16 extern int fstype_is_extfs (const char *fstype); +extern int ext_set_e2uuid_random (const char *device); /*-- in blkid.c --*/ extern char *get_blkid_tag (const char *device, const char *tag); @@ -265,6 +266,7 @@ extern int copy_xattrs (const char *src, const char *dest); /* Documented in xfs_admin(8). */ #define XFS_LABEL_MAX 12 extern int xfs_set_uuid (const char *device, const char *uuid); +extern int xfs_set_uuid_random (const char *device);...
2015 Jul 01
5
[PATCH v5 0/3] uuid: add btrfs uuid change support and set_uuid_random
- Btrfs-progs v4.1 introduced new feature of changing uuid of btrfs partition. This patch add support of this. - Introduce set_uuid_random - uuids.c did a lot of deplicated work for changing uuid of fs. Use existing functions. v5: use NOT_SUPPORTED macro improve testcases v4: introduce get_random_uuid improve testcases squash internal API patches v3.1: fix typos v3: set errno
2012 Feb 14
1
[PATCH RFC] blkid: start using libblkid directly instead
...--- a/daemon/blkid.c +++ b/daemon/blkid.c @@ -23,6 +23,8 @@ #include <string.h> #include <unistd.h> #include <limits.h> +#include <fcntl.h> +#include <blkid/blkid.h> #include "daemon.h" #include "actions.h" @@ -30,40 +32,37 @@ static char * get_blkid_tag (const char *device, const char *tag) { - char *out, *err; - int r; + int fd, rc; + const char *data = NULL; + blkid_probe blkprobe; - r = commandr (&out, &err, - "blkid", - /* Adding -c option kills all caching, even on RHEL 5. */ -...
2011 Dec 03
1
[PATCH] NEW API: add blkid command to print the attributes of the device
...++++++++++++++++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 149 insertions(+), 1 deletions(-) diff --git a/daemon/blkid.c b/daemon/blkid.c index 6d395c1..a7fd6bc 100644 --- a/daemon/blkid.c +++ b/daemon/blkid.c @@ -83,3 +83,78 @@ do_vfs_uuid (const char *device) { return get_blkid_tag (device, "UUID"); } + +char ** +do_blkid(const char *device) +{ + int r; + char *out = NULL, *err = NULL; + char **lines = NULL; + + char **ret = NULL; + int size = 0, alloc = 0; + + const char *blkid[] = {"blkid", "-p", "-i", "-o", "exp...
2016 Jul 07
0
[PATCH 2/2] daemon: fix cleanup of stringsbuf usages
...static char ** blkid_without_p_i_opt (const char *device) { char *s; - DECLARE_STRINGSBUF (ret); + CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (ret); - if (add_string (&ret, "TYPE") == -1) goto error; + if (add_string (&ret, "TYPE") == -1) return NULL; s = get_blkid_tag (device, "TYPE"); - if (s == NULL) goto error; + if (s == NULL) return NULL; if (add_string_nodup (&ret, s) == -1) - goto error; + return NULL; - if (add_string (&ret, "LABEL") == -1) goto error; + if (add_string (&ret, "LABEL") == -1) return...
2016 Jul 07
2
[PATCH 1/2] daemon: free the string on stringsbuf add failure
If add_string_nodup fails free the passed string instead of leaking it, as that string would have been owned by the stringbuf. Adapt few places to this behaviour. --- daemon/btrfs.c | 4 +--- daemon/devsparts.c | 8 ++++---- daemon/guestfsd.c | 1 + 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 9b52aa8..d70565a 100644 ---
2015 Jun 24
0
[PATCH 2/5] uuid: use existed function of ext2
...n.h @@ -219,6 +219,7 @@ extern int sync_disks (void); /* Confirmed this is true up to ext4 from the Linux sources. */ #define EXT2_LABEL_MAX 16 extern int fstype_is_extfs (const char *fstype); +extern int do_set_e2uuid (const char *device, const char *uuid); /*-- in blkid.c --*/ extern char *get_blkid_tag (const char *device, const char *tag); diff --git a/daemon/uuids.c b/daemon/uuids.c index f7791ab..8626884 100644 --- a/daemon/uuids.c +++ b/daemon/uuids.c @@ -27,16 +27,12 @@ #include "actions.h" #include "optgroups.h" -GUESTFSD_EXT_CMD(str_tune2fs, tune2fs); GUESTFSD_EXT_...
2015 Jun 26
0
[PATCH v3.1 9/9] New API: set_uuid_random
...30491 100644 --- a/daemon/uuids.c +++ b/daemon/uuids.c @@ -85,3 +85,34 @@ do_set_uuid (const char *device, const char *uuid) return r; } + +int +do_set_uuid_random (const char *device) +{ + int r; + + /* How we set the UUID depends on the filesystem type. */ + CLEANUP_FREE char *vfs_type = get_blkid_tag (device, "TYPE"); + if (vfs_type == NULL) + return -1; + + if (fstype_is_extfs (vfs_type)) + r = set_e2uuid_random (device); + + else if (STREQ (vfs_type, "xfs")) + r = xfs_set_uuid_random (device); + + else if (STREQ (vfs_type, "swap")) + r = swap_set_...
2015 Jun 30
0
[PATCH v4 7/7] New API: set_uuid_random
...5787f 100644 --- a/daemon/uuids.c +++ b/daemon/uuids.c @@ -85,3 +85,34 @@ do_set_uuid (const char *device, const char *uuid) return r; } + +int +do_set_uuid_random (const char *device) +{ + int r; + + /* How we set the UUID depends on the filesystem type. */ + CLEANUP_FREE char *vfs_type = get_blkid_tag (device, "TYPE"); + if (vfs_type == NULL) + return -1; + + if (fstype_is_extfs (vfs_type)) + r = set_e2uuid_random (device); + + else if (STREQ (vfs_type, "xfs")) + r = xfs_set_uuid_random (device); + + else if (STREQ (vfs_type, "swap")) + r = swap_set_...
2015 Jan 15
0
[PATCH 1/2] daemon: use btrfs(1) to get btrfs labels
...ntable_t *mountable) char * do_vfs_label (const mountable_t *mountable) { + CLEANUP_FREE char *type = do_vfs_type (mountable); + + if (type) { + if (STREQ (type, "btrfs") && optgroup_btrfs_available ()) + return btrfs_get_label (mountable->device); + } + return get_blkid_tag (mountable->device, "LABEL"); } diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 150c089..cf1507d 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -44,6 +44,30 @@ optgroup_btrfs_available (void) return prog_exists (str_btrfs) && filesystem_available ("btrfs&quot...
2015 Jun 30
13
[PATCH v4 0/7] uuid: add btrfs uuid change support and set_uuid_random
- Btrfs-progs v4.1 introduced new feature of changing uuid of btrfs partition. This patch add support of this. - Introduce set_uuid_random - uuids.c did a lot of deplicated work for changing uuid of fs. Use existing functions. v4: introduce get_random_uuid improve testcases squash internal API patches v3.1: fix typos v3: set errno if feature is not available. Chen Hanxiao (7):
2015 Jul 08
0
[PATCH 2/5] labels: move e2label to ext2.c and call it locally
...emon/daemon.h @@ -224,6 +224,7 @@ extern int sync_disks (void); #define EXT2_LABEL_MAX 16 extern int fstype_is_extfs (const char *fstype); extern int ext_set_uuid_random (const char *device); +extern int ext_set_label (const char *device, const char *label); /*-- in blkid.c --*/ extern char *get_blkid_tag (const char *device, const char *tag); diff --git a/daemon/ext2.c b/daemon/ext2.c index e8d2655..7bb1221 100644 --- a/daemon/ext2.c +++ b/daemon/ext2.c @@ -38,6 +38,7 @@ GUESTFSD_EXT_CMD(str_resize2fs, resize2fs); GUESTFSD_EXT_CMD(str_mke2fs, mke2fs); GUESTFSD_EXT_CMD(str_lsattr, lsattr); GUESTF...
2015 Oct 16
0
[PATCH 2/2] Include resize2fs_P into get_min_size.
...n.h +++ b/daemon/daemon.h @@ -224,6 +224,7 @@ extern int sync_disks (void); #define EXT2_LABEL_MAX 16 extern int fstype_is_extfs (const char *fstype); extern int ext_set_uuid_random (const char *device); +extern int64_t ext_get_min_size (const char *device); /*-- in blkid.c --*/ extern char *get_blkid_tag (const char *device, const char *tag); diff --git a/daemon/ext2.c b/daemon/ext2.c index 0cd6a66..fcf39de 100644 --- a/daemon/ext2.c +++ b/daemon/ext2.c @@ -279,8 +279,31 @@ do_resize2fs_M (const char *device) return 0; } +static int32_t +get_block_size (const char *device) +{ + CLEANUP_FREE_...
2015 Jun 30
0
[PATCH v4 6/7] daemon: add functions for setting random uuid of fs
...b/daemon/daemon.h @@ -223,6 +223,7 @@ extern int sync_disks (void); /* Confirmed this is true up to ext4 from the Linux sources. */ #define EXT2_LABEL_MAX 16 extern int fstype_is_extfs (const char *fstype); +extern int set_e2uuid_random (const char *device); /*-- in blkid.c --*/ extern char *get_blkid_tag (const char *device, const char *tag); @@ -265,6 +266,7 @@ extern int copy_xattrs (const char *src, const char *dest); /* Documented in xfs_admin(8). */ #define XFS_LABEL_MAX 12 extern int xfs_set_uuid (const char *device, const char *uuid); +extern int xfs_set_uuid_random (const char *device);...