Commit Graph

387 Commits

Author SHA1 Message Date
agc fca43256ed make sure we have an __UNCONST definition available, for portability reasons. 2008-02-10 11:02:05 +00:00
agc 5a37868bfa Define the version of the FUSE ABI we're working with specifically.
Don't hand all the argv options to fuse_main() - it's only interested
in the ones we haven't parsed ourselves.

These changes make the initiator compile and perform discovery successfully
on FreeBSD 6.3. Full login doesn't work yet due to a KSE related bug.
2008-02-07 07:33:37 +00:00
agc 5ca5718e92 Set a definitive FUSE ABI before including fuse.h, to avoid situations
where different operating ssystems default to different levels.
2008-02-07 07:21:15 +00:00
elad e43f626d03 Add, document, and use KAUTH_REQ_PROCESS_KTRACE_PERSISTENT. 2008-02-02 21:04:40 +00:00
elad cd23f36378 Replace a KAUTH_GENERIC_ISSUSER in the cpuctl code with a proper kauth
request.

Reviewed by ad@, tested by me.
2008-02-01 20:01:06 +00:00
elad fb37bad459 Use proper kauth(9) actions/requests for native scheduler stuff and the
recently introduced processor-sets.

Discussed with and okay rmind@, yamt@, and christos@.
2008-01-30 17:54:55 +00:00
elad c27d5f30b6 Tons of process scope changes.
- Add a KAUTH_PROCESS_SCHEDULER action, to handle scheduler related
    requests, and add specific requests for set/get scheduler policy and
    set/get scheduler parameters.

  - Add a KAUTH_PROCESS_KEVENT_FILTER action, to handle kevent(2) related
    requests.

  - Add a KAUTH_DEVICE_TTY_STI action to handle requests to TIOCSTI.

  - Add requests for the KAUTH_PROCESS_CANSEE action, indicating what
    process information is being looked at (entry itself, args, env,
    open files).

  - Add requests for the KAUTH_PROCESS_RLIMIT action indicating set/get.

  - Add requests for the KAUTH_PROCESS_CORENAME action indicating set/get.

  - Make bsd44 secmodel code handle the newly added rqeuests appropriately.

All of the above make it possible to issue finer-grained kauth(9) calls in
many places, removing some KAUTH_GENERIC_ISSUSER requests.

  - Remove the "CAN" from KAUTH_PROCESS_CAN{KTRACE,PROCFS,PTRACE,SIGNAL}.

Discussed with christos@ and yamt@.
2008-01-23 15:04:38 +00:00
elad 964f16c2b9 Make fork use kauth.
Been running in my tree for over a month at least.

Reviewed and okay yamt@, and special thanks to him as well as rittera@
for making this possible through fixing NDIS to not call fork1() with
l1 != curlwp.
2008-01-07 23:51:06 +00:00
ad 2ecdf58c2c Remove systrace. Ok core@. 2007-12-31 15:31:24 +00:00
pooka 4d243cfc9d use generic getattr 2007-12-19 14:01:30 +00:00
agc 755a2e55e0 Move to a resizable dynamic array for the targets that the initiator
can find.

If the initiator discovers too many targets for it to handle
(currently more than 16), then truncate to the maximum with a loud
warning message, rather than aborting.

In practice, this means that multiple targets can now be used with the
NetBSD iSCSI initiator.

% ls -laR /mnt/inspiron1300.wherever.co.uk/
total 192
drwxr-xr-x  2 agc   agc    512 Dec 11 08:53 .
drwxr-xr-x  2 root  wheel    0 Jan  1  1970 ..
drwxr-xr-x  2 agc   agc    512 Dec 11 08:53 target0
drwxr-xr-x  2 agc   agc    512 Dec 11 08:53 target1

/mnt/inspiron1300.wherever.co.uk/target0:
total 576
drwxr-xr-x  2 agc  agc        512 Dec 11 08:53 .
drwxr-xr-x  2 agc  agc        512 Dec 11 08:53 ..
lrw-r--r--  1 agc  agc         44 Dec 11 08:53 hostname -> inspiron1300.wherever.co.uk
lrw-r--r--  1 agc  agc          9 Dec 11 08:53 ip -> 10.4.0.42
lrw-r--r--  1 agc  agc         16 Dec 11 08:53 product -> NetBSD iSCSI
-rw-r--r--  1 agc  agc  104857600 Dec 11 08:53 storage
lrw-r--r--  1 agc  agc         43 Dec 11 08:53 targetname -> iqn.1994-04.org.netbsd.iscsi-target:target0
lrw-r--r--  1 agc  agc          8 Dec 11 08:53 vendor -> NetBSD
lrw-r--r--  1 agc  agc          4 Dec 11 08:53 version -> 0

/mnt/inspiron1300.wherever.co.uk/target1:
total 576
drwxr-xr-x  2 agc  agc       512 Dec 11 08:53 .
drwxr-xr-x  2 agc  agc       512 Dec 11 08:53 ..
lrw-r--r--  1 agc  agc        44 Dec 11 08:53 hostname -> inspiron1300.wherever.co.uk
lrw-r--r--  1 agc  agc         0 Dec 11 08:53 ip ->
lrw-r--r--  1 agc  agc        16 Dec 11 08:53 product -> NetBSD iSCSI
-rw-r--r--  1 agc  agc  52428800 Dec 11 08:53 storage
lrw-r--r--  1 agc  agc        43 Dec 11 08:53 targetname -> iqn.1994-04.org.netbsd.iscsi-target:target1
lrw-r--r--  1 agc  agc         8 Dec 11 08:53 vendor -> NetBSD
lrw-r--r--  1 agc  agc         4 Dec 11 08:53 version -> 0
%
2007-12-11 09:07:36 +00:00
oster 0fa5922403 Add a '-D' option to allow "Discovery" of the targets provided by a host.
Initial support for multiple targets from the same host.

