Commit Graph

106 Commits

Author SHA1 Message Date
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 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
pooka 6b61e56541 I've written more than a fair share of this to see my name up in
lights.  Wine & women, come to me now!
2007-11-08 17:08:46 +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 02a45a4a7c Header cleanup: don't need defs.h to do a few includes for us. Also,
use #include <> for global headers instead of #include "".
2007-11-05 13:41:52 +00:00
pooka 8f078f842e * Fix pthread key creation to depend on if it hasn't been created before
instead of depending if a lock was succesfully acquired.  Also, add
  a comment explaining why it is such complex (for all I could guess).
* replace err()'s with abort()
* replace some abort()'s by returning failure
2007-11-05 13:38:27 +00:00
pooka 9038ffc17c Use puffs prepost ops for setting pid/lwpid instead of separate
calls in all methods.
2007-10-28 18:41:54 +00:00
pooka e955e253d7 revert 1.77, MULTITHREADED_REFUSE has problems 2007-10-23 17:19:19 +00:00
pooka c683f6f6b5 Get rid of MULTITHREADED_REFUSE for context queries. We can simply
use the pthread codepaths always.
2007-10-21 16:46:52 +00:00
pooka a3e1355fe5 Use new puffs features to provide correct caller info instead of
sometimes returning stale data.
2007-10-21 14:36:35 +00:00
xtraeme 8b2678bd7e Use a two clause license for all the code I contributed.
The envsys code will be changed later.
2007-10-06 07:21:02 +00:00
pooka 12e401bc1a Add refuse paper to SEE ALSO 2007-09-24 00:22:25 +00:00
pooka ec5345d9bc Now that we don't dump operations by default, might as well detach
from the console by default also.  (but still would be nice if someone
provided options to toggle these using the fuse options framework)
2007-08-25 12:03:59 +00:00
pooka 306d09812c In case a file system doesn't provide st_blksize, default to DEV_BSIZE. 2007-08-12 15:32:39 +00:00
pooka d8a510556e get rid of DBG= 2007-07-18 22:38:58 +00:00
pooka ff87a004d6 Don't stay on the foreground and dump operations by default.
XXX: someone(tm) should make it possible to set PUFFS_OPFLAG_DUMP
using the fuse options framework
2007-07-18 22:05:41 +00:00
pooka 08db7d7534 * add mntfromname parameter to puffs_init()
* set it in file servers
2007-07-17 11:34:51 +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
agc 8ff3509ad4 Use pthread_[gs]etspecific to store a pointer to the fuse_context
information, enabled if MULTITHREADED_REFUSE is defined at build
time. This is not enabled by default since libpuffs is not
threadsafe yet.

librefuse is still not threadsafe, but this gets rid of a whole lot of
problems in the meantime.
2007-06-12 18:57:05 +00:00
agc 8dda7dd1f3 Minor cleanup - change uses of malloc, memset to calloc.
Use EXIT_FAILURE in preference to the less informational 1.
2007-06-12 18:54:36 +00:00
agc e19f0cc8f0 Re-work the way the SET_FUSE_CONTEXT* macros are done, following
feedback from Antti.
2007-06-12 18:53:29 +00:00
agc e9dcd39bdb # use puffs_cred_getuid(3) and puffs_cred_getgid(3)
for i in `jot 100 1`; do
	echo "I must respect the abstractions which pooka put in puffs_cred(3)"
done
2007-06-11 20:54:33 +00:00
agc 2f101ca796 Set the uid, gid and pid wherever possible (i.e. where known). This gets
us far enough along that fuse-loggedfs now works with the correct command,
uid and gid being displayed.
2007-06-11 20:10:00 +00:00
wiz cd4aa9ff37 Make Nm match Dt. This makes it easier to guess what the man page is
called when you find it with man -k.
2007-06-09 10:16:25 +00:00
tls 4147a3c54a Add new Makefile knob, USE_FORT, which extends USE_SSP by turning on the
FORTIFY_SOURCE feature of libssp, thus checking the size of arguments to
various string and memory copy and set functions (as well as a few system
calls and other miscellany) where known at function entry.  RedHat has
evidently built all "core system packages" with this option for some time.

This option should be used at the top of Makefiles (or Makefile.inc where
this is used for subdirectories) but after any setting of LIB.

This is only useful for userland code, and cannot be used in libc or in
any code which includes the libc internals, because it overrides certain
libc functions with macros.  Some effort has been made to make USE_FORT=yes
work correctly for a full-system build by having the bsd.sys.mk logic
disable the feature where it should not be used (libc, libssp iteself,
the kernel) but no attempt has been made to build the entire system with
USE_FORT and doing so will doubtless expose numerous bugs and misfeatures.

