[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
libfuse .cvsignore AUTHORS COPYING ChangeLog Ma...
From: |
Thomas Schwinge |
Subject: |
libfuse .cvsignore AUTHORS COPYING ChangeLog Ma... |
Date: |
Sat, 31 Mar 2012 19:38:04 +0000 |
CVSROOT: /cvsroot/hurdextras
Module name: libfuse
Changes by: Thomas Schwinge <tschwinge> 12/03/31 19:38:03
Removed files:
. : .cvsignore AUTHORS COPYING ChangeLog
Makefile.am NEWS README TODO configure.ac
fuse.pc.in libfuse-test-hello.sh
example : .cvsignore Makefile.am fusexmp.c
fusexmp.c.patch hello.c null.c
example-22 : .cvsignore Makefile.am fusexmp.c
fusexmp.c.patch hello.c null.c
example-23 : .cvsignore Makefile.am fusexmp.c
fusexmp.c.patch fusexmp_fh.c fusexmp_fh.c.patch
hello.c null.c
example-24 : .cvsignore Makefile.am fusexmp.c
fusexmp.c.patch fusexmp_fh.c fusexmp_fh.c.patch
hello.c hello_ll.c null.c
example-25 : .cvsignore Makefile.am fusexmp.c fusexmp_fh.c
hello.c hello_ll.c null.c
include : .cvsignore Makefile.am fuse.h fuse_common.h
fuse_compat.h fuse_opt.h
include/old : .cvsignore Makefile.am fuse.h
src : .cvsignore Makefile.am fuse_i.h main.c netfs.c
netnode.c node.c
Log message:
libfuse is now maintained in a Git repository:
<http://git.savannah.gnu.org/cgit/hurd/incubator.git/log/?h=libfuse/master>
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libfuse/.cvsignore?cvsroot=hurdextras&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/AUTHORS?cvsroot=hurdextras&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/COPYING?cvsroot=hurdextras&r1=1.1.1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/ChangeLog?cvsroot=hurdextras&r1=1.4&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/Makefile.am?cvsroot=hurdextras&r1=1.5&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/NEWS?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/README?cvsroot=hurdextras&r1=1.4&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/TODO?cvsroot=hurdextras&r1=1.6&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/configure.ac?cvsroot=hurdextras&r1=1.9&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/fuse.pc.in?cvsroot=hurdextras&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/libfuse-test-hello.sh?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example/.cvsignore?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example/Makefile.am?cvsroot=hurdextras&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example/fusexmp.c?cvsroot=hurdextras&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example/fusexmp.c.patch?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example/hello.c?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example/null.c?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-22/.cvsignore?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-22/Makefile.am?cvsroot=hurdextras&r1=1.4&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-22/fusexmp.c?cvsroot=hurdextras&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-22/fusexmp.c.patch?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-22/hello.c?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-22/null.c?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-23/.cvsignore?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-23/Makefile.am?cvsroot=hurdextras&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-23/fusexmp.c?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-23/fusexmp.c.patch?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-23/fusexmp_fh.c?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-23/fusexmp_fh.c.patch?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-23/hello.c?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-23/null.c?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-24/.cvsignore?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-24/Makefile.am?cvsroot=hurdextras&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-24/fusexmp.c?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-24/fusexmp.c.patch?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-24/fusexmp_fh.c?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-24/fusexmp_fh.c.patch?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-24/hello.c?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-24/hello_ll.c?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-24/null.c?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-25/.cvsignore?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-25/Makefile.am?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-25/fusexmp.c?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-25/fusexmp_fh.c?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-25/hello.c?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-25/hello_ll.c?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/example-25/null.c?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/include/.cvsignore?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/include/Makefile.am?cvsroot=hurdextras&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/include/fuse.h?cvsroot=hurdextras&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/include/fuse_common.h?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/include/fuse_compat.h?cvsroot=hurdextras&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/include/fuse_opt.h?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/include/old/.cvsignore?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/include/old/Makefile.am?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/include/old/fuse.h?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/src/.cvsignore?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/src/Makefile.am?cvsroot=hurdextras&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/src/fuse_i.h?cvsroot=hurdextras&r1=1.5&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/src/main.c?cvsroot=hurdextras&r1=1.9&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/src/netfs.c?cvsroot=hurdextras&r1=1.6&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/src/netnode.c?cvsroot=hurdextras&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/libfuse/src/node.c?cvsroot=hurdextras&r1=1.1&r2=0
Patches:
Index: .cvsignore
===================================================================
RCS file: .cvsignore
diff -N .cvsignore
--- .cvsignore 3 Dec 2005 09:46:51 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,27 +0,0 @@
-*.lo
-.deps
-Makefile
-Makefile.in
-aclocal.m4
-libtool
-stamp-h
-stamp-h.in
-autom4te.cache
-autoscan.log
-config.h
-config.h.in
-config.h.in~
-config.log
-config.status
-configure
-.libs
-libfuse.la
-INSTALL
-config.guess
-config.sub
-depcomp
-fuse.pc
-install-sh
-ltmain.sh
-missing
-stamp-h1
Index: AUTHORS
===================================================================
RCS file: AUTHORS
diff -N AUTHORS
--- AUTHORS 30 Jan 2006 21:26:26 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1 +0,0 @@
-Stefan Siegl <address@hidden>
Index: COPYING
===================================================================
RCS file: COPYING
diff -N COPYING
--- COPYING 26 Jan 2005 19:56:40 -0000 1.1.1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,340 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
Index: ChangeLog
===================================================================
RCS file: ChangeLog
diff -N ChangeLog
--- ChangeLog 14 Apr 2006 19:28:45 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,5 +0,0 @@
-#! /bin/sh
-# ChangeLog is more or less available through CVS revision history
-# there is no separate file telling what was changed line by line ...
-
-exec lynx "http://cvs.savannah.nongnu.org/viewcvs/libfuse/?root=hurdextras"
Index: Makefile.am
===================================================================
RCS file: Makefile.am
diff -N Makefile.am
--- Makefile.am 30 Jan 2006 22:37:59 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
-# Makefile.am
-# Used by automake and configure to create Makefile.
-#
-# Copyright (C) 2005,2006 Stefan Siegl <address@hidden>, Germany
-
-SUBDIRS = include src
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = fuse.pc
-
-$(pkgconfig_DATA): config.status
Index: NEWS
===================================================================
RCS file: NEWS
diff -N NEWS
--- NEWS 20 Mar 2005 13:21:30 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1 +0,0 @@
-no news is good news.
Index: README
===================================================================
RCS file: README
diff -N README
--- README 30 Jan 2006 22:33:57 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,58 +0,0 @@
- -*- mode: outline -*-
-
-* General Information
- libfuse is a library intended for the GNU Hurd trying to imitate the
- API of the fuse library, available from http://fuse.sourceforge.net, for
- Linux. It's based on Hurd's libnetfs and tries to bring all the fuse based
- virtual filesystems over to the Hurd.
-
-** Fuse Low-Level API
- The low-level API will not be supported by libfuse/Hurd for the
- time being. This is simply because it is to specific to the Linux
- kernel and (besides that) it is not farly used now.
-
- In case the latter should change in the future, we might want to
- re-think about that issue though.
-
- This is, you will not succeed in compiling the hello_ll.c example
- from the example-24 directory.
-
-* Dependencies
- Actually none, besides libnetfs. However you should have installed
- that anyways (maybe missing just the header files).
-
-* Installation
- ./configure
- make
- make install
-
- For more details see the INSTALL file in this directory.
-
-* How To Use
- Translators linked against libfuse/Hurd don't work exactly like on
- the Linux operating system. To be more precise: you need to install
- them using settrans.
-
- Some filesystems check for the availibility of a command line
- argument, which they want to pass to libfuse, and simply fail, if
- you don't supply it. This is because on Linux you call the
- translator as a program as such and specify the mount-point as the
- first argument.
-
- If the fuse-based translator insists on that argument, just provide
- any useless information (maybe the correct path). This one will not
- be treated (at least by libfuse).
-
- The filesystem will be put on the node you provide to the settrans
- command. Anything else is not of any interest.
-
- Filesystems that try to export more than one filesystem (I don't
- know of any example, sorry, but these are generally supported by
- Linux's FUSE) will fail on the Hurd. This is because of the settrans
- thing.
-
-* Bug Reports
- You can contact us at <address@hidden>.
-
-
-$Id: README,v 1.4 2006/01/30 22:33:57 stesie Exp $
Index: TODO
===================================================================
RCS file: TODO
diff -N TODO
--- TODO 9 Dec 2005 14:58:30 -0000 1.6
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,78 +0,0 @@
--*- mode: outline -*-
-
-* example fusexmp crash
-
-Running the example fusexmp file system, the translator crashes (and the whole
-system might also crash) if you try to run a binary from within that file
-system, e.g.
-
-$ settrans -ac f ./fusexmp
-$ cd f
-$ bin/ls
-
-** single-threaded operation
-
- The libfuse/Linux does allow to force single-threaded operation (`-s'
- command line arg). This was somewhat the hardcoded default case for
- the Hurd variant so far (mainly for debugging reasons).
-
- Single-threaded operation is necessary for parts of the Perl and
- Python bindings, where the filesystem callbacks would confuse the
- main interpreter.
-
- libfuse/Hurd does use multi-threaded operation by default as well
- now. This is, the fusexmp translator should work like a charm now (at
- least when it comes to this issue).
-
-
-* example null
-
-The example null file system does not return zeroes (which it is supposed to
-do, I think):
-
-$ settrans -ac n ./null
-$ od -x -N 10 < n
-0000000 01f4 0000 0000 3000 0002
-0000012
-
-Is the following fix correct?
-
---- netfs.c 15 Nov 2005 23:43:05 -0000 1.30
-+++ netfs.c 2 Dec 2005 00:03:45 -0000
-@@ -1090,6 +1101,8 @@
- || (err = fshelp_access(&node->nn_stat, S_IREAD, cred)))
- goto out;
-
-+ memset(data, 0, *len);
-+
- int sz = fuse_ops ?
- (fuse_ops->read(node->nn->path, data, *len, offset, &node->nn->info)) :
- (fuse_ops_compat->read(node->nn->path, data, *len, offset));
-
-** libfuse/Linux doesn't return null-bytes as well
-
- Since it isn't of any practical use for a meaningful filesystem,
- I would vote against applying it.
-
-
-* <hurd/netfs.h>
-
-We're supposed to define netfs_make_user().
-
-** are we?
-
- I cannot find any appearance in the Hurd sources except for the
- netfs.h header file.
-
- Is this just one relict there or is it of any use? The task sounds
- rather like another libraries and not a filesystem's job.
-
-
-* readdir()
-
- FUSE's readdir() needs to be supported in netfs_get_dirents().
-
-** this was introduced by an api change with version 2.3
-
- ... and should finally be supported. But still needs some more
- testing. I've just run the fusexmp_fh example so far.
Index: configure.ac
===================================================================
RCS file: configure.ac
diff -N configure.ac
--- configure.ac 13 Apr 2006 22:52:47 -0000 1.9
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,49 +0,0 @@
-# -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-#
-# Copyright (C) 2005,2006 by Stefan Siegl <address@hidden>, Germany
-
-AC_PREREQ(2.59)
-AC_INIT(libfuse, 0.1, address@hidden)
-AC_REVISION($Revision: 1.9 $)
-AC_CONFIG_SRCDIR(src/main.c)
-AM_CONFIG_HEADER(config.h)
-
-# Initialize automake
-AM_INIT_AUTOMAKE(libfuse, 0.1)
-
-# Checks for programs.
-m4_ifdef([LT_INIT], [LT_INIT], [AC_PROG_LIBTOOL])
-AC_PROG_CC
-AC_PROG_MAKE_SET
-
-# compatibility for automake < 1.8
-if test -z "$mkdir_p"; then
- mkdir_p="../mkinstalldirs"
- AC_SUBST(mkdir_p)
-fi
-
-# Checks for libraries.
-AC_CHECK_LIB([threads], [rwlock_init])
-AC_CHECK_LIB([ports], [hurd_ihash_init])
-AC_CHECK_LIB([fshelp], [fshelp_touch])
-AC_CHECK_LIB([iohelp], [iohelp_initialize_conch])
-#AC_CHECK_LIB([netfs], [netfs_startup])
-
-LIBS="-lnetfs $LIBS"
-CFLAGS="$CFLAGS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -W -ggdb"
-
-# Checks for header files.
-
-# Checks for typedefs, structures, and compiler characteristics.
-
-# Checks for library functions.
-
-AC_CONFIG_FILES([fuse.pc Makefile]
- [include/Makefile include/old/Makefile src/Makefile]
- [example/Makefile
- example-22/Makefile
- example-23/Makefile
- example-24/Makefile
- example-25/Makefile])
-AC_OUTPUT
Index: fuse.pc.in
===================================================================
RCS file: fuse.pc.in
diff -N fuse.pc.in
--- fuse.pc.in 4 Aug 2006 14:27:30 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,10 +0,0 @@
address@hidden@
address@hidden@
address@hidden@
address@hidden@
-
-Name: fuse
-Description: Filesystem in Userspace
-Version: @VERSION@
-Libs: -L${libdir} -lfuse -lthreads
-Cflags: -I${includedir}/fuse -D_FILE_OFFSET_BITS=64
Index: libfuse-test-hello.sh
===================================================================
RCS file: libfuse-test-hello.sh
diff -N libfuse-test-hello.sh
--- libfuse-test-hello.sh 13 Apr 2006 22:45:29 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,40 +0,0 @@
-#! /bin/sh
-
-do_test() {
- echo ""
- echo " *****************************************************"
- echo " * testing in $1/ ..."
- echo " ***"
- make -C $1 hello || {
- echo "FAILED to compile hello translator from $1/"
- exit 2
- }
-
- test -e node && settrans -fg node
-
- settrans -fca node $1/hello || {
- echo "FAILED to set translator $1/hello"
- exit 2
- }
-
- test -e node/hello || {
- echo "node/hello file missing, but should be there."
- exit 1
- }
-
- test `stat --format "%s" node/hello` -eq 13 || {
- echo "node/hello expected to be 13 bytes long."
- exit 1
- }
-
- grep -q "Hello World" node/hello || {
- echo "node/hello doesn't contain 'Hello World'"
- exit 1
- }
-
- echo "looks good."
- echo
-}
-
-# now let's get it on ...
-for A in example*; do do_test $A || exit 1; done
Index: example/.cvsignore
===================================================================
RCS file: example/.cvsignore
diff -N example/.cvsignore
--- example/.cvsignore 20 Mar 2005 13:21:30 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,8 +0,0 @@
-.deps
-Makefile
-Makefile.in
-fusexmp
-hello
-null
-test
-.libs
Index: example/Makefile.am
===================================================================
RCS file: example/Makefile.am
diff -N example/Makefile.am
--- example/Makefile.am 30 Jan 2006 23:12:04 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,10 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_PROGRAMS = fusexmp null hello
-
-fusexmp_SOURCES = fusexmp.c
-null_SOURCES = null.c
-hello_SOURCES = hello.c
-
-LDADD = ../src/libfuse.la
-AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include
Index: example/fusexmp.c
===================================================================
RCS file: example/fusexmp.c
diff -N example/fusexmp.c
--- example/fusexmp.c 20 Mar 2005 19:56:35 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,347 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2004 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <config.h>
-
-#ifdef linux
-/* For pread()/pwrite() */
-#define _XOPEN_SOURCE 500
-#endif
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/statfs.h>
-#ifdef HAVE_SETXATTR
-#include <sys/xattr.h>
-#endif
-
-static int xmp_getattr(const char *path, struct stat *stbuf)
-{
- int res;
-
- res = lstat(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_readlink(const char *path, char *buf, size_t size)
-{
- int res;
-
- res = readlink(path, buf, size - 1);
- if(res == -1)
- return -errno;
-
- buf[res] = '\0';
- return 0;
-}
-
-
-static int xmp_getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler)
-{
- DIR *dp;
- struct dirent *de;
- int res = 0;
-
- dp = opendir(path);
- if(dp == NULL)
- return -errno;
-
- while((de = readdir(dp)) != NULL) {
- res = filler(h, de->d_name, de->d_type);
- if(res != 0)
- break;
- }
-
- closedir(dp);
- return res;
-}
-
-static int xmp_mknod(const char *path, mode_t mode, dev_t rdev)
-{
- int res;
-
- /* On the Hurd we must not use mknod() to create files, but creat() */
- if(mode & S_IFREG)
- res = creat(path, mode & ALLPERMS);
- else
- res = mknod(path, mode, rdev);
-
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_mkdir(const char *path, mode_t mode)
-{
- int res;
-
- res = mkdir(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_unlink(const char *path)
-{
- int res;
-
- res = unlink(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rmdir(const char *path)
-{
- int res;
-
- res = rmdir(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_symlink(const char *from, const char *to)
-{
- int res;
-
- res = symlink(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rename(const char *from, const char *to)
-{
- int res;
-
- res = rename(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_link(const char *from, const char *to)
-{
- int res;
-
- res = link(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chmod(const char *path, mode_t mode)
-{
- int res;
-
- res = chmod(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chown(const char *path, uid_t uid, gid_t gid)
-{
- int res;
-
- res = lchown(path, uid, gid);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_truncate(const char *path, off_t size)
-{
- int res;
-
- res = truncate(path, size);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_utime(const char *path, struct utimbuf *buf)
-{
- int res;
-
- res = utime(path, buf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-
-static int xmp_open(const char *path, int flags)
-{
- int res;
-
- res = open(path, flags);
- if(res == -1)
- return -errno;
-
- close(res);
- return 0;
-}
-
-static int xmp_read(const char *path, char *buf, size_t size, off_t offset)
-{
- int fd;
- int res;
-
- fd = open(path, O_RDONLY);
- if(fd == -1)
- return -errno;
-
- res = pread(fd, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- close(fd);
- return res;
-}
-
-static int xmp_write(const char *path, const char *buf, size_t size,
- off_t offset)
-{
- int fd;
- int res;
-
- fd = open(path, O_WRONLY);
- if(fd == -1)
- return -errno;
-
- res = pwrite(fd, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- close(fd);
- return res;
-}
-
-static int xmp_statfs(const char *path, struct statfs *stbuf)
-{
- int res;
-
- res = statfs(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_release(const char *path, int flags)
-{
- /* Just a stub. This method is optional and can safely be left
- unimplemented */
-
- (void) path;
- (void) flags;
- return 0;
-}
-
-static int xmp_fsync(const char *path, int isdatasync)
-{
- /* Just a stub. This method is optional and can safely be left
- unimplemented */
-
- (void) path;
- (void) isdatasync;
- return 0;
-}
-
-#ifdef HAVE_SETXATTR
-/* xattr operations are optional and can safely be left unimplemented */
-static int xmp_setxattr(const char *path, const char *name, const char *value,
- size_t size, int flags)
-{
- int res = lsetxattr(path, name, value, size, flags);
- if(res == -1)
- return -errno;
- return 0;
-}
-
-static int xmp_getxattr(const char *path, const char *name, char *value,
- size_t size)
-{
- int res = lgetxattr(path, name, value, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_listxattr(const char *path, char *list, size_t size)
-{
- int res = llistxattr(path, list, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_removexattr(const char *path, const char *name)
-{
- int res = lremovexattr(path, name);
- if(res == -1)
- return -errno;
- return 0;
-}
-#endif /* HAVE_SETXATTR */
-
-static struct fuse_operations xmp_oper = {
- .getattr = xmp_getattr,
- .readlink = xmp_readlink,
- .getdir = xmp_getdir,
- .mknod = xmp_mknod,
- .mkdir = xmp_mkdir,
- .symlink = xmp_symlink,
- .unlink = xmp_unlink,
- .rmdir = xmp_rmdir,
- .rename = xmp_rename,
- .link = xmp_link,
- .chmod = xmp_chmod,
- .chown = xmp_chown,
- .truncate = xmp_truncate,
- .utime = xmp_utime,
- .open = xmp_open,
- .read = xmp_read,
- .write = xmp_write,
- .statfs = xmp_statfs,
- .release = xmp_release,
- .fsync = xmp_fsync,
-#ifdef HAVE_SETXATTR
- .setxattr = xmp_setxattr,
- .getxattr = xmp_getxattr,
- .listxattr = xmp_listxattr,
- .removexattr= xmp_removexattr,
-#endif
-};
-
-int main(int argc, char *argv[])
-{
- fuse_main(argc, argv, &xmp_oper);
- return 0;
-}
Index: example/fusexmp.c.patch
===================================================================
RCS file: example/fusexmp.c.patch
diff -N example/fusexmp.c.patch
--- example/fusexmp.c.patch 2 Dec 2005 00:02:24 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
---- ../../fuse-0-branch-2.2/example/fusexmp.c 2005-11-17 16:17:35.000000000
+0100
-+++ fusexmp.c 2005-03-20 20:56:35.000000000 +0100
-@@ -73,7 +73,12 @@
- {
- int res;
-
-- res = mknod(path, mode, rdev);
-+ /* On the Hurd we must not use mknod() to create files, but creat() */
-+ if(mode & S_IFREG)
-+ res = creat(path, mode & ALLPERMS);
-+ else
-+ res = mknod(path, mode, rdev);
-+
- if(res == -1)
- return -errno;
-
Index: example/hello.c
===================================================================
RCS file: example/hello.c
diff -N example/hello.c
--- example/hello.c 20 Mar 2005 13:21:30 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,89 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2004 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-
-static const char *hello_str = "Hello World!\n";
-static const char *hello_path = "/hello";
-
-static int hello_getattr(const char *path, struct stat *stbuf)
-{
- int res = 0;
-
- memset(stbuf, 0, sizeof(struct stat));
- if(strcmp(path, "/") == 0) {
- stbuf->st_mode = S_IFDIR | 0755;
- stbuf->st_nlink = 2;
- }
- else if(strcmp(path, hello_path) == 0) {
- stbuf->st_mode = S_IFREG | 0444;
- stbuf->st_nlink = 1;
- stbuf->st_size = strlen(hello_str);
- }
- else
- res = -ENOENT;
-
- return res;
-}
-
-static int hello_getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler)
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- filler(h, ".", 0);
- filler(h, "..", 0);
- filler(h, hello_path + 1, 0);
-
- return 0;
-}
-
-static int hello_open(const char *path, int flags)
-{
- if(strcmp(path, hello_path) != 0)
- return -ENOENT;
-
- if((flags & 3) != O_RDONLY)
- return -EACCES;
-
- return 0;
-}
-
-static int hello_read(const char *path, char *buf, size_t size, off_t offset)
-{
- size_t len;
- if(strcmp(path, hello_path) != 0)
- return -ENOENT;
-
- len = strlen(hello_str);
- if (offset < len) {
- if (offset + size > len)
- size = len - offset;
- memcpy(buf, hello_str + offset, size);
- } else
- size = 0;
-
- return size;
-}
-
-static struct fuse_operations hello_oper = {
- .getattr = hello_getattr,
- .getdir = hello_getdir,
- .open = hello_open,
- .read = hello_read,
-};
-
-int main(int argc, char *argv[])
-{
- fuse_main(argc, argv, &hello_oper);
- return 0;
-}
Index: example/null.c
===================================================================
RCS file: example/null.c
diff -N example/null.c
--- example/null.c 20 Mar 2005 13:21:30 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,79 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2004 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-
-#define UNUSED(x) x __attribute__((unused))
-
-static int null_getattr(const char *path, struct stat *stbuf)
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- stbuf->st_mode = S_IFREG | 0644;
- stbuf->st_nlink = 1;
- stbuf->st_uid = getuid();
- stbuf->st_gid = getgid();
- stbuf->st_size = (1ULL << 32); /* 4G */
- stbuf->st_blocks = 0;
- stbuf->st_atime = stbuf->st_mtime = stbuf->st_ctime = time(NULL);
-
- return 0;
-}
-
-static int null_truncate(const char *path, off_t UNUSED(size))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return 0;
-}
-
-static int null_open(const char *path, int UNUSED(flags))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return 0;
-}
-
-static int null_read(const char *path, char *UNUSED(buf), size_t size,
- off_t UNUSED(offset))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return size;
-}
-
-static int null_write(const char *path, const char *UNUSED(buf), size_t size,
- off_t UNUSED(offset))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return size;
-}
-
-static struct fuse_operations null_oper = {
- .getattr = null_getattr,
- .truncate = null_truncate,
- .open = null_open,
- .read = null_read,
- .write = null_write,
-};
-
-int main(int argc, char *argv[])
-{
- fuse_main(argc, argv, &null_oper);
- return 0;
-}
Index: example-22/.cvsignore
===================================================================
RCS file: example-22/.cvsignore
diff -N example-22/.cvsignore
--- example-22/.cvsignore 26 Mar 2005 22:21:35 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,8 +0,0 @@
-.deps
-Makefile
-Makefile.in
-fusexmp
-hello
-null
-test
-.libs
Index: example-22/Makefile.am
===================================================================
RCS file: example-22/Makefile.am
diff -N example-22/Makefile.am
--- example-22/Makefile.am 30 Jan 2006 23:12:03 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,10 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_PROGRAMS = fusexmp null hello
-
-fusexmp_SOURCES = fusexmp.c
-null_SOURCES = null.c
-hello_SOURCES = hello.c
-
-LDADD = ../src/libfuse.la
-AM_CPPFLAGS = -DFUSE_USE_VERSION=22 -I$(top_srcdir) -I$(top_srcdir)/include
Index: example-22/fusexmp.c
===================================================================
RCS file: example-22/fusexmp.c
diff -N example-22/fusexmp.c
--- example-22/fusexmp.c 27 Mar 2005 13:48:53 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,351 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <config.h>
-
-#ifdef linux
-/* For pread()/pwrite() */
-#define _XOPEN_SOURCE 500
-#endif
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/statfs.h>
-#ifdef HAVE_SETXATTR
-#include <sys/xattr.h>
-#endif
-
-static int xmp_getattr(const char *path, struct stat *stbuf)
-{
- int res;
-
- res = lstat(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_readlink(const char *path, char *buf, size_t size)
-{
- int res;
-
- res = readlink(path, buf, size - 1);
- if(res == -1)
- return -errno;
-
- buf[res] = '\0';
- return 0;
-}
-
-
-static int xmp_getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler)
-{
- DIR *dp;
- struct dirent *de;
- int res = 0;
-
- dp = opendir(path);
- if(dp == NULL)
- return -errno;
-
- while((de = readdir(dp)) != NULL) {
- res = filler(h, de->d_name, de->d_type, de->d_ino);
- if(res != 0)
- break;
- }
-
- closedir(dp);
- return res;
-}
-
-static int xmp_mknod(const char *path, mode_t mode, dev_t rdev)
-{
- int res;
-
- /* On the Hurd we must not use mknod() to create files, but creat() */
- if(mode & S_IFREG)
- res = creat(path, mode & ALLPERMS);
- else
- res = mknod(path, mode, rdev);
-
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_mkdir(const char *path, mode_t mode)
-{
- int res;
-
- res = mkdir(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_unlink(const char *path)
-{
- int res;
-
- res = unlink(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rmdir(const char *path)
-{
- int res;
-
- res = rmdir(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_symlink(const char *from, const char *to)
-{
- int res;
-
- res = symlink(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rename(const char *from, const char *to)
-{
- int res;
-
- res = rename(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_link(const char *from, const char *to)
-{
- int res;
-
- res = link(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chmod(const char *path, mode_t mode)
-{
- int res;
-
- res = chmod(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chown(const char *path, uid_t uid, gid_t gid)
-{
- int res;
-
- res = lchown(path, uid, gid);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_truncate(const char *path, off_t size)
-{
- int res;
-
- res = truncate(path, size);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_utime(const char *path, struct utimbuf *buf)
-{
- int res;
-
- res = utime(path, buf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-
-static int xmp_open(const char *path, struct fuse_file_info *fi)
-{
- int res;
-
- res = open(path, fi->flags);
- if(res == -1)
- return -errno;
-
- close(res);
- return 0;
-}
-
-static int xmp_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- int fd;
- int res;
-
- (void) fi;
- fd = open(path, O_RDONLY);
- if(fd == -1)
- return -errno;
-
- res = pread(fd, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- close(fd);
- return res;
-}
-
-static int xmp_write(const char *path, const char *buf, size_t size,
- off_t offset, struct fuse_file_info *fi)
-{
- int fd;
- int res;
-
- (void) fi;
- fd = open(path, O_WRONLY);
- if(fd == -1)
- return -errno;
-
- res = pwrite(fd, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- close(fd);
- return res;
-}
-
-static int xmp_statfs(const char *path, struct statfs *stbuf)
-{
- int res;
-
- res = statfs(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_release(const char *path, struct fuse_file_info *fi)
-{
- /* Just a stub. This method is optional and can safely be left
- unimplemented */
-
- (void) path;
- (void) fi;
- return 0;
-}
-
-static int xmp_fsync(const char *path, int isdatasync,
- struct fuse_file_info *fi)
-{
- /* Just a stub. This method is optional and can safely be left
- unimplemented */
-
- (void) path;
- (void) isdatasync;
- (void) fi;
- return 0;
-}
-
-#ifdef HAVE_SETXATTR
-/* xattr operations are optional and can safely be left unimplemented */
-static int xmp_setxattr(const char *path, const char *name, const char *value,
- size_t size, int flags)
-{
- int res = lsetxattr(path, name, value, size, flags);
- if(res == -1)
- return -errno;
- return 0;
-}
-
-static int xmp_getxattr(const char *path, const char *name, char *value,
- size_t size)
-{
- int res = lgetxattr(path, name, value, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_listxattr(const char *path, char *list, size_t size)
-{
- int res = llistxattr(path, list, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_removexattr(const char *path, const char *name)
-{
- int res = lremovexattr(path, name);
- if(res == -1)
- return -errno;
- return 0;
-}
-#endif /* HAVE_SETXATTR */
-
-static struct fuse_operations xmp_oper = {
- .getattr = xmp_getattr,
- .readlink = xmp_readlink,
- .getdir = xmp_getdir,
- .mknod = xmp_mknod,
- .mkdir = xmp_mkdir,
- .symlink = xmp_symlink,
- .unlink = xmp_unlink,
- .rmdir = xmp_rmdir,
- .rename = xmp_rename,
- .link = xmp_link,
- .chmod = xmp_chmod,
- .chown = xmp_chown,
- .truncate = xmp_truncate,
- .utime = xmp_utime,
- .open = xmp_open,
- .read = xmp_read,
- .write = xmp_write,
- .statfs = xmp_statfs,
- .release = xmp_release,
- .fsync = xmp_fsync,
-#ifdef HAVE_SETXATTR
- .setxattr = xmp_setxattr,
- .getxattr = xmp_getxattr,
- .listxattr = xmp_listxattr,
- .removexattr= xmp_removexattr,
-#endif
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &xmp_oper);
-}
Index: example-22/fusexmp.c.patch
===================================================================
RCS file: example-22/fusexmp.c.patch
diff -N example-22/fusexmp.c.patch
--- example-22/fusexmp.c.patch 2 Dec 2005 00:02:24 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
---- ../../fuse-0-branch-2.2/example/fusexmp.c 2005-11-17 16:29:01.000000000
+0100
-+++ fusexmp.c 2005-03-27 15:48:53.000000000 +0200
-@@ -73,7 +73,12 @@
- {
- int res;
-
-- res = mknod(path, mode, rdev);
-+ /* On the Hurd we must not use mknod() to create files, but creat() */
-+ if(mode & S_IFREG)
-+ res = creat(path, mode & ALLPERMS);
-+ else
-+ res = mknod(path, mode, rdev);
-+
- if(res == -1)
- return -errno;
-
Index: example-22/hello.c
===================================================================
RCS file: example-22/hello.c
diff -N example-22/hello.c
--- example-22/hello.c 26 Mar 2005 22:21:35 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,90 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-
-static const char *hello_str = "Hello World!\n";
-static const char *hello_path = "/hello";
-
-static int hello_getattr(const char *path, struct stat *stbuf)
-{
- int res = 0;
-
- memset(stbuf, 0, sizeof(struct stat));
- if(strcmp(path, "/") == 0) {
- stbuf->st_mode = S_IFDIR | 0755;
- stbuf->st_nlink = 2;
- }
- else if(strcmp(path, hello_path) == 0) {
- stbuf->st_mode = S_IFREG | 0444;
- stbuf->st_nlink = 1;
- stbuf->st_size = strlen(hello_str);
- }
- else
- res = -ENOENT;
-
- return res;
-}
-
-static int hello_getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler)
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- filler(h, ".", 0, 0);
- filler(h, "..", 0, 0);
- filler(h, hello_path + 1, 0, 0);
-
- return 0;
-}
-
-static int hello_open(const char *path, struct fuse_file_info *fi)
-{
- if(strcmp(path, hello_path) != 0)
- return -ENOENT;
-
- if((fi->flags & 3) != O_RDONLY)
- return -EACCES;
-
- return 0;
-}
-
-static int hello_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- size_t len;
- (void) fi;
- if(strcmp(path, hello_path) != 0)
- return -ENOENT;
-
- len = strlen(hello_str);
- if (offset < len) {
- if (offset + size > len)
- size = len - offset;
- memcpy(buf, hello_str + offset, size);
- } else
- size = 0;
-
- return size;
-}
-
-static struct fuse_operations hello_oper = {
- .getattr = hello_getattr,
- .getdir = hello_getdir,
- .open = hello_open,
- .read = hello_read,
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &hello_oper);
-}
Index: example-22/null.c
===================================================================
RCS file: example-22/null.c
diff -N example-22/null.c
--- example-22/null.c 26 Mar 2005 22:21:35 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,78 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-
-#define UNUSED(x) x __attribute__((unused))
-
-static int null_getattr(const char *path, struct stat *stbuf)
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- stbuf->st_mode = S_IFREG | 0644;
- stbuf->st_nlink = 1;
- stbuf->st_uid = getuid();
- stbuf->st_gid = getgid();
- stbuf->st_size = (1ULL << 32); /* 4G */
- stbuf->st_blocks = 0;
- stbuf->st_atime = stbuf->st_mtime = stbuf->st_ctime = time(NULL);
-
- return 0;
-}
-
-static int null_truncate(const char *path, off_t UNUSED(size))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return 0;
-}
-
-static int null_open(const char *path, struct fuse_file_info *UNUSED(fi))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return 0;
-}
-
-static int null_read(const char *path, char *UNUSED(buf), size_t size,
- off_t UNUSED(offset), struct fuse_file_info *UNUSED(fi))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return size;
-}
-
-static int null_write(const char *path, const char *UNUSED(buf), size_t size,
- off_t UNUSED(offset), struct fuse_file_info *UNUSED(fi))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return size;
-}
-
-static struct fuse_operations null_oper = {
- .getattr = null_getattr,
- .truncate = null_truncate,
- .open = null_open,
- .read = null_read,
- .write = null_write,
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &null_oper);
-}
Index: example-23/.cvsignore
===================================================================
RCS file: example-23/.cvsignore
diff -N example-23/.cvsignore
--- example-23/.cvsignore 2 Dec 2005 00:51:26 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,8 +0,0 @@
-Makefile.in
-Makefile
-.deps
-fusexmp
-fusexmp_fh
-null
-hello
-.libs
Index: example-23/Makefile.am
===================================================================
RCS file: example-23/Makefile.am
diff -N example-23/Makefile.am
--- example-23/Makefile.am 13 Apr 2006 22:52:47 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_PROGRAMS = fusexmp fusexmp_fh null hello
-
-fusexmp_SOURCES = fusexmp.c
-fusexmp_fh_SOURCES = fusexmp_fh.c
-null_SOURCES = null.c
-hello_SOURCES = hello.c
-
-LDADD = ../src/libfuse.la
-AM_CPPFLAGS = -DFUSE_USE_VERSION=22 -I$(top_srcdir) -I$(top_srcdir)/include
Index: example-23/fusexmp.c
===================================================================
RCS file: example-23/fusexmp.c
diff -N example-23/fusexmp.c
--- example-23/fusexmp.c 2 Dec 2005 00:51:26 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,357 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <config.h>
-
-#ifdef linux
-/* For pread()/pwrite() */
-#define _XOPEN_SOURCE 500
-#endif
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/statfs.h>
-#ifdef HAVE_SETXATTR
-#include <sys/xattr.h>
-#endif
-
-static int xmp_getattr(const char *path, struct stat *stbuf)
-{
- int res;
-
- res = lstat(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_readlink(const char *path, char *buf, size_t size)
-{
- int res;
-
- res = readlink(path, buf, size - 1);
- if(res == -1)
- return -errno;
-
- buf[res] = '\0';
- return 0;
-}
-
-
-static int xmp_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
- off_t offset, struct fuse_file_info *fi)
-{
- DIR *dp;
- struct dirent *de;
-
- (void) offset;
- (void) fi;
-
- dp = opendir(path);
- if(dp == NULL)
- return -errno;
-
- while((de = readdir(dp)) != NULL) {
- struct stat st;
- memset(&st, 0, sizeof(st));
- st.st_ino = de->d_ino;
- st.st_mode = de->d_type << 12;
- if (filler(buf, de->d_name, &st, 0))
- break;
- }
-
- closedir(dp);
- return 0;
-}
-
-static int xmp_mknod(const char *path, mode_t mode, dev_t rdev)
-{
- int res;
-
- /* On the Hurd we must not use mknod() to create files, but creat() */
- if(mode & S_IFREG)
- res = creat(path, mode & ALLPERMS);
- else
- res = mknod(path, mode, rdev);
-
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_mkdir(const char *path, mode_t mode)
-{
- int res;
-
- res = mkdir(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_unlink(const char *path)
-{
- int res;
-
- res = unlink(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rmdir(const char *path)
-{
- int res;
-
- res = rmdir(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_symlink(const char *from, const char *to)
-{
- int res;
-
- res = symlink(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rename(const char *from, const char *to)
-{
- int res;
-
- res = rename(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_link(const char *from, const char *to)
-{
- int res;
-
- res = link(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chmod(const char *path, mode_t mode)
-{
- int res;
-
- res = chmod(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chown(const char *path, uid_t uid, gid_t gid)
-{
- int res;
-
- res = lchown(path, uid, gid);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_truncate(const char *path, off_t size)
-{
- int res;
-
- res = truncate(path, size);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_utime(const char *path, struct utimbuf *buf)
-{
- int res;
-
- res = utime(path, buf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-
-static int xmp_open(const char *path, struct fuse_file_info *fi)
-{
- int res;
-
- res = open(path, fi->flags);
- if(res == -1)
- return -errno;
-
- close(res);
- return 0;
-}
-
-static int xmp_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- int fd;
- int res;
-
- (void) fi;
- fd = open(path, O_RDONLY);
- if(fd == -1)
- return -errno;
-
- res = pread(fd, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- close(fd);
- return res;
-}
-
-static int xmp_write(const char *path, const char *buf, size_t size,
- off_t offset, struct fuse_file_info *fi)
-{
- int fd;
- int res;
-
- (void) fi;
- fd = open(path, O_WRONLY);
- if(fd == -1)
- return -errno;
-
- res = pwrite(fd, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- close(fd);
- return res;
-}
-
-static int xmp_statfs(const char *path, struct statfs *stbuf)
-{
- int res;
-
- res = statfs(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_release(const char *path, struct fuse_file_info *fi)
-{
- /* Just a stub. This method is optional and can safely be left
- unimplemented */
-
- (void) path;
- (void) fi;
- return 0;
-}
-
-static int xmp_fsync(const char *path, int isdatasync,
- struct fuse_file_info *fi)
-{
- /* Just a stub. This method is optional and can safely be left
- unimplemented */
-
- (void) path;
- (void) isdatasync;
- (void) fi;
- return 0;
-}
-
-#ifdef HAVE_SETXATTR
-/* xattr operations are optional and can safely be left unimplemented */
-static int xmp_setxattr(const char *path, const char *name, const char *value,
- size_t size, int flags)
-{
- int res = lsetxattr(path, name, value, size, flags);
- if(res == -1)
- return -errno;
- return 0;
-}
-
-static int xmp_getxattr(const char *path, const char *name, char *value,
- size_t size)
-{
- int res = lgetxattr(path, name, value, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_listxattr(const char *path, char *list, size_t size)
-{
- int res = llistxattr(path, list, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_removexattr(const char *path, const char *name)
-{
- int res = lremovexattr(path, name);
- if(res == -1)
- return -errno;
- return 0;
-}
-#endif /* HAVE_SETXATTR */
-
-static struct fuse_operations xmp_oper = {
- .getattr = xmp_getattr,
- .readlink = xmp_readlink,
- .readdir = xmp_readdir,
- .mknod = xmp_mknod,
- .mkdir = xmp_mkdir,
- .symlink = xmp_symlink,
- .unlink = xmp_unlink,
- .rmdir = xmp_rmdir,
- .rename = xmp_rename,
- .link = xmp_link,
- .chmod = xmp_chmod,
- .chown = xmp_chown,
- .truncate = xmp_truncate,
- .utime = xmp_utime,
- .open = xmp_open,
- .read = xmp_read,
- .write = xmp_write,
- .statfs = xmp_statfs,
- .release = xmp_release,
- .fsync = xmp_fsync,
-#ifdef HAVE_SETXATTR
- .setxattr = xmp_setxattr,
- .getxattr = xmp_getxattr,
- .listxattr = xmp_listxattr,
- .removexattr= xmp_removexattr,
-#endif
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &xmp_oper);
-}
Index: example-23/fusexmp.c.patch
===================================================================
RCS file: example-23/fusexmp.c.patch
diff -N example-23/fusexmp.c.patch
--- example-23/fusexmp.c.patch 2 Dec 2005 00:51:26 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
---- fusexmp.c.orig 2005-12-02 01:47:51.000000000 +0100
-+++ fusexmp.c 2005-12-02 01:51:26.000000000 +0100
-@@ -79,7 +79,12 @@
- {
- int res;
-
-- res = mknod(path, mode, rdev);
-+ /* On the Hurd we must not use mknod() to create files, but creat() */
-+ if(mode & S_IFREG)
-+ res = creat(path, mode & ALLPERMS);
-+ else
-+ res = mknod(path, mode, rdev);
-+
- if(res == -1)
- return -errno;
-
Index: example-23/fusexmp_fh.c
===================================================================
RCS file: example-23/fusexmp_fh.c
diff -N example-23/fusexmp_fh.c
--- example-23/fusexmp_fh.c 2 Dec 2005 00:51:26 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,360 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <config.h>
-
-#ifdef linux
-/* For pread()/pwrite() */
-#define _XOPEN_SOURCE 500
-#endif
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/statfs.h>
-#ifdef HAVE_SETXATTR
-#include <sys/xattr.h>
-#endif
-
-static int xmp_getattr(const char *path, struct stat *stbuf)
-{
- int res;
-
- res = lstat(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_readlink(const char *path, char *buf, size_t size)
-{
- int res;
-
- res = readlink(path, buf, size - 1);
- if(res == -1)
- return -errno;
-
- buf[res] = '\0';
- return 0;
-}
-
-static int xmp_opendir(const char *path, struct fuse_file_info *fi)
-{
- DIR *dp = opendir(path);
- if (dp == NULL)
- return -errno;
-
- fi->fh = (unsigned long) dp;
- return 0;
-}
-
-static int xmp_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
- off_t offset, struct fuse_file_info *fi)
-{
- DIR *dp = (DIR *) fi->fh;
- struct dirent *de;
-
- (void) path;
- seekdir(dp, offset);
- while ((de = readdir(dp)) != NULL) {
- struct stat st;
- memset(&st, 0, sizeof(st));
- st.st_ino = de->d_ino;
- st.st_mode = de->d_type << 12;
- if (filler(buf, de->d_name, &st, telldir(dp)))
- break;
- }
-
- return 0;
-}
-
-static int xmp_releasedir(const char *path, struct fuse_file_info *fi)
-{
- DIR *dp = (DIR *) fi->fh;
- (void) path;
- closedir(dp);
- return 0;
-}
-
-static int xmp_mknod(const char *path, mode_t mode, dev_t rdev)
-{
- int res;
-
- /* On the Hurd we must not use mknod() to create files, but creat() */
- if(mode & S_IFREG)
- res = creat(path, mode & ALLPERMS);
- else
- res = mknod(path, mode, rdev);
-
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_mkdir(const char *path, mode_t mode)
-{
- int res;
-
- res = mkdir(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_unlink(const char *path)
-{
- int res;
-
- res = unlink(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rmdir(const char *path)
-{
- int res;
-
- res = rmdir(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_symlink(const char *from, const char *to)
-{
- int res;
-
- res = symlink(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rename(const char *from, const char *to)
-{
- int res;
-
- res = rename(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_link(const char *from, const char *to)
-{
- int res;
-
- res = link(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chmod(const char *path, mode_t mode)
-{
- int res;
-
- res = chmod(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chown(const char *path, uid_t uid, gid_t gid)
-{
- int res;
-
- res = lchown(path, uid, gid);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_truncate(const char *path, off_t size)
-{
- int res;
-
- res = truncate(path, size);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_utime(const char *path, struct utimbuf *buf)
-{
- int res;
-
- res = utime(path, buf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-
-static int xmp_open(const char *path, struct fuse_file_info *fi)
-{
- int res;
-
- res = open(path, fi->flags);
- if(res == -1)
- return -errno;
-
- fi->fh = res;
- return 0;
-}
-
-static int xmp_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- int res;
-
- (void) path;
- res = pread(fi->fh, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- return res;
-}
-
-static int xmp_write(const char *path, const char *buf, size_t size,
- off_t offset, struct fuse_file_info *fi)
-{
- int res;
-
- (void) path;
- res = pwrite(fi->fh, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- return res;
-}
-
-static int xmp_statfs(const char *path, struct statfs *stbuf)
-{
- int res;
-
- res = statfs(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_release(const char *path, struct fuse_file_info *fi)
-{
- (void) path;
- close(fi->fh);
-
- return 0;
-}
-
-static int xmp_fsync(const char *path, int isdatasync,
- struct fuse_file_info *fi)
-{
- int res;
- (void) path;
-
- if (isdatasync)
- res = fdatasync(fi->fh);
- else
- res = fsync(fi->fh);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-#ifdef HAVE_SETXATTR
-/* xattr operations are optional and can safely be left unimplemented */
-static int xmp_setxattr(const char *path, const char *name, const char *value,
- size_t size, int flags)
-{
- int res = lsetxattr(path, name, value, size, flags);
- if(res == -1)
- return -errno;
- return 0;
-}
-
-static int xmp_getxattr(const char *path, const char *name, char *value,
- size_t size)
-{
- int res = lgetxattr(path, name, value, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_listxattr(const char *path, char *list, size_t size)
-{
- int res = llistxattr(path, list, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_removexattr(const char *path, const char *name)
-{
- int res = lremovexattr(path, name);
- if(res == -1)
- return -errno;
- return 0;
-}
-#endif /* HAVE_SETXATTR */
-
-static struct fuse_operations xmp_oper = {
- .getattr = xmp_getattr,
- .readlink = xmp_readlink,
- .opendir = xmp_opendir,
- .readdir = xmp_readdir,
- .releasedir = xmp_releasedir,
- .mknod = xmp_mknod,
- .mkdir = xmp_mkdir,
- .symlink = xmp_symlink,
- .unlink = xmp_unlink,
- .rmdir = xmp_rmdir,
- .rename = xmp_rename,
- .link = xmp_link,
- .chmod = xmp_chmod,
- .chown = xmp_chown,
- .truncate = xmp_truncate,
- .utime = xmp_utime,
- .open = xmp_open,
- .read = xmp_read,
- .write = xmp_write,
- .statfs = xmp_statfs,
- .release = xmp_release,
- .fsync = xmp_fsync,
-#ifdef HAVE_SETXATTR
- .setxattr = xmp_setxattr,
- .getxattr = xmp_getxattr,
- .listxattr = xmp_listxattr,
- .removexattr= xmp_removexattr,
-#endif
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &xmp_oper);
-}
Index: example-23/fusexmp_fh.c.patch
===================================================================
RCS file: example-23/fusexmp_fh.c.patch
diff -N example-23/fusexmp_fh.c.patch
--- example-23/fusexmp_fh.c.patch 2 Dec 2005 00:51:26 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,25 +0,0 @@
---- fusexmp_fh.c.orig 2005-12-02 01:47:51.000000000 +0100
-+++ fusexmp_fh.c 2005-12-02 01:58:16.000000000 +0100
-@@ -71,7 +71,7 @@
- memset(&st, 0, sizeof(st));
- st.st_ino = de->d_ino;
- st.st_mode = de->d_type << 12;
-- if (filler(buf, de->d_name, &st, de->d_off))
-+ if (filler(buf, de->d_name, &st, telldir(dp)))
- break;
- }
-
-@@ -90,7 +90,12 @@
- {
- int res;
-
-- res = mknod(path, mode, rdev);
-+ /* On the Hurd we must not use mknod() to create files, but creat() */
-+ if(mode & S_IFREG)
-+ res = creat(path, mode & ALLPERMS);
-+ else
-+ res = mknod(path, mode, rdev);
-+
- if(res == -1)
- return -errno;
-
Index: example-23/hello.c
===================================================================
RCS file: example-23/hello.c
diff -N example-23/hello.c
--- example-23/hello.c 2 Dec 2005 00:51:26 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,94 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-
-static const char *hello_str = "Hello World!\n";
-static const char *hello_path = "/hello";
-
-static int hello_getattr(const char *path, struct stat *stbuf)
-{
- int res = 0;
-
- memset(stbuf, 0, sizeof(struct stat));
- if(strcmp(path, "/") == 0) {
- stbuf->st_mode = S_IFDIR | 0755;
- stbuf->st_nlink = 2;
- }
- else if(strcmp(path, hello_path) == 0) {
- stbuf->st_mode = S_IFREG | 0444;
- stbuf->st_nlink = 1;
- stbuf->st_size = strlen(hello_str);
- }
- else
- res = -ENOENT;
-
- return res;
-}
-
-static int hello_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
- off_t offset, struct fuse_file_info *fi)
-{
- (void) offset;
- (void) fi;
-
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- filler(buf, ".", NULL, 0);
- filler(buf, "..", NULL, 0);
- filler(buf, hello_path + 1, NULL, 0);
-
- return 0;
-}
-
-static int hello_open(const char *path, struct fuse_file_info *fi)
-{
- if(strcmp(path, hello_path) != 0)
- return -ENOENT;
-
- if((fi->flags & 3) != O_RDONLY)
- return -EACCES;
-
- return 0;
-}
-
-static int hello_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- size_t len;
- (void) fi;
- if(strcmp(path, hello_path) != 0)
- return -ENOENT;
-
- len = strlen(hello_str);
- if (offset < len) {
- if (offset + size > len)
- size = len - offset;
- memcpy(buf, hello_str + offset, size);
- } else
- size = 0;
-
- return size;
-}
-
-static struct fuse_operations hello_oper = {
- .getattr = hello_getattr,
- .readdir = hello_readdir,
- .open = hello_open,
- .read = hello_read,
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &hello_oper);
-}
Index: example-23/null.c
===================================================================
RCS file: example-23/null.c
diff -N example-23/null.c
--- example-23/null.c 2 Dec 2005 00:51:26 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,78 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-
-#define UNUSED(x) x __attribute__((unused))
-
-static int null_getattr(const char *path, struct stat *stbuf)
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- stbuf->st_mode = S_IFREG | 0644;
- stbuf->st_nlink = 1;
- stbuf->st_uid = getuid();
- stbuf->st_gid = getgid();
- stbuf->st_size = (1ULL << 32); /* 4G */
- stbuf->st_blocks = 0;
- stbuf->st_atime = stbuf->st_mtime = stbuf->st_ctime = time(NULL);
-
- return 0;
-}
-
-static int null_truncate(const char *path, off_t UNUSED(size))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return 0;
-}
-
-static int null_open(const char *path, struct fuse_file_info *UNUSED(fi))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return 0;
-}
-
-static int null_read(const char *path, char *UNUSED(buf), size_t size,
- off_t UNUSED(offset), struct fuse_file_info *UNUSED(fi))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return size;
-}
-
-static int null_write(const char *path, const char *UNUSED(buf), size_t size,
- off_t UNUSED(offset), struct fuse_file_info *UNUSED(fi))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return size;
-}
-
-static struct fuse_operations null_oper = {
- .getattr = null_getattr,
- .truncate = null_truncate,
- .open = null_open,
- .read = null_read,
- .write = null_write,
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &null_oper);
-}
Index: example-24/.cvsignore
===================================================================
RCS file: example-24/.cvsignore
diff -N example-24/.cvsignore
--- example-24/.cvsignore 30 Jan 2006 22:28:39 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,8 +0,0 @@
-Makefile.in
-Makefile
-.deps
-fusexmp
-fusexmp_fh
-null
-hello
-.libs
Index: example-24/Makefile.am
===================================================================
RCS file: example-24/Makefile.am
diff -N example-24/Makefile.am
--- example-24/Makefile.am 13 Apr 2006 22:52:47 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_PROGRAMS = fusexmp fusexmp_fh null hello
-# low-level api not supported: hello_ll
-
-fusexmp_SOURCES = fusexmp.c
-fusexmp_fh_SOURCES = fusexmp_fh.c
-null_SOURCES = null.c
-hello_SOURCES = hello.c
-
-LDADD = ../src/libfuse.la
-AM_CPPFLAGS = -DFUSE_USE_VERSION=22 -I$(top_srcdir) -I$(top_srcdir)/include
Index: example-24/fusexmp.c
===================================================================
RCS file: example-24/fusexmp.c
diff -N example-24/fusexmp.c
--- example-24/fusexmp.c 30 Jan 2006 22:28:39 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,358 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <config.h>
-
-#ifdef linux
-/* For pread()/pwrite() */
-#define _XOPEN_SOURCE 500
-#endif
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/statfs.h>
-#ifdef HAVE_SETXATTR
-#include <sys/xattr.h>
-#endif
-
-static int xmp_getattr(const char *path, struct stat *stbuf)
-{
- int res;
-
- res = lstat(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_readlink(const char *path, char *buf, size_t size)
-{
- int res;
-
- res = readlink(path, buf, size - 1);
- if(res == -1)
- return -errno;
-
- buf[res] = '\0';
- return 0;
-}
-
-
-static int xmp_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
- off_t offset, struct fuse_file_info *fi)
-{
- DIR *dp;
- struct dirent *de;
-
- (void) offset;
- (void) fi;
-
- dp = opendir(path);
- if(dp == NULL)
- return -errno;
-
- while((de = readdir(dp)) != NULL) {
- struct stat st;
- memset(&st, 0, sizeof(st));
- st.st_ino = de->d_ino;
- st.st_mode = de->d_type << 12;
- if (filler(buf, de->d_name, &st, 0))
- break;
- }
-
- closedir(dp);
- return 0;
-}
-
-static int xmp_mknod(const char *path, mode_t mode, dev_t rdev)
-{
- int res;
-
- /* On the Hurd we must not use mknod() to create files, but creat() */
- if(mode & S_IFREG)
- res = creat(path, mode & ALLPERMS);
- else
- res = mknod(path, mode, rdev);
-
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_mkdir(const char *path, mode_t mode)
-{
- int res;
-
- res = mkdir(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_unlink(const char *path)
-{
- int res;
-
- res = unlink(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rmdir(const char *path)
-{
- int res;
-
- res = rmdir(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_symlink(const char *from, const char *to)
-{
- int res;
-
- res = symlink(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rename(const char *from, const char *to)
-{
- int res;
-
- res = rename(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_link(const char *from, const char *to)
-{
- int res;
-
- res = link(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chmod(const char *path, mode_t mode)
-{
- int res;
-
- res = chmod(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chown(const char *path, uid_t uid, gid_t gid)
-{
- int res;
-
- res = lchown(path, uid, gid);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_truncate(const char *path, off_t size)
-{
- int res;
-
- res = truncate(path, size);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_utime(const char *path, struct utimbuf *buf)
-{
- int res;
-
- res = utime(path, buf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-
-static int xmp_open(const char *path, struct fuse_file_info *fi)
-{
- int res;
-
- res = open(path, fi->flags);
- if(res == -1)
- return -errno;
-
- close(res);
- return 0;
-}
-
-static int xmp_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- int fd;
- int res;
-
- (void) fi;
- fd = open(path, O_RDONLY);
- if(fd == -1)
- return -errno;
-
- res = pread(fd, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- close(fd);
- return res;
-}
-
-static int xmp_write(const char *path, const char *buf, size_t size,
- off_t offset, struct fuse_file_info *fi)
-{
- int fd;
- int res;
-
- (void) fi;
- fd = open(path, O_WRONLY);
- if(fd == -1)
- return -errno;
-
- res = pwrite(fd, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- close(fd);
- return res;
-}
-
-static int xmp_statfs(const char *path, struct statfs *stbuf)
-{
- int res;
-
- res = statfs(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_release(const char *path, struct fuse_file_info *fi)
-{
- /* Just a stub. This method is optional and can safely be left
- unimplemented */
-
- (void) path;
- (void) fi;
- return 0;
-}
-
-static int xmp_fsync(const char *path, int isdatasync,
- struct fuse_file_info *fi)
-{
- /* Just a stub. This method is optional and can safely be left
- unimplemented */
-
- (void) path;
- (void) isdatasync;
- (void) fi;
- return 0;
-}
-
-#ifdef HAVE_SETXATTR
-/* xattr operations are optional and can safely be left unimplemented */
-static int xmp_setxattr(const char *path, const char *name, const char *value,
- size_t size, int flags)
-{
- int res = lsetxattr(path, name, value, size, flags);
- if(res == -1)
- return -errno;
- return 0;
-}
-
-static int xmp_getxattr(const char *path, const char *name, char *value,
- size_t size)
-{
- int res = lgetxattr(path, name, value, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_listxattr(const char *path, char *list, size_t size)
-{
- int res = llistxattr(path, list, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_removexattr(const char *path, const char *name)
-{
- int res = lremovexattr(path, name);
- if(res == -1)
- return -errno;
- return 0;
-}
-#endif /* HAVE_SETXATTR */
-
-static struct fuse_operations xmp_oper = {
- .getattr = xmp_getattr,
- .readlink = xmp_readlink,
- .readdir = xmp_readdir,
- .mknod = xmp_mknod,
- .mkdir = xmp_mkdir,
- .symlink = xmp_symlink,
- .unlink = xmp_unlink,
- .rmdir = xmp_rmdir,
- .rename = xmp_rename,
- .link = xmp_link,
- .chmod = xmp_chmod,
- .chown = xmp_chown,
- .truncate = xmp_truncate,
- .utime = xmp_utime,
- .open = xmp_open,
- .read = xmp_read,
- .write = xmp_write,
- .statfs = xmp_statfs,
- .release = xmp_release,
- .fsync = xmp_fsync,
-#ifdef HAVE_SETXATTR
- .setxattr = xmp_setxattr,
- .getxattr = xmp_getxattr,
- .listxattr = xmp_listxattr,
- .removexattr= xmp_removexattr,
-#endif
-};
-
-int main(int argc, char *argv[])
-{
- umask(0);
- return fuse_main(argc, argv, &xmp_oper);
-}
Index: example-24/fusexmp.c.patch
===================================================================
RCS file: example-24/fusexmp.c.patch
diff -N example-24/fusexmp.c.patch
--- example-24/fusexmp.c.patch 30 Jan 2006 22:28:39 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
---- fusexmp.c.orig 2005-12-02 01:47:51.000000000 +0100
-+++ fusexmp.c 2005-12-02 01:51:26.000000000 +0100
-@@ -79,7 +79,12 @@
- {
- int res;
-
-- res = mknod(path, mode, rdev);
-+ /* On the Hurd we must not use mknod() to create files, but creat() */
-+ if(mode & S_IFREG)
-+ res = creat(path, mode & ALLPERMS);
-+ else
-+ res = mknod(path, mode, rdev);
-+
- if(res == -1)
- return -errno;
-
Index: example-24/fusexmp_fh.c
===================================================================
RCS file: example-24/fusexmp_fh.c
diff -N example-24/fusexmp_fh.c
--- example-24/fusexmp_fh.c 30 Jan 2006 22:28:39 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,358 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <config.h>
-
-#define _GNU_SOURCE
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/statfs.h>
-#ifdef HAVE_SETXATTR
-#include <sys/xattr.h>
-#endif
-
-static int xmp_getattr(const char *path, struct stat *stbuf)
-{
- int res;
-
- res = lstat(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_readlink(const char *path, char *buf, size_t size)
-{
- int res;
-
- res = readlink(path, buf, size - 1);
- if(res == -1)
- return -errno;
-
- buf[res] = '\0';
- return 0;
-}
-
-static int xmp_opendir(const char *path, struct fuse_file_info *fi)
-{
- DIR *dp = opendir(path);
- if (dp == NULL)
- return -errno;
-
- fi->fh = (unsigned long) dp;
- return 0;
-}
-
-static int xmp_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
- off_t offset, struct fuse_file_info *fi)
-{
- DIR *dp = (DIR *) fi->fh;
- struct dirent *de;
-
- (void) path;
- seekdir(dp, offset);
- while ((de = readdir(dp)) != NULL) {
- struct stat st;
- memset(&st, 0, sizeof(st));
- st.st_ino = de->d_ino;
- st.st_mode = de->d_type << 12;
- if (filler(buf, de->d_name, &st, telldir(dp)))
- break;
- }
-
- return 0;
-}
-
-static int xmp_releasedir(const char *path, struct fuse_file_info *fi)
-{
- DIR *dp = (DIR *) fi->fh;
- (void) path;
- closedir(dp);
- return 0;
-}
-
-static int xmp_mknod(const char *path, mode_t mode, dev_t rdev)
-{
- int res;
-
- /* On the Hurd we must not use mknod() to create files, but creat() */
- if(mode & S_IFREG)
- res = creat(path, mode & ALLPERMS);
- else
- res = mknod(path, mode, rdev);
-
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_mkdir(const char *path, mode_t mode)
-{
- int res;
-
- res = mkdir(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_unlink(const char *path)
-{
- int res;
-
- res = unlink(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rmdir(const char *path)
-{
- int res;
-
- res = rmdir(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_symlink(const char *from, const char *to)
-{
- int res;
-
- res = symlink(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rename(const char *from, const char *to)
-{
- int res;
-
- res = rename(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_link(const char *from, const char *to)
-{
- int res;
-
- res = link(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chmod(const char *path, mode_t mode)
-{
- int res;
-
- res = chmod(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chown(const char *path, uid_t uid, gid_t gid)
-{
- int res;
-
- res = lchown(path, uid, gid);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_truncate(const char *path, off_t size)
-{
- int res;
-
- res = truncate(path, size);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_utime(const char *path, struct utimbuf *buf)
-{
- int res;
-
- res = utime(path, buf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-
-static int xmp_open(const char *path, struct fuse_file_info *fi)
-{
- int fd;
-
- fd = open(path, fi->flags);
- if(fd == -1)
- return -errno;
-
- fi->fh = fd;
- return 0;
-}
-
-static int xmp_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- int res;
-
- (void) path;
- res = pread(fi->fh, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- return res;
-}
-
-static int xmp_write(const char *path, const char *buf, size_t size,
- off_t offset, struct fuse_file_info *fi)
-{
- int res;
-
- (void) path;
- res = pwrite(fi->fh, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- return res;
-}
-
-static int xmp_statfs(const char *path, struct statfs *stbuf)
-{
- int res;
-
- res = statfs(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_release(const char *path, struct fuse_file_info *fi)
-{
- (void) path;
- close(fi->fh);
-
- return 0;
-}
-
-static int xmp_fsync(const char *path, int isdatasync,
- struct fuse_file_info *fi)
-{
- int res;
- (void) path;
-
- if (isdatasync)
- res = fdatasync(fi->fh);
- else
- res = fsync(fi->fh);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-#ifdef HAVE_SETXATTR
-/* xattr operations are optional and can safely be left unimplemented */
-static int xmp_setxattr(const char *path, const char *name, const char *value,
- size_t size, int flags)
-{
- int res = lsetxattr(path, name, value, size, flags);
- if(res == -1)
- return -errno;
- return 0;
-}
-
-static int xmp_getxattr(const char *path, const char *name, char *value,
- size_t size)
-{
- int res = lgetxattr(path, name, value, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_listxattr(const char *path, char *list, size_t size)
-{
- int res = llistxattr(path, list, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_removexattr(const char *path, const char *name)
-{
- int res = lremovexattr(path, name);
- if(res == -1)
- return -errno;
- return 0;
-}
-#endif /* HAVE_SETXATTR */
-
-static struct fuse_operations xmp_oper = {
- .getattr = xmp_getattr,
- .readlink = xmp_readlink,
- .opendir = xmp_opendir,
- .readdir = xmp_readdir,
- .releasedir = xmp_releasedir,
- .mknod = xmp_mknod,
- .mkdir = xmp_mkdir,
- .symlink = xmp_symlink,
- .unlink = xmp_unlink,
- .rmdir = xmp_rmdir,
- .rename = xmp_rename,
- .link = xmp_link,
- .chmod = xmp_chmod,
- .chown = xmp_chown,
- .truncate = xmp_truncate,
- .utime = xmp_utime,
- .open = xmp_open,
- .read = xmp_read,
- .write = xmp_write,
- .statfs = xmp_statfs,
- .release = xmp_release,
- .fsync = xmp_fsync,
-#ifdef HAVE_SETXATTR
- .setxattr = xmp_setxattr,
- .getxattr = xmp_getxattr,
- .listxattr = xmp_listxattr,
- .removexattr= xmp_removexattr,
-#endif
-};
-
-int main(int argc, char *argv[])
-{
- umask(0);
- return fuse_main(argc, argv, &xmp_oper);
-}
Index: example-24/fusexmp_fh.c.patch
===================================================================
RCS file: example-24/fusexmp_fh.c.patch
diff -N example-24/fusexmp_fh.c.patch
--- example-24/fusexmp_fh.c.patch 30 Jan 2006 22:28:39 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,25 +0,0 @@
---- fusexmp_fh.c.orig 2005-12-02 01:47:51.000000000 +0100
-+++ fusexmp_fh.c 2005-12-02 01:58:16.000000000 +0100
-@@ -71,7 +71,7 @@
- memset(&st, 0, sizeof(st));
- st.st_ino = de->d_ino;
- st.st_mode = de->d_type << 12;
-- if (filler(buf, de->d_name, &st, de->d_off))
-+ if (filler(buf, de->d_name, &st, telldir(dp)))
- break;
- }
-
-@@ -90,7 +90,12 @@
- {
- int res;
-
-- res = mknod(path, mode, rdev);
-+ /* On the Hurd we must not use mknod() to create files, but creat() */
-+ if(mode & S_IFREG)
-+ res = creat(path, mode & ALLPERMS);
-+ else
-+ res = mknod(path, mode, rdev);
-+
- if(res == -1)
- return -errno;
-
Index: example-24/hello.c
===================================================================
RCS file: example-24/hello.c
diff -N example-24/hello.c
--- example-24/hello.c 30 Jan 2006 22:28:39 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,94 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-
-static const char *hello_str = "Hello World!\n";
-static const char *hello_path = "/hello";
-
-static int hello_getattr(const char *path, struct stat *stbuf)
-{
- int res = 0;
-
- memset(stbuf, 0, sizeof(struct stat));
- if(strcmp(path, "/") == 0) {
- stbuf->st_mode = S_IFDIR | 0755;
- stbuf->st_nlink = 2;
- }
- else if(strcmp(path, hello_path) == 0) {
- stbuf->st_mode = S_IFREG | 0444;
- stbuf->st_nlink = 1;
- stbuf->st_size = strlen(hello_str);
- }
- else
- res = -ENOENT;
-
- return res;
-}
-
-static int hello_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
- off_t offset, struct fuse_file_info *fi)
-{
- (void) offset;
- (void) fi;
-
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- filler(buf, ".", NULL, 0);
- filler(buf, "..", NULL, 0);
- filler(buf, hello_path + 1, NULL, 0);
-
- return 0;
-}
-
-static int hello_open(const char *path, struct fuse_file_info *fi)
-{
- if(strcmp(path, hello_path) != 0)
- return -ENOENT;
-
- if((fi->flags & 3) != O_RDONLY)
- return -EACCES;
-
- return 0;
-}
-
-static int hello_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- size_t len;
- (void) fi;
- if(strcmp(path, hello_path) != 0)
- return -ENOENT;
-
- len = strlen(hello_str);
- if (offset < len) {
- if (offset + size > len)
- size = len - offset;
- memcpy(buf, hello_str + offset, size);
- } else
- size = 0;
-
- return size;
-}
-
-static struct fuse_operations hello_oper = {
- .getattr = hello_getattr,
- .readdir = hello_readdir,
- .open = hello_open,
- .read = hello_read,
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &hello_oper);
-}
Index: example-24/hello_ll.c
===================================================================
RCS file: example-24/hello_ll.c
diff -N example-24/hello_ll.c
--- example-24/hello_ll.c 30 Jan 2006 22:28:39 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,177 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse_lowlevel.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <assert.h>
-
-static const char *hello_str = "Hello World!\n";
-static const char *hello_name = "hello";
-
-static int hello_stat(fuse_ino_t ino, struct stat *stbuf)
-{
- stbuf->st_ino = ino;
- switch (ino) {
- case 1:
- stbuf->st_mode = S_IFDIR | 0755;
- stbuf->st_nlink = 2;
- break;
-
- case 2:
- stbuf->st_mode = S_IFREG | 0444;
- stbuf->st_nlink = 1;
- stbuf->st_size = strlen(hello_str);
- break;
-
- default:
- return -1;
- }
- return 0;
-}
-
-static void hello_ll_getattr(fuse_req_t req, fuse_ino_t ino,
- struct fuse_file_info *fi)
-{
- struct stat stbuf;
-
- (void) fi;
-
- memset(&stbuf, 0, sizeof(stbuf));
- if (hello_stat(ino, &stbuf) == -1)
- fuse_reply_err(req, ENOENT);
- else
- fuse_reply_attr(req, &stbuf, 1.0);
-}
-
-static void hello_ll_lookup(fuse_req_t req, fuse_ino_t parent, const char
*name)
-{
- struct fuse_entry_param e;
-
- if (parent != 1 || strcmp(name, hello_name) != 0)
- fuse_reply_err(req, ENOENT);
- else {
- memset(&e, 0, sizeof(e));
- e.ino = 2;
- e.attr_timeout = 1.0;
- e.entry_timeout = 1.0;
- hello_stat(e.ino, &e.attr);
-
- fuse_reply_entry(req, &e);
- }
-}
-
-struct dirbuf {
- char *p;
- size_t size;
-};
-
-static void dirbuf_add(struct dirbuf *b, const char *name, fuse_ino_t ino)
-{
- struct stat stbuf;
- size_t oldsize = b->size;
- b->size += fuse_dirent_size(strlen(name));
- b->p = (char *) realloc(b->p, b->size);
- memset(&stbuf, 0, sizeof(stbuf));
- stbuf.st_ino = ino;
- fuse_add_dirent(b->p + oldsize, name, &stbuf, b->size);
-}
-
-#define min(x, y) ((x) < (y) ? (x) : (y))
-
-static int reply_buf_limited(fuse_req_t req, const char *buf, size_t bufsize,
- off_t off, size_t maxsize)
-{
- if (off < bufsize)
- return fuse_reply_buf(req, buf + off, min(bufsize - off, maxsize));
- else
- return fuse_reply_buf(req, NULL, 0);
-}
-
-static void hello_ll_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
- off_t off, struct fuse_file_info *fi)
-{
- (void) fi;
-
- if (ino != 1)
- fuse_reply_err(req, ENOTDIR);
- else {
- struct dirbuf b;
-
- memset(&b, 0, sizeof(b));
- dirbuf_add(&b, ".", 1);
- dirbuf_add(&b, "..", 1);
- dirbuf_add(&b, hello_name, 2);
- reply_buf_limited(req, b.p, b.size, off, size);
- free(b.p);
- }
-}
-
-static void hello_ll_open(fuse_req_t req, fuse_ino_t ino,
- struct fuse_file_info *fi)
-{
- if (ino != 2)
- fuse_reply_err(req, EISDIR);
- else if ((fi->flags & 3) != O_RDONLY)
- fuse_reply_err(req, EACCES);
- else
- fuse_reply_open(req, fi);
-}
-
-static void hello_ll_read(fuse_req_t req, fuse_ino_t ino, size_t size,
- off_t off, struct fuse_file_info *fi)
-{
- (void) fi;
-
- assert(ino == 2);
- reply_buf_limited(req, hello_str, strlen(hello_str), off, size);
-}
-
-static struct fuse_lowlevel_ops hello_ll_oper = {
- .lookup = hello_ll_lookup,
- .getattr = hello_ll_getattr,
- .readdir = hello_ll_readdir,
- .open = hello_ll_open,
- .read = hello_ll_read,
-};
-
-int main(int argc, char *argv[])
-{
- const char *mountpoint;
- int err = -1;
- int fd;
-
- if (argc != 2) {
- fprintf(stderr, "usage: %s mountpoint\n", argv[0]);
- return 1;
- }
- mountpoint = argv[1];
- fd = fuse_mount(mountpoint, NULL);
- if (fd != -1) {
- struct fuse_session *se;
-
- se = fuse_lowlevel_new("debug", &hello_ll_oper, sizeof(hello_ll_oper),
- NULL);
- if (se != NULL) {
- struct fuse_chan *ch = fuse_kern_chan_new(fd);
- if (ch != NULL) {
- fuse_session_add_chan(se, ch);
- err = fuse_session_loop(se);
- }
- fuse_session_destroy(se);
- }
- close(fd);
- }
- fuse_unmount(mountpoint);
-
- return err ? 1 : 0;
-}
Index: example-24/null.c
===================================================================
RCS file: example-24/null.c
diff -N example-24/null.c
--- example-24/null.c 30 Jan 2006 22:28:39 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,88 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-
-static int null_getattr(const char *path, struct stat *stbuf)
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- stbuf->st_mode = S_IFREG | 0644;
- stbuf->st_nlink = 1;
- stbuf->st_uid = getuid();
- stbuf->st_gid = getgid();
- stbuf->st_size = (1ULL << 32); /* 4G */
- stbuf->st_blocks = 0;
- stbuf->st_atime = stbuf->st_mtime = stbuf->st_ctime = time(NULL);
-
- return 0;
-}
-
-static int null_truncate(const char *path, off_t size)
-{
- (void) size;
-
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return 0;
-}
-
-static int null_open(const char *path, struct fuse_file_info *fi)
-{
- (void) fi;
-
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return 0;
-}
-
-static int null_read(const char *path, char *buf, size_t size,
- off_t offset, struct fuse_file_info *fi)
-{
- (void) buf;
- (void) offset;
- (void) fi;
-
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return size;
-}
-
-static int null_write(const char *path, const char *buf, size_t size,
- off_t offset, struct fuse_file_info *fi)
-{
- (void) buf;
- (void) offset;
- (void) fi;
-
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return size;
-}
-
-static struct fuse_operations null_oper = {
- .getattr = null_getattr,
- .truncate = null_truncate,
- .open = null_open,
- .read = null_read,
- .write = null_write,
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &null_oper);
-}
Index: example-25/.cvsignore
===================================================================
RCS file: example-25/.cvsignore
diff -N example-25/.cvsignore
--- example-25/.cvsignore 13 Apr 2006 22:52:47 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,8 +0,0 @@
-Makefile.in
-Makefile
-.deps
-fusexmp
-fusexmp_fh
-null
-hello
-.libs
Index: example-25/Makefile.am
===================================================================
RCS file: example-25/Makefile.am
diff -N example-25/Makefile.am
--- example-25/Makefile.am 13 Apr 2006 22:52:47 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_PROGRAMS = fusexmp fusexmp_fh null hello
-# low-level api not supported: hello_ll
-
-fusexmp_SOURCES = fusexmp.c
-fusexmp_fh_SOURCES = fusexmp_fh.c
-null_SOURCES = null.c
-hello_SOURCES = hello.c
-
-LDADD = ../src/libfuse.la
-AM_CPPFLAGS = -DFUSE_USE_VERSION=25 -I$(top_srcdir) -I$(top_srcdir)/include
Index: example-25/fusexmp.c
===================================================================
RCS file: example-25/fusexmp.c
diff -N example-25/fusexmp.c
--- example-25/fusexmp.c 13 Apr 2006 22:52:47 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,373 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2006 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <config.h>
-
-#ifdef linux
-/* For pread()/pwrite() */
-#define _XOPEN_SOURCE 500
-#endif
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <errno.h>
-#ifdef HAVE_SETXATTR
-#include <sys/xattr.h>
-#endif
-
-static int xmp_getattr(const char *path, struct stat *stbuf)
-{
- int res;
-
- res = lstat(path, stbuf);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_access(const char *path, int mask)
-{
- int res;
-
- res = access(path, mask);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_readlink(const char *path, char *buf, size_t size)
-{
- int res;
-
- res = readlink(path, buf, size - 1);
- if (res == -1)
- return -errno;
-
- buf[res] = '\0';
- return 0;
-}
-
-
-static int xmp_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
- off_t offset, struct fuse_file_info *fi)
-{
- DIR *dp;
- struct dirent *de;
-
- (void) offset;
- (void) fi;
-
- dp = opendir(path);
- if (dp == NULL)
- return -errno;
-
- while ((de = readdir(dp)) != NULL) {
- struct stat st;
- memset(&st, 0, sizeof(st));
- st.st_ino = de->d_ino;
- st.st_mode = de->d_type << 12;
- if (filler(buf, de->d_name, &st, 0))
- break;
- }
-
- closedir(dp);
- return 0;
-}
-
-static int xmp_mknod(const char *path, mode_t mode, dev_t rdev)
-{
- int res;
-
- /* On Linux this could just be 'mknod(path, mode, rdev)' but this
- is more portable */
- if (S_ISREG(mode)) {
- res = open(path, O_CREAT | O_EXCL | O_WRONLY, mode);
- if (res >= 0)
- res = close(res);
- } else if (S_ISFIFO(mode))
- res = mkfifo(path, mode);
- else
- res = mknod(path, mode, rdev);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_mkdir(const char *path, mode_t mode)
-{
- int res;
-
- res = mkdir(path, mode);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_unlink(const char *path)
-{
- int res;
-
- res = unlink(path);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rmdir(const char *path)
-{
- int res;
-
- res = rmdir(path);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_symlink(const char *from, const char *to)
-{
- int res;
-
- res = symlink(from, to);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rename(const char *from, const char *to)
-{
- int res;
-
- res = rename(from, to);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_link(const char *from, const char *to)
-{
- int res;
-
- res = link(from, to);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chmod(const char *path, mode_t mode)
-{
- int res;
-
- res = chmod(path, mode);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chown(const char *path, uid_t uid, gid_t gid)
-{
- int res;
-
- res = lchown(path, uid, gid);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_truncate(const char *path, off_t size)
-{
- int res;
-
- res = truncate(path, size);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_utime(const char *path, struct utimbuf *buf)
-{
- int res;
-
- res = utime(path, buf);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-
-static int xmp_open(const char *path, struct fuse_file_info *fi)
-{
- int res;
-
- res = open(path, fi->flags);
- if (res == -1)
- return -errno;
-
- close(res);
- return 0;
-}
-
-static int xmp_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- int fd;
- int res;
-
- (void) fi;
- fd = open(path, O_RDONLY);
- if (fd == -1)
- return -errno;
-
- res = pread(fd, buf, size, offset);
- if (res == -1)
- res = -errno;
-
- close(fd);
- return res;
-}
-
-static int xmp_write(const char *path, const char *buf, size_t size,
- off_t offset, struct fuse_file_info *fi)
-{
- int fd;
- int res;
-
- (void) fi;
- fd = open(path, O_WRONLY);
- if (fd == -1)
- return -errno;
-
- res = pwrite(fd, buf, size, offset);
- if (res == -1)
- res = -errno;
-
- close(fd);
- return res;
-}
-
-static int xmp_statfs(const char *path, struct statvfs *stbuf)
-{
- int res;
-
- res = statvfs(path, stbuf);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_release(const char *path, struct fuse_file_info *fi)
-{
- /* Just a stub. This method is optional and can safely be left
- unimplemented */
-
- (void) path;
- (void) fi;
- return 0;
-}
-
-static int xmp_fsync(const char *path, int isdatasync,
- struct fuse_file_info *fi)
-{
- /* Just a stub. This method is optional and can safely be left
- unimplemented */
-
- (void) path;
- (void) isdatasync;
- (void) fi;
- return 0;
-}
-
-#ifdef HAVE_SETXATTR
-/* xattr operations are optional and can safely be left unimplemented */
-static int xmp_setxattr(const char *path, const char *name, const char *value,
- size_t size, int flags)
-{
- int res = lsetxattr(path, name, value, size, flags);
- if (res == -1)
- return -errno;
- return 0;
-}
-
-static int xmp_getxattr(const char *path, const char *name, char *value,
- size_t size)
-{
- int res = lgetxattr(path, name, value, size);
- if (res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_listxattr(const char *path, char *list, size_t size)
-{
- int res = llistxattr(path, list, size);
- if (res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_removexattr(const char *path, const char *name)
-{
- int res = lremovexattr(path, name);
- if (res == -1)
- return -errno;
- return 0;
-}
-#endif /* HAVE_SETXATTR */
-
-static struct fuse_operations xmp_oper = {
- .getattr = xmp_getattr,
- .access = xmp_access,
- .readlink = xmp_readlink,
- .readdir = xmp_readdir,
- .mknod = xmp_mknod,
- .mkdir = xmp_mkdir,
- .symlink = xmp_symlink,
- .unlink = xmp_unlink,
- .rmdir = xmp_rmdir,
- .rename = xmp_rename,
- .link = xmp_link,
- .chmod = xmp_chmod,
- .chown = xmp_chown,
- .truncate = xmp_truncate,
- .utime = xmp_utime,
- .open = xmp_open,
- .read = xmp_read,
- .write = xmp_write,
- .statfs = xmp_statfs,
- .release = xmp_release,
- .fsync = xmp_fsync,
-#ifdef HAVE_SETXATTR
- .setxattr = xmp_setxattr,
- .getxattr = xmp_getxattr,
- .listxattr = xmp_listxattr,
- .removexattr= xmp_removexattr,
-#endif
-};
-
-int main(int argc, char *argv[])
-{
- umask(0);
- return fuse_main(argc, argv, &xmp_oper);
-}
Index: example-25/fusexmp_fh.c
===================================================================
RCS file: example-25/fusexmp_fh.c
diff -N example-25/fusexmp_fh.c
--- example-25/fusexmp_fh.c 13 Apr 2006 22:52:47 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,418 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2006 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <config.h>
-
-#define _GNU_SOURCE
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <errno.h>
-#ifdef HAVE_SETXATTR
-#include <sys/xattr.h>
-#endif
-
-static int xmp_getattr(const char *path, struct stat *stbuf)
-{
- int res;
-
- res = lstat(path, stbuf);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_fgetattr(const char *path, struct stat *stbuf,
- struct fuse_file_info *fi)
-{
- int res;
-
- (void) path;
-
- res = fstat(fi->fh, stbuf);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_access(const char *path, int mask)
-{
- int res;
-
- res = access(path, mask);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_readlink(const char *path, char *buf, size_t size)
-{
- int res;
-
- res = readlink(path, buf, size - 1);
- if (res == -1)
- return -errno;
-
- buf[res] = '\0';
- return 0;
-}
-
-static int xmp_opendir(const char *path, struct fuse_file_info *fi)
-{
- DIR *dp = opendir(path);
- if (dp == NULL)
- return -errno;
-
- fi->fh = (unsigned long) dp;
- return 0;
-}
-
-static inline DIR *get_dirp(struct fuse_file_info *fi)
-{
- return (DIR *) (uintptr_t) fi->fh;
-}
-
-static int xmp_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
- off_t offset, struct fuse_file_info *fi)
-{
- DIR *dp = get_dirp(fi);
- struct dirent *de;
-
- (void) path;
- seekdir(dp, offset);
- while ((de = readdir(dp)) != NULL) {
- struct stat st;
- memset(&st, 0, sizeof(st));
- st.st_ino = de->d_ino;
- st.st_mode = de->d_type << 12;
- if (filler(buf, de->d_name, &st, telldir(dp)))
- break;
- }
-
- return 0;
-}
-
-static int xmp_releasedir(const char *path, struct fuse_file_info *fi)
-{
- DIR *dp = get_dirp(fi);
- (void) path;
- closedir(dp);
- return 0;
-}
-
-static int xmp_mknod(const char *path, mode_t mode, dev_t rdev)
-{
- int res;
-
- if (S_ISFIFO(mode))
- res = mkfifo(path, mode);
- else
- res = mknod(path, mode, rdev);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_mkdir(const char *path, mode_t mode)
-{
- int res;
-
- res = mkdir(path, mode);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_unlink(const char *path)
-{
- int res;
-
- res = unlink(path);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rmdir(const char *path)
-{
- int res;
-
- res = rmdir(path);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_symlink(const char *from, const char *to)
-{
- int res;
-
- res = symlink(from, to);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rename(const char *from, const char *to)
-{
- int res;
-
- res = rename(from, to);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_link(const char *from, const char *to)
-{
- int res;
-
- res = link(from, to);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chmod(const char *path, mode_t mode)
-{
- int res;
-
- res = chmod(path, mode);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chown(const char *path, uid_t uid, gid_t gid)
-{
- int res;
-
- res = lchown(path, uid, gid);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_truncate(const char *path, off_t size)
-{
- int res;
-
- res = truncate(path, size);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_ftruncate(const char *path, off_t size,
- struct fuse_file_info *fi)
-{
- int res;
-
- (void) path;
-
- res = ftruncate(fi->fh, size);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_utime(const char *path, struct utimbuf *buf)
-{
- int res;
-
- res = utime(path, buf);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_create(const char *path, mode_t mode, struct fuse_file_info *fi)
-{
- int fd;
-
- fd = open(path, fi->flags, mode);
- if (fd == -1)
- return -errno;
-
- fi->fh = fd;
- return 0;
-}
-
-static int xmp_open(const char *path, struct fuse_file_info *fi)
-{
- int fd;
-
- fd = open(path, fi->flags);
- if (fd == -1)
- return -errno;
-
- fi->fh = fd;
- return 0;
-}
-
-static int xmp_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- int res;
-
- (void) path;
- res = pread(fi->fh, buf, size, offset);
- if (res == -1)
- res = -errno;
-
- return res;
-}
-
-static int xmp_write(const char *path, const char *buf, size_t size,
- off_t offset, struct fuse_file_info *fi)
-{
- int res;
-
- (void) path;
- res = pwrite(fi->fh, buf, size, offset);
- if (res == -1)
- res = -errno;
-
- return res;
-}
-
-static int xmp_statfs(const char *path, struct statvfs *stbuf)
-{
- int res;
-
- res = statvfs(path, stbuf);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_release(const char *path, struct fuse_file_info *fi)
-{
- (void) path;
- close(fi->fh);
-
- return 0;
-}
-
-static int xmp_fsync(const char *path, int isdatasync,
- struct fuse_file_info *fi)
-{
- int res;
- (void) path;
-
-#ifndef HAVE_FDATASYNC
- (void) isdatasync;
-#else
- if (isdatasync)
- res = fdatasync(fi->fh);
- else
-#endif
- res = fsync(fi->fh);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
-#ifdef HAVE_SETXATTR
-/* xattr operations are optional and can safely be left unimplemented */
-static int xmp_setxattr(const char *path, const char *name, const char *value,
- size_t size, int flags)
-{
- int res = lsetxattr(path, name, value, size, flags);
- if (res == -1)
- return -errno;
- return 0;
-}
-
-static int xmp_getxattr(const char *path, const char *name, char *value,
- size_t size)
-{
- int res = lgetxattr(path, name, value, size);
- if (res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_listxattr(const char *path, char *list, size_t size)
-{
- int res = llistxattr(path, list, size);
- if (res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_removexattr(const char *path, const char *name)
-{
- int res = lremovexattr(path, name);
- if (res == -1)
- return -errno;
- return 0;
-}
-#endif /* HAVE_SETXATTR */
-
-static struct fuse_operations xmp_oper = {
- .getattr = xmp_getattr,
- .fgetattr = xmp_fgetattr,
- .access = xmp_access,
- .readlink = xmp_readlink,
- .opendir = xmp_opendir,
- .readdir = xmp_readdir,
- .releasedir = xmp_releasedir,
- .mknod = xmp_mknod,
- .mkdir = xmp_mkdir,
- .symlink = xmp_symlink,
- .unlink = xmp_unlink,
- .rmdir = xmp_rmdir,
- .rename = xmp_rename,
- .link = xmp_link,
- .chmod = xmp_chmod,
- .chown = xmp_chown,
- .truncate = xmp_truncate,
- .ftruncate = xmp_ftruncate,
- .utime = xmp_utime,
- .create = xmp_create,
- .open = xmp_open,
- .read = xmp_read,
- .write = xmp_write,
- .statfs = xmp_statfs,
- .release = xmp_release,
- .fsync = xmp_fsync,
-#ifdef HAVE_SETXATTR
- .setxattr = xmp_setxattr,
- .getxattr = xmp_getxattr,
- .listxattr = xmp_listxattr,
- .removexattr= xmp_removexattr,
-#endif
-};
-
-int main(int argc, char *argv[])
-{
- umask(0);
- return fuse_main(argc, argv, &xmp_oper);
-}
Index: example-25/hello.c
===================================================================
RCS file: example-25/hello.c
diff -N example-25/hello.c
--- example-25/hello.c 13 Apr 2006 22:52:47 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,94 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2006 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-
-static const char *hello_str = "Hello World!\n";
-static const char *hello_path = "/hello";
-
-static int hello_getattr(const char *path, struct stat *stbuf)
-{
- int res = 0;
-
- memset(stbuf, 0, sizeof(struct stat));
- if(strcmp(path, "/") == 0) {
- stbuf->st_mode = S_IFDIR | 0755;
- stbuf->st_nlink = 2;
- }
- else if(strcmp(path, hello_path) == 0) {
- stbuf->st_mode = S_IFREG | 0444;
- stbuf->st_nlink = 1;
- stbuf->st_size = strlen(hello_str);
- }
- else
- res = -ENOENT;
-
- return res;
-}
-
-static int hello_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
- off_t offset, struct fuse_file_info *fi)
-{
- (void) offset;
- (void) fi;
-
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- filler(buf, ".", NULL, 0);
- filler(buf, "..", NULL, 0);
- filler(buf, hello_path + 1, NULL, 0);
-
- return 0;
-}
-
-static int hello_open(const char *path, struct fuse_file_info *fi)
-{
- if(strcmp(path, hello_path) != 0)
- return -ENOENT;
-
- if((fi->flags & 3) != O_RDONLY)
- return -EACCES;
-
- return 0;
-}
-
-static int hello_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- size_t len;
- (void) fi;
- if(strcmp(path, hello_path) != 0)
- return -ENOENT;
-
- len = strlen(hello_str);
- if (offset < len) {
- if (offset + size > len)
- size = len - offset;
- memcpy(buf, hello_str + offset, size);
- } else
- size = 0;
-
- return size;
-}
-
-static struct fuse_operations hello_oper = {
- .getattr = hello_getattr,
- .readdir = hello_readdir,
- .open = hello_open,
- .read = hello_read,
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &hello_oper);
-}
Index: example-25/hello_ll.c
===================================================================
RCS file: example-25/hello_ll.c
diff -N example-25/hello_ll.c
--- example-25/hello_ll.c 13 Apr 2006 22:52:47 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,177 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2006 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse_lowlevel.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <assert.h>
-
-static const char *hello_str = "Hello World!\n";
-static const char *hello_name = "hello";
-
-static int hello_stat(fuse_ino_t ino, struct stat *stbuf)
-{
- stbuf->st_ino = ino;
- switch (ino) {
- case 1:
- stbuf->st_mode = S_IFDIR | 0755;
- stbuf->st_nlink = 2;
- break;
-
- case 2:
- stbuf->st_mode = S_IFREG | 0444;
- stbuf->st_nlink = 1;
- stbuf->st_size = strlen(hello_str);
- break;
-
- default:
- return -1;
- }
- return 0;
-}
-
-static void hello_ll_getattr(fuse_req_t req, fuse_ino_t ino,
- struct fuse_file_info *fi)
-{
- struct stat stbuf;
-
- (void) fi;
-
- memset(&stbuf, 0, sizeof(stbuf));
- if (hello_stat(ino, &stbuf) == -1)
- fuse_reply_err(req, ENOENT);
- else
- fuse_reply_attr(req, &stbuf, 1.0);
-}
-
-static void hello_ll_lookup(fuse_req_t req, fuse_ino_t parent, const char
*name)
-{
- struct fuse_entry_param e;
-
- if (parent != 1 || strcmp(name, hello_name) != 0)
- fuse_reply_err(req, ENOENT);
- else {
- memset(&e, 0, sizeof(e));
- e.ino = 2;
- e.attr_timeout = 1.0;
- e.entry_timeout = 1.0;
- hello_stat(e.ino, &e.attr);
-
- fuse_reply_entry(req, &e);
- }
-}
-
-struct dirbuf {
- char *p;
- size_t size;
-};
-
-static void dirbuf_add(struct dirbuf *b, const char *name, fuse_ino_t ino)
-{
- struct stat stbuf;
- size_t oldsize = b->size;
- b->size += fuse_dirent_size(strlen(name));
- b->p = (char *) realloc(b->p, b->size);
- memset(&stbuf, 0, sizeof(stbuf));
- stbuf.st_ino = ino;
- fuse_add_dirent(b->p + oldsize, name, &stbuf, b->size);
-}
-
-#define min(x, y) ((x) < (y) ? (x) : (y))
-
-static int reply_buf_limited(fuse_req_t req, const char *buf, size_t bufsize,
- off_t off, size_t maxsize)
-{
- if (off < bufsize)
- return fuse_reply_buf(req, buf + off, min(bufsize - off, maxsize));
- else
- return fuse_reply_buf(req, NULL, 0);
-}
-
-static void hello_ll_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
- off_t off, struct fuse_file_info *fi)
-{
- (void) fi;
-
- if (ino != 1)
- fuse_reply_err(req, ENOTDIR);
- else {
- struct dirbuf b;
-
- memset(&b, 0, sizeof(b));
- dirbuf_add(&b, ".", 1);
- dirbuf_add(&b, "..", 1);
- dirbuf_add(&b, hello_name, 2);
- reply_buf_limited(req, b.p, b.size, off, size);
- free(b.p);
- }
-}
-
-static void hello_ll_open(fuse_req_t req, fuse_ino_t ino,
- struct fuse_file_info *fi)
-{
- if (ino != 2)
- fuse_reply_err(req, EISDIR);
- else if ((fi->flags & 3) != O_RDONLY)
- fuse_reply_err(req, EACCES);
- else
- fuse_reply_open(req, fi);
-}
-
-static void hello_ll_read(fuse_req_t req, fuse_ino_t ino, size_t size,
- off_t off, struct fuse_file_info *fi)
-{
- (void) fi;
-
- assert(ino == 2);
- reply_buf_limited(req, hello_str, strlen(hello_str), off, size);
-}
-
-static struct fuse_lowlevel_ops hello_ll_oper = {
- .lookup = hello_ll_lookup,
- .getattr = hello_ll_getattr,
- .readdir = hello_ll_readdir,
- .open = hello_ll_open,
- .read = hello_ll_read,
-};
-
-int main(int argc, char *argv[])
-{
- struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
- char *mountpoint;
- int err = -1;
- int fd;
-
- if (fuse_parse_cmdline(&args, &mountpoint, NULL, NULL) != -1 &&
- (fd = fuse_mount(mountpoint, &args)) != -1) {
- struct fuse_session *se;
-
- se = fuse_lowlevel_new(&args, &hello_ll_oper, sizeof(hello_ll_oper),
- NULL);
- if (se != NULL) {
- if (fuse_set_signal_handlers(se) != -1) {
- struct fuse_chan *ch = fuse_kern_chan_new(fd);
- if (ch != NULL) {
- fuse_session_add_chan(se, ch);
- err = fuse_session_loop(se);
- }
- fuse_remove_signal_handlers(se);
- }
- fuse_session_destroy(se);
- }
- close(fd);
- }
- fuse_unmount(mountpoint);
- fuse_opt_free_args(&args);
-
- return err ? 1 : 0;
-}
Index: example-25/null.c
===================================================================
RCS file: example-25/null.c
diff -N example-25/null.c
--- example-25/null.c 13 Apr 2006 22:52:47 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,88 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2006 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-
-static int null_getattr(const char *path, struct stat *stbuf)
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- stbuf->st_mode = S_IFREG | 0644;
- stbuf->st_nlink = 1;
- stbuf->st_uid = getuid();
- stbuf->st_gid = getgid();
- stbuf->st_size = (1ULL << 32); /* 4G */
- stbuf->st_blocks = 0;
- stbuf->st_atime = stbuf->st_mtime = stbuf->st_ctime = time(NULL);
-
- return 0;
-}
-
-static int null_truncate(const char *path, off_t size)
-{
- (void) size;
-
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return 0;
-}
-
-static int null_open(const char *path, struct fuse_file_info *fi)
-{
- (void) fi;
-
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return 0;
-}
-
-static int null_read(const char *path, char *buf, size_t size,
- off_t offset, struct fuse_file_info *fi)
-{
- (void) buf;
- (void) offset;
- (void) fi;
-
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return size;
-}
-
-static int null_write(const char *path, const char *buf, size_t size,
- off_t offset, struct fuse_file_info *fi)
-{
- (void) buf;
- (void) offset;
- (void) fi;
-
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return size;
-}
-
-static struct fuse_operations null_oper = {
- .getattr = null_getattr,
- .truncate = null_truncate,
- .open = null_open,
- .read = null_read,
- .write = null_write,
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &null_oper);
-}
Index: include/.cvsignore
===================================================================
RCS file: include/.cvsignore
diff -N include/.cvsignore
--- include/.cvsignore 30 Jan 2006 22:32:38 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,2 +0,0 @@
-Makefile.in
-Makefile
Index: include/Makefile.am
===================================================================
RCS file: include/Makefile.am
diff -N include/Makefile.am
--- include/Makefile.am 7 Aug 2006 12:42:29 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,13 +0,0 @@
-# Makefile.am
-# Used by automake and configure to create Makefile.
-#
-# Copyright (C) 2005,2006 Stefan Siegl <address@hidden>, Germany
-
-SUBDIRS = old
-
-fuseincludedir=$(includedir)/fuse
-fuseinclude_HEADERS = \
- fuse.h \
- fuse_opt.h \
- fuse_common.h \
- fuse_compat.h
Index: include/fuse.h
===================================================================
RCS file: include/fuse.h
diff -N include/fuse.h
--- include/fuse.h 13 Apr 2006 22:52:47 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,597 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2006 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU LGPL.
- See the file COPYING.LIB.
-*/
-
-#ifndef _FUSE_H_
-#define _FUSE_H_
-
-/* This file defines the library interface of FUSE */
-
-/* IMPORTANT: you should define FUSE_USE_VERSION before including this
- header. To use the newest API define it to 25 (recommended for any
- new application), to use the old API define it to 21 (default) or
- 22, to use the even older 1.X API define it to 11. */
-
-#ifndef FUSE_USE_VERSION
-#define FUSE_USE_VERSION 21
-#endif
-
-#include "fuse_common.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/statvfs.h>
-#include <utime.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* ----------------------------------------------------------- *
- * Basic FUSE API *
- * ----------------------------------------------------------- */
-
-/** Handle for a FUSE filesystem */
-struct fuse;
-
-/** Structure containing a raw command */
-struct fuse_cmd;
-
-/** Function to add an entry in a readdir() operation
- *
- * @param buf the buffer passed to the readdir() operation
- * @param name the file name of the directory entry
- * @param stat file attributes, can be NULL
- * @param off offset of the next entry or zero
- * @return 1 if buffer is full, zero otherwise
- */
-typedef int (*fuse_fill_dir_t) (void *buf, const char *name,
- const struct stat *stbuf, off_t off);
-
-/* Used by deprecated getdir() method */
-typedef struct fuse_dirhandle *fuse_dirh_t;
-typedef int (*fuse_dirfil_t) (fuse_dirh_t h, const char *name, int type,
- ino_t ino);
-
-/**
- * The file system operations:
- *
- * Most of these should work very similarly to the well known UNIX
- * file system operations. A major exception is that instead of
- * returning an error in 'errno', the operation should return the
- * negated error value (-errno) directly.
- *
- * All methods are optional, but some are essential for a useful
- * filesystem (e.g. getattr). Open, flush, release, fsync, opendir,
- * releasedir, fsyncdir, access, create, ftruncate, fgetattr, init and
- * destroy are special purpose methods, without which a full featured
- * filesystem can still be implemented.
- */
-struct fuse_operations {
- /** Get file attributes.
- *
- * Similar to stat(). The 'st_dev' and 'st_blksize' fields are
- * ignored. The 'st_ino' field is ignored except if the 'use_ino'
- * mount option is given.
- */
- int (*getattr) (const char *, struct stat *);
-
- /** Read the target of a symbolic link
- *
- * The buffer should be filled with a null terminated string. The
- * buffer size argument includes the space for the terminating
- * null character. If the linkname is too long to fit in the
- * buffer, it should be truncated. The return value should be 0
- * for success.
- */
- int (*readlink) (const char *, char *, size_t);
-
- /* Deprecated, use readdir() instead */
- int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t);
-
- /** Create a file node
- *
- * There is no create() operation, mknod() will be called for
- * creation of all non-directory, non-symlink nodes.
- */
- int (*mknod) (const char *, mode_t, dev_t);
-
- /** Create a directory */
- int (*mkdir) (const char *, mode_t);
-
- /** Remove a file */
- int (*unlink) (const char *);
-
- /** Remove a directory */
- int (*rmdir) (const char *);
-
- /** Create a symbolic link */
- int (*symlink) (const char *, const char *);
-
- /** Rename a file */
- int (*rename) (const char *, const char *);
-
- /** Create a hard link to a file */
- int (*link) (const char *, const char *);
-
- /** Change the permission bits of a file */
- int (*chmod) (const char *, mode_t);
-
- /** Change the owner and group of a file */
- int (*chown) (const char *, uid_t, gid_t);
-
- /** Change the size of a file */
- int (*truncate) (const char *, off_t);
-
- /** Change the access and/or modification times of a file */
- int (*utime) (const char *, struct utimbuf *);
-
- /** File open operation
- *
- * No creation, or truncation flags (O_CREAT, O_EXCL, O_TRUNC)
- * will be passed to open(). Open should check if the operation
- * is permitted for the given flags. Optionally open may also
- * return an arbitrary filehandle in the fuse_file_info structure,
- * which will be passed to all file operations.
- *
- * Changed in version 2.2
- */
- int (*open) (const char *, struct fuse_file_info *);
-
- /** Read data from an open file
- *
- * Read should return exactly the number of bytes requested except
- * on EOF or error, otherwise the rest of the data will be
- * substituted with zeroes. An exception to this is when the
- * 'direct_io' mount option is specified, in which case the return
- * value of the read system call will reflect the return value of
- * this operation.
- *
- * Changed in version 2.2
- */
- int (*read) (const char *, char *, size_t, off_t, struct fuse_file_info *);
-
- /** Write data to an open file
- *
- * Write should return exactly the number of bytes requested
- * except on error. An exception to this is when the 'direct_io'
- * mount option is specified (see read operation).
- *
- * Changed in version 2.2
- */
- int (*write) (const char *, const char *, size_t, off_t,
- struct fuse_file_info *);
-
- /** Just a placeholder, don't set */
- /** Get file system statistics
- *
- * The 'f_frsize', 'f_favail', 'f_fsid' and 'f_flag' fields are ignored
- *
- * Replaced 'struct statfs' parameter with 'struct statvfs' in
- * version 2.5
- */
- int (*statfs) (const char *, struct statvfs *);
-
- /** Possibly flush cached data
- *
- * BIG NOTE: This is not equivalent to fsync(). It's not a
- * request to sync dirty data.
- *
- * Flush is called on each close() of a file descriptor. So if a
- * filesystem wants to return write errors in close() and the file
- * has cached dirty data, this is a good place to write back data
- * and return any errors. Since many applications ignore close()
- * errors this is not always useful.
- *
- * NOTE: The flush() method may be called more than once for each
- * open(). This happens if more than one file descriptor refers
- * to an opened file due to dup(), dup2() or fork() calls. It is
- * not possible to determine if a flush is final, so each flush
- * should be treated equally. Multiple write-flush sequences are
- * relatively rare, so this shouldn't be a problem.
- *
- * Filesystems shouldn't assume that flush will always be called
- * after some writes, or that if will be called at all.
- *
- * Changed in version 2.2
- */
- int (*flush) (const char *, struct fuse_file_info *);
-
- /** Release an open file
- *
- * Release is called when there are no more references to an open
- * file: all file descriptors are closed and all memory mappings
- * are unmapped.
- *
- * For every open() call there will be exactly one release() call
- * with the same flags and file descriptor. It is possible to
- * have a file opened more than once, in which case only the last
- * release will mean, that no more reads/writes will happen on the
- * file. The return value of release is ignored.
- *
- * Changed in version 2.2
- */
- int (*release) (const char *, struct fuse_file_info *);
-
- /** Synchronize file contents
- *
- * If the datasync parameter is non-zero, then only the user data
- * should be flushed, not the meta data.
- *
- * Changed in version 2.2
- */
- int (*fsync) (const char *, int, struct fuse_file_info *);
-
- /** Set extended attributes */
- int (*setxattr) (const char *, const char *, const char *, size_t, int);
-
- /** Get extended attributes */
- int (*getxattr) (const char *, const char *, char *, size_t);
-
- /** List extended attributes */
- int (*listxattr) (const char *, char *, size_t);
-
- /** Remove extended attributes */
- int (*removexattr) (const char *, const char *);
-
- /** Open directory
- *
- * This method should check if the open operation is permitted for
- * this directory
- *
- * Introduced in version 2.3
- */
- int (*opendir) (const char *, struct fuse_file_info *);
-
- /** Read directory
- *
- * This supersedes the old getdir() interface. New applications
- * should use this.
- *
- * The filesystem may choose between two modes of operation:
- *
- * 1) The readdir implementation ignores the offset parameter, and
- * passes zero to the filler function's offset. The filler
- * function will not return '1' (unless an error happens), so the
- * whole directory is read in a single readdir operation. This
- * works just like the old getdir() method.
- *
- * 2) The readdir implementation keeps track of the offsets of the
- * directory entries. It uses the offset parameter and always
- * passes non-zero offset to the filler function. When the buffer
- * is full (or an error happens) the filler function will return
- * '1'.
- *
- * Introduced in version 2.3
- */
- int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t,
- struct fuse_file_info *);
-
- /** Release directory
- *
- * Introduced in version 2.3
- */
- int (*releasedir) (const char *, struct fuse_file_info *);
-
- /** Synchronize directory contents
- *
- * If the datasync parameter is non-zero, then only the user data
- * should be flushed, not the meta data
- *
- * Introduced in version 2.3
- */
- int (*fsyncdir) (const char *, int, struct fuse_file_info *);
-
- /**
- * Initialize filesystem
- *
- * The return value will passed in the private_data field of
- * fuse_context to all file operations and as a parameter to the
- * destroy() method.
- *
- * Introduced in version 2.3
- */
- void *(*init) (void);
-
- /**
- * Clean up filesystem
- *
- * Called on filesystem exit.
- *
- * Introduced in version 2.3
- */
- void (*destroy) (void *);
-
- /**
- * Check file access permissions
- *
- * This will be called for the access() system call. If the
- * 'default_permissions' mount option is given, this method is not
- * called.
- *
- * This method is not called under Linux kernel versions 2.4.x
- *
- * Introduced in version 2.5
- */
- int (*access) (const char *, int);
-
- /**
- * Create and open a file
- *
- * If the file does not exist, first create it with the specified
- * mode, and then open it.
- *
- * If this method is not implemented or under Linux kernel
- * versions earlier than 2.6.15, the mknod() and open() methods
- * will be called instead.
- *
- * Introduced in version 2.5
- */
- int (*create) (const char *, mode_t, struct fuse_file_info *);
-
- /**
- * Change the size of an open file
- *
- * This method is called instead of the truncate() method if the
- * truncation was invoked from an ftruncate() system call.
- *
- * If this method is not implemented or under Linux kernel
- * versions earlier than 2.6.15, the truncate() method will be
- * called instead.
- *
- * Introduced in version 2.5
- */
- int (*ftruncate) (const char *, off_t, struct fuse_file_info *);
-
- /**
- * Get attributes from an open file
- *
- * This method is called instead of the getattr() method if the
- * file information is available.
- *
- * Currently this is only called after the create() method if that
- * is implemented (see above). Later it may be called for
- * invocations of fstat() too.
- *
- * Introduced in version 2.5
- */
- int (*fgetattr) (const char *, struct stat *, struct fuse_file_info *);
-};
-
-/** Extra context that may be needed by some filesystems
- *
- * The uid, gid and pid fields are not filled in case of a writepage
- * operation.
- */
-struct fuse_context {
- /** Pointer to the fuse object */
- struct fuse *fuse;
-
- /** User ID of the calling process */
- uid_t uid;
-
- /** Group ID of the calling process */
- gid_t gid;
-
- /** Thread ID of the calling process */
- pid_t pid;
-
- /** Private filesystem data */
- void *private_data;
-};
-
-/*
- * Main function of FUSE.
- *
- * This is for the lazy. This is all that has to be called from the
- * main() function.
- *
- * This function does the following:
- * - parses command line options (-d -s and -h)
- * - passes relevant mount options to the fuse_mount()
- * - installs signal handlers for INT, HUP, TERM and PIPE
- * - registers an exit handler to unmount the filesystem on program exit
- * - creates a fuse handle
- * - registers the operations
- * - calls either the single-threaded or the multi-threaded event loop
- *
- * Note: this is currently implemented as a macro.
- *
- * @param argc the argument counter passed to the main() function
- * @param argv the argument vector passed to the main() function
- * @param op the file system operation
- * @return 0 on success, nonzero on failure
- */
-/*
-int fuse_main(int argc, char *argv[], const struct fuse_operations *op);
-*/
-#define fuse_main(argc, argv, op) \
- fuse_main_real(argc, argv, op, sizeof(*(op)))
-
-/* ----------------------------------------------------------- *
- * More detailed API *
- * ----------------------------------------------------------- */
-
-/**
- * Create a new FUSE filesystem.
- *
- * @param fd the control file descriptor
- * @param args argument vector
- * @param op the operations
- * @param op_size the size of the fuse_operations structure
- * @return the created FUSE handle
- */
-struct fuse *fuse_new(int fd, struct fuse_args *args,
- const struct fuse_operations *op, size_t op_size);
-
-/**
- * Destroy the FUSE handle.
- *
- * The filesystem is not unmounted.
- *
- * @param f the FUSE handle
- */
-void fuse_destroy(struct fuse *f);
-
-/**
- * FUSE event loop.
- *
- * Requests from the kernel are processed, and the appropriate
- * operations are called.
- *
- * @param f the FUSE handle
- * @return 0 if no error occurred, -1 otherwise
- */
-int fuse_loop(struct fuse *f);
-
-/**
- * Exit from event loop
- *
- * @param f the FUSE handle
- */
-void fuse_exit(struct fuse *f);
-
-/**
- * FUSE event loop with multiple threads
- *
- * Requests from the kernel are processed, and the appropriate
- * operations are called. Request are processed in parallel by
- * distributing them between multiple threads.
- *
- * Calling this function requires the pthreads library to be linked to
- * the application.
- *
- * @param f the FUSE handle
- * @return 0 if no error occurred, -1 otherwise
- */
-int fuse_loop_mt(struct fuse *f);
-
-/**
- * Get the current context
- *
- * The context is only valid for the duration of a filesystem
- * operation, and thus must not be stored and used later.
- *
- * @param f the FUSE handle
- * @return the context
- */
-struct fuse_context *fuse_get_context(void);
-
-/**
- * Obsolete, doesn't do anything
- *
- * @return -EINVAL
- */
-int fuse_invalidate(struct fuse *f, const char *path);
-
-/* Deprecated, don't use */
-int fuse_is_lib_option(const char *opt);
-
-/**
- * The real main function
- *
- * Do not call this directly, use fuse_main()
- */
-int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op,
- size_t op_size);
-
-/* ----------------------------------------------------------- *
- * Advanced API for event handling, don't worry about this... *
- * ----------------------------------------------------------- */
-
-/** Function type used to process commands */
-typedef void (*fuse_processor_t)(struct fuse *, struct fuse_cmd *, void *);
-
-/** This is the part of fuse_main() before the event loop */
-struct fuse *fuse_setup(int argc, char *argv[],
- const struct fuse_operations *op, size_t op_size,
- char **mountpoint, int *multithreaded, int *fd);
-
-/** This is the part of fuse_main() after the event loop */
-void fuse_teardown(struct fuse *fuse, int fd, char *mountpoint);
-
-/** Read a single command. If none are read, return NULL */
-struct fuse_cmd *fuse_read_cmd(struct fuse *f);
-
-/** Process a single command */
-void fuse_process_cmd(struct fuse *f, struct fuse_cmd *cmd);
-
-/** Multi threaded event loop, which calls the custom command
- processor function */
-int fuse_loop_mt_proc(struct fuse *f, fuse_processor_t proc, void *data);
-
-/** Return the exited flag, which indicates if fuse_exit() has been
- called */
-int fuse_exited(struct fuse *f);
-
-/** Set function which can be used to get the current context */
-void fuse_set_getcontext_func(struct fuse_context *(*func)(void));
-
-/* ----------------------------------------------------------- *
- * Compatibility stuff *
- * ----------------------------------------------------------- */
-
-#ifndef __FreeBSD__
-
-#if FUSE_USE_VERSION == 22 || FUSE_USE_VERSION == 21 || FUSE_USE_VERSION == 11
-# include "fuse_compat.h"
-# undef FUSE_MINOR_VERSION
-# undef fuse_main
-# if FUSE_USE_VERSION == 22
-# define FUSE_MINOR_VERSION 4
-# define fuse_main(argc, argv, op) \
- fuse_main_real_compat22(argc, argv, op, sizeof(*(op)))
-# define fuse_new fuse_new_compat22
-# define fuse_setup fuse_setup_compat22
-# define fuse_operations fuse_operations_compat22
-# define fuse_file_info fuse_file_info_compat22
-# define fuse_mount fuse_mount_compat22
-# else
-# define fuse_dirfil_t fuse_dirfil_t_compat
-# define __fuse_read_cmd fuse_read_cmd
-# define __fuse_process_cmd fuse_process_cmd
-# define __fuse_loop_mt fuse_loop_mt_proc
-# if FUSE_USE_VERSION == 21
-# define FUSE_MINOR_VERSION 1
-# define fuse_operations fuse_operations_compat2
-# define fuse_main fuse_main_compat2
-# define fuse_new fuse_new_compat2
-# define __fuse_setup fuse_setup_compat2
-# define __fuse_teardown fuse_teardown
-# define __fuse_exited fuse_exited
-# define __fuse_set_getcontext_func fuse_set_getcontext_func
-# define fuse_mount fuse_mount_compat22
-# else
-# warning Compatibility with API version 11 is deprecated
-# undef FUSE_MAJOR_VERSION
-# define FUSE_MAJOR_VERSION 1
-# define FUSE_MINOR_VERSION 1
-# define fuse_statfs fuse_statfs_compat1
-# define fuse_operations fuse_operations_compat1
-# define fuse_main fuse_main_compat1
-# define fuse_new fuse_new_compat1
-# define fuse_mount fuse_mount_compat1
-# define FUSE_DEBUG FUSE_DEBUG_COMPAT1
-# endif
-# endif
-#elif FUSE_USE_VERSION < 25
-# error Compatibility with API version other than 21, 22 and 11 not supported
-#endif
-
-#else /* __FreeBSD__ */
-
-#if FUSE_USE_VERSION < 25
-# error On FreeBSD API version 25 or greater must be used
-#endif
-
-#endif /* __FreeBSD__ */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _FUSE_H_ */
Index: include/fuse_common.h
===================================================================
RCS file: include/fuse_common.h
diff -N include/fuse_common.h
--- include/fuse_common.h 13 Apr 2006 22:52:47 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,117 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2006 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU LGPL.
- See the file COPYING.LIB.
-*/
-
-#if !defined(_FUSE_H_) && !defined(_FUSE_LOWLEVEL_H_)
-#error "Never include <fuse_common.h> directly; use <fuse.h> or
<fuse_lowlevel.h instead."
-#endif
-
-#ifndef _FUSE_COMMON_H_
-#define _FUSE_COMMON_H_
-
-#include "fuse_opt.h"
-#include <stdint.h>
-
-/** Major version of FUSE library interface */
-#define FUSE_MAJOR_VERSION 2
-
-/** Minor version of FUSE library interface */
-#define FUSE_MINOR_VERSION 5
-
-#define FUSE_MAKE_VERSION(maj, min) ((maj) * 10 + (min))
-#define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION)
-
-/* This interface uses 64 bit off_t */
-#if _FILE_OFFSET_BITS != 64
-#error Please add -D_FILE_OFFSET_BITS=64 to your compile flags!
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Information about open files
- *
- * Changed in version 2.5
- */
-struct fuse_file_info {
- /** Open flags. Available in open() and release() */
- int flags;
-
- /** Old file handle, don't use */
- unsigned long fh_old;
-
- /** In case of a write operation indicates if this was caused by a
- writepage */
- int writepage;
-
- /** Can be filled in by open, to use direct I/O on this file.
- Introduced in version 2.4 */
- unsigned int direct_io : 1;
-
- /** Can be filled in by open, to indicate, that cached file data
- need not be invalidated. Introduced in version 2.4 */
- unsigned int keep_cache : 1;
-
- /** Padding. Do not use*/
- unsigned int padding : 30;
-
- /** File handle. May be filled in by filesystem in open().
- Available in all other file operations */
- uint64_t fh;
-};
-
-/**
- * Create a FUSE mountpoint
- *
- * Returns a control file descriptor suitable for passing to
- * fuse_new()
- *
- * @param mountpoint the mount point path
- * @param args argument vector
- * @return the control file descriptor on success, -1 on failure
- */
-int fuse_mount(const char *mountpoint, struct fuse_args *args);
-
-/**
- * Umount a FUSE mountpoint
- *
- * @param mountpoint the mount point path
- */
-void fuse_unmount(const char *mountpoint);
-
-/**
- * Parse common options
- *
- * The following options are parsed:
- *
- * '-f' foreground
- * '-d' '-odebug' foreground, but keep the debug option
- * '-s' single threaded
- * '-h' '--help' help
- * '-ho' help without header
- * '-ofsname=..' file system name, if not present, then set to the program
- * name
- *
- * All parameters may be NULL
- *
- * @param args argument vector
- * @param mountpoint the returned mountpoint, should be freed after use
- * @param multithreaded set to 1 unless the '-s' option is present
- * @param foreground set to 1 if one of the relevant options is present
- * @return 0 on success, -1 on failure
- */
-int fuse_parse_cmdline(struct fuse_args *args, char **mountpoint,
- int *multithreaded, int *foreground);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _FUSE_COMMON_H_ */
Index: include/fuse_compat.h
===================================================================
RCS file: include/fuse_compat.h
diff -N include/fuse_compat.h
--- include/fuse_compat.h 13 Apr 2006 22:52:47 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,147 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2006 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU LGPL.
- See the file COPYING.LIB.
-*/
-
-/* these definitions provide source compatibility to prior versions.
- Do not include this file directly! */
-
-#include <sys/statfs.h>
-
-struct fuse_file_info_compat22 {
- int flags;
- unsigned long fh;
- int writepage;
- unsigned int direct_io : 1;
- unsigned int keep_cache : 1;
-};
-
-struct fuse_operations_compat22 {
- int (*getattr) (const char *, struct stat *);
- int (*readlink) (const char *, char *, size_t);
- int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t);
- int (*mknod) (const char *, mode_t, dev_t);
- int (*mkdir) (const char *, mode_t);
- int (*unlink) (const char *);
- int (*rmdir) (const char *);
- int (*symlink) (const char *, const char *);
- int (*rename) (const char *, const char *);
- int (*link) (const char *, const char *);
- int (*chmod) (const char *, mode_t);
- int (*chown) (const char *, uid_t, gid_t);
- int (*truncate) (const char *, off_t);
- int (*utime) (const char *, struct utimbuf *);
- int (*open) (const char *, struct fuse_file_info_compat22 *);
- int (*read) (const char *, char *, size_t, off_t,
- struct fuse_file_info_compat22 *);
- int (*write) (const char *, const char *, size_t, off_t,
- struct fuse_file_info_compat22 *);
- int (*statfs) (const char *, struct statfs *);
- int (*flush) (const char *, struct fuse_file_info_compat22 *);
- int (*release) (const char *, struct fuse_file_info_compat22 *);
- int (*fsync) (const char *, int, struct fuse_file_info_compat22 *);
- int (*setxattr) (const char *, const char *, const char *, size_t, int);
- int (*getxattr) (const char *, const char *, char *, size_t);
- int (*listxattr) (const char *, char *, size_t);
- int (*removexattr) (const char *, const char *);
- int (*opendir) (const char *, struct fuse_file_info_compat22 *);
- int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t,
- struct fuse_file_info_compat22 *);
- int (*releasedir) (const char *, struct fuse_file_info_compat22 *);
- int (*fsyncdir) (const char *, int, struct fuse_file_info_compat22 *);
- void *(*init) (void);
- void (*destroy) (void *);
-};
-
-struct fuse *fuse_new_compat22(int fd, const char *opts,
- const struct fuse_operations_compat22 *op,
- size_t op_size);
-
-struct fuse *fuse_setup_compat22(int argc, char *argv[],
- const struct fuse_operations_compat22 *op,
- size_t op_size, char **mountpoint,
- int *multithreaded, int *fd);
-
-int fuse_main_real_compat22(int argc, char *argv[],
- const struct fuse_operations_compat22 *op,
- size_t op_size);
-
-int fuse_mount_compat22(const char *mountpoint, const char *opts);
-
-typedef int (*fuse_dirfil_t_compat) (fuse_dirh_t h, const char *name, int
type);
-struct fuse_operations_compat2 {
- int (*getattr) (const char *, struct stat *);
- int (*readlink) (const char *, char *, size_t);
- int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t_compat);
- int (*mknod) (const char *, mode_t, dev_t);
- int (*mkdir) (const char *, mode_t);
- int (*unlink) (const char *);
- int (*rmdir) (const char *);
- int (*symlink) (const char *, const char *);
- int (*rename) (const char *, const char *);
- int (*link) (const char *, const char *);
- int (*chmod) (const char *, mode_t);
- int (*chown) (const char *, uid_t, gid_t);
- int (*truncate) (const char *, off_t);
- int (*utime) (const char *, struct utimbuf *);
- int (*open) (const char *, int);
- int (*read) (const char *, char *, size_t, off_t);
- int (*write) (const char *, const char *, size_t, off_t);
- int (*statfs) (const char *, struct statfs *);
- int (*flush) (const char *);
- int (*release) (const char *, int);
- int (*fsync) (const char *, int);
- int (*setxattr) (const char *, const char *, const char *, size_t, int);
- int (*getxattr) (const char *, const char *, char *, size_t);
- int (*listxattr) (const char *, char *, size_t);
- int (*removexattr) (const char *, const char *);
-};
-
-int fuse_main_compat2(int argc, char *argv[], const struct
fuse_operations_compat2 *op);
-
-struct fuse *fuse_new_compat2(int fd, const char *opts, const struct
fuse_operations_compat2 *op);
-
-struct fuse *fuse_setup_compat2(int argc, char *argv[], const struct
fuse_operations_compat2 *op, char **mountpoint, int *multithreaded, int *fd);
-
-struct fuse_statfs_compat1 {
- long block_size;
- long blocks;
- long blocks_free;
- long files;
- long files_free;
- long namelen;
-};
-
-struct fuse_operations_compat1 {
- int (*getattr) (const char *, struct stat *);
- int (*readlink) (const char *, char *, size_t);
- int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t_compat);
- int (*mknod) (const char *, mode_t, dev_t);
- int (*mkdir) (const char *, mode_t);
- int (*unlink) (const char *);
- int (*rmdir) (const char *);
- int (*symlink) (const char *, const char *);
- int (*rename) (const char *, const char *);
- int (*link) (const char *, const char *);
- int (*chmod) (const char *, mode_t);
- int (*chown) (const char *, uid_t, gid_t);
- int (*truncate) (const char *, off_t);
- int (*utime) (const char *, struct utimbuf *);
- int (*open) (const char *, int);
- int (*read) (const char *, char *, size_t, off_t);
- int (*write) (const char *, const char *, size_t, off_t);
- int (*statfs) (struct fuse_statfs_compat1 *);
- int (*release) (const char *, int);
- int (*fsync) (const char *, int);
-};
-
-#define FUSE_DEBUG_COMPAT1 (1 << 1)
-
-int fuse_mount_compat1(const char *mountpoint, const char *args[]);
-
-struct fuse *fuse_new_compat1(int fd, int flags, const struct
fuse_operations_compat1 *op);
-
-void fuse_main_compat1(int argc, char *argv[], const struct
fuse_operations_compat1 *op);
Index: include/fuse_opt.h
===================================================================
RCS file: include/fuse_opt.h
diff -N include/fuse_opt.h
--- include/fuse_opt.h 13 Apr 2006 22:52:47 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,227 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2006 Miklos Szeredi <address@hidden>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#ifndef _FUSE_OPT_H_
-#define _FUSE_OPT_H_
-
-/* This file defines the option parsing interface of FUSE */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Option description
- *
- * This structure describes a single option, and and action associated
- * with it, in case it matches.
- *
- * More than one such match may occur, in which case the action for
- * each match is executed.
- *
- * There are three possible actions in case of a match:
- *
- * i) An integer (int or unsigned) variable determined by 'offset' is
- * set to 'value'
- *
- * ii) The processing function is called, with 'value' as the key
- *
- * iii) An integer (any) or string (char *) variable determined by
- * 'offset' is set to the value of an option parameter
- *
- * 'offset' should normally be either set to
- *
- * - 'offsetof(struct foo, member)' actions i) and iii)
- *
- * - -1 action ii)
- *
- * The 'offsetof()' macro is defined in the <stddef.h> header.
- *
- * The template determines which options match, and also have an
- * effect on the action. Normally the action is either i) or ii), but
- * if a format is present in the template, then action iii) is
- * performed.
- *
- * The types of templates are:
- *
- * 1) "-x", "-foo", "--foo", "--foo-bar", etc. These match only
- * themselves. Invalid values are "--" and anything beginning
- * with "-o"
- *
- * 2) "foo", "foo-bar", etc. These match "-ofoo", "-ofoo-bar" or
- * the relevant option in a comma separated option list
- *
- * 3) "bar=", "--foo=", etc. These are variations of 1) and 2)
- * which have a parameter
- *
- * 4) "bar=%s", "--foo=%lu", etc. Same matching as above but perform
- * action iii).
- *
- * 5) "-x ", etc. Matches either "-xparam" or "-x param" as
- * two separate arguments
- *
- * 6) "-x %s", etc. Combination of 4) and 5)
- *
- * If the format is "%s", memory is allocated for the string unlike
- * with scanf().
- */
-struct fuse_opt {
- /** Matching template and optional parameter formatting */
- const char *templ;
-
- /**
- * Offset of variable within 'data' parameter of fuse_opt_parse()
- * or -1
- */
- unsigned long offset;
-
- /**
- * Value to set the variable to, or to be passed as 'key' to the
- * processing function. Ignored if template has a format
- */
- int value;
-};
-
-/**
- * Key option. In case of a match, the processing function will be
- * called with the specified key.
- */
-#define FUSE_OPT_KEY(templ, key) { templ, -1U, key }
-
-/**
- * Last option. An array of 'struct fuse_opt' must end with a NULL
- * template value
- */
-#define FUSE_OPT_END { .templ = NULL }
-
-/**
- * Argument list
- */
-struct fuse_args {
- /** Argument count */
- int argc;
-
- /** Argument vector. NULL terminated */
- char **argv;
-
- /** Is 'argv' allocated? */
- int allocated;
-};
-
-/**
- * Initializer for 'struct fuse_args'
- */
-#define FUSE_ARGS_INIT(argc, argv) { argc, argv, 0 }
-
-/**
- * Key value passed to the processing function if an option did not
- * match any template
- */
-#define FUSE_OPT_KEY_OPT -1
-
-/**
- * Key value passed to the processing function for all non-options
- *
- * Non-options are the arguments beginning with a charater other than
- * '-' or all arguments after the special '--' option
- */
-#define FUSE_OPT_KEY_NONOPT -2
-
-/**
- * Processing function
- *
- * This function is called if
- * - option did not match any 'struct fuse_opt'
- * - argument is a non-option
- * - option did match and offset was set to -1
- *
- * The 'arg' parameter will always contain the whole argument or
- * option including the parameter if exists. A two-argument option
- * ("-x foo") is always converted to single arguemnt option of the
- * form "-xfoo" before this function is called.
- *
- * Options of the form '-ofoo' are passed to this function without the
- * '-o' prefix.
- *
- * The return value of this function determines whether this argument
- * is to be inserted into the output argument vector, or discarded.
- *
- * @param data is the user data passed to the fuse_opt_parse() function
- * @param arg is the whole argument or option
- * @param key determines why the processing function was called
- * @param outargs the current output argument list
- * @return -1 on error, 0 if arg is to be discarded, 1 if arg should be kept
- */
-typedef int (*fuse_opt_proc_t)(void *data, const char *arg, int key,
- struct fuse_args *outargs);
-
-/**
- * Option parsing function
- *
- * If 'args' was returned from a previous call to fuse_opt_parse() or
- * it was constructed from
- *
- * A NULL 'args' is equivalent to an empty argument vector
- *
- * A NULL 'opts' is equivalent to an 'opts' array containing a single
- * end marker
- *
- * A NULL 'proc' is equivalent to a processing function always
- * returning '1'
- *
- * @param args is the input and output argument list
- * @param data is the user data
- * @param opts is the option description array
- * @param proc is the processing function
- * @return -1 on error, 0 on success
- */
-int fuse_opt_parse(struct fuse_args *args, void *data,
- const struct fuse_opt opts[], fuse_opt_proc_t proc);
-
-/**
- * Add an option to a comma separated option list
- *
- * @param opts is a pointer to an option list, may point to a NULL value
- * @param opt is the option to add
- * @return -1 on allocation error, 0 on success
- */
-int fuse_opt_add_opt(char **opts, const char *opt);
-
-/**
- * Add an argument to a NULL terminated argument vector
- *
- * @param args is the structure containing the current argument list
- * @param arg is the new argument to add
- * @return -1 on allocation error, 0 on success
- */
-int fuse_opt_add_arg(struct fuse_args *args, const char *arg);
-
-/**
- * Free the contents of argument list
- *
- * The structure itself is not freed
- *
- * @param args is the structure containing the argument list
- */
-void fuse_opt_free_args(struct fuse_args *args);
-
-
-/**
- * Check if an option matches
- *
- * @param opts is the option description array
- * @param opt is the option to match
- * @return 1 if a match is found, 0 if not
- */
-int fuse_opt_match(const struct fuse_opt opts[], const char *opt);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _FUSE_OPT_H_ */
Index: include/old/.cvsignore
===================================================================
RCS file: include/old/.cvsignore
diff -N include/old/.cvsignore
--- include/old/.cvsignore 13 Apr 2006 19:14:02 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,2 +0,0 @@
-Makefile.in
-Makefile
Index: include/old/Makefile.am
===================================================================
RCS file: include/old/Makefile.am
diff -N include/old/Makefile.am
--- include/old/Makefile.am 13 Apr 2006 19:14:02 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,10 +0,0 @@
-# Makefile.am
-# Used by automake and configure to create Makefile.
-#
-# Copyright (C) 2005,2006 Stefan Siegl <address@hidden>, Germany
-
-SUBDIRS =
-
-fuseincludedir=$(includedir)
-fuseinclude_HEADERS = \
- fuse.h
Index: include/old/fuse.h
===================================================================
RCS file: include/old/fuse.h
diff -N include/old/fuse.h
--- include/old/fuse.h 13 Apr 2006 19:14:02 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,9 +0,0 @@
-/*
- This header is for compatibility with older software using FUSE.
-
- Please use 'pkg-config --cflags fuse' to set include path. The
- correct usage is still '#include <fuse.h>', not '#include
- <fuse/fuse.h>'.
-*/
-
-#include "fuse/fuse.h"
Index: src/.cvsignore
===================================================================
RCS file: src/.cvsignore
diff -N src/.cvsignore
--- src/.cvsignore 30 Jan 2006 22:32:14 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,6 +0,0 @@
-Makefile.in
-Makefile
-*.lo
-*.la
-.deps
-.libs
Index: src/Makefile.am
===================================================================
RCS file: src/Makefile.am
diff -N src/Makefile.am
--- src/Makefile.am 30 Jan 2006 22:37:59 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,18 +0,0 @@
-# Makefile.am
-# Used by automake and configure to create Makefile.
-#
-# Copyright (C) 2005,2006 Stefan Siegl <address@hidden>, Germany
-
-lib_LTLIBRARIES = libfuse.la
-
-libfuse_la_LDFLAGS = -version-number 0:0:1
-libfuse_la_SOURCES = \
- main.c \
- netfs.c \
- netnode.c \
- node.c
-
-noinst_HEADERS = \
- fuse_i.h
-
-DEFAULT_INCLUDES = -I. -I$(top_srcdir) -I$(top_srcdir)/include
\ No newline at end of file
Index: src/fuse_i.h
===================================================================
RCS file: src/fuse_i.h
diff -N src/fuse_i.h
--- src/fuse_i.h 4 Aug 2006 12:16:12 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,263 +0,0 @@
-/**********************************************************
- * fuse_i.h
- *
- * Copyright (C) 2004, 2005, 2006 by Stefan Siegl <address@hidden>, Germany
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Publice License,
- * version 2 or any later. The license is contained in the COPYING
- * file that comes with the libfuse distribution.
- *
- * libfuse internals ...
- */
-
-#ifndef FUSE_INTERNAL_H
-#define FUSE_INTERNAL_H
-
-#ifdef FUSE_USE_VERSION
-# include "fuse.h"
-#else
-# define FUSE_USE_VERSION 25
-# include "fuse.h"
-# include "fuse_compat.h"
-#endif
-
-/* write out message to stderr, that some routine is not yet implemented,
- * thus misbehaviour must be accepted. */
-#define NOT_IMPLEMENTED() \
- fprintf(stderr, PACKAGE ": functionality not yet implemented in " \
- __FILE__ ":%d\nyou're welcome to put your effort to here.\n\n", \
- __LINE__)
-
-/* pointer to the fuse_operations structure of this translator process */
-extern const struct fuse_operations_compat22 *fuse_ops_compat22;
-extern const struct fuse_operations_compat2 *fuse_ops_compat2;
-extern const struct fuse_operations *fuse_ops25;
-
-#define FUSE_OP_HAVE(a) (fuse_ops25 ? \
- (fuse_ops25->a != NULL) \
- : ((fuse_ops_compat22) ? \
- (fuse_ops_compat22->a != NULL) : \
- (fuse_ops_compat2->a != NULL)))
-#define FUSE_OP_CALL(a,b...) (fuse_ops25 ? \
- (fuse_ops25->a(b)) : \
- ((fuse_ops_compat22) ? \
- (fuse_ops_compat22->a(b)) : \
- (fuse_ops_compat2->a(b))))
-
-#define FUSE_OP_HAVE22(a) (fuse_ops25 ? \
- (fuse_ops25->a != NULL) \
- : ((fuse_ops_compat22) ? \
- (fuse_ops_compat22->a != NULL) : 0))
-
-#define FUSE_OP_CALL22(a,b...) (fuse_ops25 ? \
- (fuse_ops25->a(b)) : \
- ((fuse_ops_compat22) ? \
- (fuse_ops_compat22->a(b)) : (0)))
-
-#define NN_INFO(dir) (fuse_ops25 ? \
- ((void *) &(dir)->nn->info.info25) \
- : ((void *) &(dir)->nn->info.compat22))
-
-#define NN_INFO_APPLY(node,key) do { \
- if(fuse_ops25) (node)->nn->info.info25.key; \
- else (node)->nn->info.compat22.key; \
- } while(0)
-
-/*****************************************************************************
- *** netnodes (in memory representation of libfuse's files or directories) ***
- *****************************************************************************/
-struct netnode;
-struct netnode {
- /* full pathname of the referenced file or directory */
- char *path;
-
- /* inode number assigned to the node, unique id that mustn't be
- * changed - throughout the life of this translator
- */
- ino_t inode;
-
- /* information about the opened file
- */
- union {
- struct fuse_file_info_compat22 compat22;
- struct fuse_file_info info25;
- } info;
-
- /* pointer to our parent's netnode, if any */
- struct netnode *parent;
-
- /* reference to our libnetfs node, if any
- * (lock must be held on read or write attempt)
- */
- struct node *node;
-
- /* lock for *node pointer */
- struct mutex lock;
-
- /* whether this is an anonymous node, i.e. it has to be deleted,
- * after the last node associated to it, was removed.
- */
- unsigned anonymous :1;
-
- /* whether the netnode was touched since reading it from disk,
- * i.e. the was a write access that may not be synced to disk
- */
- unsigned may_need_sync :1;
-};
-
-/* make a new netnode for a specific path, with specified parent
- * parent == NULL means root node, i.e. "/" ...
- */
-struct netnode *fuse_make_netnode(struct netnode *parent, const char *path);
-
-/* scan the whole netnode hash and call fuse_ops->fsync on every node,
- * that may be out of sync
- */
-error_t fuse_sync_filesystem(void);
-
-
-
-/*****************************************************************************
- *** nodes (structures used by the GNU Hurd, i.e. libnetfs) ***
- *****************************************************************************/
-
-/* make a new node for a specific netnode */
-struct node *fuse_make_node(struct netnode *nn);
-
-
-
-/*****************************************************************************
- *** various parameters which can be used to change libfuse's behaviour ***
- *****************************************************************************/
-struct _libfuse_params {
- /* whether or not the filesystem sets the inode number */
- unsigned use_ino : 1;
-
- /* whether uid,gid,umask-parameters are specified or not */
- unsigned force_uid : 1;
- unsigned force_gid : 1;
- unsigned force_umask : 1;
-
- /* whether either root or other users should be allowed to use the
- * filesystem (this overrides uid/gid/umask checking!) */
- unsigned deflt_perms : 1;
- unsigned allow_other : 1;
- unsigned allow_root : 1;
-
- /* whether to disable multithreading (if using fuse_main) */
- unsigned disable_mt : 1;
-
- /* whether to fork to background or not (if started without settrans) */
- unsigned foreground : 1;
-
- /* the uid and gid to set and which umask to apply (if bitfields are set) */
- uid_t uid;
- gid_t gid;
- mode_t umask;
-};
-
-extern struct _libfuse_params libfuse_params;
-
-/* the private data pointer returned from init() callback */
-extern void *fsys_privdata;
-
-/* magic number, passed from fuse_mount to fuse_new */
-#define FUSE_MAGIC ((int) 0x66757365)
-
-
-
-/*****************************************************************************
- *** debug cruft ***
- *****************************************************************************/
-
-/* the port where to write out debug messages to, NULL to omit these */
-extern FILE *debug_port;
-
-#define DEBUG(cat,msg...) \
- if(debug_port) \
- fprintf(debug_port, PACKAGE ": " cat ": " msg)
-
-#define FUNC_PROLOGUE_(func_name, fmt...) \
- do \
- { \
- const char *debug_func_name = func_name; \
- DEBUG("tracing", "entering %s (" __FILE__ ":%d) ", \
- debug_func_name, __LINE__); \
- if(debug_port) \
- { \
- fmt; \
- fprintf(debug_port, "\n"); \
- }
-
-#define FUNC_PROLOGUE(func_name) \
- FUNC_PROLOGUE_(func_name, (void)0)
-
-#define FUNC_PROLOGUE_FMT(func_name, fmt...) \
- FUNC_PROLOGUE_(func_name, fprintf(debug_port, fmt))
-
-#define FUNC_PROLOGUE_NODE(func_name, node) \
- FUNC_PROLOGUE_FMT(func_name, "node=%s", (node)->nn->path)
-
-#define FUNC_EPILOGUE_NORET() \
- DEBUG("tracing", "leaving %s\n", debug_func_name); \
- } while(0);
-
-#define FUNC_RETURN_(ret, fmt) \
- { \
- int retval = (ret); \
- DEBUG("tracing", "leaving %s (" __FILE__ ":%d) ret=%d ", \
- debug_func_name, __LINE__, retval); \
- if(debug_port) \
- { \
- if(retval) \
- fprintf(debug_port, "(%s) ", strerror(retval)); \
- fmt; \
- fprintf(debug_port, "\n"); \
- } \
- return retval; \
- }
-
-#define FUNC_EPILOGUE_(ret, fmt) \
- FUNC_RETURN_(ret, fmt) \
- } while(0)
-
-#define FUNC_RETURN_FMT(ret, fmt...) \
- FUNC_RETURN_(ret, fprintf(debug_port, fmt))
-
-#define FUNC_EPILOGUE_FMT(ret, fmt...) \
- FUNC_EPILOGUE_(ret, fprintf(debug_port, fmt))
-
-#define FUNC_RETURN(ret) \
- FUNC_RETURN_(ret, (void)0)
-
-#define FUNC_EPILOGUE(ret) \
- FUNC_EPILOGUE_(ret, (void)0)
-
-
-
-/* malloc debugging */
-#if 0
-static char *_strdup(const char *s, const char *f, int l) {
-void *ptr = strdup(s);
-DEBUG("strdup", "ptr=%8p [%s:%d]\n", ptr, f, l);
-return ptr;
-}
-#undef strdup
-#define strdup(s) _strdup(s, __FILE__, __LINE__)
-
-static void *_malloc(size_t sz, const char *f, int l) {
-void *ptr = malloc(sz);
-DEBUG("malloc", "ptr=%8p [%s:%d]\n", ptr, f, l);
-return ptr;
-}
-#define malloc(s) _malloc(s, __FILE__, __LINE__)
-
-static void _free(void *ptr, const char *f, int l) {
-DEBUG(" free", "ptr=%8p [%s:%d]\n", ptr, f, l);
-free(ptr);
-}
-#define free(s) _free(s, __FILE__, __LINE__)
-#endif /* malloc debugging */
-
-#endif /* FUSE_INTERNAL_H */
Index: src/main.c
===================================================================
RCS file: src/main.c
diff -N src/main.c
--- src/main.c 7 Aug 2006 14:20:18 -0000 1.9
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,595 +0,0 @@
-/**********************************************************
- * main.c
- *
- * Copyright (C) 2004,2005,2006 by Stefan Siegl <address@hidden>, Germany
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Publice License,
- * version 2 or any later. The license is contained in the COPYING
- * file that comes with the libfuse distribution.
- *
- * translator startup code (and argp handling)
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <unistd.h>
-#include <stdio.h>
-#include <error.h>
-#include <hurd/netfs.h>
-#include <hurd.h>
-
-#include "fuse_i.h"
-#include "fuse.h"
-
-/* global variables, needed for netfs */
-char *netfs_server_name = PACKAGE;
-char *netfs_server_version = VERSION;
-int netfs_maxsymlinks = 12;
-
-/* libfuse filesystem configuration */
-struct _libfuse_params libfuse_params = { 0 };
-
-/* pointer to the fuse_operations structure of this translator process */
-const struct fuse_operations_compat22 *fuse_ops_compat22 = NULL;
-const struct fuse_operations_compat2 *fuse_ops_compat2 = NULL;
-const struct fuse_operations *fuse_ops25 = NULL;
-
-/* the port where to write out debug messages to, NULL to omit these */
-FILE *debug_port = NULL;
-
-/* the private data pointer returned from init() callback */
-void *fsys_privdata = NULL;
-
-/* bootstrap fuse translator */
-static int fuse_bootstrap(const char *mountpoint);
-
-
-/* Interpret a __single__ mount option
- * The option itself `opt' may be modified during this call.
- */
-static int
-fuse_parse_opt(char *opt)
-{
- char *ptrptr;
- char *option = strtok_r(opt, "=", &ptrptr);
- char *value = strtok_r(NULL, "=", &ptrptr);
-
- DEBUG("parse_opt", "option `%s' => `%s'\n", option, value);
-
- if(! strcmp(option, "use_ino"))
- libfuse_params.use_ino = 1;
-
- else if(! strcmp(option, "default_permissions"))
- libfuse_params.deflt_perms = 1;
-
- else if(! strcmp(option, "allow_other"))
- libfuse_params.allow_other = 1;
-
- else if(! strcmp(option, "allow_root"))
- libfuse_params.allow_root = 1;
-
- else if(! strcmp(option, "uid"))
- {
- char *endptr;
- if(! value || (libfuse_params.uid = strtol(value, &endptr, 10),
- endptr == value))
- {
- fprintf(stderr, PACKAGE_NAME ": missing or invalid argument to "
- "mount option '%s': %s\n", option, value);
- return EINVAL;
- }
-
- libfuse_params.force_uid = 1;
- }
-
- else if(! strcmp(option, "gid"))
- {
- char *endptr;
- if(! value || (libfuse_params.gid = strtol(value, &endptr, 10),
- endptr == value))
- {
- fprintf(stderr, PACKAGE_NAME ": missing or invalid argument to "
- "mount option '%s': %s\n", option, value);
- return EINVAL;
- }
-
- libfuse_params.force_gid = 1;
- }
-
- else if(! strcmp(option, "umask"))
- {
- char *endptr;
- if(! value || (libfuse_params.umask = strtol(value, &endptr, 8),
- endptr == value))
- {
- fprintf(stderr, PACKAGE_NAME ": missing or invalid argument to "
- "mount option '%s': %s\n", option, value);
- return EINVAL;
- }
-
- libfuse_params.force_umask = 1;
- }
-
- else if(! strcmp(option, "fsname"))
- {
- /* nothing to do for us */
- }
-
- else
- {
- fprintf(stderr, PACKAGE_NAME ": unsupported mount option: %s\n", option);
- return EINVAL;
- }
-
- return 0;
-}
-
-/* Parse a single (or a comma-separated list) of mount options
- * (those that are specified using `-o' on the command line for example)
- */
-static int
-fuse_parse_opts(const char *opts)
-{
- if(! opts) return 0; /* ... why did'ya call us? */
-
- char *copy = strdup(opts); /* copy string to allow strtok calls */
- if(! copy) return ENOMEM;
-
- char *ptrptr, *token, *tok_me = copy;
- while((token = strtok_r(tok_me, ",", &ptrptr)))
- {
- tok_me = NULL;
- if(fuse_parse_opt(token))
- {
- free(copy);
- return EINVAL;
- }
- }
-
- free(copy);
- return 0;
-}
-
-
-
-/* Parse the command line arguments given to fuse_main (or _compat function).
- * If --help specified, output help string and call exit. If there are any
- * options that shall be passed to the file system itself, return them.
- */
-static void
-fuse_parse_argv(int argc, char *argv[])
-{
- const char *translat_path = argv[0];
-
- /* parse command line arguments */
- int opt;
- FILE *opt_help = NULL;
-
- while((opt = getopt(argc, argv, "d::o:hsf")) >= 0)
- switch(opt)
- {
- case 'd':
- if(optarg)
- debug_port = fopen(optarg, "w");
- if(! debug_port)
- debug_port = stderr;
-
- setvbuf(debug_port, NULL, _IONBF, 0);
- fprintf(debug_port, "translator %s starting up.\n", translat_path);
- break;
-
- case 'o':
- assert(optarg);
- if(fuse_parse_opts(optarg))
- exit(1);
- break;
-
- case 'h':
- opt_help = stdout;
- break;
-
- case 's':
- libfuse_params.disable_mt = 1;
- break;
-
- case 'f':
- libfuse_params.foreground = 1;
- break;
-
- case '?':
- default:
- opt_help = stderr;
- break;
- }
-
- if(argc - optind > 1)
- {
- opt_help = stderr;
- fprintf(opt_help, "%s: too many command line arguments.\n", argv[0]);
- }
-
- if(opt_help)
- {
- fprintf(opt_help,
- "usage: %s [FUSE options]\n\n"
- "FUSE Options:\n"
- " -d[FILENAME] "
- "enable debug output (default=stderr)\n"
- " -s disable multi-threaded operation\n"
- " -f don't fork to background\n"
- /* " -r "
- * "mount read only (equivalent to '-o ro')\n" */
- " -o opt,[opt...] mount options\n"
- " -h print help\n"
- "\n"
- "Mount options:\n"
- " default_permissions enable permission checking\n"
- " allow_other allow access to other users\n"
- " allow_root allow access to root\n"
- " use_ino let filesystem set inode numbers\n"
- /* " readdir_ino "
- * "try to fill in d_ino in readdir\n" */
- " umask set file permissions (octal)\n"
- " uid set file owner\n"
- " gid set file group\n",
- translat_path);
-
- exit(opt_help == stdout ? 0 : 1);
- }
-
- /* chop off the consumed args */
- argv[0] = argv[optind];
- argv[1] = NULL;
-}
-
-
-
-/* Main function of FUSE. (compatibility one for old Fuse API) */
-int
-fuse_main_compat2(int argc, char *argv[],
- const struct fuse_operations_compat2 *op)
-{
- fuse_parse_argv(argc, argv);
-
- int fd = fuse_mount_compat22(argv[0], NULL);
- return (libfuse_params.disable_mt ? fuse_loop : fuse_loop_mt)
- (fuse_new_compat2(fd, NULL, op));
-}
-
-
-
-/* Main function of FUSE.
- * named fuse_main_real, since originial fuse.h defines a macro renaming it */
-int
-fuse_main_real_compat22(int argc, char *argv[],
- const struct fuse_operations_compat22 *op,
- size_t op_size)
-{
- fuse_parse_argv(argc, argv);
-
- int fd = fuse_mount_compat22(argv[0], NULL);
- return (libfuse_params.disable_mt ? fuse_loop : fuse_loop_mt)
- (fuse_new_compat22(fd, NULL, op, op_size));
-}
-
-
-int
-fuse_main_real(int argc, char *argv[], const struct fuse_operations *op,
- size_t op_size)
-{
- fuse_parse_argv(argc, argv);
-
- int fd = fuse_mount(argv[0], NULL);
- return (libfuse_params.disable_mt ? fuse_loop : fuse_loop_mt)
- (fuse_new(fd, NULL, op, op_size));
-}
-
-
-/* Create a new FUSE filesystem, actually there's nothing for us to do
- * on the Hurd.
- *
- * (Compatibility function for the old Fuse API)
- */
-struct fuse *
-fuse_new_compat2(int fd, const char *opts,
- const struct fuse_operations_compat2 *op)
-{
- if(fd != FUSE_MAGIC)
- return NULL;
-
- if(fuse_parse_opts(opts))
- return NULL;
-
- fuse_ops_compat2 = op;
-
- return (void *) FUSE_MAGIC; /* we don't have a fuse structure, sorry. */
-}
-
-
-
-/* Create a new FUSE filesystem, actually there's nothing for us to do
- * on the Hurd. Hmm.
- */
-struct fuse *
-fuse_new(int fd, struct fuse_args *args,
- const struct fuse_operations *op, size_t op_size)
-{
- (void) op_size; /* FIXME, see what the real Fuse library does with
- * this argument */
-
- if(fd != FUSE_MAGIC)
- return NULL;
-
- if(args && args->allocated)
- {
- int i;
- for(i = 0; i < args->argc; i ++)
- if(fuse_parse_opt(args->argv[i]))
- return NULL;
- }
-
- fuse_ops25 = op;
-
- if(op->init)
- fsys_privdata = op->init();
-
- return (void *) FUSE_MAGIC; /* we don't have a fuse structure, sorry. */
-}
-
-
-/* Create a new FUSE filesystem, actually there's nothing for us to do
- * on the Hurd.
- */
-struct fuse *
-fuse_new_compat22(int fd, const char *opts,
- const struct fuse_operations_compat22 *op, size_t op_size)
-{
- (void) op_size; /* FIXME, see what the real Fuse library does with
- * this argument */
-
- if(fd != FUSE_MAGIC)
- return NULL;
-
- if(fuse_parse_opts(opts))
- return NULL;
-
- fuse_ops_compat22 = op;
-
- if(op->init)
- fsys_privdata = op->init();
-
- return (void *) FUSE_MAGIC; /* we don't have a fuse structure, sorry. */
-}
-
-
-/* Create a new mountpoint for our fuse filesystem, i.e. do the netfs
- * initialization stuff ...
- */
-int
-fuse_mount(const char *mountpoint, struct fuse_args *args)
-{
- if(args && args->allocated)
- {
- int i;
- for(i = 0; i < args->argc; i ++)
- if(fuse_parse_opt(args->argv[i]))
- return 0;
- }
-
- return fuse_bootstrap(mountpoint);
-}
-
-
-int
-fuse_mount_compat22(const char *mountpoint, const char *opts)
-{
- if(fuse_parse_opts(opts))
- return 0;
-
- return fuse_bootstrap(mountpoint);
-}
-
-static int
-fuse_bootstrap(const char *mountpoint)
-{
- mach_port_t bootstrap, ul_node;
- task_get_bootstrap_port(mach_task_self(), &bootstrap);
-
- if(! mountpoint || bootstrap)
- {
- netfs_init();
- ul_node = netfs_startup(bootstrap, 0);
- }
- else
- {
- /*
- * we don't have a bootstrap port, i.e. we were not started using
- * settrans, but know the mountpoint, therefore try to become
- * a translator the hard way ...
- */
- ul_node = file_name_lookup(mountpoint, 0, 0);
-
- if(ul_node == MACH_PORT_NULL)
- error(10, 0, "Unable to access underlying node");
-
- /* fork first, we are expected to act from the background */
- pid_t pid = libfuse_params.foreground ? 0 : fork();
- if(pid < 0)
- {
- perror(PACKAGE ": failed to fork to background");
- exit(1);
- }
- else if(pid)
- exit(0); /* parent process */
-
- /* finally try to get it on ... */
- netfs_init();
-
- struct port_info *newpi;
- error_t err = ports_create_port(netfs_control_class, netfs_port_bucket,
- sizeof(struct port_info), &newpi);
-
- if(! err)
- {
- mach_port_t right = ports_get_send_right(newpi);
-
- err = file_set_translator(ul_node, 0, FS_TRANS_SET, 0, "", 0,
- right, MACH_MSG_TYPE_COPY_SEND);
- mach_port_deallocate(mach_task_self(), right);
- ports_port_deref(newpi);
- }
-
- if(err)
- error(11, err, "Translator startup failure: fuse_mount_compat22");
- }
-
- /* create our root node */
- {
- struct netnode *root = fuse_make_netnode(NULL, "/");
- netfs_root_node = fuse_make_node(root);
- }
-
- if(! netfs_root_node)
- {
- perror(PACKAGE ": cannot create rootnode");
- return -EAGAIN;
- }
-
- return FUSE_MAGIC;
-}
-
-
-
-int
-fuse_loop(struct fuse *f)
-{
- if(f != ((void *) FUSE_MAGIC))
- return -1;
-
- static int server_timeout = 1000 * 60 * 10; /* ten minutes, just like in
- * init-loop.c of libnetfs */
-
- ports_manage_port_operations_one_thread(netfs_port_bucket,
- netfs_demuxer,
- server_timeout);
- return 0;
-}
-
-
-struct fuse_cmd {
- mach_msg_header_t *inp;
- mach_msg_header_t *outp;
- int return_value;
-};
-
-static fuse_processor_t fuse_proc = NULL;
-static void *fuse_proc_data;
-
-static int
-fuse_demuxer(mach_msg_header_t *inp,
- mach_msg_header_t *outp)
-{
- struct fuse_cmd cmd;
-
- cmd.inp = inp;
- cmd.outp = outp;
-
- fuse_proc((void *) FUSE_MAGIC, &cmd, fuse_proc_data);
-
- return cmd.return_value;
-}
-
-void
-fuse_process_cmd(struct fuse *f, struct fuse_cmd *cmd)
-{
- if(f != ((void *) FUSE_MAGIC))
- {
- cmd->return_value = -1;
- return;
- }
-
- int netfs_fs_server (mach_msg_header_t *, mach_msg_header_t *);
- int netfs_io_server (mach_msg_header_t *, mach_msg_header_t *);
- int netfs_fsys_server (mach_msg_header_t *, mach_msg_header_t *);
- int netfs_ifsock_server (mach_msg_header_t *, mach_msg_header_t *);
-
- mach_msg_header_t *inp = cmd->inp;
- mach_msg_header_t *outp = cmd->outp;
-
- cmd->return_value = (netfs_io_server (inp, outp)
- || netfs_fs_server (inp, outp)
- || ports_notify_server (inp, outp)
- || netfs_fsys_server (inp, outp)
- || ports_interrupt_server (inp, outp)
- || netfs_ifsock_server (inp, outp));
-}
-
-
-int
-fuse_loop_mt_proc(struct fuse *f, fuse_processor_t proc, void *data)
-{
- static int thread_timeout = 1000 * 60 * 2; /* two minutes */
- static int server_timeout = 1000 * 60 * 10; /* ten minutes, just like in
- * init-loop.c of libnetfs */
-
- if(f != ((void *) FUSE_MAGIC))
- return -1;
-
- /* copy the provided arguments to global variables to make them available
- * to fuse_demuxer ... */
- fuse_proc = proc;
- fuse_proc_data = data;
-
- ports_manage_port_operations_multithread(netfs_port_bucket,
- fuse_demuxer,
- thread_timeout,
- server_timeout,
- 0);
- return 0;
-}
-
-
-int
-fuse_loop_mt(struct fuse *f)
-{
- if (f == NULL)
- return -1;
-
- return fuse_loop_mt_proc(f, (fuse_processor_t) fuse_process_cmd, NULL);
-}
-
-
-void
-fuse_exit(struct fuse *f)
-{
- (void) f;
- /*
- * well, we should make fuse_main exit, this is, we would have to
- * cancel ports_manage_port_operations_one_thread. however this is
- * not possible, therefore buy the farm for the moment.
- */
- error(1, EIEIO, "fuse_exit called");
-}
-
-
-int
-fuse_exited(struct fuse *f)
-{
- (void) f;
-
- /*
- * if fuse_exit is called, we buy the farm, therefore we still must be alive.
- */
- return 0;
-}
-
-
-struct fuse_context *
-fuse_get_context(void)
-{
- struct fuse_context *ctx = cthread_data(cthread_self());
- return ctx;
-}
Index: src/netfs.c
===================================================================
RCS file: src/netfs.c
diff -N src/netfs.c
--- src/netfs.c 5 Aug 2006 19:02:36 -0000 1.6
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,1714 +0,0 @@
-/**********************************************************
- * netfs.c
- *
- * Copyright(C) 2004,2005,2006 by Stefan Siegl <address@hidden>, Germany
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Publice License,
- * version 2 or any later. The license is contained in the COPYING
- * file that comes with the libfuse distribution.
- *
- * callback functions for libnetfs
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <dirent.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/mman.h>
-
-#include <hurd/netfs.h>
-
-#include <stdio.h>
-
-#include "fuse_i.h"
-#include "fuse.h"
-
-
-
-
-
-/* fuse_dirhandle, passed to ops->getdir to store our information */
-struct fuse_dirhandle {
- int first_entry; /* index of first entry to return (counted down
- * in helper function) */
- int num_entries; /* number of further entries we may write out to the
- * buffer, counted down in callback function*/
- int count; /* number of elements, we already wrote to buffer */
- size_t size; /* number of further bytes we may write to buffer */
- struct dirent *hdrpos; /* where to write next dirent structure */
- size_t maxlen; /* (allocated) length of filename field, def 256 */
- struct netnode *parent; /* netnode of the dir which's content we list */
-
- char *abspath;
- char *filename;
-};
-
-
-static inline void
-refresh_context_struct(struct iouser *cred)
-{
- FUNC_PROLOGUE("refresh_context_struct");
- struct fuse_context *ctx = cthread_data(cthread_self());
-
- if(! ctx)
- {
- ctx = malloc(sizeof(struct fuse_context));
- if(! ctx)
- {
- perror(PACKAGE_NAME);
- return;
- }
-
- cthread_set_data(cthread_self(), ctx);
-
- ctx->fuse = (void *) FUSE_MAGIC;
- ctx->private_data = fsys_privdata;
-
- /* FIXME, how to figure out the pid of the program asking for the
- * filesystem operation? */
- ctx->pid = 0;
- }
-
- if(cred)
- {
- ctx->uid = cred->uids->num ? cred->uids->ids[0] :
- (libfuse_params.force_uid ? libfuse_params.uid : geteuid());
- ctx->gid = cred->gids->num ? cred->gids->ids[0] :
- (libfuse_params.force_gid ? libfuse_params.gid : getegid());
- }
- else
- {
- ctx->uid = libfuse_params.force_uid ? libfuse_params.uid : geteuid();
- ctx->gid = libfuse_params.force_gid ? libfuse_params.gid : getegid();
- }
-
- FUNC_EPILOGUE_NORET();
-}
-
-/* Check whether to allow access to a node, testing the allow_root and
- * allow_other flag. This does not check whether default permissions
- * are okay to allow access.
- *
- * Return: 0 if access is to be granted, EPERM otherwise
- *
- * Sidenote: This function is mainly called from netfs_validate_stat which in
- * turn is called by any other of the netfs-operation-functions. This
- * is, we don't have to call this from all of the operation-functions
- * since netfs_validate_stat is called anyways!
- */
-static error_t
-test_allow_root_or_other (struct iouser *cred)
-{
- FUNC_PROLOGUE("test_allow_root_or_other");
-
- assert(cred);
-
- /* if allow_other is set, access is okay in any case */
- if(libfuse_params.allow_other)
- FUNC_RETURN_FMT(0, "allow_other is set");
-
- unsigned int i;
- uid_t proc_uid = getuid();
- for(i = 0; i < cred->uids->num; i ++)
- {
- DEBUG("test_allow", "testing for uid=%d\n", cred->uids->ids[i]);
-
- if(cred->uids->ids[i] == 0 && libfuse_params.allow_root)
- FUNC_RETURN_FMT(0, "allowing access for root");
-
- if(cred->uids->ids[i] == proc_uid)
- FUNC_RETURN_FMT(0, "allowing access for owner");
- }
-
- /* iouser is not the "filesystem-owner" and allow_other is not set,
- * or iouser is root but allow_root is not set either */
- FUNC_EPILOGUE(EPERM);
-}
-
-
-
-/* Make sure that NP->nn_stat is filled with current information. CRED
- identifies the user responsible for the operation.
-
- If the user `CRED' is not allowed to perform any operation (considering
- the allow_root and allow_other flags), return EPERM. */
-error_t
-netfs_validate_stat (struct node *node, struct iouser *cred)
-{
- FUNC_PROLOGUE_NODE("netfs_validate_stat", node);
- error_t err = EOPNOTSUPP;
-
- if(test_allow_root_or_other(cred))
- FUNC_RETURN(EPERM);
-
- if(FUSE_OP_HAVE(getattr))
- {
- refresh_context_struct(cred);
- err = -FUSE_OP_CALL(getattr, node->nn->path, &node->nn_stat);
- }
-
- if(! err)
- {
- if(! libfuse_params.use_ino)
- node->nn_stat.st_ino = node->nn->inode;
-
- node->nn_stat.st_dev = getpid();
- node->nn_stat.st_blksize = 1 << 12; /* there's probably no sane default,
- * use 4 kB for the moment */
-
- if(libfuse_params.force_uid)
- node->nn_stat.st_uid = libfuse_params.uid;
-
- if(libfuse_params.force_gid)
- node->nn_stat.st_gid = libfuse_params.gid;
-
- if(libfuse_params.force_umask)
- node->nn_stat.st_mode &= ~libfuse_params.umask;
- }
-
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* Read the contents of NODE (a symlink), for USER, into BUF. */
-error_t netfs_attempt_readlink (struct iouser *user, struct node *node,
- char *buf)
-{
- FUNC_PROLOGUE_NODE("netfs_attempt_readlink", node);
- error_t err;
-
- if((err = netfs_validate_stat(node, user))
- || (libfuse_params.deflt_perms
- && (err = fshelp_access(&node->nn_stat, S_IREAD, user))))
- goto out;
-
- if(FUSE_OP_HAVE(readlink))
- err = -FUSE_OP_CALL(readlink, node->nn->path, buf, INT_MAX);
- else
- err = EOPNOTSUPP;
-
- out:
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* Attempt to create a file named NAME in DIR for USER with MODE. Set *NODE
- to the new node upon return. On any error, clear *NODE. *NODE should be
- locked on success; no matter what, unlock DIR before returning. */
-error_t
-netfs_attempt_create_file (struct iouser *user, struct node *dir,
- char *name, mode_t mode, struct node **node)
-{
- FUNC_PROLOGUE("netfs_attempt_create_file");
- error_t err;
- char *path = NULL;
-
- if((err = netfs_validate_stat(dir, user))
- || (libfuse_params.deflt_perms
- && (err = fshelp_checkdirmod(&dir->nn_stat, NULL, user))))
- goto out;
-
- if(! FUSE_OP_HAVE(mknod))
- {
- err = EOPNOTSUPP;
- goto out;
- }
-
- if(! (path = malloc(strlen(dir->nn->path) + strlen(name) + 2)))
- {
- err = ENOMEM;
- goto out;
- }
-
- sprintf(path, "%s/%s", dir->nn->path, name);
-
- /* FUSE expects us to use mknod function to create files. This is allowed
- * on Linux, however neither the Hurd nor the POSIX standard consider that
- */
- err = -FUSE_OP_CALL(mknod, path, (mode & ALLPERMS) | S_IFREG, 0);
-
- out:
- if(err)
- *node = NULL;
- else
- {
- /* create a new (net-)node for this file */
- struct netnode *nn = fuse_make_netnode(dir->nn, path);
-
- if(nn)
- {
- nn->may_need_sync = 1;
- *node = fuse_make_node(nn);
- }
- else
- {
- *node = NULL;
- err = ENOMEM;
- }
- }
-
- free(path); /* fuse_make_netnode strdup'ed it. */
-
- if(*node)
- mutex_lock(&(*node)->lock);
-
- mutex_unlock (&dir->lock);
-
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* This should attempt a chmod call for the user specified by CRED on node
- NODE, to change the owner to UID and the group to GID. */
-error_t netfs_attempt_chown (struct iouser *cred, struct node *node,
- uid_t uid, uid_t gid)
-{
- FUNC_PROLOGUE_NODE("netfs_attempt_chown", node);
- error_t err;
-
- if((err = netfs_validate_stat(node, cred))
- || (libfuse_params.deflt_perms
- && (err = fshelp_isowner(&node->nn_stat, cred))))
- goto out;
-
- if(! FUSE_OP_HAVE(chown))
- {
- err = EOPNOTSUPP;
- goto out;
- }
-
- /* FIXME, make sure, that user CRED is not able to change permissions
- * to somebody who is not. That is, don't allow $unpriv_user to change
- * owner to e.g. root.
- */
-
- err = -FUSE_OP_CALL(chown, node->nn->path, uid, gid);
- node->nn->may_need_sync = 1;
-
- out:
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* This should attempt to fetch filesystem status information for the remote
- filesystem, for the user CRED. */
-error_t
-netfs_attempt_statfs (struct iouser *cred, struct node *node,
- fsys_statfsbuf_t *st)
-{
- FUNC_PROLOGUE_NODE("netfs_attempt_statfs", node);
- error_t err;
-
- if(test_allow_root_or_other(cred))
- err = EPERM;
-
- else if(FUSE_OP_HAVE(statfs))
- {
- refresh_context_struct(cred);
-
- if(fuse_ops25)
- {
- struct statvfs stvfs;
- err = -fuse_ops25->statfs(node->nn->path, &stvfs);
-
- st->f_type = stvfs.__f_type;
- st->f_bsize = stvfs.f_bsize;
- st->f_blocks = stvfs.f_blocks;
- st->f_bfree = stvfs.f_bfree;
- st->f_bavail = stvfs.f_bavail;
- st->f_files = stvfs.f_files;
- st->f_ffree = stvfs.f_ffree;
- st->f_fsid = stvfs.f_fsid;
- st->f_namelen = stvfs.f_namemax;
- st->f_favail = stvfs.f_favail;
- st->f_frsize = stvfs.f_frsize;
- st->f_flag = stvfs.f_flag;
- }
-
- else if(fuse_ops_compat22)
- err = -fuse_ops_compat22->statfs(node->nn->path, st);
-
- else if(fuse_ops_compat2)
- err = -fuse_ops_compat2->statfs(node->nn->path, st);
-
- else
- assert(0);
- }
-
- else
- err = EOPNOTSUPP;
-
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* Attempt to create a new directory named NAME in DIR for USER with mode
- MODE. */
-error_t netfs_attempt_mkdir (struct iouser *user, struct node *dir,
- char *name, mode_t mode)
-{
- FUNC_PROLOGUE("netfs_attempt_mkdir");
- error_t err;
- char *path = NULL;
-
- if((err = netfs_validate_stat(dir, user))
- || (libfuse_params.deflt_perms
- && (err = fshelp_checkdirmod(&dir->nn_stat, NULL, user))))
- goto out;
-
- if(! FUSE_OP_HAVE(mkdir))
- {
- err = EOPNOTSUPP;
- goto out;
- }
-
- if(! (path = malloc(strlen(dir->nn->path) + strlen(name) + 2)))
- {
- err = ENOMEM;
- goto out;
- }
-
- sprintf(path, "%s/%s", dir->nn->path, name);
-
- err = -FUSE_OP_CALL(mkdir, path, mode & ALLPERMS);
-
- out:
- /* we don't need to make a netnode already, lookup will be called and do
- * that for us.
- *
- * FIXME we must make sure, that the netnode will have may_need_sync is set
- */
- free(path);
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* This should attempt a chflags call for the user specified by CRED on node
- NODE, to change the flags to FLAGS. */
-error_t netfs_attempt_chflags (struct iouser *cred, struct node *node,
- int flags)
-{
- (void) cred;
- (void) flags;
-
- FUNC_PROLOGUE_NODE("netfs_attempt_chflags", node);
- NOT_IMPLEMENTED();
- FUNC_EPILOGUE(EOPNOTSUPP);
-}
-
-
-
-/* Node NODE is being opened by USER, with FLAGS. NEWNODE is nonzero if we
- just created this node. Return an error if we should not permit the open
- to complete because of a permission restriction. */
-error_t
-netfs_check_open_permissions (struct iouser *user, struct node *node,
- int flags, int newnode)
-{
- (void) newnode;
-
- FUNC_PROLOGUE_FMT("netfs_check_open_permissions", "node=%s, flags=%d",
- node->nn->path, flags);
- error_t err = 0;
-
- if((err = netfs_validate_stat(node, user)))
- goto out;
-
- if(libfuse_params.deflt_perms)
- {
- if (flags & O_READ)
- err = fshelp_access (&node->nn_stat, S_IREAD, user);
-
- if (!err && (flags & O_WRITE))
- err = fshelp_access (&node->nn_stat, S_IWRITE, user);
-
- if (!err && (flags & O_EXEC))
- err = fshelp_access (&node->nn_stat, S_IEXEC, user);
- }
-
- /* store provided flags for later open/read/write/release operation call.
- *
- * If O_EXEC is set, make sure O_RDONLY is set, this is, if you want to
- * execute a binary, only O_EXEC is set, but we want to read the binary
- * into memory. */
- if(! err)
- {
- NN_INFO_APPLY(node, flags = flags);
- if(flags & O_EXEC) NN_INFO_APPLY(node, flags |= O_RDONLY);
- }
-
- out:
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* This should attempt a chmod call for the user specified by CRED on node
- NODE, to change the mode to MODE. Unlike the normal Unix and Hurd meaning
- of chmod, this function is also used to attempt to change files into other
- types. If such a transition is attempted which is impossible, then return
- EOPNOTSUPP. */
-error_t netfs_attempt_chmod (struct iouser *cred, struct node *node,
- mode_t mode)
-{
- FUNC_PROLOGUE_NODE("netfs_attempt_chmod", node);
- error_t err;
-
- if((err = netfs_validate_stat(node, cred))
- || (libfuse_params.deflt_perms
- && (err = fshelp_isowner(&node->nn_stat, cred))))
- goto out;
-
- if(! FUSE_OP_HAVE(chmod))
- {
- err = EOPNOTSUPP;
- goto out;
- }
-
- err = -FUSE_OP_CALL(chmod, node->nn->path, mode);
- node->nn->may_need_sync = 1;
-
- out:
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* Attempt to create an anonymous file related to DIR for USER with MODE.
- Set *NODE to the returned file upon success. No matter what, unlock DIR. */
-error_t netfs_attempt_mkfile (struct iouser *user, struct node *dir,
- mode_t mode, struct node **node)
-{
- FUNC_PROLOGUE("netfs_attempt_mkfile");
- error_t err;
- char name[20];
- static int num = 0;
-
- if(! (err = netfs_validate_stat(dir, user))
- && libfuse_params.deflt_perms)
- err = fshelp_checkdirmod(&dir->nn_stat, NULL, user);
-
- if(! err && ! FUSE_OP_HAVE(mknod))
- err = EOPNOTSUPP;
-
- if(err)
- {
- /* dir has to be unlocked no matter what ... */
- mutex_unlock (&dir->lock);
- goto out;
- }
-
- /* call netfs_attempt_create_file with O_EXCL and O_CREAT bits set */
- mode |= O_EXCL | O_CREAT;
-
- do
- {
- snprintf(name, sizeof(name), ".libfuse-%06d", num ++);
- err = netfs_attempt_create_file(user, dir, name, mode, node);
-
- if(err == EEXIST)
- mutex_lock(&dir->lock); /* netfs_attempt_create_file just unlocked
- * it for us, however we need to call it once
- * more ...
- */
- }
- while(err == EEXIST);
-
- out:
- if(err)
- *node = 0;
- else
- (*node)->nn->anonymous = 1; /* mark netnode of created file as anonymous,
- * i.e. mark it as to delete in noref routine
- */
-
- /* we don't have to mark the netnode as may_need_sync, as
- * netfs_attempt_create_file has already done that for us
- */
-
- /* mutex_unlock (&dir->lock);
- * netfs_attempt_create_file already unlocked the node for us.
- */
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* This should sync the entire remote filesystem. If WAIT is set, return
- only after sync is completely finished. */
-error_t netfs_attempt_syncfs (struct iouser *cred, int wait)
-{
- (void) wait; /* there's no such flag in libfuse */
-
- FUNC_PROLOGUE("netfs_attempt_syncfs");
- error_t err;
-
- if(cred && test_allow_root_or_other(cred))
- err = EPERM;
- else
- {
- refresh_context_struct(cred);
- err = fuse_sync_filesystem();
- }
-
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* This should sync the file NODE completely to disk, for the user CRED. If
- WAIT is set, return only after sync is completely finished. */
-error_t
-netfs_attempt_sync (struct iouser *cred, struct node *node, int wait)
-{
- (void) wait; /* there's no such flag in libfuse */
-
- FUNC_PROLOGUE_NODE("netfs_attempt_sync", node);
- error_t err;
-
- if((err = netfs_validate_stat(node, cred))
- || (libfuse_params.deflt_perms
- && (err = fshelp_access(&node->nn_stat, S_IWRITE, cred))))
- goto out;
-
- if(! FUSE_OP_HAVE(fsync))
- {
- err = EOPNOTSUPP;
- goto out;
- }
-
- if(FUSE_OP_HAVE22(fsync))
- err = -FUSE_OP_CALL22(fsync, node->nn->path, 0, NN_INFO(node));
-
- else if(fuse_ops_compat2)
- err = -fuse_ops_compat2->fsync(node->nn->path, 0);
-
- else
- assert(0);
-
- if(! err)
- node->nn->may_need_sync = 0;
-
- out:
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* Delete NAME in DIR for USER.
- * The node DIR is locked, and shall stay locked
- */
-error_t netfs_attempt_unlink (struct iouser *user, struct node *dir,
- char *name)
-{
- FUNC_PROLOGUE("netfs_attempt_unlink");
- error_t err;
- struct node *node = NULL;
-
- err = netfs_attempt_lookup(user, dir, name, &node);
- assert(dir != node);
- mutex_lock(&dir->lock); /* re-lock directory, since netfs_attempt_lookup
- * unlocked it for us
- */
- if(err)
- goto out;
-
- mutex_unlock(&node->lock);
-
- if((err = netfs_validate_stat(dir, user))
- || (err = netfs_validate_stat(node, user))
- || (libfuse_params.deflt_perms
- && (err = fshelp_checkdirmod(&dir->nn_stat, &node->nn_stat, user))))
- goto out;
-
- if(FUSE_OP_HAVE(unlink))
- err = -FUSE_OP_CALL(unlink, node->nn->path);
- else
- err = EOPNOTSUPP;
-
- /* TODO free associated netnode. really?
- * FIXME, make sure nn->may_need_sync is set */
- out:
- if(node)
- netfs_nrele(node);
-
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* This should attempt to set the size of the file NODE (for user CRED) to
- SIZE bytes long. */
-error_t netfs_attempt_set_size (struct iouser *cred, struct node *node,
- loff_t size)
-{
- FUNC_PROLOGUE_NODE("netfs_attempt_set_size", node);
- error_t err;
-
- if((err = netfs_validate_stat(node, cred))
- || (libfuse_params.deflt_perms
- && (err = fshelp_access(&node->nn_stat, S_IWRITE, cred))))
- goto out;
-
- if(FUSE_OP_HAVE(truncate))
- err = -FUSE_OP_CALL(truncate, node->nn->path, size);
- else
- err = EOPNOTSUPP;
-
- out:
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* Attempt to turn NODE (user CRED) into a device. TYPE is either S_IFBLK or
- S_IFCHR. */
-error_t netfs_attempt_mkdev (struct iouser *cred, struct node *node,
- mode_t type, dev_t indexes)
-{
- FUNC_PROLOGUE_NODE("netfs_attempt_mkdev", node);
- error_t err;
-
- /* check permissions
- * XXX, shall we check permissions of the parent directory as well,
- * since we're going to unlink files?
- */
- if((err = netfs_validate_stat(node, cred))
- || (libfuse_params.deflt_perms
- && (err = fshelp_access(&node->nn_stat, S_IWRITE, cred))))
- goto out;
-
- /* check whether the operations are available at all */
- if(! FUSE_OP_HAVE(mknod))
- {
- err = EOPNOTSUPP;
- goto out;
- }
-
- /* we need to unlink the existing node, therefore, if unlink is not
- * available, we cannot turn *node into a device.
- */
- if(! FUSE_OP_HAVE(unlink))
- {
- err = EOPNOTSUPP;
- goto out;
- }
-
- /* unlink the already existing node, to be able to create the (new)
- * device file
- */
- if((err = -FUSE_OP_CALL(unlink, node->nn->path)))
- goto out;
-
- err = -FUSE_OP_CALL(mknod, node->nn->path,
- type & (ALLPERMS | S_IFBLK | S_IFCHR), indexes);
-
- node->nn->may_need_sync = 1;
-
- out:
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* Return the valid access types (bitwise OR of O_READ, O_WRITE, and O_EXEC)
- in *TYPES for file NODE and user CRED. */
-error_t
-netfs_report_access (struct iouser *cred, struct node *node, int *types)
-{
- FUNC_PROLOGUE_NODE("netfs_report_access", node);
- error_t err;
- *types = 0;
-
- if((err = netfs_validate_stat(node, cred)))
- goto out;
-
- if(libfuse_params.deflt_perms)
- {
- if(fshelp_access (&node->nn_stat, S_IREAD, cred) == 0)
- *types |= O_READ;
-
- if(fshelp_access (&node->nn_stat, S_IWRITE, cred) == 0)
- *types |= O_WRITE;
-
- if(fshelp_access (&node->nn_stat, S_IEXEC, cred) == 0)
- *types |= O_EXEC;
- }
- else
- /* check_allow_root_or_other allowed to get here, this is, we're
- * allowed to access the file. Default permissions checking is disabled,
- * thus, grant access
- */
- *types |= O_READ | O_WRITE | O_EXEC;
-
- out:
- FUNC_EPILOGUE(0);
-}
-
-
-/* Lookup NAME in DIR for USER; set *NODE to the found name upon return. If
- the name was not found, then return ENOENT. On any error, clear *NODE.
- (*NODE, if found, should be locked, this call should unlock DIR no matter
- what.) */
-error_t netfs_attempt_lookup (struct iouser *user, struct node *dir,
- char *name, struct node **node)
-{
- FUNC_PROLOGUE_FMT("netfs_attempt_lookup", "name=%s, dir=%s",
- name, dir->nn->path);
-
- error_t err;
-
- if((err = netfs_validate_stat(dir, user))
- || (libfuse_params.deflt_perms
- && ((err = fshelp_access(&dir->nn_stat, S_IREAD, user))
- || (err = fshelp_access(&dir->nn_stat, S_IEXEC, user)))))
- goto out;
- else
- err = ENOENT; /* default to return ENOENT */
-
- if(! strcmp(name, "."))
- {
- /* lookup for current directory, return another refernce to it */
- netfs_nref(dir);
- *node = dir;
- err = 0; /* it's alright ... */
- }
-
- else if(! strcmp(name, ".."))
- {
- if(dir->nn->parent)
- {
- /* okay, there is a parent directory, return a reference to that */
- *node = fuse_make_node(dir->nn->parent);
- err = 0;
- }
- else
- /* cannot go up from top directory */
- err = EAGAIN;
- }
-
- else if(FUSE_OP_HAVE(getattr))
- {
- /* lookup for common file */
- struct netnode *nn;
- char *path;
- struct stat stbuf;
-
- if(asprintf(&path, "%s/%s",
- dir->nn->parent ? dir->nn->path : "", name) < 0)
- {
- err = ENOMEM;
- goto out;
- }
-
- if(! (err = -FUSE_OP_CALL(getattr, path, &stbuf)))
- if(! (nn = fuse_make_netnode(dir->nn, path)) ||
- ! (*node = fuse_make_node(nn)))
- err = ENOMEM;
-
- free(path); /* fuse_make_netnode strdup()s the pathname */
- }
-
-out:
- mutex_unlock(&dir->lock);
-
- if(err)
- *node = NULL;
- else
- mutex_lock(&(*node)->lock);
-
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* Create a link in DIR with name NAME to FILE for USER. Note that neither
- DIR nor FILE are locked. If EXCL is set, do not delete the target, but
- return EEXIST if NAME is already found in DIR. */
-error_t netfs_attempt_link (struct iouser *user, struct node *dir,
- struct node *file, char *name, int excl)
-{
- FUNC_PROLOGUE_FMT("netfs_attempt_link", "link=%s/%s, to=%s",
- dir->nn->path, name, file->nn->path);
- error_t err;
- struct node *node = NULL;
-
- mutex_lock(&dir->lock);
-
- if((err = netfs_attempt_lookup(user, dir, name, &node)))
- goto out_nounlock; /* netfs_attempt_lookup unlocked dir */
-
- assert(dir != node);
- mutex_lock(&dir->lock);
-
- if((err = netfs_validate_stat(node, user))
- || (libfuse_params.deflt_perms
- && (err = fshelp_checkdirmod(&dir->nn_stat, &node->nn_stat, user))))
- goto out;
-
- if(! FUSE_OP_HAVE(link)) {
- err = EOPNOTSUPP;
- goto out;
- }
-
- if(! excl && FUSE_OP_HAVE(unlink))
- /* EXCL is not set, therefore we may remove the target, i.e. call
- * unlink on it. Ignoring return value, as it's mostly not interesting,
- * since the file does not exist in most case
- */
- (void) FUSE_OP_CALL(unlink, node->nn->path);
-
- err = -FUSE_OP_CALL(link, file->nn->path, node->nn->path);
-
- /* TODO
- * create a netnode with the may_need_sync flag set!! */
-
- out:
- mutex_unlock(&dir->lock);
-
- mutex_unlock(&node->lock);
- netfs_nrele(node);
-
- out_nounlock:
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* Attempt to remove directory named NAME in DIR for USER.
- * directory DIR is locked, and shall stay locked. */
-error_t netfs_attempt_rmdir (struct iouser *user,
- struct node *dir, char *name)
-{
- FUNC_PROLOGUE("netfs_attempt_rmdir");
- error_t err;
- struct node *node = NULL;
-
- err = netfs_attempt_lookup(user, dir, name, &node);
- assert(dir != node);
- mutex_lock(&dir->lock); /* netfs_attempt_lookup unlocked dir */
-
- if(err)
- goto out_nounlock;
-
- if((err = netfs_validate_stat(node, user))
- || (libfuse_params.deflt_perms
- && (err = fshelp_checkdirmod(&dir->nn_stat, &node->nn_stat, user))))
- goto out;
-
- if(FUSE_OP_HAVE(rmdir))
- err = -FUSE_OP_CALL(rmdir, node->nn->path);
- else
- err = EOPNOTSUPP;
-
-
- /* TODO free associated netnode. really?
- * FIXME, make sure nn->may_need_sync is set */
-
- out:
- mutex_unlock(&node->lock);
- netfs_nrele(node);
-
- out_nounlock:
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* This should attempt a chauthor call for the user specified by CRED on node
- NODE, to change the author to AUTHOR. */
-error_t netfs_attempt_chauthor (struct iouser *cred, struct node *node,
- uid_t author)
-{
- (void) cred;
- (void) author;
-
- FUNC_PROLOGUE_NODE("netfs_attempt_chauthor", node);
- NOT_IMPLEMENTED();
- FUNC_EPILOGUE(EROFS);
-}
-
-
-
-/* Attempt to turn NODE (user CRED) into a symlink with target NAME. */
-error_t netfs_attempt_mksymlink (struct iouser *cred, struct node *node,
- char *name)
-{
- FUNC_PROLOGUE_NODE("netfs_attempt_mksymlink", node);
- error_t err;
-
- /* check permissions
- * XXX, shall we check permissions of the parent directory as well,
- * since we're going to unlink files?
- */
- if((err = netfs_validate_stat(node, cred))
- || (libfuse_params.deflt_perms
- && (err = fshelp_access(&node->nn_stat, S_IWRITE, cred))))
- goto out;
-
- /* we need to unlink the existing node, therefore, if unlink is not
- * available, we cannot create symlinks
- */
- if(! FUSE_OP_HAVE(unlink))
- {
- err = EOPNOTSUPP;
- goto out;
- }
-
- /* symlink function available? if not, fail. */
- if(! FUSE_OP_HAVE(symlink))
- {
- err = EOPNOTSUPP;
- goto out;
- }
-
- /* try to remove the existing node (probably an anonymous file) */
- if((err = -FUSE_OP_CALL(unlink, node->nn->path)))
- goto out;
-
- err = -FUSE_OP_CALL(symlink, name, node->nn->path);
-
- /* we don't have to adjust nodes/netnodes, as these are already existing.
- * netfs_attempt_mkfile did that for us.
- */
- if(! err)
- node->nn->may_need_sync = 1;
-
- out:
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* Note that in this one call, neither of the specific nodes are locked. */
-error_t netfs_attempt_rename (struct iouser *user, struct node *fromdir,
- char *fromname, struct node *todir,
- char *toname, int excl)
-{
- FUNC_PROLOGUE("netfs_attempt_rename");
- error_t err;
- struct node *fromnode;
- char *topath = NULL;
-
- if(! (topath = malloc(strlen(toname) + strlen(todir->nn->path) + 2)))
- {
- err = ENOMEM;
- goto out_nounlock;
- }
-
- mutex_lock(&fromdir->lock);
-
- if(netfs_attempt_lookup(user, fromdir, fromname, &fromnode))
- {
- err = ENOENT;
- goto out_nounlock; /* netfs_attempt_lookup unlocked fromdir and locked
- * fromnode for us.
- */
- }
-
- mutex_lock(&todir->lock);
-
- if((err = netfs_validate_stat(fromdir, user))
- || (libfuse_params.deflt_perms
- && (err = fshelp_checkdirmod(&fromdir->nn_stat,
- &fromnode->nn_stat, user))))
- goto out;
-
- if((err = netfs_validate_stat(todir, user))
- || (libfuse_params.deflt_perms
- && (err = fshelp_checkdirmod(&todir->nn_stat, NULL, user))))
- goto out;
-
- if(! FUSE_OP_HAVE(rename))
- {
- err = EOPNOTSUPP;
- goto out;
- }
-
- sprintf(topath, "%s/%s", todir->nn->path, toname);
-
- if(! excl && FUSE_OP_HAVE(unlink))
- /* EXCL is not set, therefore we may remove the target, i.e. call
- * unlink on it. Ignoring return value, as it's mostly not interesting,
- * since the file does not exist in most cases
- */
- (void) FUSE_OP_CALL(unlink, topath);
-
- err = -FUSE_OP_CALL(rename, fromnode->nn->path, topath);
-
- if(! err)
- {
- struct netnode *nn;
-
- if(! (nn = fuse_make_netnode(todir->nn, topath)))
- goto out;
-
- nn->may_need_sync = 1;
- /* FIXME mark fromnode to destroy it's associated netnode */
- }
-
- out:
- free(topath);
- mutex_unlock(&todir->lock);
-
- mutex_unlock(&fromnode->lock);
- netfs_nrele(fromnode);
-
- out_nounlock:
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* Write to the file NODE for user CRED starting at OFSET and continuing for up
- to *LEN bytes from DATA. Set *LEN to the amount seccessfully written upon
- return. */
-error_t netfs_attempt_write (struct iouser *cred, struct node *node,
- loff_t offset, size_t *len, void *data)
-{
- FUNC_PROLOGUE_NODE("netfs_attempt_write", node);
- error_t err;
-
- if((err = netfs_validate_stat(node, cred))
- || (libfuse_params.deflt_perms
- && (err = fshelp_access(&node->nn_stat, S_IWRITE, cred))))
- goto out;
-
- if(! FUSE_OP_HAVE(write))
- {
- err = EOPNOTSUPP;
- goto out;
- }
-
- NN_INFO_APPLY(node, writepage = 0); /* cannot distinct on the Hurd :( */
-
- if(FUSE_OP_HAVE(open))
- {
- if(FUSE_OP_HAVE22(open))
- err = FUSE_OP_CALL22(open, node->nn->path, NN_INFO(node));
-
- else if(fuse_ops_compat2)
- err = fuse_ops_compat2->open(node->nn->path,
- node->nn->info.compat22.flags);
-
- else
- assert(0);
-
- if(err) goto out;
- }
-
- int sz;
- if(FUSE_OP_HAVE22(write))
- sz = FUSE_OP_CALL22(write, node->nn->path, data, *len, offset,
- NN_INFO(node));
-
- else if(fuse_ops_compat2)
- sz = fuse_ops_compat2->write(node->nn->path, data, *len, offset);
-
- else
- assert(0);
-
- /* FIXME: open, flush and release handling probably should be changed
- * completely, I mean, we probably should do fuse_ops->open in
- * the netfs_check_open_permissions function and leave it open
- * until the node is destroyed.
- *
- * This way we wouldn't be able to report any errors back.
- */
- if(sz >= 0 && FUSE_OP_HAVE22(flush))
- err = FUSE_OP_CALL22(flush, node->nn->path, NN_INFO(node));
-
- if(FUSE_OP_HAVE(open) && FUSE_OP_HAVE(release))
- {
- if(FUSE_OP_HAVE22(release))
- FUSE_OP_CALL22(release, node->nn->path, NN_INFO(node));
-
- else if(fuse_ops_compat2)
- fuse_ops_compat2->release(node->nn->path,
- node->nn->info.compat22.flags);
-
- else
- assert(0);
- }
-
- if(sz < 0)
- err = -sz;
- else
- *len = sz;
-
- out:
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* This should attempt a utimes call for the user specified by CRED on node
- NODE, to change the atime to ATIME and the mtime to MTIME. */
-error_t
-netfs_attempt_utimes (struct iouser *cred, struct node *node,
- struct timespec *atime, struct timespec *mtime)
-{
- FUNC_PROLOGUE_NODE("netfs_attempt_utimes", node);
- error_t err;
-
- /* test whether operation is supported and permission are sufficient */
- if((err = netfs_validate_stat(node, cred))
- || (libfuse_params.deflt_perms
- && (err = fshelp_isowner(&node->nn_stat, cred))))
- goto out;
-
- if(! FUSE_OP_HAVE(utime))
- {
- err = EOPNOTSUPP;
- goto out;
- }
-
- /* prepare utimebuf for FUSE_OP_HAVE(utime) call */
- struct utimbuf utb;
- utb.actime = atime ? atime->tv_sec : node->nn_stat.st_atime;
- utb.modtime = mtime ? mtime->tv_sec : node->nn_stat.st_mtime;
-
- err = -FUSE_OP_CALL(utime, node->nn->path, &utb);
-
- if (! err)
- {
- node->nn_stat.st_mtime = utb.modtime;
- node->nn_stat.st_mtime_usec = 0;
-
- node->nn_stat.st_atime = utb.actime;
- node->nn_stat.st_atime_usec = 0;
-
- node->nn->may_need_sync = 1;
- }
-
- out:
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* Read from the file NODE for user CRED starting at OFFSET and continuing for
- up to *LEN bytes. Put the data at DATA. Set *LEN to the amount
- successfully read upon return. */
-error_t netfs_attempt_read (struct iouser *cred, struct node *node,
- loff_t offset, size_t *len, void *data)
-{
- FUNC_PROLOGUE_NODE("netfs_attempt_read", node);
- error_t err;
-
- if((err = netfs_validate_stat(node, cred))
- || (libfuse_params.deflt_perms
- && (err = fshelp_access(&node->nn_stat, S_IREAD, cred))))
- goto out;
-
- if(! FUSE_OP_HAVE(read))
- {
- err = EOPNOTSUPP;
- goto out;
- }
-
- if(FUSE_OP_HAVE(open))
- {
- if(FUSE_OP_HAVE22(open))
- err = FUSE_OP_CALL22(open, node->nn->path, NN_INFO(node));
-
- else if(fuse_ops_compat2)
- err = fuse_ops_compat2->open(node->nn->path,
- node->nn->info.compat22.flags);
-
- else
- assert(0);
-
- if(err) goto out;
- }
-
- int sz;
- if(FUSE_OP_HAVE22(read))
- sz = FUSE_OP_CALL22(read, node->nn->path, data, *len, offset,
- NN_INFO(node));
-
- else if(fuse_ops_compat2)
- sz = fuse_ops_compat2->read(node->nn->path, data, *len, offset);
-
- else
- assert(0);
-
- /* FIXME: open, flush and release handling probably should be changed
- * completely, I mean, we probably should do fuse_ops->open in
- * the netfs_check_open_permissions function and leave it open
- * until the node is destroyed.
- *
- * This way we wouldn't be able to report any errors back.
- */
- if(sz >= 0 && FUSE_OP_HAVE22(flush))
- err = FUSE_OP_CALL22(flush, node->nn->path, NN_INFO(node));
-
- if(FUSE_OP_HAVE(open) && FUSE_OP_HAVE(release))
- {
- if(FUSE_OP_HAVE22(release))
- FUSE_OP_CALL22(release, node->nn->path, NN_INFO(node));
-
- else if(fuse_ops_compat2)
- fuse_ops_compat2->release(node->nn->path,
- node->nn->info.compat22.flags);
-
- else
- assert(0);
- }
-
- if(sz < 0)
- err = -sz;
- else
- {
- err = 0;
- *len = sz;
- }
-
- out:
- FUNC_EPILOGUE(err);
-}
-
-
-
-/* Returned directory entries are aligned to blocks this many bytes long.
- Must be a power of two. */
-#define DIRENT_ALIGN 4
-#define DIRENT_NAME_OFFS offsetof (struct dirent, d_name)
-
-/* Length is structure before the name + the name + '\0', all
- padded to a four-byte alignment. */
-#define DIRENT_LEN(name_len) \
- ((DIRENT_NAME_OFFS + (name_len) + 1 + (DIRENT_ALIGN - 1)) \
- & ~(DIRENT_ALIGN - 1))
-
-/* fuse_get_inode
- *
- * look up the inode of the named file (full path) in fuse_use_ino mode,
- * where we don't have the inode number of parent directories in our structs
- */
-static ino_t
-fuse_get_inode(const char *name)
-{
- struct stat stat;
-
- assert(FUSE_OP_HAVE22(getattr));
- FUSE_OP_CALL22(getattr, name, &stat);
-
- return stat.st_ino;
-}
-
-/* callback handler used by netfs_get_dirents to write our dirents
- * to the mmaped memory (getdir case)
- */
-static int
-get_dirents_getdir_helper(fuse_dirh_t handle, const char *name,
- int type, ino_t ino)
-{
- ino_t inode;
-
- if(handle->first_entry)
- {
- /* skip this entry, it's before the first one we got to write out ... */
- handle->first_entry --;
- return 0;
- }
-
- if(! (handle->num_entries --))
- return ENOMEM;
-
- size_t name_len = strlen(name);
- size_t dirent_len = DIRENT_LEN(name_len);
-
- if(dirent_len > handle->size)
- {
- handle->num_entries = 0; /* don't write any further data, e.g. in case */
- return ENOMEM; /* next filename's shorter */
- }
- else
- handle->size -= dirent_len;
-
- /* look the inode of this element up ... */
- if(libfuse_params.use_ino)
- {
- /* using the inode based api */
- if(! strcmp(name, "."))
- inode = fuse_get_inode(handle->parent->path);
-
- else if(handle->parent->parent && ! strcmp(name, ".."))
- inode = fuse_get_inode(handle->parent->parent->path);
-
- else
- inode = ino;
- }
- else
- {
- /* using the old (lookup) method ... */
-
- if(! strcmp(name, "."))
- inode = handle->parent->inode;
-
- else if(handle->parent->parent && ! strcmp(name, ".."))
- inode = handle->parent->parent->inode;
-
- else
- {
- if(name_len > handle->maxlen)
- {
- /* allocated field in handle structure is to small, enlarge it */
- handle->maxlen = name_len << 1;
- void *a = realloc(handle->abspath, handle->maxlen +
- (handle->filename - handle->abspath) + 1);
- if(! a)
- return ENOMEM;
-
- handle->filename = a + (handle->filename - handle->abspath);
- handle->abspath = a;
- }
-
- strcpy(handle->filename, name);
- struct netnode *nn = fuse_make_netnode(handle->parent,
- handle->abspath);
-
- if(! nn)
- return ENOMEM;
-
- inode = nn->inode;
- }
- }
-
- /* write out struct dirent ... */
- handle->hdrpos->d_fileno = inode;
- handle->hdrpos->d_reclen = dirent_len;
- handle->hdrpos->d_type = type;
- handle->hdrpos->d_namlen = name_len;
-
- /* copy file's name ... */
- memcpy(((void *) handle->hdrpos) + DIRENT_NAME_OFFS, name, name_len + 1);
-
- /* update hdrpos pointer */
- handle->hdrpos = ((void *) handle->hdrpos) + dirent_len;
-
- handle->count ++;
- return 0;
-}
-
-
-/* callback handler used by netfs_get_dirents to write our dirents
- * to the mmaped memory
- *
- * version for old api
- */
-static int
-get_dirents_getdir_helper_compat(fuse_dirh_t hdl, const char *name, int type)
-{
- return get_dirents_getdir_helper(hdl, name, type, 0);
-}
-
-
-static error_t
-get_dirents_getdir(struct node *dir, int first_entry, int num_entries,
- char **data, mach_msg_type_number_t *data_len,
- int *data_entries)
-{
- FUNC_PROLOGUE_NODE("get_dirents_getdir", dir);
-
- if(! FUSE_OP_HAVE(getdir))
- FUNC_RETURN(EOPNOTSUPP);
-
- fuse_dirh_t handle;
- if(! (handle = malloc(sizeof(struct fuse_dirhandle))))
- FUNC_RETURN(ENOMEM);
-
- handle->first_entry = first_entry;
- handle->num_entries = num_entries;
- handle->count = 0;
- handle->size = *data_len;
-
- /* allocate handle->abspath */
- size_t path_len = strlen(dir->nn->path);
- if(! (handle->abspath = malloc((handle->maxlen = 256) + path_len + 2)))
- {
- free(handle);
- FUNC_RETURN(ENOMEM);
- }
-
- memcpy(handle->abspath, dir->nn->path, path_len);
- handle->filename = handle->abspath + path_len;
-
- /* add a delimiting slash if there are parent directories */
- if(dir->nn->parent)
- *(handle->filename ++) = '/';
-
- handle->parent = dir->nn;
- handle->hdrpos = (struct dirent*) *data;
-
- if(FUSE_OP_HAVE22(getdir))
- FUSE_OP_CALL22(getdir, dir->nn->path, handle, get_dirents_getdir_helper);
-
- else if(fuse_ops_compat2)
- fuse_ops_compat2->getdir(dir->nn->path, handle,
- get_dirents_getdir_helper_compat);
-
- else
- assert(0);
-
- *data_len -= handle->size; /* subtract number of bytes left in the
- * buffer from the length of the buffer we
- * got. */
- *data_entries = handle->count;
-
- free(handle->abspath);
- free(handle);
-
- FUNC_EPILOGUE(0);
-}
-
-
-/* callback handler used by netfs_get_dirents to write our dirents
- * to the mmaped memory (in readdir case)
- *
- * be careful, according to fuse.h `stat' may be NULL!
- */
-static int
-get_dirents_readdir_helper(void *buf, const char *name,
- const struct stat *stat, off_t off)
-{
- fuse_dirh_t handle = buf;
- ino_t inode;
-
- if(handle->first_entry && !off)
- {
- /* skip this entry, it's before the first one
- * we got to write out ... */
- handle->first_entry --;
- return 0;
- }
-
- if(! (handle->num_entries --))
- return 1;
-
- size_t name_len = strlen(name);
- size_t dirent_len = DIRENT_LEN(name_len);
-
- if(dirent_len > handle->size)
- {
- handle->num_entries = 0; /* don't write any further data, e.g. in case */
- return ENOMEM; /* next filename's shorter */
- }
- else
- handle->size -= dirent_len;
-
- /* look the inode of this element up ... */
- if(libfuse_params.use_ino)
- {
- /* using the inode based api */
- if(! strcmp(name, "."))
- inode = fuse_get_inode(handle->parent->path);
-
- else if(handle->parent->parent && ! strcmp(name, ".."))
- inode = fuse_get_inode(handle->parent->parent->path);
-
- if(! stat)
- {
- DEBUG("critical", "use_ino flag set, but stat ptr not available.\n");
- inode = 0;
- }
-
- else
- inode = stat->st_ino;
- }
- else
- {
- /* using the old (lookup) method ... */
-
- if(! strcmp(name, "."))
- inode = handle->parent->inode;
-
- else if(handle->parent->parent && ! strcmp(name, ".."))
- inode = handle->parent->parent->inode;
-
- else
- {
- if(name_len > handle->maxlen)
- {
- /* allocated field in handle structure is to small, enlarge it */
- handle->maxlen = name_len << 1;
- void *a = realloc(handle->abspath, handle->maxlen +
- (handle->filename - handle->abspath) + 1);
- if(! a)
- return ENOMEM;
-
- handle->filename = a + (handle->filename - handle->abspath);
- handle->abspath = a;
- }
-
- strcpy(handle->filename, name);
- struct netnode *nn = fuse_make_netnode(handle->parent,
- handle->abspath);
-
- if(! nn)
- return ENOMEM;
-
- inode = nn->inode;
- }
- }
-
- /* write out struct dirent ... */
- handle->hdrpos->d_fileno = inode;
- handle->hdrpos->d_reclen = dirent_len;
- handle->hdrpos->d_type = stat ? (stat->st_mode >> 12) : 0;
- handle->hdrpos->d_namlen = name_len;
-
- /* copy file's name ... */
- memcpy(((void *) handle->hdrpos) + DIRENT_NAME_OFFS, name, name_len + 1);
-
- /* update hdrpos pointer */
- handle->hdrpos = ((void *) handle->hdrpos) + dirent_len;
-
- handle->count ++;
- return 0;
-}
-
-
-static error_t
-get_dirents_readdir(struct node *dir, int first_entry, int num_entries,
- char **data, mach_msg_type_number_t *data_len,
- int *data_entries)
-{
- error_t err;
- FUNC_PROLOGUE_NODE("get_dirents_readdir", dir);
-
- assert(FUSE_OP_HAVE22(readdir));
-
- fuse_dirh_t handle;
- if(! (handle = malloc(sizeof(struct fuse_dirhandle))))
- FUNC_RETURN(ENOMEM);
-
- handle->first_entry = first_entry;
- handle->num_entries = num_entries;
- handle->count = 0;
- handle->size = *data_len;
-
- /* allocate handle->abspath */
- size_t path_len = strlen(dir->nn->path);
- if(! (handle->abspath = malloc((handle->maxlen = 256) + path_len + 2)))
- {
- err = ENOMEM;
- goto out;
- }
-
- memcpy(handle->abspath, dir->nn->path, path_len);
- handle->filename = handle->abspath + path_len;
-
- /* add a delimiting slash if there are parent directories */
- if(dir->nn->parent)
- *(handle->filename ++) = '/';
-
- handle->parent = dir->nn;
- handle->hdrpos = (struct dirent*) *data;
-
- if(FUSE_OP_HAVE22(opendir)
- && (err = FUSE_OP_CALL22(opendir, dir->nn->path, NN_INFO(dir))))
- goto out;
-
- if((err = FUSE_OP_CALL22(readdir, dir->nn->path, handle,
- get_dirents_readdir_helper,
- first_entry, NN_INFO(dir))))
- {
- if(FUSE_OP_HAVE22(releasedir))
- FUSE_OP_CALL22(releasedir, dir->nn->path, NN_INFO(dir));
- goto out;
- }
-
- if(FUSE_OP_HAVE22(releasedir)
- && (err = FUSE_OP_CALL22(releasedir, dir->nn->path, NN_INFO(dir))))
- goto out;
-
- *data_len -= handle->size; /* subtract number of bytes left in the
- * buffer from the length of the buffer we
- * got. */
- *data_entries = handle->count;
-
- out:
- free(handle->abspath);
- free(handle);
-
- FUNC_EPILOGUE(err);
-}
-
-error_t
-netfs_get_dirents (struct iouser *cred, struct node *dir,
- int first_entry, int num_entries, char **data,
- mach_msg_type_number_t *data_len,
- vm_size_t max_data_len, int *data_entries)
-{
- (void) max_data_len; /* we live with the supplied mmap area in any case,
- * i.e. never allocate any further memory */
-
- FUNC_PROLOGUE_NODE("netfs_get_dirents", dir);
- error_t err;
-
- if((err = netfs_validate_stat(dir, cred))
- || (libfuse_params.deflt_perms
- && ((err = fshelp_access(&dir->nn_stat, S_IREAD, cred))
- || (err = fshelp_access(&dir->nn_stat, S_IEXEC, cred)))))
- goto out;
-
-
- if(FUSE_OP_HAVE22(readdir))
- err = get_dirents_readdir(dir, first_entry, num_entries, data, data_len,
- data_entries);
-
- else if(FUSE_OP_HAVE(getdir))
- err = get_dirents_getdir(dir, first_entry, num_entries, data, data_len,
- data_entries);
-
- else
- err = EOPNOTSUPP;
-
- /* TODO: fshelp_touch ATIME here */
-
- out:
- FUNC_EPILOGUE_FMT(err, "%d entries.", *data_entries);
-}
-
-
-
-/* Node NP is all done; free all its associated storage. */
-void
-netfs_node_norefs (struct node *node)
-{
- FUNC_PROLOGUE_NODE("netfs_node_norefs", node);
- assert(node);
-
- DEBUG("netnode-lock", "locking netnode, path=%s\n", node->nn->path);
- mutex_lock(&node->nn->lock);
-
- if(node->nn->anonymous && FUSE_OP_HAVE(unlink))
- {
- /* FIXME, need to lock parent directory structure */
- FUSE_OP_CALL(unlink, node->nn->path);
-
- /* FIXME, free associated netnode somehow. */
- }
-
- node->nn->node = NULL;
-
- mutex_unlock(&node->nn->lock);
- DEBUG("netnode-lock", "netnode unlocked.\n"); /* no ref to node->nn av. */
-
- FUNC_EPILOGUE_NORET();
-}
Index: src/netnode.c
===================================================================
RCS file: src/netnode.c
diff -N src/netnode.c
--- src/netnode.c 5 Aug 2006 18:53:46 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,180 +0,0 @@
-/**********************************************************
- * netnode.c
- *
- * Copyright(C) 2004,2005,2006 by Stefan Siegl <address@hidden>, Germany
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Publice License,
- * version 2 or any later. The license is contained in the COPYING
- * file that comes with the libfuse distribution.
- *
- * netnode handling
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <error.h>
-#include <string.h>
-#include <rwlock.h>
-#include <hurd/netfs.h>
-
-#include "fuse_i.h"
-#include "fuse.h"
-
-#define HASH_BUCKETS 512
-
-struct hash_element;
-static struct hash_element {
- struct netnode *nn;
- struct hash_element *next; /* singly linked list */
-} fuse_netnodes[HASH_BUCKETS] = {{ 0 }};
-
-/* rwlock needs to be held when touching either fuse_netnodes hash or
- * fuse_next_inode variable
- */
-struct rwlock fuse_netnodes_lock = RWLOCK_INITIALIZER;
-
-/* next inode number that will be assigned
- * (fuse_netnodes_lock must be write locked, when touching this)
- */
-ino_t fuse_next_inode = 1;
-
-
-
-static unsigned int
-fuse_netnode_hash_value(const char *path)
-{
- unsigned int hash = 0, a = 23, b = 251;
-
- while(*path)
- {
- hash = hash * a + *(path ++);
- a *= b;
- }
-
- return hash % HASH_BUCKETS;
-}
-
-
-
-struct netnode *
-fuse_make_netnode(struct netnode *parent, const char *path)
-{
- struct hash_element *hash_el;
- struct netnode *nn;
-
- unsigned int hash_value = fuse_netnode_hash_value(path);
- DEBUG("make_netnode", "hash for '%s' is %u\n", path, hash_value);
-
- DEBUG("netnodes_lock", "aquiring rwlock_reader_lock for %s.\n", path);
- rwlock_reader_lock(&fuse_netnodes_lock);
-
- hash_el = &fuse_netnodes[hash_value];
- if(hash_el->nn)
- do
- if(! strcmp(hash_el->nn->path, path))
- {
- nn = hash_el->nn;
- rwlock_reader_unlock(&fuse_netnodes_lock);
- DEBUG("netnodes_lock", "releasing rwlock_reader_lock.\n");
-
- return nn;
- }
- while((hash_el = hash_el->next));
-
- rwlock_reader_unlock(&fuse_netnodes_lock);
- DEBUG("netnodes_lock", "releasing rwlock_reader_lock.\n");
-
- nn = malloc(sizeof(*nn));
- if(! nn)
- return NULL; /* unfortunately we cannot serve a netnode .... */
-
- nn->path = strdup(path);
- nn->parent = parent;
- nn->node = NULL;
- mutex_init(&nn->lock);
-
- DEBUG("netnodes_lock", "aquiring rwlock_writer_lock for %s.\n", path);
- rwlock_writer_lock(&fuse_netnodes_lock);
-
- nn->inode = fuse_next_inode ++;
-
- /* unable to find hash element, need to generate a new one */
- if(! hash_el)
- hash_el = &fuse_netnodes[hash_value];
-
- if(hash_el->nn)
- {
- struct hash_element *new = malloc(sizeof(*new));
-
- if(! new) {
- rwlock_writer_unlock(&fuse_netnodes_lock);
- DEBUG("netnodes_lock", "releasing rwlock_writer_lock.\n");
- free(nn);
- return NULL; /* can't help, sorry. */
- }
-
- /* enqueue new hash_element */
- new->next = hash_el->next;
- hash_el->next = new;
-
- hash_el = new;
- }
-
- hash_el->nn = nn;
-
- rwlock_writer_unlock(&fuse_netnodes_lock);
- DEBUG("netnodes_lock", "releasing rwlock_writer_lock.\n");
- return nn;
-}
-
-
-/* scan the whole netnode hash and call fuse_ops->fsync on every node,
- * that may be out of sync
- */
-error_t
-fuse_sync_filesystem(void)
-{
- int i;
- error_t err = 0;
-
- if(! FUSE_OP_HAVE(fsync))
- return err; /* success */
-
- /* make sure, nobody tries to confuse us */
- rwlock_writer_lock(&fuse_netnodes_lock);
-
- for(i = 0; i < HASH_BUCKETS; i ++)
- {
- struct hash_element *he = &fuse_netnodes[i];
-
- if(he->nn)
- do
- {
- if(he->nn->may_need_sync)
- {
- err = -(fuse_ops_compat22 ?
- fuse_ops_compat22->fsync(he->nn->path, 0,
- &he->nn->info.compat22) :
- fuse_ops_compat2->fsync(he->nn->path, 0));
-
- if(err)
- goto out;
- else
- he->nn->may_need_sync = 0;
- }
-
- if(he->nn->node)
- DEBUG("netnode-scan", "netnode=%s has attached node\n",
- he->nn->path);
- }
- while((he = he->next));
- }
-
- out:
- rwlock_writer_unlock(&fuse_netnodes_lock);
- return err;
-}
Index: src/node.c
===================================================================
RCS file: src/node.c
diff -N src/node.c
--- src/node.c 30 Jan 2006 22:37:59 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,69 +0,0 @@
-/**********************************************************
- * node.c
- *
- * Copyright(C) 2004, 2005 by Stefan Siegl <address@hidden>, Germany
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Publice License,
- * version 2 or any later. The license is contained in the COPYING
- * file that comes with the libfuse distribution.
- *
- * create (and care for) nodes ...
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <error.h>
-#include <string.h>
-#include <hurd/netfs.h>
-
-#include "fuse_i.h"
-#include "fuse.h"
-
-/* create a new node for the specified netnode
- */
-struct node *
-fuse_make_node(struct netnode *nn)
-{
- struct node *node;
-
- DEBUG("fuse_make_node", "creating node for %s.\n", nn->path);
- DEBUG("netnode-lock", "locking netnode, path=%s\n", nn->path);
- mutex_lock(&nn->lock);
-
- if((node = nn->node))
- {
- /* there already is a node, therefore return another reference to it */
- netfs_nref(node);
- mutex_unlock(&nn->lock);
- DEBUG("netnode-lock", "UNlocking netnode, path=%s\n", nn->path);
- DEBUG("fuse_make_node", "reusing already existing node, %s\n", nn->path);
- return node;
- }
-
- if(! (node = netfs_make_node(nn)))
- {
- mutex_unlock(&nn->lock);
- DEBUG("netnode-lock", "UNlocking netnode, path=%s\n", nn->path);
- return NULL; /* doesn't look to good for us :-( */
- }
-
- /* now initialize those stats for which we are reliable ...
- */
- node->nn_stat.st_ino = nn->inode;
- node->nn_stat.st_blksize = 4096; /* depends on our host program, but since
- * we're expected to fill, assume 4k for now
- */
- node->nn_stat.st_rdev = 0;
-
- /* add pointer to our new node structure to the netnode */
- nn->node = node;
-
- mutex_unlock(&nn->lock);
- DEBUG("netnode-lock", "UNlocking netnode, path=%s\n", nn->path);
- DEBUG("fuse_make_node", "created a new node for %s.\n", nn->path);
- return node;
-}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- libfuse .cvsignore AUTHORS COPYING ChangeLog Ma...,
Thomas Schwinge <=