History log of /openbsd-current/sbin/fsck_ext2fs/setup.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.33 01-Jul-2019 kevlo

Oops, forgot to commit this patch.


# 1.32 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.31 26-Aug-2017 otto

Do not check the array but its length; based on a netbsd commit by christos@;
also unsigned values cannot be < 0; ok millert@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.30 28-Apr-2016 krw

Fix fsck'ing. ext2fs_dinode grew extra bits to support ext4
and sizeof(struct ext2fs_dinode) had to be replaced with
EXT2_DINODE_SIZE() and such.

ok beck@


Revision tags: OPENBSD_5_9_BASE
# 1.29 15-Oct-2015 semarie

corrects pledge code for fsck_ffs and fsck_ext2fs

on filesystem error, fsck will try to display username of inode, resulting need
of "getpw" for not SMALL version.

add a missed (?) -DSMALL in distrib/special/ for fsck_ffs and fsck_ext2fs

found by hard way by ajacoutot@

OK millert@


# 1.28 14-Oct-2015 deraadt

Since the fsck_* programs now only handle one filesystem, this creates
a point where open() and disklabel reading have completed. After that
point, pledge "stdio".

As a result, an fsck of a hostile partition (noone ever does that, or
do they? :) is done by a program with SUBSTANTIALLY less system call
exposure.
ok semarie


# 1.27 10-Sep-2015 deraadt

avoid divide by zero; from Michael McConville


# 1.26 20-Aug-2015 deraadt

<stdlib.h> is included, so do not need to cast result from
malloc, calloc, realloc*
ok krw millert


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.25 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


# 1.24 20-Nov-2014 tedu

remove sys/file.h includes in favor of fcntl.h where needed.
ok deraadt guenther


Revision tags: OPENBSD_5_6_BASE
# 1.23 13-Jul-2014 pelikan

kill fs2hXX/h2fsXX macros with letohXX/htoleXX

The reason being that ext2 structures are little-endian but JBD2 journal
is big-endian. Don't confuse readers by talking about "file system endian".

ok guenther


# 1.22 13-Jul-2014 pelikan

new superblock header needs fixes


# 1.21 11-Jul-2014 tobias

Prevent division by zero on erroneous file systems.

ok pelikan@


# 1.20 22-May-2014 krw

Nuke pointless dev_bsize variable which is always set to 512, and just
use DEV_BSIZE.

Write sizes need to be secsize and not DEV_BSIZE, just like reads.

Equivalent to changes made in fsck_ffs.


Revision tags: OPENBSD_5_5_BASE
# 1.19 22-Nov-2013 guenther

Kirk was being waaaay too chummy with the compiler when he trusted
it to not optimize away a comparison against NULL-1.
Add (unsigned char) casts for some ctype calls.
Teach fsck_ext2fs about MAXPARTITIONS, letting it operate on
partitions 'i' through 'p'.

ok deraadt@ millert@ otto@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.18 12-Mar-2011 deraadt

These utilities can currently only operate with a 32-bit block number range,
so use daddr32_t
ok jasper


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.17 18-May-2010 dlg

dont let sys/ioctl.h imply that you get the ioctls in dkio.h. this
gets rid of #include <sys/dkio.h> in sys/ioctl.h and adds #include
<sys/dkio.h> to the places that actually want and use the disk
ioctls.

this became an issue when krw@'s X build failed when he was testing
a change to dkio.h.
tested by krw@
help from and ok miod@


Revision tags: OPENBSD_4_7_BASE
# 1.16 08-Mar-2010 otto

if ncg == 1, there's no alternate superblock; from NetBSD; ok deraadt@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.15 02-Sep-2007 deraadt

use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg


Revision tags: OPENBSD_4_2_BASE
# 1.14 29-May-2007 otto