Base 'MaxTargets' on a #define, rather than hard-coding.

Reviewed by: agc
2007-12-04 16:22:38 +00:00
wiz 0d78c993a2 Use more markup. Fix xrefs. Use standard headers. 2007-12-02 19:31:46 +00:00
pooka 21913eabe5 Rototill.
Ok, ok, a few more words about it: stop holding puffs_cc as a holy
value and passing it around to almost every possible place (popquiz:
which kernel variable does this remind you of?).  Instead, pass
the natural choice, puffs_usermount, and fetch puffs_cc via
puffs_cc_getcc() only in routines which actually need it.  This
not only simplifies code, but (thanks to the introduction of
puffs_cc_getcc()) enables constructs which weren't previously sanely
possible, say layering as a curious example.

There's still a little to do on this front, but this was the major
fs interface blast.
2007-11-30 19:02:28 +00:00
pooka efe797dc32 * version the registration interface
* destroy all created locks
2007-11-28 16:59:02 +00:00
pooka 6a3d9a187d Remove "puffs_cid" from the puffs interface following l-removal
from the kernel vfs interfaces.  puffs_cc_getcaller(pcc) can be
used now should the same information be desired.
2007-11-27 11:31:17 +00:00
uebayasi 22274752ee s, , , 2007-11-23 16:37:47 +00:00
elad 18558073a1 Kill another instance of KAUTH_GENERIC_ISSUSER. 2007-11-23 16:03:47 +00:00
pooka a4b032e2c8 quick & dirty support & tests for ioctl 2007-11-22 11:28:48 +00:00
pooka cf9f5c8530 Register a block device and support read/write to it. 2007-11-21 18:11:17 +00:00
pooka 378e2f0d3e Add a very simple intro-level example on how to use pud. 2007-11-20 18:58:17 +00:00
agc 8b0e0ddc0d The iSCSI target returns the 0-based Max LBA in the READ_CAPACITY command,
and we need to add 1 to it to get the size of the LUN.

Revert Max LBA calculation when returning the Maximum LBA from the target
to the iinitiator, following an email conversation with Jonathan Kollasch,
who points out a number of things:

+ the NetBSD scsipi driver reads the value returned by the drive and adds
one to it, so that standard SCSI drives return the 0-based Max LBA in a
READ CAPACITY command.

+ it is up to the initiator to add 1 to the Max LBA to find out the size
of the LUN (Jonathan verified this by using the UNH iSCSI initiator on
to a NetBSD target)

+ an analogous change to the NetBSD target (revision 1.34 of
disk.c) is needed.
2007-11-18 23:52:13 +00:00
agc 3d98641f85 Fix from Jonathan Kollasch - avoid an intermediate 32-bit value in the
calculation of the size of the storage file.

Remove some dead code.
2007-11-17 23:35:28 +00:00
pooka 4462e9454f use puffs_daemon() instead of daemon() 2007-11-16 18:39:01 +00:00
jmmv 416efab2e1 Fix release build that was broken due to the lack of a clean target.
Noted by ad@.  I didn't see this myself because I always build with
UPDATE set, so no cleaning is done.
2007-11-12 20:13:21 +00:00
jmmv 78bb0388d3 Add the ATF data files
This change adds example files shipped with ATF as well as other data files
required to support some of its features.
2007-11-12 15:01:50 +00:00
agc f2e9f627b5 Only use the bottom 20bits for an inode number to prevent the inode number creeping out of range for fts 2007-11-11 09:31:31 +00:00
agc 762d3dee18 Use the new virtual inode number, which is calculated at directory entry
insertion time, to prevent fts thinking that we have directory cycles.
2007-11-11 09:25:37 +00:00
agc 8abe1b3c75 Include a (random) inode number in the virtual directory information that
is held. Return this as part of the virtual entry information.

Prevents problems with fts code thinking that some directories create
a cycle.
2007-11-11 09:23:29 +00:00
agc 43385f0ea1 Initial import of a working iSCSI initiator, which uses reFUSE and
libpuffs.

With a round of applause to Antti Kantee for helping out with puffs
debugging, and a huge thank you to Greg Oster, who has fixed numerous
bugs over the last week (unfortunately, the bugs are all mine), and
provided enthusiasm and drive.

Right now, the initiator is fulling working for only a single target,
and should be considered to be in a state of flux.  Having said that,
Greg completed a run of build.sh with the storage on the iSCSI target,
and found times to be within 0.5% of direct attached storage.  Cache
effects apply.

The initiator should be portable to everything that uses the FUSE
interface. That's right - a portable iSCSI initiator.

Storage (LUNs exported by the target) is, at the present time,
presented as a regular file called "storage". This will likely
change in the future.

% priv obj/iscsifs -u agc inspiron1300 /mnt &
[1] 13158
inspiron1300.wherever.co.uk: 10.4.0.42:3260,1 iqn.1994-04.org.netbsd.iscsi-target:target0
inspiron1300.wherever.co.uk: 10.4.0.42:3260,1 iqn.1994-04.org.netbsd.iscsi-target:target1

