Commit Graph

110 Commits

Author SHA1 Message Date
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
xtraeme b1f8749808 Wrap long lines. 2007-04-17 00:20:52 +00:00
agc 426de30578 Flesh out the args management a bit more:
+ put some meat into the add_arg and insert_arg functions
+ implement the free_args function
+ use 0 and 1 return values, instead of EXIT_SUCCESS and EXIT_FAILURE, in
  internal functions (they bear no relation to shell exit values)
+ deep copy argument structures in refuse.c - we need to do this because
  some FUSE file systems attempt to obliterate^Wcloak the argument vector
  "for security reasons"
+ a side benefit of this is that we get the specific refuse file system
  name back again:

[10:48:43] agc@inspiron1300 ...src/lib/librefuse 38 > df
Filesystem         1K-blocks      Used     Avail Capacity  Mounted on
/dev/dk0            28101396  19318530   7377798    72%    /
kernfs                     1         1         0   100%    /kern
procfs                     4         4         0   100%    /proc
ptyfs                      1         1         0   100%    /dev/pts
puffs:refuse:id3fs         0         0         0   100%    /mnt
[10:48:51] agc@inspiron1300 ...src/lib/librefuse 39 >
2007-04-16 09:55:51 +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 9aca91baa1 use puffs_addvtype2mode() in puffs_fuse_node_mknod() 2007-03-16 08:17:36 +00:00
agc 950c7ae274 Revert the most recent changes I made - they weren't ready for primetime. 2007-03-13 22:47:03 +00:00
agc a43c9c728d Fix a thinko - if we're going to do a deep copy, let's do it properly.
With  thanks to xtraeme for the viirtual PR.
2007-03-13 22:25:32 +00:00
agc e7d3032061 + Only use EXIT_SUCCESS and EXIT_FAILURE for the return code to the
shell in the fuse_opt functions

+ add new debugging functions:
	+ __fuse_debug(), which is used to set and retrieve the
	debugging level, so that debugging information can be turned
	on and off from the user-level filesystem, and
	+ __fuse_pargs(), which prints out an argv vector

+ put the comment about pu_privdata back with the code it references

+ put the code to place the refuse name back into the fuse_new()
function - we have access to all the arguments there.

+ specifically include <fuse_opt.h> in <fuse.h> - this would seem to
be what FUSE itself does, judging by the number of fuse-based
filesystems I've patched to include <fuse_opt.h> specifically

+ do away with the forward reference to struct fuse_args in fuse.h,
since it is defined just after the forward reference without being
referenced in between

+ fill in the missing refuse_opt args functionality - add an arg to the
args structure in fuse_opt_add_arg() and fuse_opt_insert_arg(), and
free allocated memory in fuse_opt_free_args().

+ get rid of spurious forward declarations and prototypes.

+ if REFUSE_INHERIT_FS_CHARACTERISTICS is defined when refuse is built,
file systems inherit the vfs characteristics of their mountpoints. The
default value is NOT to inherit the vfs characteristics.

+ perform a deep copy of the fuse_args structure in fuse_mount() -
this is so that existing FUSE filesystems still DTRT when arguments
are zeroed out.
2007-03-13 20:50:47 +00:00
agc bffaa1dff1 Minor cosmetic changes to clean up some lint. 2007-02-28 21:48:46 +00:00
xtraeme 942dafa618 Add missing NetBSD RCS id. 2007-02-28 16:28:25 +00:00
xtraeme c7b91b596f * Move fuse_opt* defs and prototypes into fuse_opt.h.
* Move fuse_opt* funcs from refuse.c into refuse_opt.c.

Implement fuse_opt_parse() and fuse_opt_match(). And make the other
functions just dummy, always returning 0 (I added debugging printfs
to see what the application is trying to do).

For now there are two things that do not work in fuse_opt:

	* options accepting arguments, i.e -otimeout=%u or -ofile=%s.
	* options without arguments are not enabled, just parsed.

At least now curlftpfs works, even with verbose mode! :-)

Ok'ed by pooka.
2007-02-28 16:23:00 +00:00
agc 803c0cb0e3 For just now, just use "puffs:refuse" as the file system name - this will
be revisited when thee fuse_args parsing is revisited.
2007-02-26 22:28:11 +00:00
pooka 03c5e15dc2 Refactor a few interfaces a bit to look more like fuse. fuse_args
is implemented as a very dummy version (i.e. totally unimplemented),
so some effort is still needed there.

After this change it is possible to compile and run ntfs-3g.  It
works read/write for ntfs images and shows no faults at least with
superficial testing.  I did not test it against a block device,
only an image.

