1994-05-26 08:35:07 +02:00
|
|
|
# @(#)Makefile 8.2 (Berkeley) 3/27/94
|
2000-09-16 15:43:00 +02:00
|
|
|
# $FreeBSD$
|
1994-05-26 08:35:07 +02:00
|
|
|
|
2017-03-04 12:33:01 +01:00
|
|
|
.PATH: ${SRCTOP}/sys/geom
|
Enable operation of newfs on plain files, which is useful when you
want to prepare disk images for emulators (though 'makefs' in port
can do something similar).
This relies on:
+ minor changes to pass the consistency checks even when working on a file;
+ an additional option, '-p partition' , to specify the disk partition to
initialize;
+ some changes on the I/O routines to deal with partition offsets.
The latter was a bit tricky to implement, see the details in newfs.h:
in newfs, I/O is done through libufs which assumes that the file
descriptor refers to the whole partition. Introducing support for
the offset in libufs would require a non-backward compatible change
in the library, to be dealt with a version bump or with symbol
versioning.
I felt both approaches to be overkill for this specific application,
especially because there might be other changes to libufs that might
become necessary in the near future.
So I used the following trick:
- read access is always done by calling bread() directly, so we just add
the offset in the (few) places that call bread();
- write access is done through bwrite() and sbwrite(), which in turn
calls bwrite(). To avoid rewriting sbwrite(), we supply our own version
of bwrite() here, which takes precedence over the version in libufs.
MFC after: 4 weeks
2008-12-03 19:36:59 +01:00
|
|
|
|
1994-05-26 08:35:07 +02:00
|
|
|
PROG= newfs
|
2014-11-25 12:23:12 +01:00
|
|
|
LIBADD= ufs util
|
Enable operation of newfs on plain files, which is useful when you
want to prepare disk images for emulators (though 'makefs' in port
can do something similar).
This relies on:
+ minor changes to pass the consistency checks even when working on a file;
+ an additional option, '-p partition' , to specify the disk partition to
initialize;
+ some changes on the I/O routines to deal with partition offsets.
The latter was a bit tricky to implement, see the details in newfs.h:
in newfs, I/O is done through libufs which assumes that the file
descriptor refers to the whole partition. Introducing support for
the offset in libufs would require a non-backward compatible change
in the library, to be dealt with a version bump or with symbol
versioning.
I felt both approaches to be overkill for this specific application,
especially because there might be other changes to libufs that might
become necessary in the near future.
So I used the following trick:
- read access is always done by calling bread() directly, so we just add
the offset in the (few) places that call bread();
- write access is done through bwrite() and sbwrite(), which in turn
calls bwrite(). To avoid rewriting sbwrite(), we supply our own version
of bwrite() here, which takes precedence over the version in libufs.
MFC after: 4 weeks
2008-12-03 19:36:59 +01:00
|
|
|
SRCS= newfs.c mkfs.c geom_bsd_enc.c
|
|
|
|
|
2010-01-17 22:56:27 +01:00
|
|
|
WARNS?= 3
|
2002-03-18 03:23:43 +01:00
|
|
|
MAN= newfs.8
|
1994-05-26 08:35:07 +02:00
|
|
|
|
|
|
|
.include <bsd.prog.mk>
|
2002-03-19 22:05:29 +01:00
|
|
|
|
|
|
|
test: ${PROG}
|
2017-03-04 12:33:01 +01:00
|
|
|
sh ${.CURDIR}/runtest01.sh
|
2002-03-19 22:05:29 +01:00
|
|
|
sh ${.CURDIR}/runtest00.sh | tee _.test
|
|
|
|
diff --ignore-matching-lines=FreeBSD _.test ${.CURDIR}/ref.test
|
|
|
|
echo All Tests Passed
|