% ls -al /mnt/inspiron1300.wherever.co.uk/target0/
total 576
drwxr-xr-x  2 agc  agc        512 Nov  8 21:07 .
drwxr-xr-x  2 agc  agc        512 Nov  8 21:07 ..
lrw-r--r--  1 agc  agc         44 Nov  8 21:07 hostname -> inspiron1300.wherever.co.uk
lrw-r--r--  1 agc  agc          9 Nov  8 21:07 ip -> 10.4.0.42
lrw-r--r--  1 agc  agc         16 Nov  8 21:07 product -> NetBSD iSCSI
-rw-r--r--  1 agc  agc  104857088 Nov  8 21:07 storage
lrw-r--r--  1 agc  agc         43 Nov  8 21:07 targetname -> iqn.1994-04.org.netbsd.iscsi-target:target0
lrw-r--r--  1 agc  agc          8 Nov  8 21:07 vendor -> NetBSD
lrw-r--r--  1 agc  agc          4 Nov  8 21:07 version -> 0

FFS needs a block device, and so vnconfig can be used to sit on top of
the regular file.

% mount -vv | grep iscsifs
/dev/puffs on /mnt type puffs|refuse:iscsifs (nosuid, nodev, fsid: 0xcb04/0x6acb, reads: sync 0 async 0, writes: sync 0 async 0)
% priv vnconfig vnd0 /mnt/inspiron1300.wherever.co.uk/target0/storage
% priv mount /dev/vnd0a /iscsi
% df
Filesystem   1K-blocks       Used      Avail %Cap Mounted on
/dev/dk0      28101396   21491182    5205146  80% /
kernfs               1          1          0 100% /kern
procfs               4          4          0 100% /proc
ptyfs                1          1          0 100% /dev/pts
/dev/puffs           0          0          0 100% /mnt
/dev/vnd0a       99214       8209      86045   8% /iscsi
% mount -vv | grep iscsi
/dev/puffs on /mnt type puffs|refuse:iscsifs (nosuid, nodev, fsid: 0xcb04/0x6acb, reads: sync 0 async 0, writes: sync 0 async 0)
/dev/vnd0a on /iscsi type ffs (local, fsid: 0xe00/0x78b, reads: sync 1 async 0, writes: sync 2 async 0)
2007-11-08 23:12:03 +00:00
pooka ec865a5b29 Actually, daemonize the file servers before mounting. I might require
at some point that the local protocol handler does not change after
the file system has been mounted.
2007-11-05 17:54:31 +00:00
pooka 4b0f2948e2 Pull the daemonizing code out of the library mainloop into the file
servers.  Calling daemon() (i.e. fork()ing) inside a library can
cause nice surprises for e.g. threaded programs.  As discussed with
Greg Oster & others.
2007-11-05 17:48:17 +00:00
pooka de3b90f940 add testing option -l, which causes the flush of the page cache of
the node under lookup (if found)
2007-10-11 23:03:00 +00:00
pooka ceb690c88e when removing file, free last block also 2007-10-11 13:50:42 +00:00
pooka 90900b0311 dtfs memsets all allocated block content to 0 immediately, so to
avoid wasting unbelievable amounts of memory, set the blocksize to
something more believable.  Should fix the memset-part to act only
up to the size the file is extended to, though.
2007-09-27 12:03:31 +00:00
wiz 68b83c64db Fix xref, sort SEE ALSO. Add RCS Id. 2007-09-11 23:26:13 +00:00
agc bb80e7775d Generalise the tests for OBJDIR and non-OBJDIR builds 2007-09-11 23:23:51 +00:00
agc 696c18a993 Generalise the tests for objdir builds, as well as none 2007-09-11 23:23:08 +00:00
pooka 059aa1fbbc fix usage. from Karl Jenkinson 2007-09-05 17:15:35 +00:00
agc a577a06f30 Modify the NetBSD emulation of the FreeBSD __DECONST macro to include
the cast as well. From Dag-Erling Co\xEFdan Sm\xF8rgrav.
2007-08-29 22:28:23 +00:00
agc 0920b4f20b Add a new refuse-based file system called ian - the Internet Access Node.
This utility uses FreeBSD's libfetch (updated for NetBSD, and to quieten
lint) to provide a BSD-licensed ftp/http/https file system similar to the
old alex utility. The full URL is used as the path underneath the "/ian"
mountpoint.

Sample use as follows:

	[19:09:38] agc@inspiron1300 ...examples/refuse/ian 126 > priv ian/obj/ian /ian
	[19:09:55] agc@inspiron1300 ...examples/refuse/ian 127 > cat /ian/ftp://localhost/motd
	NetBSD 4.99.27 (INSPIRON) #4: Tue Aug 7 13:04:33 BST 2007

	Welcome to NetBSD!

	This system is running a development snapshot of the NetBSD operating system,
	also known as NetBSD-current.  It is highly possible for it to contain serious
	bugs, regressions, broken features or other problems.  Please bear this in mind
	and use the system with care.

	You are encouraged to test this version as thoroughly as possible.  Should you
	encounter any problem, please report it back to the development team using the
	send-pr(1) utility (requires a working MTA).  If yours is not properly set up,
	use the web interface at: http://www.netbsd.org/support/send-pr.html

	Thank you for helping us test and improve NetBSD.

	[19:10:17] agc@inspiron1300 ...examples/refuse/ian 128 > df
	Filesystem   1K-blocks       Used      Avail %Cap Mounted on
	/dev/dk0      28101396   19491972    7204356  73% /
	kernfs               1          1          0 100% /kern
	procfs               4          4          0 100% /proc
	ptyfs                1          1          0 100% /dev/pts
	/dev/puffs           0          0          0 100% /ian
	[19:10:21] agc@inspiron1300 ...examples/refuse/ian 129 > ls -al /ian/ftp://localhost/motd
	-rw-------  1 root  wheel  705 Aug 28 19:10 /ian/ftp://localhost/motd
	[19:10:42] agc@inspiron1300 ...examples/refuse/ian 130 > ls -al ~ftp/motd
	-rw-r--r--  1 ftp  ftp  705 Aug 27 21:33 /home/ftp/motd
	[19:10:53] agc@inspiron1300 ...examples/refuse/ian 131 >
