OpenBSD CVS

CVS log for src/lib/libutil/opendev.c


[BACK] Up to [local] / src / lib / libutil

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.17 / (download) - annotate - [select for diffs], Fri Aug 26 21:47:16 2022 UTC (21 months, 2 weeks ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, HEAD
Changes since 1.16: +1 -17 lines
Diff to previous 1.16 (colored)

Backout "Only return file descriptors to block or character devices"

mount_mfs(8) no monger mounts "/build" with the following fstab(5) entry:
	/dev/sd0b /build mfs rw,noperm,nodev,nosuid,-s=2064348,noauto

as found out by bluhm the hard way.

Revision 1.16 / (download) - annotate - [select for diffs], Thu Aug 25 17:09:54 2022 UTC (21 months, 2 weeks ago) by kn
Branch: MAIN
Changes since 1.15: +17 -1 lines
Diff to previous 1.15 (colored)

Only return file descriptors to block or character devices

If the requested path contained a slash, opendev(3) blindly opened the file
and returned a file descriptor to it.

Check for block or character devices (according to OPENDEV_BLCK) and fail
for other types.

Spotted through installboot(8) which happily opened a stage file as device
when forgetting the device argument:
	# installboot -v ./biosboot
	Using / as root
	installing bootstrap on ./biosboot
	using first-stage /usr/mdec/biosboot, second-stage /usr/mdec/boot
	installboot: disklabel: ./biosboot: Inappropriate ioctl for device

This makes it fail earlier, as expected:
	# installboot -v ./biosboot
	installboot: open: ./biosboot: Block device required

The case where opendev(3) is passed a string not containing a slash, i.e.
a supposed DUID, is fine, as diskmap(4) will ensure that only valid device
paths are returned, if the DUID is valid.

Feedback OK millert

Revision 1.15 / (download) - annotate - [select for diffs], Thu Jun 30 15:04:58 2011 UTC (12 years, 11 months ago) by jsing
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9, OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7, OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.14: +0 -3 lines
Diff to previous 1.14 (colored)

Do not mask errno if we fail to open /dev/diskmap. Also, fall through
rather than returning so that realname still gets assigned.

ok millert@ deraadt@ thib@

Revision 1.14 / (download) - annotate - [select for diffs], Wed Dec 22 17:24:32 2010 UTC (13 years, 5 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.13: +19 -17 lines
Diff to previous 1.13 (colored)

Do not attempt to prepend /dev/ to path if it already contains a slash.
OK jsing@

Revision 1.13 / (download) - annotate - [select for diffs], Tue Dec 21 15:47:52 2010 UTC (13 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.12: +10 -13 lines
Diff to previous 1.12 (colored)

Always return a pointer to the static buffer in realpath, even if
path and realpath are the same.  This matches the manual and avoids
a bogus cast to non-const.  OK jsing@, previous version OK kettenis@

Revision 1.12 / (download) - annotate - [select for diffs], Fri Dec 17 19:35:34 2010 UTC (13 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.11: +3 -3 lines
Diff to previous 1.11 (colored)

opendev() path argument should be const.  OK deraadt@

Revision 1.11 / (download) - annotate - [select for diffs], Mon Nov 15 15:07:40 2010 UTC (13 years, 6 months ago) by jsing
Branch: MAIN
Changes since 1.10: +2 -24 lines
Diff to previous 1.10 (colored)

Factor out DUID identification code so that it can easily be reused.

ok krw@

Revision 1.10 / (download) - annotate - [select for diffs], Mon Jun 28 19:12:29 2010 UTC (13 years, 11 months ago) by chl
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.9: +3 -1 lines
Diff to previous 1.9 (colored)

add missing headers needed for close() and ioctl().

ok krw@ millert@

Revision 1.9 / (download) - annotate - [select for diffs], Fri Jun 18 17:03:06 2010 UTC (13 years, 11 months ago) by jsing
Branch: MAIN
Changes since 1.8: +50 -2 lines
Diff to previous 1.8 (colored)

If a request to opendev(3) is given in the form of a disklabel UID,
open /dev/diskmap and perform a DIOCMAP ioctl in order to open the actual
device. As a result, all programs which make use of opendev(3) can now
operate with disklabel UIDs.

Feedback from millert@

ok millert@ krw@ thib@

Revision 1.8 / (download) - annotate - [select for diffs], Fri May 28 07:03:47 2004 UTC (20 years ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.7: +4 -8 lines
Diff to previous 1.7 (colored)

knf; otto ok

Revision 1.7 / (download) - annotate - [select for diffs], Sun Jun 9 22:18:43 2002 UTC (22 years ago) by fgsch
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5, OPENBSD_3_4_BASE, OPENBSD_3_4, OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.6: +1 -1 lines
Diff to previous 1.6 (colored)

some -Wall and spaces cleanup, scsi.c left.
some brave soul should look at it.

Revision 1.6 / (download) - annotate - [select for diffs], Sun Apr 30 17:37:46 2000 UTC (24 years, 1 month ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1, OPENBSD_3_0_BASE, OPENBSD_3_0, OPENBSD_2_9_BASE, OPENBSD_2_9, OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.5: +35 -34 lines
Diff to previous 1.5 (colored)

Add OPENDEV_BLCK flag for opening the block devices (the character
device is opened by default).

Don't open the file w/o adding a /dev/ prefix unless the file has
a '/' in it.  This prevents problems where someone says "disklabel
sd0" with a file called "sd0" in the cwd.

The OPENDEV_DRCT flag has been deprecated as it is the the default
behavior and always has been.

Add checks for >= MAXPATHLEN and return ENAMETOOLONG in that case.

Revision 1.5 / (download) - annotate - [select for diffs], Mon Sep 16 02:40:51 1996 UTC (27 years, 9 months ago) by tholo
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6, OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4, OPENBSD_2_3_BASE, OPENBSD_2_3, OPENBSD_2_2_BASE, OPENBSD_2_2, OPENBSD_2_1_BASE, OPENBSD_2_1, OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.4: +2 -1 lines
Diff to previous 1.4 (colored)

Bring prototypes into scope

Revision 1.4 / (download) - annotate - [select for diffs], Tue Jul 2 07:57:54 1996 UTC (27 years, 11 months ago) by downsj
Branch: MAIN
Changes since 1.3: +3 -3 lines
Diff to previous 1.3 (colored)

Use getrawpartition().

Revision 1.3 / (download) - annotate - [select for diffs], Thu Jun 20 10:46:02 1996 UTC (27 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +7 -4 lines
Diff to previous 1.2 (colored)

only write to realpath if non-NULL

Revision 1.2 / (download) - annotate - [select for diffs], Mon Jun 17 07:46:03 1996 UTC (28 years ago) by downsj
Branch: MAIN
Changes since 1.1: +7 -8 lines
Diff to previous 1.1 (colored)

util.h: new resting place
opendev.h: ok, so I merged it with util.h
opendev.h: use util.h
everything else: use "util.h"

Revision 1.1 / (download) - annotate - [select for diffs], Mon Jun 17 06:35:34 1996 UTC (28 years ago) by downsj
Branch: MAIN

Add opendev(3) to libutil.  Used by mt(1), soon by disklabel(8), maybe
others.  This is a generic version of the code used by mt(1).

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.