Displaying 20 results from an estimated 26 matches for "guestfs___parse_unsigned_int".
2013 Nov 03
2
[PATCH stable-1.24] Fix fstab block device resolution for FreeBSD
...to Linux
+ * device names is straight forward. Partitions on a virtio disk are
+ * prefixed with vtbd. IDE hard drives used to be prefixed with ad and now
+ * are with ada.
+ */
+ char type_c = (strcmp (type, "vtbd") == 0) ? 'v' : 's';
+ int disk_i = guestfs___parse_unsigned_int (g, disk);
+ int part_i = guestfs___parse_unsigned_int (g, part);
+ free (type);
+ free (disk);
+ free (part);
+
+ if (disk_i != -1 && disk_i <= 26 && part_i > 0 && part_i <= 128)
+ device = safe_asprintf (g, "/dev/%cd%c%d", type_c, dis...
2013 Nov 05
2
[PATCH stable-1.24] Fix fstab block device resolution for FreeBSD
...isk, &part)) {
+ /* If the FreeBSD disk contains GPT partitions, the translation to Linux
+ * device names is straight forward. Partitions on a virtio disk are
+ * prefixed with vtbd. IDE hard drives used to be prefixed with ad and now
+ * are with ada.
+ */
+ int disk_i = guestfs___parse_unsigned_int (g, disk);
+ int part_i = guestfs___parse_unsigned_int (g, part);
+ free (type);
+ free (disk);
+ free (part);
+
+ if (disk_i != -1 && disk_i <= 26 && part_i > 0 && part_i <= 128)
+ device = safe_asprintf (g, "/dev/sd%c%d", disk_i + ...
2014 Dec 02
0
[PATCH 2/5] inspect_os: Add support for detecting OpenBSD
...fs->distro = OS_DISTRO_OPENBSD;
+
+ /* Before the first boot, the first line will look like this:
+ *
+ * OpenBSD ?.? (UNKNOWN)
+ */
+ if ((fs->product_name[8] != '?') && (fs->product_name[10] != '?')) {
+ fs->major_version = guestfs___parse_unsigned_int (g, major);
+ if (fs->major_version == -1)
+ return -1;
+
+ fs->minor_version = guestfs___parse_unsigned_int (g, minor);
+ if (fs->minor_version == -1)
+ return -1;
+ }
+ }
+ } else {
+ return -1;
+ }
+
+ /* Determine the architecture. *...
2013 Nov 04
0
Re: [PATCH stable-1.24] Fix fstab block device resolution for FreeBSD
On Sun, Nov 03, 2013 at 11:16:23PM +0200, Nikos Skalkotos wrote:
> + char type_c = (strcmp (type, "vtbd") == 0) ? 'v' : 's';
> int disk_i = guestfs___parse_unsigned_int (g, disk);
> int slice_i = guestfs___parse_unsigned_int (g, slice);
> int part_i = part[0] - 'a' /* counting from 0 */;
> @@ -1481,7 +1501,7 @@ resolve_fstab_device (guestfs_h *g, const char *spec, Hash_table *md_map)
> if (disk_i != -1 && disk_i <= 26...
2014 Dec 03
1
[PATCH 1/4] inspect_os: Add support for detecting OpenBSD
...fs->distro = OS_DISTRO_OPENBSD;
+
+ /* Before the first boot, the first line will look like this:
+ *
+ * OpenBSD ?.? (UNKNOWN)
+ */
+ if ((fs->product_name[8] != '?') && (fs->product_name[10] != '?')) {
+ fs->major_version = guestfs___parse_unsigned_int (g, major);
+ if (fs->major_version == -1)
+ return -1;
+
+ fs->minor_version = guestfs___parse_unsigned_int (g, minor);
+ if (fs->minor_version == -1)
+ return -1;
+ }
+ }
+ } else {
+ return -1;
+ }
+
+ /* Determine the architecture. *...
2012 Sep 21
1
[PATCH] Update SuSE Linux detection.
...if (match (g, fs->product_name, re_sles) || match (g, fs->product_name, re_nld)) {
+ fs->distro = OS_DISTRO_SLES;
+
+ /* Second line contains version string */
+ if (lines[1] == NULL)
+ goto out;
+ major = match1 (g, lines[1], re_sles_version);
+ fs->major_version = guestfs___parse_unsigned_int (g, major);
+ free (major);
+ if (fs->major_version == -1)
+ goto out;
+
+ /* Third line contains service pack string */
+ if (lines[2] == NULL)
+ goto out;
+ minor = match1 (g, lines[2], re_sles_patchlevel);
+ fs->minor_version = guestfs___parse_unsigned_int (g, m...
2014 Nov 17
1
[PATCH] inspection: deb: Seperate epoch field from version
...(&line[9], '-');
- if (p) {
- *p = '\0';
- version = safe_strdup (g, &line[9]);
- release = safe_strdup (g, p+1);
+ char *p1, *p2;
+ p1 = strchr (&line[9], ':');
+ if (p1) {
+ *p1++ = '\0';
+ epoch = guestfs___parse_unsigned_int (g, &line[9]); /* -1 on error */
+ } else {
+ p1 = &line[9];
+ epoch = 0;
+ }
+ p2 = strchr (p1, '-');
+ if (p2) {
+ *p2++ = '\0';
+ release = safe_strdup (g, p2);
} else {
- version = safe_strdup (g, &line[9]...
2014 Dec 03
0
[PATCH 2/4] Support fstab block device resolution for NetBSD
...uot;/dev/sd%c%d", disk_i + 'a', part_i + 5);
}
}
- else if (match3 (g, spec, re_openbsd_dev, &type, &disk, &part)) {
+ else if ((os_type == OS_TYPE_NETBSD) &&
+ match3 (g, spec, re_netbsd_dev, &type, &disk, &part)) {
+ int disk_i = guestfs___parse_unsigned_int (g, disk);
+ int part_i = part[0] - 'a'; /* counting from 0 */
+ free (type);
+ free (disk);
+ free (part);
+
+ if (part_i > 3)
+ /* Partition 'c' is the disklabel partition and 'd' the hard disk itself.
+ * Not mapped under Linux.
+ */
+...
2014 Dec 02
0
[PATCH 3/5] Support fstab block device resolution for NetBSD
...uot;/dev/sd%c%d", disk_i + 'a', part_i + 5);
}
}
- else if (match3 (g, spec, re_openbsd_dev, &type, &disk, &part)) {
+ else if ((os_type == OS_TYPE_NETBSD) &&
+ match3 (g, spec, re_netbsd_dev, &type, &disk, &part)) {
+ int disk_i = guestfs___parse_unsigned_int (g, disk);
+ int part_i = part[0] - 'a'; /* counting from 0 */
+ free (type);
+ free (disk);
+ free (part);
+
+ if (part_i > 3)
+ /* Partition 'c' is the disklabel partition and 'd' the hard disk itself.
+ * Not mapped under Linux.
+ */
+...
2014 Nov 17
2
Re: [PATCH] list-applications: Add support for pacman
...ng, I left out of the patch the epoch translation. Pacman's
version formats looks like this: epoch:version-rel. You have the epoch
hard-coded to 0 in list_applications_deb() and
list_applications_rpm(), so I did the same but I can implement it for
the sake of completeness. Should I be using the
guestfs___parse_unsigned_int() function for the string to int
conversion?
Nikos
On 17 November 2014 00:16, Richard W.M. Jones <rjones@redhat.com> wrote:
> On Sun, Nov 16, 2014 at 03:24:16PM +0200, Nikos Skalkotos wrote:
>> Extend the guestfs_inspect_list_applications2 API call to work on Arch
>> Linux gu...
2014 Sep 23
1
[PATCH] inspect: map Hurd devices, and enable fstab introspection
..., re_hurd_dev, &type, &disk, &part)) {
+ /* Hurd disk devices are like /dev/hdNsM, where hdN is the
+ * N-th disk and M is the M-th partition on that disk.
+ * Turn the disk number into a letter-based identifier, so
+ * we can resolve it easily.
+ */
+ int disk_i = guestfs___parse_unsigned_int (g, disk);
+ char disk_as_letter[2] = { 0 };
+ disk_as_letter[0] = disk_i + 'a';
+ r = resolve_fstab_device_xdev (g, type, disk_as_letter, part, &device);
+ free (type);
+ free (disk);
+ free (part);
+ if (r == -1)
+ return NULL;
+ }
/* Didn't match d...
2014 Sep 22
1
[PATCH] inspect: basic Minix support
...GUESTFS_IS_FILE_OPTS_FOLLOWSYMLINKS, 1, -1) > 0) {
+ char *major, *minor;
+ if (parse_release_file (g, fs, "/etc/version") == -1)
+ return -1;
+
+ if (match2 (g, fs->product_name, re_minix, &major, &minor)) {
+ fs->major_version = guestfs___parse_unsigned_int (g, major);
+ free (major);
+ if (fs->major_version == -1) {
+ free (minor);
+ return -1;
+ }
+ fs->minor_version = guestfs___parse_unsigned_int (g, minor);
+ free (minor);
+ if (fs->minor_version == -1)
+ return -1;
+ }
+ } else {
+...
2015 Feb 14
2
[PATCH 0/2] Change guestfs__*
libguestfs has used double and triple underscores in identifiers.
These aren't valid for global names in C++.
(http://stackoverflow.com/a/228797)
These large but completely mechanical patches change the illegal
identifiers to legal ones.
Rich.
2014 Nov 17
0
Re: [PATCH] list-applications: Add support for pacman
...an's
> version formats looks like this: epoch:version-rel. You have the epoch
> hard-coded to 0 in list_applications_deb() and
> list_applications_rpm(),
Hmm, this is a bug ...
> so I did the same but I can implement it for
> the sake of completeness. Should I be using the
> guestfs___parse_unsigned_int() function for the string to int
> conversion?
Yes, or sscanf.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many...
2014 Nov 17
3
Re: [PATCH] list-applications: Add support for pacman
...ks like this: epoch:version-rel. You have the epoch
>> hard-coded to 0 in list_applications_deb() and
>> list_applications_rpm(),
>
> Hmm, this is a bug ...
>
>> so I did the same but I can implement it for
>> the sake of completeness. Should I be using the
>> guestfs___parse_unsigned_int() function for the string to int
>> conversion?
>
> Yes, or sscanf.
>
> Rich.
>
> --
> Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> Read my programming and virtualization blog: http://rwmj.wordpress.com
> virt-top is 'top'...
2014 Dec 03
0
[PATCH 4/4] Add freebsd and netbsd distros
...istrator might edit, but
@@ -634,6 +635,7 @@ guestfs___check_netbsd_root (guestfs_h *g, struct inspect_fs *fs)
if (match2 (g, fs->product_name, re_netbsd, &major, &minor)) {
fs->type = OS_TYPE_NETBSD;
+ fs->distro = OS_DISTRO_NETBSD;
fs->major_version = guestfs___parse_unsigned_int (g, major);
free (major);
if (fs->major_version == -1) {
diff --git a/src/inspect-fs.c b/src/inspect-fs.c
index aaddb49..e9cc2e9 100644
--- a/src/inspect-fs.c
+++ b/src/inspect-fs.c
@@ -448,6 +448,8 @@ guestfs___check_package_format (guestfs_h *g, struct inspect_fs *fs)
case OS_...
2014 Dec 02
0
[PATCH 5/5] Add freebsd and netbsd distros
...istrator might edit, but
@@ -634,6 +635,7 @@ guestfs___check_netbsd_root (guestfs_h *g, struct inspect_fs *fs)
if (match2 (g, fs->product_name, re_netbsd, &major, &minor)) {
fs->type = OS_TYPE_NETBSD;
+ fs->distro = OS_DISTRO_NETBSD;
fs->major_version = guestfs___parse_unsigned_int (g, major);
free (major);
if (fs->major_version == -1) {
diff --git a/src/inspect-fs.c b/src/inspect-fs.c
index aaddb49..e9cc2e9 100644
--- a/src/inspect-fs.c
+++ b/src/inspect-fs.c
@@ -448,6 +448,8 @@ guestfs___check_package_format (guestfs_h *g, struct inspect_fs *fs)
case OS_...
2014 Nov 17
1
[PATCH] list-applications: Add support for pacman
...+
+ if ((name == NULL) || (version == NULL) || (arch == NULL))
+ /* Those are mandatory fields. The file is corrupted */
+ goto after_add_application;
+
+ /* version: [epoch:]ver-rel */
+ p = strchr (version, ':');
+ if (p) {
+ *p = '\0';
+ epoch = guestfs___parse_unsigned_int (g, version); /* -1 on error */
+ ver = p + 1;
+ } else {
+ epoch = 0;
+ ver = version;
+ }
+
+ p = strchr (ver, '-');
+ if (p) {
+ *p = '\0';
+ rel = p + 1;
+ } else /* release is a mandatory field */
+ goto after_add_application;
+
+...
2014 Nov 27
2
[PATCH 1/1] inspect: Fix a bug in the *BSD root detection
..._h *g, const char *);
extern int guestfs___is_dir_nocase (guestfs_h *g, const char *);
extern int guestfs___check_for_filesystem_on (guestfs_h *g,
const char *mountable);
+extern void guestfs___check_for_dublicated_bsd_root(guestfs_h *g);
extern int guestfs___parse_unsigned_int (guestfs_h *g, const char *str);
extern int guestfs___parse_unsigned_int_ignore_trailing (guestfs_h *g, const char *str);
extern int guestfs___parse_major_minor (guestfs_h *g, struct inspect_fs *fs);
diff --git a/src/inspect-fs.c b/src/inspect-fs.c
index 539d814..99a8658 100644
--- a/src/inspect-...
2011 Oct 13
9
[PATCH 1/9] Partially fix --disable-erlang
From: Michael Scherer <misc at zarb.org>
Without this, configure will always enable erlang, no matter what
argument are passed. Now, we can disable it, even if configure still
need the erlang compiler for some obscure reason.
---
configure.ac | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 337a3ed..e0bed2f 100644
---