Updated disklabel format to support larger disks and partitions. We
free room in struct partition by packing fragment size and
fragments/block more tighlty and use the resulting space to make
offset and size 48 bits. For the disk part we use spare fields in
struct disklabel. Kernel converts in-mem copy of the on-disk
label if needed, disklabel(8) writes new version.
We are careful to only change fields not used by bootloaders.
Conception of basic scheme by deraadt.
ok deraadt@ krw@


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.13 30-Apr-2005 niallo

Support checking filesystems which have or once had large files (>4 GB)
on them.

From NetBSD


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.12 29-Jul-2003 deraadt

spaces


# 1.11 11-Jun-2003 deraadt

ansification


# 1.10 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.9 09-Jun-2002 todd

rm trailing whitespace


Revision tags: OPENBSD_3_1_BASE
# 1.8 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.7 18-Sep-2001 art

cleanups and endianness fixes. Mostly from NetBSD


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.6 26-Apr-2000 jasoni

Support for ext2fs rev. 1


Revision tags: OPENBSD_2_6_BASE
# 1.5 17-Aug-1999 millert

More <sys/file.h> vs. <fcntl.h> and open() flags fixes.


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.4 14-Jun-1997 downsj

s/malloc.h/stdlib.h in pass5.c, and actually malloc() enough memory in
setup() for the superblock!


# 1.3 14-Jun-1997 downsj

Add tags, fix man page. Purely cosmetic.


# 1.2 14-Jun-1997 downsj

Sync with NetBSD. Purely cosmetic.


# 1.1 30-May-1997 downsj

branches: 1.1.1;
Initial revision


# 1.32 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.31 26-Aug-2017 otto

Do not check the array but its length; based on a netbsd commit by christos@;
also unsigned values cannot be < 0; ok millert@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.30 28-Apr-2016 krw

Fix fsck'ing. ext2fs_dinode grew extra bits to support ext4
and sizeof(struct ext2fs_dinode) had to be replaced with
EXT2_DINODE_SIZE() and such.

ok beck@


Revision tags: OPENBSD_5_9_BASE
# 1.29 15-Oct-2015 semarie

corrects pledge code for fsck_ffs and fsck_ext2fs

on filesystem error, fsck will try to display username of inode, resulting need
of "getpw" for not SMALL version.

add a missed (?) -DSMALL in distrib/special/ for fsck_ffs and fsck_ext2fs

found by hard way by ajacoutot@

OK millert@


# 1.28 14-Oct-2015 deraadt

Since the fsck_* programs now only handle one filesystem, this creates
a point where open() and disklabel reading have completed. After that
point, pledge "stdio".

As a result, an fsck of a hostile partition (noone ever does that, or
do they? :) is done by a program with SUBSTANTIALLY less system call
exposure.
ok semarie


# 1.27 10-Sep-2015 deraadt

avoid divide by zero; from Michael McConville


# 1.26 20-Aug-2015 deraadt

<stdlib.h> is included, so do not need to cast result from
malloc, calloc, realloc*
ok krw millert


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.25 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


# 1.24 20-Nov-2014 tedu

remove sys/file.h includes in favor of fcntl.h where needed.
ok deraadt guenther


Revision tags: OPENBSD_5_6_BASE
# 1.23 13-Jul-2014 pelikan

kill fs2hXX/h2fsXX macros with letohXX/htoleXX

The reason being that ext2 structures are little-endian but JBD2 journal
is big-endian. Don't confuse readers by talking about "file system endian".

ok guenther


# 1.22 13-Jul-2014 pelikan

new superblock header needs fixes


# 1.21 11-Jul-2014 tobias

Prevent division by zero on erroneous file systems.

ok pelikan@


# 1.20 22-May-2014 krw

Nuke pointless dev_bsize variable which is always set to 512, and just
use DEV_BSIZE.

Write sizes need to be secsize and not DEV_BSIZE, just like reads.

Equivalent to changes made in fsck_ffs.


Revision tags: OPENBSD_5_5_BASE
# 1.19 22-Nov-2013 guenther