Thanks to Tracy and Jason for help with the test image.
2007-02-26 15:57:33 +00:00
pooka 819ea01282 convert FREAD/FWRITE to O_RDWR-stuff in open 2007-02-26 15:09:19 +00:00
pooka 1b5f35a8e4 Implement readdir properly, or at least as close to possible to how
fuse does it: read directory completely into refuse buffers if starting
from read offset 0 and for later calls trickle results from the buffers
to the kernel without consulting the fuse file system.
2007-02-26 13:52:16 +00:00
pooka a058b5a8e7 revert 1.34, as discussed with agc. It creates more problems than
it solves, namely breaks ~all fuse file systems.  Proper fix is known
but not yet implemented.
2007-02-26 00:25:40 +00:00
agc 607e07e6b1 For large directories, remove the artificial restriction on one
buffer's worth of directory entries - this work is done in the higher
level (re)fuse readdir or getdir operation.
2007-02-23 20:51:49 +00:00
pooka fedaaf62e4 * missing open is not a failure, just return 0
* nuke accidentally committed debug printf
2007-02-20 23:49:15 +00:00
pooka a44cf00bd8 reverse order of arguments to fuse->op.symlink, remove comment
suspecting argument order reversal
2007-02-20 19:13:28 +00:00
pooka af95243f4c * Thread flags to VOP_OPEN (except of course O_CREAT, O_TRUNC and O_EXCL)
through fuse_file_info to the fuse open operation.
* reference count opens for each node and do release once the count
  drops to zero (instead of waiting for inactive).  I'm still not sure
  if this exactly matches linux/fuse behaviour, but at least we do
  open when a new file descriptor is opened for each node and a do
  a release when the reference to the last file descriptor for a
  node is closed, so it ought to be pretty close

cryptofs works after these changes
2007-02-20 19:00:21 +00:00
pooka 0d421bcd8b * create a refusenode also for the root node
* opendir directories in open
2007-02-20 14:51:52 +00:00
pooka 838ac147aa Implement a very very stubby fuse_unmount(), which does ... nothing.
Pending some puffs changes that are in the queue, this is the best way
currently.
2007-02-19 23:12:29 +00:00
pooka bb3c90d323 fix return-in-the-middle bug in inactive. and while there, make
it always return 0, since the return value is not used for error
indication for the kernel
2007-02-19 22:12:44 +00:00
xtraeme a7ff578b00 puffs_fuse_node_inactive: initialize ret to 0 to avoid a warning. 2007-02-19 22:07:51 +00:00
pooka 6a3c4eb394 * combine emulation layer tasks for node creation to a common routine
* make set/getattr easily callable from interface functions and sprinkle
  calls to locations which require them
* use libpuffs routine for stat->vattr translation instead of homegrown one
* I have concluded that we really want to do release/releasedir in
  inactive instead of reclaim.  make it so.  we'll tweak it for the next
  file system which decides it doesn't want to work

