Commit Graph

216 Commits

Author SHA1 Message Date
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