Kirk was being waaaay too chummy with the compiler when he trusted
it to not optimize away a comparison against NULL-1.
Add (unsigned char) casts for some ctype calls.
Teach fsck_ext2fs about MAXPARTITIONS, letting it operate on
partitions 'i' through 'p'.

ok deraadt@ millert@ otto@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.18 12-Mar-2011 deraadt

These utilities can currently only operate with a 32-bit block number range,
so use daddr32_t
ok jasper


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.17 18-May-2010 dlg

dont let sys/ioctl.h imply that you get the ioctls in dkio.h. this
gets rid of #include <sys/dkio.h> in sys/ioctl.h and adds #include
<sys/dkio.h> to the places that actually want and use the disk
ioctls.

this became an issue when krw@'s X build failed when he was testing
a change to dkio.h.
tested by krw@
help from and ok miod@


Revision tags: OPENBSD_4_7_BASE
# 1.16 08-Mar-2010 otto

if ncg == 1, there's no alternate superblock; from NetBSD; ok deraadt@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.15 02-Sep-2007 deraadt

use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg


Revision tags: OPENBSD_4_2_BASE
# 1.14 29-May-2007 otto

Updated disklabel format to support larger disks and partitions. We
free room in struct partition by packing fragment size and
fragments/block more tighlty and use the resulting space to make
offset and size 48 bits. For the disk part we use spare fields in
struct disklabel. Kernel converts in-mem copy of the on-disk
label if needed, disklabel(8) writes new version.
We are careful to only change fields not used by bootloaders.
Conception of basic scheme by deraadt.
ok deraadt@ krw@


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.13 30-Apr-2005 niallo

Support checking filesystems which have or once had large files (>4 GB)
on them.

From NetBSD


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.12 29-Jul-2003 deraadt

spaces


# 1.11 11-Jun-2003 deraadt

ansification


# 1.10 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.9 09-Jun-2002 todd

rm trailing whitespace


Revision tags: OPENBSD_3_1_BASE
# 1.8 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.7 18-Sep-2001 art

cleanups and endianness fixes. Mostly from NetBSD


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.6 26-Apr-2000 jasoni

Support for ext2fs rev. 1


Revision tags: OPENBSD_2_6_BASE
# 1.5 17-Aug-1999 millert

More <sys/file.h> vs. <fcntl.h> and open() flags fixes.


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.4 14-Jun-1997 downsj

s/malloc.h/stdlib.h in pass5.c, and actually malloc() enough memory in
setup() for the superblock!


# 1.3 14-Jun-1997 downsj

Add tags, fix man page. Purely cosmetic.


# 1.2 14-Jun-1997 downsj

Sync with NetBSD. Purely cosmetic.


# 1.1 30-May-1997 downsj

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_2_BASE
# 1.31 26-Aug-2017 otto

Do not check the array but its length; based on a netbsd commit by christos@;
also unsigned values cannot be < 0; ok millert@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.30 28-Apr-2016 krw

Fix fsck'ing. ext2fs_dinode grew extra bits to support ext4
and sizeof(struct ext2fs_dinode) had to be replaced with
EXT2_DINODE_SIZE() and such.

ok beck@


Revision tags: OPENBSD_5_9_BASE
# 1.29 15-Oct-2015 semarie

corrects pledge code for fsck_ffs and fsck_ext2fs

on filesystem error, fsck will try to display username of inode, resulting need
of "getpw" for not SMALL version.

add a missed (?) -DSMALL in distrib/special/ for fsck_ffs and fsck_ext2fs

found by hard way by ajacoutot@

OK millert@


# 1.28 14-Oct-2015 deraadt

Since the fsck_* programs now only handle one filesystem, this creates
a point where open() and disklabel reading have completed. After that
point, pledge "stdio".

As a result, an fsck of a hostile partition (noone ever does that, or
do they? :) is done by a program with SUBSTANTIALLY less system call
exposure.
ok semarie


# 1.27 10-Sep-2015 deraadt

avoid divide by zero; from Michael McConville


