Commit Graph

16 Commits

Author SHA1 Message Date
pjd
781b031d07 The ufs_disk_fillout(3) can take special device name (with or without /dev/
prefix) as an argument and mount point path. At the end it has to find
device name file system is stored on, which means when mount point path is
given, it tries to look into /etc/fstab and find special device
corresponding to the given mount point. This is not perfect, because it
doesn't handle the case when file system is mounted by hand and mount point
is given as an argument.

I found this problem while trying to use snapinfo(8), which passes mount
points to the ufs_disk_fillout(3) function, but I had file system mounted
manually, so snapinfo(8) was exiting with the error below:

	ufs_disk_fillout: No such file or directory

I modified libufs(3) to handle those arguments (the order is important):

1. special device with /dev/ prefix
2. special device without /dev/ prefix
3. mount point listed in /etc/fstab, directory exists
4. mount point listed in /etc/fstab, directory doesn't exist
5. mount point of a file system mounted by hand
2007-03-16 03:13:28 +00:00
jmallett
088f7e9d08 Remove ufs_disk_ctor and ufs_disk_dtor, they never came to fruition. I do
not know of any software using them, and there is no "published API" for
libufs, as it were.
2003-06-09 09:47:38 +00:00
jmallett
0e96b35689 Reduce diffs with code in Perforce:
Parenthesise return values.
2003-06-09 09:32:29 +00:00
jmallett
2b3cee5134 Close the disk file descriptor that is RO before trying to open the
new one, and do not fall back to the RO fd.  There was a bug here
in that the RO fd was never closed, if the RDRW open succeeded, but
this code is bogus anyway, and it breaks newfs of floppies, at least
for me, due to "Device busy."  Anything that wants to fall back is
doing something significantly odd that it should have some more complex
code on its end.
2003-03-28 01:50:11 +00:00
jmallett
746b853b9c Missing "return 0"
Big pointy hat to:	jmallett
Spotted by:		peter
2003-01-30 00:10:24 +00:00
jmallett
994054cea6 API for opening (and tracking) writable file descriptors per disk. 2003-01-29 23:19:46 +00:00
jmallett
070819018f API to fillout a blank disk. For e.g. newfs. 2003-01-23 21:32:56 +00:00
jmallett
ade073ea23 Store not only the current cylinder group in the series (i.e. next that needs
to be read in) but also the last cylinder group in the series (i.e. what is
stored in the structure).
2003-01-19 05:46:23 +00:00
jmallett
445adec218 Add facility to read one, or a string of, cylinger groups. 2003-01-19 01:31:26 +00:00
jmallett
0a0a65bb42 Hunt for a disk to operate on, if we're passed a partition mountpoint, etc.
Concept reviewed by:	phk
2003-01-19 00:43:17 +00:00
jmallett
7284e7e47f Nuke dumb error reporting code, people can just use disk::d_error. Unify the
DEBUG and d_error initialisation into an ERROR macro, which can both trace and
set the d_error field.  Much a more meaningful thing, I should say.
2003-01-18 04:22:14 +00:00
jmallett
df1f55a8e7 Add the concept of a per-disk error string, and a function which prints it
along with the errno, if one is set.
2002-10-22 19:25:58 +00:00
jmallett
9313936769 Initialise disk->d_ufs so that in sblock.c it's always initialised
(unless someone tries to use libufs support functions without using
	_fillout or _ctor to construct a uufsd.)

Obtained from:	jmallett_libufs Perforce branch.
2002-08-11 15:37:10 +00:00
jmallett
9c7ad0f5fd Fill out (zero) and fill in (when doing getino()) the minimum and maximum
inodes in our inoblock (disk->d_ino{min,max}) appropriately.
2002-07-11 21:27:26 +00:00
jmallett
1c27521e29 In getino, have our DEBUG message in the unhandled case mention that it
does not know what sort of UFS filesystem this is.

Add some DEBUG(NULL)'s to function entry points.
2002-07-01 18:19:20 +00:00
jmallett
e7f13daa73 Add libufs, a library for dealing with UFS filesystems from userland to
the build.  It is here to compartmentalise functionality currently duplicated
in many notable programs in the base system.  It currently handles block
reads and writes, as well as reading and writing of the filesystem superblock,
and the reading/lookup of inode data.  It supports both UFS and UFS2.  I
will be maintaining it, and porting programs to use it, however for now, it
is simply being built as part of world.
2002-07-01 01:45:03 +00:00