diff options
| author | mlelstv <mlelstv@NetBSD.org> | 2022-04-24 06:48:15 +0000 |
|---|---|---|
| committer | mlelstv <mlelstv@NetBSD.org> | 2022-04-24 06:48:15 +0000 |
| commit | a17aed3befa70ff13d8e8d3ef4340fcecdcd445a (patch) | |
| tree | d6ce678d885587967b940269faa2d7ef9543ffac /sys/lib/libsa/ext2fs.c | |
| parent | 1640aad2b8e4339f34784a4bc14e52fb6a068cb4 (diff) | |
Ask driver about sector size to support reading superblocks from fixed
byte offsets.
Diffstat (limited to 'sys/lib/libsa/ext2fs.c')
| -rw-r--r-- | sys/lib/libsa/ext2fs.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/lib/libsa/ext2fs.c b/sys/lib/libsa/ext2fs.c index b810947fdaf..007c732dfac 100644 --- a/sys/lib/libsa/ext2fs.c +++ b/sys/lib/libsa/ext2fs.c @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs.c,v 1.30 2022/04/19 09:25:38 skrll Exp $ */ +/* $NetBSD: ext2fs.c,v 1.31 2022/04/24 06:48:15 mlelstv Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -415,9 +415,15 @@ read_sblock(struct open_file *f, struct m_ext2fs *fs) struct ext2fs ext2fs; size_t buf_size; int rc; + u_int secsize; + + secsize = 0; + rc = DEV_IOCTL(f->f_dev)(f, SAIOSECSIZE, &secsize); + if (rc != 0 || secsize == 0) + secsize = DEV_BSIZE; rc = DEV_STRATEGY(f->f_dev)(f->f_devdata, F_READ, - SBOFF / DEV_BSIZE, SBSIZE, sbbuf, &buf_size); + SBOFF / secsize, SBSIZE, sbbuf, &buf_size); if (rc) return rc; |