Adjust the system build so that all programs and libraries that are setuid,
directly handle network data (including serial comm data), perform
authentication, or appear likely to have (or have a history of having)
data-driven bugs (e.g. file(1)) are built with USE_FORT=yes by default,
with the exception of libc, which cannot use USE_FORT and thus uses
only USE_SSP by default.  Tested on i386 with no ill results; USE_FORT=no
per-directory or in a system build will disable if desired.
2007-05-28 12:06:17 +00:00
agc 9cdcc01daf After we've malloc'd an area of storage, zero out this storage, "just in
case".
2007-05-24 00:55:57 +00:00
pooka 6a3281d2da Calling puffs_exit() in fuse_{exit,unmount}() is wrong, as those
shouldn't release resources.  As a quick hack to prevent double
frees etc, introduce "dead" variable into fuse channel to signal
if the backing puffs resource was already freed.  XXX: the check
is only in exit/unmount currently.

Proper fix really depends on some puffs features I still haven't
gotten around to doing.
2007-05-17 21:28:12 +00:00
pooka a367d901e0 create hash for the root path object 2007-05-17 21:00:32 +00:00
pooka d2228f155e initialize refusenode contents to 0
(don't change malloc to calloc and expect things not to break)
2007-05-17 16:41:18 +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
christos 19468d62cc More fixes:
- make sure that the args array is NULL terminated.
- make sure argc is initialized and argv is set to NULL after freeing.
- make the deep copy function an opt interface function.
2007-05-17 01:55:43 +00:00
xtraeme b18c74c93e Add the $NetBSD$ tag, it's easier to know what revision you have. 2007-05-16 22:17:52 +00:00
christos c0df99a133 - Always check strdup return. For now we are lazy and bail instead of cleaning
up.
- Use malloc and free instead of macros, delete macros.
- Merge the two copies of deep copy and free args that were slightly buggy
  into one and use that one.

XXX: Lots of ints should be size_t.
XXX: Bailing on error is not a good thing for a library.
XXX: Defs.h should be eliminated completely. Not all files need all the headers.
2007-05-16 21:39:08 +00:00
agc 9ceda06dfa The FUSE_USE_VERSION is the definition which the user sets, and which
determines the API.

Provide a default for FUSE_USE_VERSION if it's not set, and use this
value to determine the number of arguments given to fuse_main().
2007-05-16 21:37:18 +00:00
pooka 71bc398720 Enable puffs_fakecc. FUSE file systems don't use continuations anyway,
and now file servers linked against libpthread won't crash when they
attempt to malloc something.
2007-05-16 10:53:41 +00:00
agc dcd3457a33 When parsing arguments for the directory to mount, search backwards from
the end of the argument vector for an argument that doesn't begin with '-',
and use it - this improves upon the previous naive approach of using the
last argument, which could have been placed there by one of the argument
appending functions.

Be consistent with the mount name processing, and always do the
puffs:refuse:filesystem substitution once and once only.

% priv mount.ntfs-3g ntfs-refuse.img /mnt
% df /mnt
Filesystem           1K-blocks      Used     Avail Capacity  Mounted on
puffs:refuse:ntfs-3g   1000943     66309    934634     6%    /mnt
% priv umount /mnt
% priv /usr/src/share/examples/refuse/id3fs/id3fs /mnt &
% df /mnt
Filesystem         1K-blocks      Used     Avail Capacity  Mounted on
puffs:refuse:id3fs         0         0         0   100%    /mnt
% priv umount /mnt
%
2007-05-15 22:56:16 +00:00
agc 01b98414eb Fuse version 2.6 (and above) has a 4 argument version of fuse_main(),
whereas previous versions had a 3 argument one. Accept both.
2007-05-15 22:47:35 +00:00
agc a6521ab14a When puffs_mount fails, display the name of the directory which wasn't
able to be mounted.
2007-05-15 22:46:06 +00:00
agc 76c020111a ...and include fuse_opt.h in the correct place. 2007-05-03 21:13:25 +00:00
agc 363bf2c052 Implement fuse_setup(), and fuse_teardown() - necessary for the python
bindings for refuse.
2007-05-03 21:02:54 +00:00
agc a2b7c5e9b3 FUSE includes fuse_opt.h from fuse.h, albeit indirectly, via fuse_common.h.
Refuse doessn't have a fuse_common.h, so include fuse_opt.h explicitly
from fuse.h.  To avoid circular dependencies, don't include fuse.h
from fuse_opt.h.

This means that we no longer have to modify packages which use the argument
and option parsing routines to include fuse_opt.h.
2007-05-03 20:58:22 +00:00
pooka 80dbf44035 In case a fuse fs hands an stbuf with an inode number 0 to the
readdir filler, fake the inode number.  Our readdir() doesn't show
entries with inode number 0.

per discussion with Stephen Borrill
2007-05-02 18:05:54 +00:00
pooka f5ef068cda use PUFFS_FLAG_HASHPATH 2007-05-01 15:58:25 +00:00
agc 1e1fbd91da The error return code from fuse_opt_add_arg() and fuse_opt_insert_arg() is
actually -1, not 1. Fix the broken sewing machine, and make it sew.
2007-04-17 06:34:48 +00:00
xtraeme 2a9a16f24b Forgot to move the prototype in a comment to the correct place. 2007-04-17 00:25:21 +00:00
xtraeme 5ebefbd7c9 Sync comments with reality. 2007-04-17 00:23:23 +00:00