2007-08-28 19:45:02 +00:00
agc 5a236e395c Makefile for new ian file system 2007-08-28 19:39:30 +00:00
agc b143e0b001 If we're writing to a file, make sure the version we're writing is in
the topmost directory (the writable one).  If it's not there, copy the
file to there.
2007-08-20 21:55:44 +00:00
pooka 25a346d4fb Nuke PUFFSLOOKUP_FOO and move to NAMEI_FOO 2007-08-15 14:19:19 +00:00
pooka 37f06f1c57 sysctlfs was moved to base 2007-08-15 14:13:57 +00:00
pooka ba4e596bc9 move sysctlfs from examples to base 2007-08-09 22:01:25 +00:00
pooka 5b593f2aeb require standard mount_foo bar /path usage, where bar is ignored here 2007-08-09 21:54:27 +00:00
pooka 4a7c7712c6 * require standard mount_foo bar /path usage, where bar is ignored here
* allow only root callers to modify sysctl tree
2007-08-09 21:54:16 +00:00
pooka e4b63c41f0 implement node_mmap and allow to specify accepted mappings on command line 2007-07-27 08:29:10 +00:00
pooka 27c5f7cba3 Match code with comment (can't really remember doing it often that
way around .. ) and initialize storage to zero when extending a file.
2007-07-22 13:19:38 +00:00
pooka a53b2cab5e missed one place to set dirent namelen - unmiss it 2007-07-22 12:26:58 +00:00
pooka 87429c840c Oops, the cookies for nfs of course represent the *next* directory
entry offset, not the current one.
2007-07-19 10:14:53 +00:00
pooka b4d2a683de -m for setting maxreqlen 2007-07-19 07:58:56 +00:00
pooka ce80f00ff3 With fullpath support we need to check name lengths also, otherwise
lookup for "foo" will match "foobar".
2007-07-17 16:33:27 +00:00
pooka 9ee5fb2795 nuke accidental debug printf 2007-07-17 16:00:56 +00:00
pooka 0038fe558b Use "sysctlfs" as the type name instead of the mountpath.
Methinks it's nicer that way.
2007-07-17 12:03:46 +00:00
pooka 08db7d7534 * add mntfromname parameter to puffs_init()
* set it in file servers
2007-07-17 11:34:51 +00:00
dsl 1f7faf40a2 Change the entry for ptmx to use the netbsd ptm driver.
Delete the entries for pts/nnn and add a note at the tope (next to the
ptmx info) about using ptyfs for the pts devices.
2007-07-05 19:34:36 +00:00
pooka 3c01554a05 dtfs -f for PUFFS_KFLAG_LOOKUP_FULLPNBUF 2007-07-01 22:59:09 +00:00
pooka 6596e0c995 adapt: **newnode etc. pointers -> struct puffs_newinfo 2007-07-01 18:40:15 +00:00
pooka fe7bbdec69 adapt: pid -> const struct puffs_cid * 2007-07-01 17:23:44 +00:00
pooka 1776bc7796 adapt: pcn->pcn_cred is now a pointer 2007-07-01 15:32:02 +00:00
pooka 53a4105885 Actually, keep PUFFS_KFLAG_NOCACHE and -o cache around as shorthand
to neither page- nor namecache.
2007-06-24 22:25:49 +00:00
pooka 5662e7f720 PUFFS_KFLAG_NOCACHE became two, so introduce the command line options
-o nonamecache and -o nopagecache and adapt file systems where necessary.
2007-06-24 22:18:38 +00:00
pooka 3aa77bc919 Just to demonstrate namemod a bit further, make this flip the case
of filenames / contents instead of rot13 if -f is given.
2007-06-24 18:59:27 +00:00
pooka 39542808a8 cast tolower() arg to unsigned char 2007-06-24 18:57:26 +00:00
pooka 0d05db1c32 use puffs_null_setops() 2007-06-24 18:43:30 +00:00
pooka a2b6c72725 fix this also, had a similar rototill-typo as rot13fs 2007-06-24 18:37:40 +00:00
pooka eb83bd6c94 I wasn't going to add any more silly examples, but I'll bite for
this one, since it's a good exercise ..

Add icfs, which does the same thing as the refuse-based icfs agc
added earlier this week, i.e. null-mounts & converts the entire
namespace to lowercase.  However, it's a fun comparison, since this
is implemented in a completely different fashion from the refuse
version.
2007-06-24 18:32:00 +00:00
agc a08d769680 Initial import of icfs, a case-insensitive/retentive file system.
This file system is based on librefuse and puffs.

	The icfs(8) utility can be used to mount an existing directory on a
	new mount point.  icfs makes use of the virtdir(3) virtual directory
	routines.  Underneath those virtual directories, the individual
	directory entries will be displayed as an exact mirror of the original
	directory, except that any capital letters in the original entry's
	name will be substituted with an entry name consisting entirely of
	lower-case letters.

