Displaying 20 results from an estimated 50 matches for "is_dev".
2017 Aug 03
0
[PATCH 3/6] daemon: Refine check for Device and Dev_or_Path parameters (RHBZ#1477623).
For Device parameters we expect a block device name. However we were
only testing for "/dev/..." and so chardevs (from the appliance) could
be passed here, resulting in strange effects. This adds a function
is_device_parameter which tests for a valid block device name.
For Dev_or_Path parameters much the same, except we can also use the
is_device_parameter function elsewhere in the daemon to distinguish if
we were called with a device or path parameter. Previously we used a
simple test if the path begins w...
2012 Jul 24
3
[PATCH V4 1/3] umount: add force umount and lazy umount
...ory. (It has to be *or
@@ -187,12 +189,16 @@ do_mount_options (const char *options, const char *device,
* is kept updated.
*/
int
-do_umount (const char *pathordevice)
+do_umount (const char *pathordevice,
+ int force, int lazyunmount)
{
int r;
char *err;
char *buf;
int is_dev;
+ char prog[] = "umount";
+ const char *argv[MAX_ARGS];
+ size_t i = 0;
is_dev = STREQLEN (pathordevice, "/dev/", 5);
buf = is_dev ? strdup (pathordevice)
@@ -205,7 +211,22 @@ do_umount (const char *pathordevice)
if (is_dev)
RESOLVE_DEVICE (buf, , { free (buf...
2012 Jul 23
1
[PATCH V3 1/2] umount: add force umount and lazy umount
...ory. (It has to be *or
@@ -187,12 +189,16 @@ do_mount_options (const char *options, const char *device,
* is kept updated.
*/
int
-do_umount (const char *pathordevice)
+do_umount (const char *pathordevice,
+ int force, int lazyunmount)
{
int r;
char *err;
char *buf;
int is_dev;
+ char prog[] = "umount";
+ const char *argv[MAX_ARGS];
+ size_t i = 0;
is_dev = STREQLEN (pathordevice, "/dev/", 5);
buf = is_dev ? strdup (pathordevice)
@@ -205,7 +211,22 @@ do_umount (const char *pathordevice)
if (is_dev)
RESOLVE_DEVICE (buf, , { free (buf...
2016 Dec 14
0
[PATCH] daemon: expose file upload logic
...return -1;
+ }
+
+ if (close (fd) == -1) {
+ reply_with_perror ("close");
+ return -1;
+ }
+
+ return 0;
+}
+
/* Has one FileIn parameter. */
static int
upload (const char *filename, int flags, int64_t offset)
{
- struct write_cb_data data = { .written = 0 };
- int err, r, is_dev;
+ int err, is_dev, fd;
is_dev = STRPREFIX (filename, "/dev/");
if (!is_dev) CHROOT_IN;
- data.fd = open (filename, flags, 0666);
+ fd = open (filename, flags, 0666);
if (!is_dev) CHROOT_OUT;
- if (data.fd == -1) {
+ if (fd == -1) {
err = errno;
- r = cancel_receiv...
2017 Mar 12
0
[PATCH v4 1/7] daemon: expose file upload logic
...return -1;
+ }
+
+ if (close (fd) == -1) {
+ reply_with_perror ("close");
+ return -1;
+ }
+
+ return 0;
+}
+
/* Has one FileIn parameter. */
static int
upload (const char *filename, int flags, int64_t offset)
{
- struct write_cb_data data = { .written = 0 };
- int err, r, is_dev;
+ int err, is_dev, fd;
is_dev = STRPREFIX (filename, "/dev/");
if (!is_dev) CHROOT_IN;
- data.fd = open (filename, flags, 0666);
+ fd = open (filename, flags, 0666);
if (!is_dev) CHROOT_OUT;
- if (data.fd == -1) {
+ if (fd == -1) {
err = errno;
- r = cancel_receiv...
2017 Apr 06
0
[PATCH v6 1/7] daemon: expose file upload logic
...return -1;
+ }
+
+ if (close (fd) == -1) {
+ reply_with_perror ("close");
+ return -1;
+ }
+
+ return 0;
+}
+
/* Has one FileIn parameter. */
static int
upload (const char *filename, int flags, int64_t offset)
{
- struct write_cb_data data = { .written = 0 };
- int err, r, is_dev;
+ int err, is_dev, fd;
is_dev = STRPREFIX (filename, "/dev/");
if (!is_dev) CHROOT_IN;
- data.fd = open (filename, flags, 0666);
+ fd = open (filename, flags, 0666);
if (!is_dev) CHROOT_OUT;
- if (data.fd == -1) {
+ if (fd == -1) {
err = errno;
- r = cancel_receiv...
2017 Apr 23
0
[PATCH v7 1/7] daemon: expose file upload logic
...return -1;
+ }
+
+ if (close (fd) == -1) {
+ reply_with_perror ("close");
+ return -1;
+ }
+
+ return 0;
+}
+
/* Has one FileIn parameter. */
static int
upload (const char *filename, int flags, int64_t offset)
{
- struct write_cb_data data = { .written = 0 };
- int err, r, is_dev;
+ int r, err, is_dev, fd;
is_dev = STRPREFIX (filename, "/dev/");
if (!is_dev) CHROOT_IN;
- data.fd = open (filename, flags, 0666);
+ fd = open (filename, flags, 0666);
if (!is_dev) CHROOT_OUT;
- if (data.fd == -1) {
+ if (fd == -1) {
err = errno;
r = cancel_rec...
2016 Dec 14
2
[PATCH] daemon: expose file upload logic
Exposing file upload logic as suggested in previous patch:
https://www.redhat.com/archives/libguestfs/2016-November/msg00109.html
Matteo Cafasso (1):
daemon: expose upload logic
daemon/daemon.h | 3 +++
daemon/upload.c | 70 ++++++++++++++++++++++++++++++++-------------------------
2 files changed, 42 insertions(+), 31 deletions(-)
--
2.10.2
2012 Jul 23
3
[PATCH V2 1/4] mount: add a macro to resolve path or device
...char *buffer, size_t size)
} \
} while (0)
+/* Same as REQUIRE_ROOT_OR_RESOLVE_DEVICE but this strdup's the result. */
+#define STRDUP_RESOLVE_DEVICE_OR_PATH(path,buf,cancel_stmt,fail_stmt) \
+ do { \
+ int is_dev; \
+ is_dev = STREQLEN (path, "/dev/", 5); \
+ buf = is_dev ? strdup (path) \
+ : sysroot_path (path); \
+...
2015 Jun 19
2
[PATCH v2 1/2] Modify the function: analyze_line, make it more flexible
Mofify the function from a fixed delimiter to a variable. So,
it can be used in more APIs later. Also modified the existing
callers
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
daemon/btrfs.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 39392f7..caa28ca 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@
2015 Jun 16
2
[PATCH] New API: btrfs_device_stats
...(const char *path, int zero)
+{
+ const size_t MAX_ARGS = 64;
+ const char *argv[MAX_ARGS];
+ size_t i = 0;
+ CLEANUP_FREE char *buf = NULL;
+ CLEANUP_FREE char *err = NULL;
+ CLEANUP_FREE char *out = NULL;
+ char *p, *key = NULL, *value = NULL;
+ DECLARE_STRINGSBUF (ret);
+ int r;
+ int is_dev;
+
+ is_dev = STREQLEN (path, "/dev/", 5);
+ buf = is_dev ? strdup (path) : sysroot_path (path);
+ if (buf == NULL) {
+ reply_with_perror ("malloc");
+ return NULL;
+ }
+
+
+ ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "device");
+ ADD_ARG (argv, i,...
2015 Jun 19
3
[PATCH v3 1/2] Modify the function: analyze_line, make it more flexible
Mofify the function from a fixed delimiter to a variable. So,
it can be used in more APIs later. Also modified the existing
callers
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
daemon/btrfs.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 39392f7..caa28ca 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@
2017 Jul 14
0
[PATCH 03/27] daemon: Reimplement ‘file’ API in OCaml.
...write_device (const char *device, const char *content, size_t size,
return pwrite_fd (fd, content, size, offset, device, 1);
}
-/* This runs the 'file' command. */
-char *
-do_file (const char *path)
-{
- CLEANUP_FREE char *buf = NULL;
- const char *display_path = path;
- const int is_dev = STRPREFIX (path, "/dev/");
- struct stat statbuf;
-
- if (!is_dev) {
- buf = sysroot_path (path);
- if (!buf) {
- reply_with_perror ("malloc");
- return NULL;
- }
- path = buf;
-
- /* For non-dev, check this is a regular file, else just return the
-...
2012 Jul 21
5
[PATCH 1/5] mount: add a macro to resolve path or device
...} \
} while (0)
+/* Helper for functions which need either a root(/sysroot) path,
+ * OR a /dev/ device which exists.
+ */
+#define DUP_RESOLVE_DEVICE_OR_PATH(path,buf,cancel_stmt,fail_stmt) \
+ do { \
+ int is_dev; \
+ is_dev = STREQLEN (path, "/dev/", 5); \
+ buf = is_dev ? strdup (path) \
+ : sysroot_path (path); \
+...
2015 Jun 19
0
[PATCH v2 2/2] New API: btrfs_device_stats
...vice_stats (const char *path)
+{
+ const size_t MAX_ARGS = 64;
+ const char *argv[MAX_ARGS];
+ size_t i = 0;
+ CLEANUP_FREE char *buf = NULL;
+ CLEANUP_FREE char *err = NULL;
+ CLEANUP_FREE char *out = NULL;
+ char *p, *key = NULL, *value = NULL;
+ DECLARE_STRINGSBUF (ret);
+ int r;
+ int is_dev;
+
+ is_dev = STREQLEN (path, "/dev/", 5);
+ buf = is_dev ? strdup (path) : sysroot_path (path);
+ if (buf == NULL) {
+ reply_with_perror ("malloc");
+ return NULL;
+ }
+
+ ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "device");
+ ADD_ARG (argv, i, &q...
2015 Jun 19
0
[PATCH v3 2/2] New API: btrfs_device_stats
...vice_stats (const char *path)
+{
+ const size_t MAX_ARGS = 64;
+ const char *argv[MAX_ARGS];
+ size_t i = 0;
+ CLEANUP_FREE char *buf = NULL;
+ CLEANUP_FREE char *err = NULL;
+ CLEANUP_FREE char *out = NULL;
+ char *p, *key = NULL, *value = NULL;
+ DECLARE_STRINGSBUF (ret);
+ int r;
+ int is_dev;
+
+ is_dev = STREQLEN (path, "/dev/", 5);
+ buf = is_dev ? strdup (path) : sysroot_path (path);
+ if (buf == NULL) {
+ reply_with_perror ("malloc");
+ return NULL;
+ }
+
+ ADD_ARG (argv, i, str_btrfs);
+ ADD_ARG (argv, i, "device");
+ ADD_ARG (argv, i, &q...
2015 Jun 16
0
Re: [PATCH] New API: btrfs_device_stats
...;
> + CLEANUP_FREE char *buf = NULL;
> + CLEANUP_FREE char *err = NULL;
> + CLEANUP_FREE char *out = NULL;
> + char *p, *key = NULL, *value = NULL;
> + DECLARE_STRINGSBUF (ret);
'ret' is leaked if returning before "return ret.argv".
> + int r;
> + int is_dev;
> +
> + is_dev = STREQLEN (path, "/dev/", 5);
> + buf = is_dev ? strdup (path) : sysroot_path (path);
> + if (buf == NULL) {
> + reply_with_perror ("malloc");
> + return NULL;
> + }
> +
> +
> + ADD_ARG (argv, i, str_btrfs);
> + ADD_A...
2008 Mar 30
0
[PATCH] swfdec-mozilla: remove duplicate SWFDEC_CVS assignment
---
configure.ac | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/configure.ac b/configure.ac
index ce8192c..a55e446 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,6 @@ AC_INIT(swfdec-mozilla,0.7.1)
[is_dev=$(echo $PACKAGE_VERSION | sed 's/[0-9]\.[0-9][0-9]*\.[0-9]*[13579]/1/')]
if test x"$is_dev" = x1 ; then
SWFDEC_CVS="yes"
- SWFDEC_CVS="yes"
else
SWFDEC_CVS="no"
fi
2009 Nov 09
1
use STREQ(a,b), not strcmp(a,b) == 0
...uot;, 4)) {
/* Resolve the hostname. */
struct addrinfo *res, *rr;
struct addrinfo hints;
diff --git a/daemon/mount.c b/daemon/mount.c
index 463e789..5a27cea 100644
--- a/daemon/mount.c
+++ b/daemon/mount.c
@@ -112,7 +112,7 @@ do_umount (const char *pathordevice)
char *buf;
int is_dev;
- is_dev = strncmp (pathordevice, "/dev/", 5) == 0;
+ is_dev = STREQLEN (pathordevice, "/dev/", 5);
buf = is_dev ? strdup (pathordevice)
: sysroot_path (pathordevice);
if (buf == NULL) {
diff --git a/daemon/upload.c b/daemon/upload.c
index da86bd6..7b2c...
2015 Jun 17
3
[PATCH v2 1/2] Modify public function: analyze_line, make it more flexible
Mofify the function from fixed dilemiter to variabler. So,
it could be used in more APIs later. Also modified the existed caller
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
daemon/btrfs.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 39392f7..caa28ca 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@