Displaying 20 results from an estimated 30 matches for "block_dev_func_t".
2017 Jan 19
3
[PATCH 1/2] daemon: Fix part-to-dev when the partition name includes p<N>.
From: Pino Toscano <ptoscano@redhat.com>
If the device name ends with a number, Linux uses partition names of
the form <device>p<N>. Handle this case by knocking off the 'p'
character.
---
daemon/devsparts.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/daemon/devsparts.c b/daemon/devsparts.c
index 5862ae2..b764f63 100644
--- a/daemon/devsparts.c
+++
2017 Jan 19
0
[PATCH 2/2] daemon: Return MD partitions in guestfs_list_partitions (RHBZ#1414510).
...arts.c
index b764f63..852ee99 100644
--- a/daemon/devsparts.c
+++ b/daemon/devsparts.c
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
@@ -36,7 +37,7 @@ typedef int (*block_dev_func_t) (const char *dev, struct stringsbuf *r);
/* Execute a given function for each discovered block device */
static char **
-foreach_block_device (block_dev_func_t func)
+foreach_block_device (block_dev_func_t func, bool return_md)
{
CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (r);
DIR *dir;...
2009 Aug 06
1
[PATCH] Fix errno check in readdir in devsparts.c
---
daemon/devsparts.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/daemon/devsparts.c b/daemon/devsparts.c
index b89682c..e9c5e8f 100644
--- a/daemon/devsparts.c
+++ b/daemon/devsparts.c
@@ -40,7 +40,6 @@ foreach_block_device (block_dev_func_t func)
int size = 0, alloc = 0;
DIR *dir;
- struct dirent *d;
int err = 0;
dir = opendir ("/sys/block");
@@ -49,8 +48,11 @@ foreach_block_device (block_dev_func_t func)
return NULL;
}
- errno = 0;
- while ((d = readdir (dir)) != NULL) {
+ while(1) {
+ errno...
2009 Aug 03
1
[PATCH] Recognise cd-rom devices in devsparts.c
...------------
1 files changed, 116 insertions(+), 93 deletions(-)
diff --git a/daemon/devsparts.c b/daemon/devsparts.c
index 33579ba..0e056a1 100644
--- a/daemon/devsparts.c
+++ b/daemon/devsparts.c
@@ -29,57 +29,38 @@
#include "daemon.h"
#include "actions.h"
+typedef int (*block_dev_func_t)(const char *dev);
+
+static int foreach_block_device (block_dev_func_t func);
+
char **
do_list_devices (void)
{
char **r = NULL;
int size = 0, alloc = 0;
- DIR *dir;
- struct dirent *d;
- char buf[256];
-
- dir = opendir ("/sys/block");
- if (!dir) {
- reply_with_perror...
2017 Apr 19
1
[PATCH] daemon: Remove use of fixed-size stack buffers.
...O3 -mtune=broadwell’.
---
daemon/devsparts.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/daemon/devsparts.c b/daemon/devsparts.c
index 584e7d8b8..eac79197e 100644
--- a/daemon/devsparts.c
+++ b/daemon/devsparts.c
@@ -125,13 +125,16 @@ foreach_block_device (block_dev_func_t func, bool return_md)
static int
add_device (const char *device, struct stringsbuf *r)
{
- char dev_path[256];
- snprintf (dev_path, sizeof dev_path, "/dev/%s", device);
+ CLEANUP_FREE char *dev_path;
- if (add_string (r, dev_path) == -1) {
+ if (asprintf (&dev_path, "/...
2016 Jul 07
0
[PATCH 2/2] daemon: fix cleanup of stringsbuf usages
...olume)
if (end_stringsbuf (&ret) == -1)
return NULL;
- return ret.argv;
+ return take_stringsbuf (&ret);
}
int
diff --git a/daemon/devsparts.c b/daemon/devsparts.c
index 41c728c..c750c64 100644
--- a/daemon/devsparts.c
+++ b/daemon/devsparts.c
@@ -38,7 +38,7 @@ typedef int (*block_dev_func_t) (const char *dev, struct stringsbuf *r);
static char **
foreach_block_device (block_dev_func_t func)
{
- DECLARE_STRINGSBUF (r);
+ CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (r);
DIR *dir;
int err = 0;
struct dirent *d;
@@ -89,7 +89,6 @@ foreach_block_device (block_dev_func_t func)...
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
---
2017 Feb 14
0
[PATCH 2/2] GCC 7: Allocate sufficient space for sprintf output.
...free (out);
+ closedir (dir);
+ return NULL;
+ }
r = lstat (fname, &statbuf);
if (r == -1) {
diff --git a/daemon/devsparts.c b/daemon/devsparts.c
index f15d2c3..96e867f 100644
--- a/daemon/devsparts.c
+++ b/daemon/devsparts.c
@@ -43,7 +43,6 @@ foreach_block_device (block_dev_func_t func, bool return_md)
DIR *dir;
int err = 0;
struct dirent *d;
- char dev_path[256];
int fd;
dir = opendir ("/sys/block");
@@ -64,7 +63,12 @@ foreach_block_device (block_dev_func_t func, bool return_md)
STREQLEN (d->d_name, "sr", 2) ||
(ret...
2017 Feb 14
0
[PATCH v2 2/2] GCC 7: Allocate sufficient space for sprintf output.
...free (out);
+ closedir (dir);
+ return NULL;
+ }
r = lstat (fname, &statbuf);
if (r == -1) {
diff --git a/daemon/devsparts.c b/daemon/devsparts.c
index f15d2c3..96e867f 100644
--- a/daemon/devsparts.c
+++ b/daemon/devsparts.c
@@ -43,7 +43,6 @@ foreach_block_device (block_dev_func_t func, bool return_md)
DIR *dir;
int err = 0;
struct dirent *d;
- char dev_path[256];
int fd;
dir = opendir ("/sys/block");
@@ -64,7 +63,12 @@ foreach_block_device (block_dev_func_t func, bool return_md)
STREQLEN (d->d_name, "sr", 2) ||
(ret...
2017 Feb 14
4
[PATCH v2 0/2] GCC 7: Misc fixes
v1 -> v2:
- Use intprops macro suggested by danpb.
Rich.
2017 Apr 19
2
[PATCH v2] daemon: Remove use of fixed-size stack buffers.
v1 -> v2:
- Fixes as suggested by Pino.
Rich.
2017 Apr 19
0
[PATCH v2] daemon: Remove use of fixed-size stack buffers.
...O3 -mtune=broadwell’.
---
daemon/devsparts.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/daemon/devsparts.c b/daemon/devsparts.c
index 584e7d8b8..82467b92f 100644
--- a/daemon/devsparts.c
+++ b/daemon/devsparts.c
@@ -125,13 +125,16 @@ foreach_block_device (block_dev_func_t func, bool return_md)
static int
add_device (const char *device, struct stringsbuf *r)
{
- char dev_path[256];
- snprintf (dev_path, sizeof dev_path, "/dev/%s", device);
+ char *dev_path;
- if (add_string (r, dev_path) == -1) {
+ if (asprintf (&dev_path, "/dev/%s",...
2017 Feb 14
2
[PATCH 1/2] GCC 7: Add __attribute__((noreturn)) to some usage functions which call exit.
This happens with GCC 7.0.1. The errors were all of the form:
qemu-speed-test.c: In function 'main':
qemu-speed-test.c:153:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
usage (EXIT_SUCCESS);
^~~~~~~~~~~~~~~~~~~~
qemu-speed-test.c:155:5: note: here
default:
^~~~~~~
---
builder/index-validate.c | 2 +-
2011 Jun 09
15
[PATCH 00/13] Fix errors found using Coverity static analyzer.
I ran the Coverity static analyzer[1] on libguestfs, and fixed many
errors as a result.
Coverity found some errors in gnulib, but it doesn't seem to be worth
following those up since the version of gnulib we are using is so old.
There are a couple more errors (possibly 1 false-positive) which I'm
going to send in a separate email.
BTW all the errors found by Coverity were in the daemon
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.
2017 Jul 14
0
[PATCH 05/27] daemon: Reimplement several devsparts APIs in OCaml.
...ines_sb (char *str);
extern char **split_lines (char *str);
diff --git a/daemon/devsparts.c b/daemon/devsparts.c
index 82467b92f..1aacb8e16 100644
--- a/daemon/devsparts.c
+++ b/daemon/devsparts.c
@@ -33,263 +33,6 @@
#include "daemon.h"
#include "actions.h"
-typedef int (*block_dev_func_t) (const char *dev, struct stringsbuf *r);
-
-/* Execute a given function for each discovered block device */
-static char **
-foreach_block_device (block_dev_func_t func, bool return_md)
-{
- CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (r);
- DIR *dir;
- int err = 0;
- struct dirent *d;
- int f...
2015 Jul 17
1
[PATCH] daemon: add a space after func/macro to fit code-style
...ttern);
#define CORE_PATTERN "/proc/sys/kernel/core_pattern"
int fd = open (CORE_PATTERN, O_WRONLY|O_CLOEXEC);
diff --git a/daemon/devsparts.c b/daemon/devsparts.c
index 875238a..aebc213 100644
--- a/daemon/devsparts.c
+++ b/daemon/devsparts.c
@@ -53,7 +53,7 @@ foreach_block_device (block_dev_func_t func)
for (;;) {
errno = 0;
- d = readdir(dir);
+ d = readdir (dir);
if (!d) break;
if (STREQLEN (d->d_name, "sd", 2) ||
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index ee0aa43..5edfc69 100644
--- a/daemon/guestfsd.c
+++ b/daemon/guestfsd.c
@@ -1203...
2009 Nov 09
1
use STREQ(a,b), not strcmp(a,b) == 0
...v/", 5)) \
RESOLVE_DEVICE ((path), fail_stmt); \
else { \
NEED_ROOT (fail_stmt); \
diff --git a/daemon/devsparts.c b/daemon/devsparts.c
index 76852cc..60e7aa8 100644
--- a/daemon/devsparts.c
+++ b/daemon/devsparts.c
@@ -53,10 +53,10 @@ foreach_block_device (block_dev_func_t func)
struct dirent *d = readdir(dir);
if(NULL == d) break;
- if (strncmp (d->d_name, "sd", 2) == 0 ||
- strncmp (d->d_name, "hd", 2) == 0 ||
- strncmp (d->d_name, "vd", 2) == 0 ||
- strncmp (d->d_name, "sr", 2)...
2016 Feb 23
4
[PATCH v3 0/4] [FOR COMMENTS ONLY] Rework inspection.
Previously posted:
https://www.redhat.com/archives/libguestfs/2015-December/msg00038.html
Inspection now really succeeds on a small number of simple guests.
To test it out:
$ ./run guestfish -v -x -a /tmp/centos-6.img
><fs> run
><fs> debug sh "guestfs-inspection --verbose"
Rich.
2017 Jun 03
12
[PATCH v2 00/12] Allow APIs to be implemented in OCaml.
Version 1 was here:
https://www.redhat.com/archives/libguestfs/2017-June/msg00003.html
This patch series reimplements a few more APIs in OCaml, including
some very important core APIs like ?list_filesystems? and ?mount?.
All the tests pass after this.
The selection of APIs that I have moved may look a little random, but
in fact they are all APIs consumed by the inspection code (and some
more