This is an unusual example of a refuse-based file system which provides
lesser functionality than the file system it sits on.
2007-06-21 22:05:28 +00:00
agc 5599c23a3d Record the root directory at initialisation time.
Add a function to "normalise" a path to condense multiple repeated '/'
characters into one.
2007-06-21 21:59:32 +00:00
pooka 1c4b40e1bc fix typo from previous rototill, makes this work again 2007-06-20 21:11:26 +00:00
pooka f8326bf98e Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
2007-06-06 01:54:59 +00:00
pooka ae34899ec3 make getopt() actually accept -t also 2007-06-05 12:20:35 +00:00
agc d49e2683be Another day, another file system.
dmesgfs is another example file system, which displays the device tree
information gained from dmesg(8) as a directory hierarchy. The information
can be displayed in files, or as targets of symbolic links.

% l /mnt/mainbus0
total 320
drwxr-xr-x  2 agc   agc    512 May 21 22:21 .
drwxr-xr-x  2 root  wheel    0 Jan  1  1970 ..
drwxr-xr-x  2 agc   agc    512 May 21 22:21 acpi0
lrwxr-xr-x  1 agc   agc     41 May 21 22:21 cpu0 -> cpu0 at mainbus0 apid 0: (boot processor)
lrwxr-xr-x  1 agc   agc     40 May 21 22:21 ioapic -> ioapic at mainbus0 apid 1 not configured
drwxr-xr-x  2 agc   agc    512 May 21 22:21 pci0
% l /mnt/mainbus0/pci0/piixide0/atabus1/atapibus0
total 256
drwxr-xr-x  2 agc  agc  512 May 21 22:21 .
drwxr-xr-x  2 agc  agc  512 May 21 22:21 ..
lrwxr-xr-x  1 agc  agc   31 May 21 22:21 Description -> atapibus0 at atabus1: 2 targets
lrwxr-xr-x  1 agc  agc  104 May 21 22:21 cd0 -> cd0 at atapibus0 drive 0: <VMware Virtual IDE CDROM Drive, 1000000000000000000, 0000000> cdrom removable
%
2007-05-21 21:29:23 +00:00
agc cfb41894f8 Adapt to new signature for virtdir_add(). 2007-05-21 21:19:25 +00:00
agc 12eda41239 Add a size parameter to virtdir_add, so that binary information can be
attached to a virtual directory entry.
2007-05-21 21:15:34 +00:00
agc c048d63924 Add a function to return the virtual offset in the virtdir_t tree. 2007-05-19 06:15:38 +00:00
pooka 1d9d9332f5 Use SETBACK_NOREF instead of SETBACK_INACT to control node removal.
Avoids one round of inactive (wheee!).
2007-05-18 15:53:07 +00:00
pooka 48d5a49e1f "support" vop_poll enough for testing purposes. In short, yield every
poll request for a few seconds before returning.
2007-05-18 13:55:21 +00:00
pooka c8b0a89198 reflect changes in fs mount: use puffs_mount() instead of
puffs_domount() & puffs_start()
2007-05-17 14:13:04 +00:00
pooka 9550017a8d Adapt to changes with mounting file systems.
Introduce a parameter -r to control the root node type.  For example
"dtfs -r 'lnk /etc' /puffs" mounts dtfs with the root node as a
symbolic link to /etc:

jojonaru# ./dtfs -r 'lnk /etc' /puffs
jojonaru# ls -l /puffs
lrw-rw-rw-  1 root  wheel  4 May 17 14:06 /puffs -> /etc
jojonaru# cd /puffs
jojonaru# pwd
/etc
jojonaru#

Extra credit for figuring out how to unmount this file system with
umount(8).

Likewise, "dtfs -r 'chr 2 12' /puffs" makes /puffs (i386) /dev/zero etcetc.
2007-05-17 14:10:13 +00:00
agc cd3ccd9b12 Add a new, trivial file system, pcifs, which shows the devices on a
pcibus (via pcictl(8)) under the mount point:

% df /mnt
Filesystem         1K-blocks      Used     Avail Capacity  Mounted on
puffs:refuse:pcifs         0         0         0   100%    /mnt
% l /mnt
total 642
drwxr-xr-x   2 root  wheel     0 Jan  1  1970 .
drwxr-xr-x  31 root  wheel  1024 May 16 20:06 ..
lrw-r--r--   1 agc   agc      65 May 16 22:05 000:00:0: -> Intel 82443BX Host Bridge/Controller (host bridge, revision 0x01)
lrw-r--r--   1 agc   agc      55 May 16 22:05 000:01:0: -> Intel 82443BX AGP Interface (PCI bridge, revision 0x01)
lrw-r--r--   1 agc   agc      64 May 16 22:05 000:07:0: -> Intel 82371AB (PIIX4) PCI-ISA Bridge (ISA bridge, revision 0x08)
lrw-r--r--   1 agc   agc      86 May 16 22:05 000:07:1: -> Intel 82371AB (PIIX4) IDE controller (IDE mass storage, interface 0x8a, revision 0x01)
lrw-r--r--   1 agc   agc      58 May 16 22:05 000:07:2: -> Intel 82371AB (PIIX4) USB Host Controller (USB serial bus)
lrw-r--r--   1 agc   agc      87 May 16 22:05 000:07:3: -> Intel 82371AB (PIIX4) Power Management Controller (miscellaneous bridge, revision 0x08)
lrw-r--r--   1 agc   agc      36 May 16 22:05 000:15:0: -> VMware Virtual SVGA II (VGA display)
lrw-r--r--   1 agc   agc      56 May 16 22:05 000:16:0: -> Symbios Logic 53c1030 (SCSI mass storage, revision 0x01)
lrw-r--r--   1 agc   agc      75 May 16 22:05 000:17:0: -> Advanced Micro Devices PCnet-PCI Ethernet (ethernet network, revision 0x10)
lrw-r--r--   1 agc   agc      53 May 16 22:05 000:18:0: -> Ensoniq AudioPCI 97 (audio multimedia, revision 0x02)
%

