search for: do_tune2fs_l

Displaying 20 results from an estimated 27 matches for "do_tune2fs_l".

2015 Oct 19
1
Re: [PATCH 2/2] Include resize2fs_P into vfs_min_size.
...r *device) > return 0; > } > > +static int32_t > +get_block_size (const char *device) > +{ > + CLEANUP_FREE_STRING_LIST char **params = NULL; > + const char *block_pattern = "Block size"; > + size_t i; > + int32_t block_size; > + > + params = do_tune2fs_l (device); This works, yes, although maybe there should be a way to run tune2fs -l and traverse its output to either build a return hash (i.e. what do_tune2fs_l currently does) or just lookup one or more keys (like needed here). > + if (params == NULL) > + return -1; > + > + for (...
2015 Jul 08
0
[PATCH 2/5] labels: move e2label to ext2.c and call it locally
...38,7 @@ GUESTFSD_EXT_CMD(str_resize2fs, resize2fs); GUESTFSD_EXT_CMD(str_mke2fs, mke2fs); GUESTFSD_EXT_CMD(str_lsattr, lsattr); GUESTFSD_EXT_CMD(str_chattr, chattr); +GUESTFSD_EXT_CMD(str_e2label, e2label); /* https://bugzilla.redhat.com/show_bug.cgi?id=978302#c1 */ int @@ -123,14 +124,30 @@ do_tune2fs_l (const char *device) } int +ext_set_label (const char *device, const char *label) +{ + int r; + CLEANUP_FREE char *err = NULL; + + if (strlen (label) > EXT2_LABEL_MAX) { + reply_with_error ("%s: ext2 labels are limited to %d bytes", + label, EXT2_LABEL_MA...
2015 Oct 19
5
[PATCHv2 0/2] Introduce vfs_min_size API to get minimum filesystem size.
Tried to make it in accordance with your comments. Difference to v1: Added reply_with_error where necessary. Changed name get_min_size -> vfs_min_size. Maxim Perevedentsev (2): New API: vfs_min_size Include resize2fs_P into vfs_min_size. daemon/Makefile.am | 1 + daemon/daemon.h | 2 ++ daemon/ext2.c | 45 ++++++++++++++++++++++++++----- daemon/fs-min-size.c | 49
2015 Oct 16
0
[PATCH 2/2] Include resize2fs_P into get_min_size.
...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_STRING_LIST char **params = NULL; + const char *block_pattern = "Block size"; + size_t i; + int32_t block_size; + + params = do_tune2fs_l (device); + if (params == NULL) + return -1; + + for (i = 0; params[i] != NULL; i += 2) { + if ((!strcmp (params[i], block_pattern))) { + if (sscanf (params[i + 1], "%" SCNd32, &block_size) != 1) + return -1; + return block_size; + } + } + + return -1; +}...
2015 Oct 19
0
[PATCH 2/2] Include resize2fs_P into vfs_min_size.
...daemon/ext2.c @@ -279,8 +279,34 @@ do_resize2fs_M (const char *device) return 0; } +static int32_t +get_block_size (const char *device) +{ + CLEANUP_FREE_STRING_LIST char **params = NULL; + const char *block_pattern = "Block size"; + size_t i; + int32_t block_size; + + params = do_tune2fs_l (device); + if (params == NULL) + return -1; + + for (i = 0; params[i] != NULL; i += 2) { + if ((!strcmp (params[i], block_pattern))) { + if (sscanf (params[i + 1], "%" SCNd32, &block_size) != 1) { + reply_with_error("Cannot parse block size"); + r...
2015 Oct 20
0
[PATCHv3 2/2] Include resize2fs_P into vfs_min_size.
...efine MAX_ARGS 128 @@ -279,15 +280,41 @@ do_resize2fs_M (const char *device) return 0; } +static long +get_block_size (const char *device) +{ + CLEANUP_FREE_STRING_LIST char **params = NULL; + const char *block_pattern = "Block size"; + size_t i; + long block_size; + + params = do_tune2fs_l (device); + if (params == NULL) + return -1; + + for (i = 0; params[i] != NULL; i += 2) { + if (STREQ (params[i], block_pattern)) { + if (xstrtol (params[i + 1], NULL, 10, &block_size, NULL) != LONGINT_OK) { + reply_with_error ("Cannot parse block size"); +...
2016 Jul 07
0
[PATCH 2/2] daemon: fix cleanup of stringsbuf usages
...-1) goto error; - return ret.argv; /* caller frees */ + return take_stringsbuf (&ret); /* caller frees */ error: if (dir) diff --git a/daemon/ext2.c b/daemon/ext2.c index 95a65ae..e556095 100644 --- a/daemon/ext2.c +++ b/daemon/ext2.c @@ -55,7 +55,7 @@ do_tune2fs_l (const char *device) int r; CLEANUP_FREE char *out = NULL, *err = NULL; char *p, *pend, *colon; - DECLARE_STRINGSBUF (ret); + CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (ret); r = command (&out, &err, str_tune2fs, "-l", device, NULL); if (r == -1) { @@ -121,7 +1...
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 Jul 08
5
[PATCH v2 0/4] labels: rework
We should use the existing function from specific fs, if not, move it to specific fs files. Chen Hanxiao (4): labels: move e2label to ext2.c and call it directly labels: move ntfslabel to ntfs.c labels: use existing do_xfs_admin for xfslabel labels: return ENOTSUP if could not set label for specific fs daemon/daemon.h | 2 ++ daemon/ext2.c | 23 ++++++++++++-----
2015 Oct 20
4
[PATCHv3 0/2] Introduce vfs_min_size API to get minimum filesystem size.
Tried to make it in accordance with your comments. Difference to v1: Added reply_with_error where necessary. Changed name get_min_size -> vfs_min_size. Difference to v2: Changed name to vfs_minimum_size. Changed parsing to xstrtol + STR* macros where possible. Maxim Perevedentsev (2): New API: vfs_min_size Include resize2fs_P into vfs_min_size. daemon/Makefile.am | 1 +
2015 Oct 16
4
[PATCH 0/2] Introduce get_min_size API to get minimum filesystem size.
Tried to make it in accordance with your comments. Maybe you can suggest a better name for API? Maxim Perevedentsev (2): New API: get_min_size Include resize2fs_P into get_min_size. daemon/Makefile.am | 1 + daemon/daemon.h | 2 ++ daemon/ext2.c | 37 ++++++++++++++++++++++++---- daemon/fs-min-size.c | 49 +++++++++++++++++++++++++++++++++++++ daemon/ntfs.c | 68
2009 Sep 24
1
enabling more syntax-checks
...c @@ -21,10 +21,10 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <ctype.h> #include "../src/guestfs_protocol.h" #include "daemon.h" +#include "c-ctype.h" #include "actions.h" char ** @@ -72,7 +72,7 @@ do_tune2fs_l (const char *device) if (colon) { *colon = '\0'; - do { colon++; } while (*colon && isspace (*colon)); + do { colon++; } while (*colon && c_isspace (*colon)); if (add_string (&ret, &size, &alloc, p) == -1) { free (out); @@...
2012 Mar 13
2
[PATCH 0/2] 'int' to 'size_t' changes
These two patches are probably not completely independent, but separating them is a lot of work. With *both* patches applied, all the tests and extra-tests pass. That's no guarantee however that there isn't a mistake, so I don't think this patch is a candidate for the 1.16 branch, until it's had a lot more testing in development. Rich.
2015 Jul 08
9
[PATCH 0/5] labels: rework
We should use the existing function from specific fs, if not, move it to specific fs files. Chen Hanxiao (5): label: move btrfslabel to btrfs.c label: move e2label to ext2.c and call it locally label: move ntfslabel to ntfs.c label: use existing do_xfs_admin for xfslabel labels: return ENOTSUP if could not set label for specific fs daemon/btrfs.c | 16 +++++++++++ daemon/daemon.h |
2015 Oct 20
8
[PATCHv4 0/2] Introduce vfs_minimum_size API to get minimum filesystem size.
Tried to make it in accordance with your comments. Difference to v1: Added reply_with_error where necessary. Changed name get_min_size -> vfs_min_size. Difference to v2: Changed name to vfs_minimum_size. Changed parsing to xstrtol + STR* macros where possible. Difference to v3: Decapitalize error messages. Maxim Perevedentsev (2): New API: vfs_minimum_size Include resize2fs_P into
2009 Nov 09
1
use STREQ(a,b), not strcmp(a,b) == 0
...e)) == 0) { + if (STREQLEN (d->d_name, device, strlen (device))) { char part[256]; snprintf (part, sizeof part, "/dev/%s", d->d_name); diff --git a/daemon/ext2.c b/daemon/ext2.c index 0021a06..14cbb3c 100644 --- a/daemon/ext2.c +++ b/daemon/ext2.c @@ -48,7 +48,7 @@ do_tune2fs_l (const char *device) p = out; /* Discard the first line if it contains "tune2fs ...". */ - if (strncmp (p, "tune2fs ", 8) == 0) { + if (STREQLEN (p, "tune2fs ", 8)) { p = strchr (p, '\n'); if (p) p++; else { diff --git a/daemon/file.c b/...
2012 Feb 27
4
[PATCH 0/4] Add various ntfs* tools and unify label setting.
This miscellaneous patch adds bindings for: - ntfsfix - ntfsclone - ntfslabel and unifies filesystem label setting through a single API 'set-label' which replaces 'set-e2label' and is also able to set labels on NTFS using the ntfslabel program. 'ntfsfix' has been added as a possible way to fix RHBZ#797760. However I have not found a way to fully fix this bug. See
2009 Aug 12
23
[PATCH 0/23] factor and const-correctness
This started as a simple warning-elimination change. I'll get back to that series shortly ;-) It turned into a factorization and constification exercise during which I got a taste of ocaml. Thanks to Rich Jones for help with a few snippets in generator.ml. The overall result is that many previously-manually-maintained bits from daemon/*.c functions are now hoisted into the automatically-
2012 Aug 30
2
[PATCH v2] daemon: collect list of called external commands
...c @@ -31,6 +31,13 @@ #define MAX_ARGS 64 +GUESTFSD_EXT_CMD(str_tune2fs, tune2fs); +GUESTFSD_EXT_CMD(str_e2fsck, e2fsck); +GUESTFSD_EXT_CMD(str_resize2fs, resize2fs); +GUESTFSD_EXT_CMD(str_mke2fs, mke2fs); +GUESTFSD_EXT_CMD(str_lsattr, lsattr); +GUESTFSD_EXT_CMD(str_chattr, chattr); + char ** do_tune2fs_l (const char *device) { @@ -39,7 +46,7 @@ do_tune2fs_l (const char *device) char *p, *pend, *colon; DECLARE_STRINGSBUF (ret); - r = command (&out, &err, "tune2fs", "-l", device, NULL); + r = command (&out, &err, str_tune2fs, "-l", device, NULL...
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