[gfs2-utils] branch master updated: libgfs2: Remove new_rgrps from
struct gfs2_sbd
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
The following commit(s) were added to refs/heads/master by this push:
new c0ea1bc4 libgfs2: Remove new_rgrps from struct gfs2_sbd
c0ea1bc4 is described below
commit c0ea1bc41123b44f9211cacf3d3f7f4e7e79d387
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Fri Nov 12 16:20:58 2021 +0000
libgfs2: Remove new_rgrps from struct gfs2_sbd
This field hasn't been used outside of compute_rgrp_layout() since 2014.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/rgrepair.c | 7 +++----
gfs2/libgfs2/libgfs2.h | 1 -
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
index 6698b29c..129e3e5c 100644
--- a/gfs2/fsck/rgrepair.c
+++ b/gfs2/fsck/rgrepair.c
@@ -758,7 +758,6 @@ static void compute_rgrp_layout(struct gfs2_sbd *sdp, struct osi_root *rgtree, i
unsigned int rgrp = 0, nrgrp, rglength;
uint64_t rgaddr;
- sdp->new_rgrps = 0;
dev = &sdp->device;
/* If this is a new file system, compute the length and number */
@@ -768,9 +767,9 @@ static void compute_rgrp_layout(struct gfs2_sbd *sdp, struct osi_root *rgtree, i
dev->length -= LGFS2_SB_ADDR(sdp) + 1;
nrgrp = how_many_rgrps(sdp, dev, rgsize_specified);
rglength = dev->length / nrgrp;
- sdp->new_rgrps = nrgrp;
} else {
uint64_t old_length, new_chunk;
+ unsigned new_rgrps;
printf("Existing resource groups:\n");
for (rgrp = 0, n = osi_first(rgtree); n; n = next, rgrp++) {
@@ -788,8 +787,8 @@ static void compute_rgrp_layout(struct gfs2_sbd *sdp, struct osi_root *rgtree, i
rlast->length = rglength;
old_length = rlast->rt_addr + rglength;
new_chunk = dev->length - old_length;
- sdp->new_rgrps = new_chunk / rglength;
- nrgrp = rgrp + sdp->new_rgrps;
+ new_rgrps = new_chunk / rglength;
+ nrgrp = rgrp + new_rgrps;
}
if (rgrp < nrgrp)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 2b816f3c..dd97441f 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -376,7 +376,6 @@ struct gfs2_sbd {
uint64_t orig_rgrps;
uint64_t rgrps;
- uint64_t new_rgrps;
struct osi_root rgtree;
struct osi_root rgcalc;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 5 months
[gfs2-utils] branch master updated: tests: Increase the size of the
sparse file used by tests
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
The following commit(s) were added to refs/heads/master by this push:
new 1f20df9c tests: Increase the size of the sparse file used by tests
1f20df9c is described below
commit 1f20df9cf4c2aa36258c70a4ffbed7a2a87aaf7b
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Tue Nov 9 15:22:15 2021 +0000
tests: Increase the size of the sparse file used by tests
Bump the size of the 'testvol' sparse file that the tests use to 20G.
The actual disk space used is more like 200M which should be fine for
build environments. The increased size allows more resource groups to be
created in tests that use a larger resource group size.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
tests/atlocal.in | 2 +-
tests/edit.at | 4 ++--
tests/tune.at | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/atlocal.in b/tests/atlocal.in
index b021b132..b0f22f10 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -1,5 +1,5 @@
GFS_TGT="$abs_builddir/testvol"
-GFS_TGT_SZ=10
+GFS_TGT_SZ=20
GFS_MKFS="mkfs.gfs2 -O -D"
gfs_max_blocks()
diff --git a/tests/edit.at b/tests/edit.at
index d70d012e..d6795218 100644
--- a/tests/edit.at
+++ b/tests/edit.at
@@ -6,8 +6,8 @@ AT_KEYWORDS(gfs2_edit edit)
GFS_TGT_REGEN
AT_CHECK([$GFS_MKFS -p lock_nolock $GFS_TGT $(($(gfs_max_blocks 4096)/2))], 0, [ignore], [ignore])
AT_CHECK([gfs2_edit savemeta $GFS_TGT test.meta > savemeta.log], 0, [ignore], [ignore])
-AT_CHECK([head -2 savemeta.log], 0, [There are 1310716 blocks of 4096 bytes in the filesystem.
-Filesystem size: 5.00GB
+AT_CHECK([head -2 savemeta.log], 0, [There are 2621439 blocks of 4096 bytes in the filesystem.
+Filesystem size: 10.00GB
], [ignore])
GFS_TGT_REGEN
AT_CHECK([gfs2_edit restoremeta test.meta $GFS_TGT], 0, [ignore], [ignore])
diff --git a/tests/tune.at b/tests/tune.at
index 43ce34ce..4f0ecd79 100644
--- a/tests/tune.at
+++ b/tests/tune.at
@@ -32,8 +32,8 @@ File system magic number: 0x1161970
File system format version: 1802
Block size: 4096
Block shift: 12
-Root inode: 16709
-Master inode: 16437
+Root inode: 33127
+Master inode: 32854
Lock protocol: lock_nolock
Lock table: cluster:fsname
" > expout], 0, [ignore], [ignore])
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 5 months
[gfs2-utils] branch master updated: gfs2/edit: always use "%s"-style
format for printf()-style functions
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
The following commit(s) were added to refs/heads/master by this push:
new 17fb4703 gfs2/edit: always use "%s"-style format for printf()-style functions
17fb4703 is described below
commit 17fb470356a6d55988f05ac70f06b382ef982604
Author: Sergei Trofimovich <slyich(a)gmail.com>
AuthorDate: Sun Nov 7 09:00:31 2021 +0000
gfs2/edit: always use "%s"-style format for printf()-style functions
`ncurses-6.3` added printf-style function attributes and now makes
it easier to catch cases when user input is used in place of format
string when built with CFLAGS=-Werror=format-security:
hexedit.c:227:9: error: format not a string literal and no format arguments [-Werror=format-security]
227 | printw(s2);
| ^~~~~~
Let's wrap all the missing places with "%s" format.
---
gfs2/edit/hexedit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 798639b5..88ee3e5f 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -221,10 +221,10 @@ static void gfs2instr(const char *s1, const char *s2)
{
COLORS_HIGHLIGHT;
move(line,0);
- printw(s1);
+ printw("%s", s1);
COLORS_NORMAL;
move(line,17);
- printw(s2);
+ printw("%s", s2);
line++;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 5 months
[gfs2-utils] branch master updated: tunegfs2: Use O_EXCL when opening
the device rw
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
The following commit(s) were added to refs/heads/master by this push:
new 8005e763 tunegfs2: Use O_EXCL when opening the device rw
8005e763 is described below
commit 8005e763c7eefb535134a0686f3f0a1b1a2b8180
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Thu Nov 4 11:32:53 2021 +0000
tunegfs2: Use O_EXCL when opening the device rw
Use O_RDONLY when listing and O_RDWR|O_EXCL when modifying.
Also don't print the tunegfs2 version with -l output, improve open()
error reporting and add some more basic tunegfs2 tests.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/tune/main.c | 12 ++++++------
tests/tune.at | 30 ++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/gfs2/tune/main.c b/gfs2/tune/main.c
index fe137803..f72bdc3c 100644
--- a/gfs2/tune/main.c
+++ b/gfs2/tune/main.c
@@ -65,6 +65,7 @@ static void version(void)
int main(int argc, char **argv)
{
int c, status;
+ int flags = O_RDWR | O_EXCL;
memset(tfs, 0, sizeof(struct tunegfs2));
while((c = getopt(argc, argv, "hL:U:lo:Vr:")) != -1) {
@@ -82,6 +83,7 @@ int main(int argc, char **argv)
break;
case 'l':
tfs->opt_list = 1;
+ flags = O_RDONLY;
break;
case 'o':
parse_mount_options(optarg);
@@ -113,11 +115,11 @@ int main(int argc, char **argv)
}
tfs->devicename = argv[optind];
- tfs->fd = open(tfs->devicename, O_RDWR);
+ tfs->fd = open(tfs->devicename, flags);
if (tfs->fd < 0) {
- fprintf(stderr, _("Unable to open device %s\n"),
- tfs->devicename);
+ fprintf(stderr, _("Unable to open device %s: %s\n"),
+ tfs->devicename, strerror(errno));
return EX_IOERR;
}
@@ -160,10 +162,8 @@ int main(int argc, char **argv)
goto out;
}
- if (tfs->opt_list) {
- version();
+ if (tfs->opt_list)
print_super(tfs);
- }
close(tfs->fd);
out:
diff --git a/tests/tune.at b/tests/tune.at
index b0158034..43ce34ce 100644
--- a/tests/tune.at
+++ b/tests/tune.at
@@ -15,3 +15,33 @@ AT_CHECK([$GFS_MKFS -p lock_nolock -o format=1801 $GFS_TGT], 0, [ignore], [ignor
AT_CHECK([tunegfs2 -r 1802 $GFS_TGT], 0, [ignore], [ignore])
AT_CHECK([fsck.gfs2 -n $GFS_TGT], 0, [ignore], [ignore])
AT_CLEANUP
+
+AT_SETUP([Handle bad fs])
+AT_KEYWORDS(tunegfs2 tune)
+AT_CHECK([tunegfs2 -l /dev/null], 74, [ignore], [Device does not contain a GFS or GFS2 file system
+])
+AT_CHECK([tunegfs2 -l /dev/zero], 74, [ignore], [Device does not contain a GFS or GFS2 file system
+])
+AT_CLEANUP
+
+AT_SETUP([Expected output])
+AT_KEYWORDS(tunegfs2 tune)
+AT_CHECK([echo -n "File system volume name: cluster:fsname
+File system UUID: e90815fc-087b-460c-b8a5-8edc8a2ed691
+File system magic number: 0x1161970
+File system format version: 1802
+Block size: 4096
+Block shift: 12
+Root inode: 16709
+Master inode: 16437
+Lock protocol: lock_nolock
+Lock table: cluster:fsname
+" > expout], 0, [ignore], [ignore])
+# Create the fs without alignment so that we can predict the root inode address
+AT_CHECK([$GFS_MKFS -p lock_nolock -t cluster:fsname -o align=0 $GFS_TGT], 0, [ignore], [ignore])
+# Set a known UUID to ease comparison
+AT_CHECK([tunegfs2 -U e90815fc-087b-460c-b8a5-8edc8a2ed691 $GFS_TGT], 0, [ignore], [ignore])
+# Check tunegfs2 set the UUID correctly with gfs2_edit
+AT_CHECK([gfs2_edit -p sb field sb_uuid $GFS_TGT | tr -d '\n'], 0, [e90815fc-087b-460c-b8a5-8edc8a2ed691], [ignore])
+AT_CHECK([tunegfs2 -l $GFS_TGT], 0, [expout], [stderr])
+AT_CLEANUP
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 6 months