pcifs uses the virtdir routines, librefuse and puffs.
2007-05-16 21:44:30 +00:00
pooka d583f4a1ec Unmount frequently requires some test code, so define it here as
a dummy instead of libpuffs to make plugging the test code in easier.
2007-05-07 17:22:50 +00:00
pooka 2893a07834 Default to inactive-on-demand, use inactive setback to request inactive
to be called for a removed node (for unix open file semantics).
2007-05-07 17:18:50 +00:00
pooka 65b2578e0c allow to mount nullfs types only from directories
TODO: generalize
2007-04-24 21:38:32 +00:00
pooka 2878c03588 mount with write-through page cache if command line -t is given 2007-04-22 18:03:18 +00:00
pooka 9a3c4f612c remove assertion now done in libpuffs 2007-04-20 08:29:28 +00:00
agc af7508ae15 Take advantage of the new functionality in virtdir_add() to create
intermediate directories automatically.
2007-04-18 20:33:59 +00:00
agc 9448d95472 When adding virtual directory entries, check the path to see that
intermediate directories have already been created. If not, then
create the intermediate directories. This means that callers don't
need to create the intermediate directories themselves.

When reading a virtual directory, don't return a zero-length
virtual directory entry.
2007-04-18 20:32:16 +00:00
agc 41c7d6fedc Don't allow duplicate directory entries to be created.
Correct a comment.
2007-04-17 22:51:53 +00:00
pooka 66efb94d3b use PUFFS_STORE_DCOOKIE 2007-04-17 11:43:32 +00:00
pooka 558edb1195 update usage 2007-04-16 13:52:38 +00:00
pooka 4609dd7023 lessen file handle size sanity checks: kernel does it already (mostly) 2007-04-16 13:25:09 +00:00
pooka b173dac692 adapt to kernel changes with file handles 2007-04-16 13:06:39 +00:00
agc aac1680082 Add id3fs, a virtual file system, based on librefuse, for accessing
mp3-based files according to artist, genre or year.

Three virtual directories are made available under the mount point -

	artists/
	genre/
	year/

and then virtual directory entries (see virtdir(3)) are created under
these heading directories.

The pkgsrc/audio/id3 package is needed for this file system to function
properly.

Two shell scripts, id3info.sh and id3db.sh, are included to build up
the music database for id3fs to use to build up its virtual
directories.
2007-04-15 15:22:44 +00:00
agc 777436c8cf Add routines to manipulate virtual directory entries, for use with
librefuse-based file systems.

These are especially useful for file systems which present virtual
directory hierarchies to the caller.

The routines build up and manage an array of virtual directory
entries, indexed upon full pathname within the file system.  This is
analogous to the way refuse indexes its own entries.  Routines are
available to add, delete, and find entries.  Each entry can be one of
3 types - file ('f'), directory ('d') or symbolic link ('l').  Each
entry can also be associated with a target, which is a character
string allocated upon addition.  This can be useful for virtual
directory entries of the symbolic link type.

The virtual directory entries can be traversed as an ordered list
(the entries are ordered alphabetically), or can be accessed by
directory component, using routines analogous to opendir(3), readdir(3),
and closedir(3).
2007-04-15 15:10:56 +00:00
pooka 37dd7942fc Instead of keeping on adding parameters to puffs_mount(), make it
only take the bare essentials, which currently means removing
"maxreqlen" from the argument list (all current callers I'm aware
of set it as 0 anyway).  Introduce puffs_init(), which provides a
context for setting various parameters and puffs_domount(), which
can be used to mount the file system.  Keep puffs_mount() as a
shortcut for the above two for simple file systems.

Bump development ABI version to 13.  After all, it's Friday the 13th.
Watch out!  Bad things can happen on Friday the 13th. --No carrier--
2007-04-13 13:35:46 +00:00
pooka 95a18d20b9 Hide struct puffs_usermount from the rest of the world and provide
accessors for interesting data in it.  Namely, you can now get
pu->pu_privdata with puffs_getspecific(), pu->pu_pn_root with
puffs_set/getroot() and pu->pu_maxreqlen with puffs_getmaxreqlen().
2007-04-12 15:09:00 +00:00
pooka 7ed53cb9ec adapt to new readdir signature. no functional change 2007-04-11 21:10:49 +00:00
pooka 5af002af7d support nfs exporting sysctlfs. it is now possible to manage the
sysctl tree for a host over nfs (for however megaexciting that is)
2007-04-11 21:08:52 +00:00
pooka 3e65ff17b5 support nfs exporting dtfs 2007-04-11 21:07:54 +00:00
pooka c6d7dea8d5 use dev_t from puffs_node instead of duplicating it into
fs specific structures
2007-04-10 13:32:02 +00:00
pooka d99ec1ff38 g/c leftovers 2007-04-10 12:29:29 +00:00
pooka 4a480ffabb Allocate file memory in blocks instead of one big chunk. Makes
writing large files much cheaper since there's no longer a need to
realloc $lots of memory when the file grows.
2007-04-01 10:55:38 +00:00
agc f44794b224 Add a refuse-based "fanout" file system. This is more commonly known in
the BSD world as a "union" file system.

This fanout file system takes a number of directories and makes them
available under a single mount point.

