]> git.pld-linux.org Git - packages/parted.git/blob - 0064-libparted-tests-Move-get_sector_size-to-common.c.patch
- release 6 (by relup.sh)
[packages/parted.git] / 0064-libparted-tests-Move-get_sector_size-to-common.c.patch
1 From 105746f40724d94499a04a0d7036380aaa41c1f5 Mon Sep 17 00:00:00 2001
2 From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
3 Date: Sun, 4 Dec 2016 17:12:45 +0100
4 Subject: [PATCH 64/75] libparted:tests: Move get_sector_size() to common.c
5
6 Moving get_sector_size() from disk.c to common.c allows
7 us to use it in _implemented_disk_label() to test for
8 512-byte sectors. This change is required to be able to
9 enable this test for atari partition tables for which
10 support is added in a follow-up patch.
11
12 Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
13 Signed-off-by: Brian C. Lane <bcl@redhat.com>
14 ---
15  libparted/tests/common.c | 14 ++++++++++++++
16  libparted/tests/common.h |  5 +++++
17  libparted/tests/disk.c   | 15 ---------------
18  3 files changed, 19 insertions(+), 15 deletions(-)
19
20 diff --git a/libparted/tests/common.c b/libparted/tests/common.c
21 index a0be997..9115686 100644
22 --- a/libparted/tests/common.c
23 +++ b/libparted/tests/common.c
24 @@ -7,9 +7,23 @@
25  #include <check.h>
26  
27  #include "common.h"
28 +#include "xstrtol.h"
29  
30  #define STREQ(a, b) (strcmp (a, b) == 0)
31  
32 +size_t get_sector_size (void)
33 +{
34 +  char *p = getenv ("PARTED_SECTOR_SIZE");
35 +  size_t ss = 512;
36 +  unsigned long val;
37 +  if (p
38 +      && xstrtoul (p, NULL, 10, &val, NULL) == LONGINT_OK
39 +      && val % 512 == 0)
40 +    ss = val;
41 +
42 +  return ss;
43 +}
44 +
45  PedExceptionOption
46  _test_exception_handler (PedException* e)
47  {
48 diff --git a/libparted/tests/common.h b/libparted/tests/common.h
49 index 1b1c801..5d7485e 100644
50 --- a/libparted/tests/common.h
51 +++ b/libparted/tests/common.h
52 @@ -1,5 +1,10 @@
53  #include <parted/parted.h>
54  
55 +/* Determine sector size from environment
56 + *
57 + */
58 +size_t get_sector_size (void);
59 +
60  /* Create an empty disk image
61   *
62   * filename: file (with full path) where to write the disk image
63 diff --git a/libparted/tests/disk.c b/libparted/tests/disk.c
64 index 48561b9..62d20c1 100644
65 --- a/libparted/tests/disk.c
66 +++ b/libparted/tests/disk.c
67 @@ -7,24 +7,9 @@
68  
69  #include "common.h"
70  #include "progname.h"
71 -#include "xstrtol.h"
72  
73  static char* temporary_disk;
74  
75 -static
76 -size_t get_sector_size (void)
77 -{
78 -  char *p = getenv ("PARTED_SECTOR_SIZE");
79 -  size_t ss = 512;
80 -  unsigned long val;
81 -  if (p
82 -      && xstrtoul (p, NULL, 10, &val, NULL) == LONGINT_OK
83 -      && val % 512 == 0)
84 -    ss = val;
85 -
86 -  return ss;
87 -}
88 -
89  static void
90  create_disk (void)
91  {
92 -- 
93 2.9.3
94
This page took 0.037887 seconds and 3 git commands to generate.