# 1.26 20-Aug-2015 deraadt

<stdlib.h> is included, so do not need to cast result from
malloc, calloc, realloc*
ok krw millert


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.25 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


# 1.24 20-Nov-2014 tedu

remove sys/file.h includes in favor of fcntl.h where needed.
ok deraadt guenther


Revision tags: OPENBSD_5_6_BASE
# 1.23 13-Jul-2014 pelikan

kill fs2hXX/h2fsXX macros with letohXX/htoleXX

The reason being that ext2 structures are little-endian but JBD2 journal
is big-endian. Don't confuse readers by talking about "file system endian".

ok guenther


# 1.22 13-Jul-2014 pelikan

new superblock header needs fixes


# 1.21 11-Jul-2014 tobias

Prevent division by zero on erroneous file systems.

ok pelikan@


# 1.20 22-May-2014 krw

Nuke pointless dev_bsize variable which is always set to 512, and just
use DEV_BSIZE.

Write sizes need to be secsize and not DEV_BSIZE, just like reads.

Equivalent to changes made in fsck_ffs.


Revision tags: OPENBSD_5_5_BASE
# 1.19 22-Nov-2013 guenther

Kirk was being waaaay too chummy with the compiler when he trusted
it to not optimize away a comparison against NULL-1.
Add (unsigned char) casts for some ctype calls.
Teach fsck_ext2fs about MAXPARTITIONS, letting it operate on
partitions 'i' through 'p'.

ok deraadt@ millert@ otto@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.18 12-Mar-2011 deraadt

These utilities can currently only operate with a 32-bit block number range,
so use daddr32_t
ok jasper


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.17 18-May-2010 dlg

dont let sys/ioctl.h imply that you get the ioctls in dkio.h. this
gets rid of #include <sys/dkio.h> in sys/ioctl.h and adds #include
<sys/dkio.h> to the places that actually want and use the disk
ioctls.

this became an issue when krw@'s X build failed when he was testing
a change to dkio.h.
tested by krw@
help from and ok miod@


Revision tags: OPENBSD_4_7_BASE
# 1.16 08-Mar-2010 otto

if ncg == 1, there's no alternate superblock; from NetBSD; ok deraadt@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.15 02-Sep-2007 deraadt

use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg


Revision tags: OPENBSD_4_2_BASE
# 1.14 29-May-2007 otto

Updated disklabel format to support larger disks and partitions. We
free room in struct partition by packing fragment size and
fragments/block more tighlty and use the resulting space to make
offset and size 48 bits. For the disk part we use spare fields in
struct disklabel. Kernel converts in-mem copy of the on-disk
label if needed, disklabel(8) writes new version.
We are careful to only change fields not used by bootloaders.
Conception of basic scheme by deraadt.
ok deraadt@ krw@


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.13 30-Apr-2005 niallo

Support checking filesystems which have or once had large files (>4 GB)
on them.

From NetBSD


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.12 29-Jul-2003 deraadt

spaces


# 1.11 11-Jun-2003 deraadt

ansification


# 1.10 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.9 09-Jun-2002 todd

rm trailing whitespace


Revision tags: OPENBSD_3_1_BASE
# 1.8 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.7 18-Sep-2001 art

cleanups and endianness fixes. Mostly from NetBSD


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.6 26-Apr-2000 jasoni

Support for ext2fs rev. 1


Revision tags: OPENBSD_2_6_BASE
# 1.5 17-Aug-1999 millert

More <sys/file.h> vs. <fcntl.h> and open() flags fixes.


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.4 14-Jun-1997 downsj

s/malloc.h/stdlib.h in pass5.c, and actually malloc() enough memory in
setup() for the superblock!


# 1.3 14-Jun-1997 downsj

Add tags, fix man page. Purely cosmetic.


# 1.2 14-Jun-1997 downsj

Sync with NetBSD. Purely cosmetic.


# 1.1 30-May-1997 downsj

branches: 1.1.1;
Initial revision