This is more of an example file sytsem than anything else, but is used
as the basis of a number of other file systems which will be forthcoming
"real soon now".
2007-03-31 21:05:56 +00:00
pooka 27eb6005d2 reflect libpuffs change of puffs_access argument unification 2007-03-22 16:59:34 +00:00
pooka 4370dd6320 check puffs_access_{chmod,chown,times} in setattr 2007-03-21 19:56:49 +00:00
pooka 6d03fb0803 add support for permissions and file ownership 2007-03-20 18:30:30 +00:00
pooka 19dd9ef4ee don't shrink file size when writing to the middle of an existing file
(mandatory AsiaBSDCon live commit)
2007-03-11 10:08:37 +00:00
pooka d89ebe7462 * remove rogue header
* better variable name to avoid shadowing global symbol name
2007-02-27 22:03:45 +00:00
agc 7f4005e3b0 Add dbfs, an example (re)fuse file system which mounts a Berkeley
database as a file system.

The file was created in the first place with the following commands:

	cp /etc/passwd infile
	db -E B -w -f infile -F: -C btree bdb.db

and mounted as follows:

	./dbfs bdb.db /mnt

Example use is as follows, using a btree-based database with login
names as the key, and the rest of the passwd file entry as the value:

[21:17:20] agc@inspiron1300 ~ 142 > df -i /mnt
Filesystem        1K-blocks      Used     Avail Capacity  iused    ifree  %iused  Mounted on
puffs:refuse:dbfs        32        32         0   100%        1        0   100%   /mnt
[21:17:25] agc@inspiron1300 ~ 143 > l /mnt
total 2
drwxr-xr-x   2 root  wheel     0 Jan  1  1970 .
drwxr-xr-x  29 root  wheel  1024 Jan 31 21:14 ..
-r--r--r--   1 agc   agc      55 Feb 23 14:49 _pflogd
-r--r--r--   1 agc   agc      50 Feb 23 14:49 _proxy
-r--r--r--   1 agc   agc      46 Feb 23 14:49 _rwhod
-r--r--r--   1 agc   agc      49 Feb 23 14:49 _timedc
-r--r--r--   1 agc   agc      33 Feb 23 14:49 agc
-r--r--r--   1 agc   agc      51 Feb 23 14:49 bin
-r--r--r--   1 agc   agc      40 Feb 23 14:49 daemon
-r--r--r--   1 agc   agc      46 Feb 23 14:49 games
-r--r--r--   1 agc   agc      54 Feb 23 14:49 named
-r--r--r--   1 agc   agc      56 Feb 23 14:49 nobody
-r--r--r--   1 agc   agc      53 Feb 23 14:49 ntpd
-r--r--r--   1 agc   agc      49 Feb 23 14:49 operator
-r--r--r--   1 agc   agc      55 Feb 23 14:49 postfix
-r--r--r--   1 agc   agc      32 Feb 23 14:49 root
-r--r--r--   1 agc   agc      53 Feb 23 14:49 sshd
-r--r--r--   1 agc   agc      43 Feb 23 14:49 toor
-r--r--r--   1 agc   agc      52 Feb 23 14:49 uucp
[21:17:32] agc@inspiron1300 ~ 144 > grep nologin /mnt/*
/mnt/_pflogd:*:18:18:& pseudo-user:/var/chroot/pflogd:/sbin/nologin
/mnt/_proxy:*:21:21:Proxy Services:/nonexistent:/sbin/nologin
/mnt/_rwhod:*:19:19:& pseudo-user:/var/rwho:/sbin/nologin
/mnt/_timedc:*:22:22:& pseudo-user:/nonexistent:/sbin/nologin
/mnt/bin:*:3:7:Binaries Commands and Source:/:/sbin/nologin
/mnt/daemon:*:1:1:The devil himself:/:/sbin/nologin
/mnt/games:*:7:13:& pseudo-user:/usr/games:/sbin/nologin
/mnt/named:*:14:14:& pseudo-user:/var/chroot/named:/sbin/nologin
/mnt/nobody:*:32767:39:Unprivileged user:/nonexistent:/sbin/nologin
/mnt/ntpd:*:15:15:& pseudo-user:/var/chroot/ntpd:/sbin/nologin
/mnt/operator:*:2:5:System &:/usr/guest/operator:/sbin/nologin
/mnt/postfix:*:12:12:& pseudo-user:/var/spool/postfix:/sbin/nologin
/mnt/sshd:*:16:16:& pseudo-user:/var/chroot/sshd:/sbin/nologin
/mnt/uucp:*:66:1:UNIX-to-UNIX Copy:/nonexistent:/sbin/nologin
[21:17:37] agc@inspiron1300 ~ 145 >
2007-02-23 21:26:44 +00:00
pooka 27f51110f8 lookup in-core nodes in readdir() and provide the real inode for
each node.  This makes pwd work.
2007-02-16 16:39:56 +00:00
pooka 34faca38b1 * introduce path comparison method for the sysctl MIB paths
* use puffs_path_walkcmp() instead of a homegrown routine
2007-02-15 17:07:31 +00:00
pooka 3f1bccc16c Use new libpuffs dotdot features to get rid of embedding the directory
hierarchy in the in-memory nodes.  This allows us to easily do
reclaim, since we don't have to worry about reclaiming a node which
has alive children which might want to dotdot lookup later on.
2007-02-15 12:59:22 +00:00
pooka 5f82fb0670 support reclaim 2007-02-15 12:54:52 +00:00
pooka 70d42dbba1 do reclaim 2007-02-15 12:54:24 +00:00
pooka 9c41498b0b PUFFS_ISDOTDOT -> PCNISDOTDOT 2007-02-15 12:52:30 +00:00
gdt 5ff979921c Even though the parent doesn't descend here, it's still convenient to
have a makefile to build the 4 examples at once.
2007-01-30 01:26:58 +00:00
pooka c1b9179682 Avoid doing a ludicrous number of reallocs when the file grows by only
lazy extending the file in setattr and really extending it in write.
2007-01-28 10:47:36 +00:00
pooka f235a8d60c Add very uncorrect "suspend fs if server gets SIGUSR1" test for fs
suspension (hey, it's a test file system after all .... )
2007-01-26 23:02:05 +00:00
elad a78693aa19 Kill KAUTH_PROCESS_RESOURCE and just replace it with two actions for
nice and rlimit.
2007-01-20 16:47:38 +00:00
elad e52ee73ea8 arg0 is always 'struct proc *' for the process scope. 2007-01-15 17:05:01 +00:00
pooka b5da39fea6 Gur Zbba vf Jnavat Perfprag (19% bs Shyy)
Add a little layering experiment, which both exercises the
componentname modification feature of libpuffs and tries to do
layering (just a little too hardcoded for comfort, fow now).  This
simply uses the puffs nullfs to present all data and paths in rot13.
You can even mount it twice for extra fun.
2007-01-15 00:46:29 +00:00
pooka e6ea11c9c0 use new style to indicate rootpath 2007-01-15 00:43:07 +00:00
pooka 9a25a94ef7 adapt to libpuffs changes 2007-01-15 00:41:09 +00:00
pooka 14995912ad use the libpuffs path management routines to help build the sysctl
mib names
2007-01-15 00:40:37 +00:00
pooka dd15744c39 * register fsync operation
* test for -s, which causes no detach (don't need to remember to
  do follow-dances in gdb because of fork() used in daemon())
2007-01-11 17:50:35 +00:00
pooka 764f2241da * initialize pflags properly
* make 'dump' imply 'don't detach'
2007-01-11 11:52:53 +00:00
pooka cf4b2a379f example null file system built on top of the null layer in libpuffs 2007-01-11 01:03:03 +00:00
pooka a67e4ce37f * do mount as a forward operation instead of a callback
* process -o args for mount
2007-01-06 18:25:19 +00:00
elad a75d82b0bc We no longer have 'enum kauth_machdep_req'. 2007-01-05 13:23:22 +00:00
elad a13160f423 Make mount(2) and unmount(2) use kauth(9) for security policy.
Okay yamt@.
2007-01-02 10:47:28 +00:00
pooka d584a8d23a SUSv3 says: should the implementation not support directory unlinking,
unlink shall fail with EPERM and the errno of the failure shall be EPERM
2007-01-01 21:32:12 +00:00
pooka 6a42c9c838 apply wide-angle rotollation beam to match libpuffs changes 2006-12-29 15:37:06 +00:00
pooka fb7890b666 ssshfs is obsoleted by mount_psshfs 2006-12-29 15:36:18 +00:00
elad 504c71d9fe Make machdep scope architecture-agnostic by removing all arch-specific
requests and centralizing them all. The result is that some of these
are not used on some architectures, but the documentation was updated
to reflect that.
2006-12-26 10:43:43 +00:00
elad 3d11477c94 Add requests indicating access to unmanaged memory for arm, pc532, powerpc,
sh3, sh5, and vax, and use them instead of KAUTH_GENERIC_ISSUSER.

Update documentation and example secmodel code.
2006-12-22 11:13:21 +00:00
elad 238ad51d2d - moves 'nice' access semantics to secmodel code,
- makes sysctl_proc_find() just lookup the process,
- use KAUTH_PROCESS_CANSEE requests to determine if the caller is
  allowed to view the target process' corename, stop flags, and
  rlimits,
- use explicit kauth(9) calls with KAUTH_PROCESS_CORENAME,
  KAUTH_REQ_PROCESS_RESOURCE_NICE, KAUTH_REQ_PROCESS_RESOURCE_RLIMIT,
  and KAUTH_PROCESS_STOPFLAG when modifying the aforementioned.
- sync man-page and example skeleton secmodel with reality.

okay yamt@

this is a pullup candidate.
2006-12-14 11:45:08 +00:00
manu 098ea45eb4 New README.plainrsa sample file 2006-12-10 05:52:10 +00:00
pooka fe53828f70 use command line flags to set various options 2006-12-07 22:49:04 +00:00
pooka 7e3489d64a write requires setattr, so do a dummy version to make write here work
again after the checkops kernel changes
2006-12-07 10:59:03 +00:00
pooka fb5e346800 counter-rototill for libpuffs change: unify all callback ops under
a single structure
2006-12-07 10:54:29 +00:00
pooka 44576f90f6 fix IO_APPEND for write 2006-12-05 23:14:13 +00:00
pooka 05b1899256 only count directories in the number of hard links to a directory 2006-12-05 14:32:03 +00:00
pooka 69dbc08863 update flag names 2006-12-01 12:50:52 +00:00
pooka 496f59a99f adapt to flags parameter for puffs_mainloop() 2006-11-30 05:38:54 +00:00
wiz fa34b615d2 Correct spelling of "immediate(ly)". From Zafer. 2006-11-24 21:23:07 +00:00
hubertf 1ee989e6be Don't try to handle symlinks on versions of the SSH File Transfer Protocol
that don't support it, e.g. the Solaris 9/x86 sshd (SSH-2.0-Sun_SSH_1.0;
..._1.1 from Solaris 10/x86 is fine)

OK'd by pooka@
2006-11-23 01:51:15 +00:00
elad 4b316db1d1 Introduce KAUTH_REQ_MACHDEP_{ALPHA,X86}_UNMANAGEDMEM to handle access
to unmanaged memory.

These are the last two securelevel references in the MD code.
2006-11-22 12:12:51 +00:00