after these changes lzofs works, at least for most parts
(I'd assume the non-working parts to fail also on fuse/linux)
2007-02-19 22:04:26 +00:00
pooka 3780ec4943 * don't allow reads beyond at offset = EOF, all fuse file systems can't
handle it
* initialize refuse root node properly
* some misc cleanup
2007-02-18 23:30:45 +00:00
pooka 12999dc43c fix rename (yes, it's really that simple) 2007-02-18 22:42:33 +00:00
pooka 45bd3a1031 * oh, and when removing, remove the target node, not its parent directory
* use PUFFS_KFLAG_NOCACHE always for now, since code is too jumpy and
  volatile to deal with caches
2007-02-18 22:30:59 +00:00
pooka c82c131e9f * map reclaim to release, but call it only for files which were opened
* use node paths in remove/rmdir instead of pcn full paths (which are
  null for those ops)
2007-02-18 22:08:42 +00:00
pooka e8d4536f16 in create, if op.create doesn't exist, try op.mknod instead 2007-02-18 20:38:07 +00:00
pooka a24db39ba5 move getdir() location to match layout of real fuse operations 2007-02-18 18:47:40 +00:00
agc 3d88835937 Added extra functionality:
fuse_opt_free_args()

	fuse_exit()

Both from Juan RP - thanks!
2007-02-18 17:44:57 +00:00
pooka 6f8e93a61f support some more fuse interfaces required for setattr:
utimens, utime, truncate and ftruncate
2007-02-18 00:01:18 +00:00
wiz c3ab7ea8ed Remove superfluous Pp. Fix xref target. 2007-02-17 08:40:36 +00:00
pooka eb8b0d493d LIBDPLIBS on puffs 2007-02-16 15:44:37 +00:00
pooka 9212590495 * can't call unlink(2) & rmdir(2) in error paths. Rather, call
ops specified in the fuse op vector (or, if they're missing,
  we're SOL)
* great return value overhaul: return -ret to get linuxy -errno
  right for the kernel
2007-02-16 00:35:06 +00:00
pooka c18a22fa1f write to end-of-file in case of IOAPPEND 2007-02-16 00:16:39 +00:00
pooka 8d87a172a3 * first stab at create
* return proper return values from read/write
2007-02-16 00:13:02 +00:00
pooka 33cad1c7b0 No need to set read, readdir and write in the ops vector twice.
Pair up some ops while shuffling.
2007-02-15 21:57:09 +00:00
pooka 76fead3a3e Readlink should place the length of the link (without terminating
nul) in the length field.  Make it so.
2007-02-15 19:33:51 +00:00
pooka a5855ee07b * slightly better dirfillers
* make readlink work
2007-02-15 18:35:16 +00:00
pooka 38efeab0aa implement proper lookup 2007-02-15 17:06:24 +00:00
pooka 99f9488df4 Implement a very very hacky fuse_get_context(), needs to be visited once
threading is added (and probably otherwise also).
2007-02-15 10:54:40 +00:00
pooka ef61c39aea link operation does not create a new node, therefore don't do it in
the code either
2007-02-11 18:33:30 +00:00
pooka 7027ce431d hash out a bit further 2007-02-11 18:32:02 +00:00
pooka 66eeb022c2 insert comma in SEE ALSO list in fear of retaliation by wizd 2007-02-11 18:31:32 +00:00
pooka b4a4328b14 need to compare against PUFFS_VNOVAL instead of 0 to determnine if
fields are valid
2007-02-11 18:30:55 +00:00
pooka 1bcabb4452 pass real fuse_file_info to rest of fuse ops instead of a memset-to-zero one 2007-02-11 16:06:52 +00:00
pooka d2895ac61d sprinkle some KNF
agc ok
2007-02-11 16:02:24 +00:00
pooka dccec0f03b fuse directory fillers return opposite truth values from puffs_nextdent,
so invert return value to make readdir callers which check the return
value work.
2007-02-11 14:38:00 +00:00
pooka 85a3d9279a Allocate refuse private data, refusenode, for all nodes. Currently it
carries fuse_file_info.

.. and lo, cddafs works
2007-02-11 12:12:39 +00:00
pooka f3a3462b84 implement getdir, used by some older fuse file systems instead of readdir 2007-02-11 11:57:41 +00:00
pooka 8343e96869 Don't release nodes in _remove or _rmdir, implement reclaim
where to do it.
2007-02-11 10:58:43 +00:00
pooka 7d7c04f43a * sprinkle some comments to obvious XXX places
* remove outdated #ifdef from write
* return 0 if unmount is not supported instead of ENOSYS
2007-02-11 10:51:53 +00:00
agc 4cccedc203 Add an implementation of the file system in userspace functionality,
based on top of libpuffs.  This version is still barebones and
incomplete, but will benefit from others working on it, rather than
just me.

The option code has still to be implemented, but this gets far enough
to run hellofs (from the fuse web page):

	% priv ./hellofs ~/hellofs/mnt &
	% l ~/hellofs/mnt
	total 2
	drwxr-xr-x  2 root  wheel    0 Jan  1  1970 .
	drwxr-xr-x  4 agc   agc    512 Feb  9 18:05 ..
	-r--r--r--  1 root  wheel   13 Jan  1  1970 hello
	% cat ~/hellofs/mnt/hello
	Hello World!
	% df ~/hellofs/mnt
	Filesystem           1K-blocks      Used     Avail Capacity  Mounted on
	/dev/dk0              28101396  18946682   7749646    70%    /
	kernfs                       1         1         0   100%    /kern
	procfs                       4         4         0   100%    /proc
	ptyfs                        1         1         0   100%    /dev/pts
	puffs:refuse:hellofs  28101396  18946682   7749646    70%    /home/agc/hellofs/mnt
	% mount -v -v
	...
	mount: mount_puffs not found for /home/agc/hellofs/mnt
	puffs:refuse:hellofs on /home/agc/hellofs/mnt type puffs (nosuid, nodev, fsid: 0xcb01/0x6acb, reads: sync 0 async 0, writes: sync 0 async 0)
	%

This code is not enabled by default. Yet.
2007-02-11 10:31:37 +00:00