Showing preview only (2,222K chars total). Download the full file or copy to clipboard to get everything.
Repository: haiwen/seafile
Branch: master
Commit: 642280c1ec9e
Files: 203
Total size: 2.1 MB
Directory structure:
gitextract_gmo0gv1b/
├── .gitignore
├── .travis.yml
├── LICENSE.txt
├── Makefile.am
├── README.markdown
├── app/
│ ├── Makefile.am
│ └── seaf-cli
├── autogen.sh
├── common/
│ ├── Makefile.am
│ ├── block-backend-fs.c
│ ├── block-backend.c
│ ├── block-backend.h
│ ├── block-mgr.c
│ ├── block-mgr.h
│ ├── block.h
│ ├── branch-mgr.c
│ ├── branch-mgr.h
│ ├── cdc/
│ │ ├── Makefile.am
│ │ ├── cdc.c
│ │ ├── cdc.h
│ │ ├── rabin-checksum.c
│ │ └── rabin-checksum.h
│ ├── commit-mgr.c
│ ├── commit-mgr.h
│ ├── common.h
│ ├── curl-init.c
│ ├── curl-init.h
│ ├── diff-simple.c
│ ├── diff-simple.h
│ ├── fs-mgr.c
│ ├── fs-mgr.h
│ ├── index/
│ │ ├── Makefile.am
│ │ ├── cache-tree.c
│ │ ├── cache-tree.h
│ │ ├── hash.c
│ │ ├── hash.h
│ │ ├── index.c
│ │ ├── index.h
│ │ └── name-hash.c
│ ├── log.c
│ ├── log.h
│ ├── mq-mgr.c
│ ├── mq-mgr.h
│ ├── obj-backend-fs.c
│ ├── obj-backend.h
│ ├── obj-store.c
│ ├── obj-store.h
│ ├── password-hash.c
│ ├── password-hash.h
│ ├── rpc-service.c
│ ├── seafile-crypt.c
│ ├── seafile-crypt.h
│ ├── vc-common.c
│ └── vc-common.h
├── configure.ac
├── daemon/
│ ├── Makefile.am
│ ├── c_bpwrapper.cpp
│ ├── c_bpwrapper.h
│ ├── cevent.c
│ ├── cevent.h
│ ├── change-set.c
│ ├── change-set.h
│ ├── clone-mgr.c
│ ├── clone-mgr.h
│ ├── filelock-mgr.c
│ ├── filelock-mgr.h
│ ├── http-tx-mgr.c
│ ├── http-tx-mgr.h
│ ├── job-mgr.c
│ ├── job-mgr.h
│ ├── notif-mgr.c
│ ├── notif-mgr.h
│ ├── repo-mgr.c
│ ├── repo-mgr.h
│ ├── seaf-daemon.c
│ ├── seafile-config.c
│ ├── seafile-config.h
│ ├── seafile-error-impl.h
│ ├── seafile-error.c
│ ├── seafile-session.c
│ ├── seafile-session.h
│ ├── set-perm.c
│ ├── set-perm.h
│ ├── sync-mgr.c
│ ├── sync-mgr.h
│ ├── sync-status-tree.c
│ ├── sync-status-tree.h
│ ├── test-sync-tree.c
│ ├── timer.c
│ ├── timer.h
│ ├── vc-utils.c
│ ├── vc-utils.h
│ ├── wt-monitor-linux.c
│ ├── wt-monitor-macos.c
│ ├── wt-monitor-structs.c
│ ├── wt-monitor-structs.h
│ ├── wt-monitor-win32.c
│ ├── wt-monitor.c
│ └── wt-monitor.h
├── debian/
│ ├── README.Debian
│ ├── changelog
│ ├── compat
│ ├── control
│ ├── copyright
│ ├── dirs
│ ├── docs
│ ├── libseafile-dev.install
│ ├── libseafile0.install
│ ├── patches/
│ │ ├── fix-pkgconfig-paths.patch
│ │ └── series
│ ├── rules
│ ├── seafile-cli.install
│ ├── seafile-daemon.install
│ └── source/
│ └── format
├── dmg/
│ └── seafileLayout/
│ ├── Icons/
│ │ ├── LayoutItem.042D24CE-36D9-4328-A97F-BCF3DC524509.icns
│ │ ├── LayoutItem.209D5BB3-143C-4DB8-8FB9-F1175B8184F2.icns
│ │ ├── LayoutItem.7DCEB33C-3B26-463C-9D52-D2E99ADD0AD0.icns
│ │ ├── LayoutItem.830478CF-49D6-4772-AC6C-3A56A329536F.icns
│ │ ├── LayoutItem.CFA83A1B-E783-4354-88A9-255F0F623398.icns
│ │ └── LayoutItem.E417B39C-5B93-4D7D-AE5A-FC3B0CDFD9D7.icns
│ ├── Info.plist
│ └── Preview.icns
├── doc/
│ ├── Makefile.am
│ ├── cli-readme.txt
│ ├── seaf-cli.1
│ └── seaf-daemon.1
├── include/
│ ├── Makefile.am
│ ├── seafile-error.h
│ ├── seafile-rpc.h
│ └── seafile.h
├── integration-tests/
│ └── install-deps.sh
├── lib/
│ ├── Makefile.am
│ ├── db.c
│ ├── db.h
│ ├── include.h
│ ├── libseafile.pc.in
│ ├── net.c
│ ├── net.h
│ ├── repo.c
│ ├── repo.vala
│ ├── rpc_table.py
│ ├── seafile-object.h
│ ├── seafile-rpc-wrapper.c
│ ├── searpc-marshal.h
│ ├── searpc-signature.h
│ ├── task.c
│ ├── task.vala
│ ├── utils.c
│ └── utils.h
├── m4/
│ ├── ax_lib_sqlite3.m4
│ ├── glib-gettext.m4
│ └── python.m4
├── msi/
│ ├── Includes.wxi
│ ├── MyInstallDirDlg.wxs
│ ├── WixUI_InstallDir_NoLicense.wxs
│ ├── custom/
│ │ ├── custom.c
│ │ ├── custom.def
│ │ ├── seafile_custom.sln
│ │ ├── seafile_custom.vcxproj
│ │ └── seafile_custom.vcxproj.filters
│ ├── de_de.wxl
│ ├── en_US.wxl
│ ├── seafile.wxs
│ ├── strip-files.py
│ └── zh_CN.wxl
├── python/
│ ├── Makefile.am
│ └── seafile/
│ ├── Makefile.am
│ ├── __init__.py
│ └── rpcclient.py
├── scripts/
│ ├── breakpad.py
│ ├── build/
│ │ ├── build-cli.py
│ │ ├── build-deb.py
│ │ ├── build-mac-local-py3.py
│ │ ├── build-mac-local.py
│ │ ├── build-mac.py
│ │ ├── build-msi-vs-cn.py
│ │ ├── build-msi-vs.py
│ │ ├── build-msi.py
│ │ ├── gen-deb-src.py
│ │ ├── notarize-universal.sh
│ │ ├── notarize.sh
│ │ └── osx.entitlements
│ └── seaf-cli-wrapper.sh
├── seafile.sln
├── seafile.vcxproj
├── setupwin.py
├── tests/
│ └── sync-auto-test/
│ ├── README.md
│ ├── __init__.py
│ ├── cli1/
│ │ ├── ccnet.conf
│ │ └── mykey.peer
│ ├── cli2/
│ │ ├── ccnet.conf
│ │ └── mykey.peer
│ ├── requirements.txt
│ ├── run.sh.template
│ ├── seaf_op.py
│ ├── setting.py
│ ├── test.conf.template
│ ├── test_cases/
│ │ ├── __init__.py
│ │ ├── test_release.py
│ │ └── test_simple.py
│ └── util.py
├── updateversion.sh
└── vcpkg.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
*~
*.bak
*.o
*.exe
cscope*
*#
Makefile.in
ltmain.sh
libtool
*.lo
*.la
install-sh
depcomp
config.guess
config.h
config.log
config.status
config.sub
config.cache
configure
*/.deps
autom4te*
po/POTFILES
po/Makefile*
po/stamp-it
po/*.gmo
po/*.pot
missing
mkinstalldirs
stamp-h1
*.libs/
Makefile
aclocal.m4
*core
m4/intltool.m4
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
ccnet-*.tar.gz
config.h.in
py-compile
intltool-extract.in
intltool-merge.in
intltool-update.in
*.stamp
*.pyc
*.tmp.ui
*.defs
*.log
.deps
*.db
*.dll
*.aps
*.so
build-stamp
debian/files
debian/seafile
debian/*.substvars
lib/*.tmp
lib/dir.c
lib/dirent.c
lib/webaccess.c
lib/branch.c
lib/commit.c
lib/crypt.c
lib/copy-task.c
app/seafile
app/seafserv-tool
daemon/seaf-daemon
gui/gtk/seafile-applet
server/seaf-server
server/gc/seafserv-gc
monitor/seaf-mon
controller/seafile-controller
fileserver/fileserver
tests/common-conf.sh
tools/seaf-server-init
*.mo
seafile-web
tests/basic/conf1/c882e263e9d02c63ca6b61c68508761cbc74c358.peer
tests/basic/conf1/c882e263e9d02c63ca6b61c68508761cbc74c358.user
tests/basic/conf1/group-db/
tests/basic/conf1/peer-db/
tests/basic/conf1/user-db/
tests/basic/conf2/376cf9b6ef33a6839cf1fc096131893b5ecc673f.peer
tests/basic/conf2/376cf9b6ef33a6839cf1fc096131893b5ecc673f.user
tests/basic/conf2/group-db/
tests/basic/conf2/peer-db/
tests/basic/conf2/user-db/
tests/basic/conf3/1e5b5e0f49010b94aa6c2995a6e7b7cba462d388.peer
tests/basic/conf3/1e5b5e0f49010b94aa6c2995a6e7b7cba462d388.user
tests/basic/conf3/group-db/
tests/basic/conf3/peer-db/
tests/basic/conf3/user-db/
tests/basic/conf4/93ae3e01eea6667cbdd03c4afde413ccd9f1eb43.peer
tests/basic/conf4/93ae3e01eea6667cbdd03c4afde413ccd9f1eb43.user
tests/basic/conf4/peer-db/
tests/basic/conf4/user-db/
web/local_settings.py
gui/win/applet-po-gbk.h
*.dylib
.DS_Store
gui/mac/seafile/build/
gui/mac/seafile/ccnet
gui/mac/seafile/seaf-daemon
gui/mac/seafile/seafileweb.app
web/build/
web/dist/
tests/basic/conf2/misc/
tests/basic/conf2/seafile-data/
tests/test-cdc
tests/test-index
tests/test-seafile-fmt
*.pc
seaf-fsck
*.tar.gz
fuse/seaf-fuse
server/gc/seaf-migrate
/compile
/test-driver
*.dmp
/symbols
# visual studio
Debug
msi/custom/x64
msi/ext.wxi
msi/shell.wxs
seafile.vcxproj.user
x64
msi/custom/seafile_custom.vcxproj.user
msi/custom/.vs
================================================
FILE: .travis.yml
================================================
sudo: false
language: c
dist: Xenial
compiler: gcc
os: linux
install:
- ./integration-tests/install-deps.sh
script:
- ./autogen.sh
- ./configure
- make
================================================
FILE: LICENSE.txt
================================================
This program is released under GPLv2, with the following addition
permission to link with OpenSSL library.
If you modify this program, or any covered work, by linking or
combining it with the OpenSSL project's OpenSSL library (or a
modified version of that library), containing parts covered by the
terms of the OpenSSL or SSLeay licenses, Seafile Ltd.
grants you additional permission to convey the resulting work.
Corresponding Source for a non-source form of such a combination
shall include the source code for the parts of OpenSSL used as well
as that of the covered work.
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser 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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser General
Public License instead of this License.
================================================
FILE: Makefile.am
================================================
SUBDIRS = include lib common daemon app doc python
DIST_SUBDIRS = include lib common app daemon doc python
EXTRA_DIST = install-sh $(INTLTOOL) README.markdown scripts debian msi LICENSE.txt dmg
ACLOCAL_AMFLAGS = -I m4
dist-hook:
git log --format='%H' -1 > $(distdir)/latest_commit
================================================
FILE: README.markdown
================================================
## Introduction [](http://travis-ci.org/haiwen/seafile)
Seafile is an open source cloud storage system with privacy protection and teamwork features. Collections of files are called libraries. Each library can be synced separately. A library can also be encrypted with a user chosen password. Seafile also allows users to create groups and easily sharing files into groups.
## Feature Summary
Seafile has the following features:
### File syncing
1. Selective sync for any folder.
2. Correctly handles file conflicts based on history instead of timestamp.
3. Only transfer content delta to the server. Interrupted transfers can be resumed.
4. Sync with two or more servers.
5. Sync with existing folders.
### File sharing and collaboration
1. Sharing folders between users or into groups.
3. Download links with password protection
4. Upload links
5. Version control
### Drive client
* Access all files in the cloud via virtual drive.
* Files are synced on demand.
### Privacy protection
1. Library encryption with a user chosen password.
2. Client side encryption when using the desktop syncing.
### Online documents and knowledge management (New)
* Online Markdown editing in WYSIWYG way
* A draft review workflow for online documents
* Metadata management, including
* File labels
* Related documents
* Wiki mode
* Realtime notifications
## Source repositories for Seafile components
Each component of Seafile has its own source code repository on Github.
* Sync client daemon (this repository): https://github.com/haiwen/seafile
* Sync client GUI: https://github.com/haiwen/seafile-client
* Server core: https://github.com/haiwen/seafile-server
* Server web UI: https://github.com/haiwen/seahub
* iOS app: https://github.com/haiwen/seafile-iOS
* Android app: https://github.com/haiwen/seadroid
* WebDAV: https://github.com/haiwen/seafdav
Before version 6.0, the source code of "sync client daemon" and "server core" was mixed together in https://github.com/haiwen/seafile.
But after 6.0 version, the server core is separated into its own repository.
For this reason, the sync client daemon repository is still the "front page" for Seafile project on Github.
Build and Run
=============
See <https://manual.seafile.com/build_seafile/server>
Bug and Feature Request Reports
===============================
Please only submit bugs in GitHub issues (Pro customers should contact us via Email):
* Server, Web interface (Seahub) and desktop clients: https://github.com/haiwen/seafile/issues
* Android client: https://github.com/haiwen/seadroid/issues
* iOS client: https://github.com/haiwen/seafile-iOS/issues
Feature requests can be made and installation/usage problems can be discussed in the forum https://forum.seafile.com/.
Internationalization (I18n)
===========================
* [Translate Seafile web ui](https://github.com/haiwen/seahub/?tab=readme-ov-file#internationalization-i18n)
* [Translate Seafile desktop client](https://github.com/haiwen/seafile-client/#internationalization)
* [Translate Seafile Android app](https://github.com/haiwen/seadroid#internationalization)
* [Translate Seafile iOS app](https://github.com/haiwen/seafile-ios#internationalization-i18n)
Change Logs
===========
See <https://manual.seafile.com/changelog/server-changelog/>
Why Open Source
===============
Our primary goal is to build a first-class product. We think this goal can only be achieved by collaborating with the whole world.
Contributing
===========
For more information read [Contribution](https://manual.seafile.com/contribution/).
License
=======
- Seafile iOS client: Apache License v2
- Seafile Android client: GPLv3
- Desktop syncing client (this repository): GPLv2
- Seafile Server core: AGPLv3
- Seahub (Seafile server Web UI): Apache License v2
Contact
=======
Twitter: @seafile <https://twitter.com/seafile>
Forum: <https://forum.seafile.com>
================================================
FILE: app/Makefile.am
================================================
bin_SCRIPTS = seaf-cli
EXTRA_DIST = seaf-cli
================================================
FILE: app/seaf-cli
================================================
#!/usr/bin/env python3
#-*- coding:utf-8 -*-
# pylint: disable=E1121
'''
seaf-cli is command line interface for seafile client.
Subcommands:
init: create config files for seafile client
start: start and run seafile client as daemon
stop: stop seafile client
list: list local libraries
status: show syncing status
download: download a library from seafile server
(using libary id)
download-by-name: download a library from seafile server
(using library name)
sync: synchronize an existing folder with a library in
seafile server
desync: desynchronize a library with seafile server
create: create a new library
Detail
======
Seafile client stores all its configure information in a config dir. The default location is `~/.ccnet`. All the commands below accept an option `-c <config-dir>`.
init
----
Initialize seafile client. This command initializes the config dir. It also creates sub-directories `seafile-data` and `seafile` under `parent-dir`. `seafile-data` is used to store internal data, while `seafile` is used as the default location put downloaded libraries.
seaf-cli init [-c <config-dir>] -d <parent-dir>
start
-----
Start seafile client. This command starts `seaf-daemon`, which manages all the files.
seaf-cli start [-c <config-dir>]
stop
----
Stop seafile client.
seaf-cli stop [-c <config-dir>]
Download by id
--------
Download a library from seafile server (using library id)
seaf-cli download -l <library-id> -s <seahub-server-url> -d <parent-directory> -u <username> -p <password> [-a <2fa-code>]
Download by name
--------
Download a library from seafile server (using library name)
seaf-cli download -L <library-name> -s <seahub-server-url> -d <parent-directory> -u <username> -p <password> [-a <2fa-code>]
sync
----
Synchronize a library with an existing folder.
seaf-cli sync -l <library-id> -s <seahub-server-url> -d <existing-folder> -u <username> -p <password> [-a <2fa-code>]
desync
------
Desynchronize a library from seafile server
seaf-cli desync -d <existing-folder>
create
------
Create a new library
seaf-cli create -s <seahub-server-url> -n <library-name> -u <username> -p <password> [-a <2fa-code>] -t <description> [-e <library-password>]
'''
import argparse
import os
import json
import subprocess
import re
import sys
import time
import getpass
import random
import urllib.request, urllib.parse, urllib.error
import urllib.request, urllib.error, urllib.parse
from urllib.parse import urlparse
from os.path import abspath, dirname, exists, isdir, join
import seafile
if 'HOME' in os.environ:
DEFAULT_CONF_DIR = "%s/.ccnet" % os.environ['HOME']
DEFAULT_USER_CONF_DIR = "%s/.seafile.conf" % os.environ['HOME']
else:
DEFAULT_CONF_DIR = None
DEFAULT_USER_CONF_DIR = None
seafile_datadir = None
seafile_worktree = None
def _check_seafile():
''' Check seafile daemon have been installed '''
dirs = os.environ['PATH'].split(':')
def exist_in_path(prog):
''' Check whether 'prog' exists in system path '''
for d in dirs:
if d == '':
continue
path = join(d, prog)
if exists(path):
return True
progs = ['seaf-daemon']
for prog in progs:
if not exist_in_path(prog):
print("%s not found in PATH. Have you installed seafile?" % prog)
sys.exit(1)
def _check_daemon_running():
import fcntl
pidfile = os.path.join(seafile_datadir, 'seaf-daemon.pid')
with open(pidfile, 'w') as f:
try:
fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
fcntl.flock(f, fcntl.LOCK_UN)
except:
print("The seafile data directory %s is already used by another Seafile client instance. Please use another seafile data directory."%seafile_datadir)
sys.exit(1)
def get_rpc_client(confdir):
return seafile.RpcClient(join(seafile_datadir, 'seafile.sock'))
def _config_valid(conf):
''' Check config directory valid '''
if not exists(conf) or not isdir(conf):
print("%s not exists" % conf)
return False
seafile_ini = conf + "/seafile.ini"
if not exists(seafile_ini):
print("Could not load %s" % seafile_ini)
return False
with open(seafile_ini) as f:
for line in f:
global seafile_datadir, seafile_worktree
seafile_datadir = line.strip()
seafile_worktree = join(
dirname(seafile_datadir), "seafile")
break
if not seafile_datadir or not seafile_worktree:
print("Could not load seafile_datadir and seafile_worktree")
return False
return True
def _conf_dir(args):
''' Determine and return the value of conf_dir '''
conf_dir = DEFAULT_CONF_DIR
if args.confdir:
conf_dir = args.confdir
conf_dir = abspath(conf_dir)
if not _config_valid(conf_dir):
print("Invalid config directory")
sys.exit(1)
else:
get_device_id(conf_dir)
return conf_dir
def _user_config_valid(conf):
if exists(conf):
return True
return False
def _parse_user_config(conf):
try:
from configparser import ConfigParser
from configparser import NoOptionError
except ImportError:
from ConfigParser import ConfigParser
from ConfigParser import NoOptionError
cfg = ConfigParser()
cfg.read(conf)
if len(cfg.sections()) < 1 or cfg.sections()[0] != 'account':
return None, None
try:
server = cfg.get('account', 'server')
user = cfg.get('account', 'user')
return server,user
except NoOptionError:
return None, None
def run_argv(argv, cwd=None, env=None, suppress_stdout=False, suppress_stderr=False):
'''Run a program and wait it to finish, and return its exit code. The
standard output of this program is supressed.
'''
with open(os.devnull, 'w') as devnull:
if suppress_stdout:
stdout = devnull
else:
stdout = sys.stdout
if suppress_stderr:
stderr = devnull
else:
stderr = sys.stderr
proc = subprocess.Popen(argv,
cwd=cwd,
stdout=stdout,
stderr=stderr,
env=env)
return proc.wait()
def get_env():
env = dict(os.environ)
ld_library_path = os.environ.get('SEAFILE_LD_LIBRARY_PATH', '')
if ld_library_path:
env['LD_LIBRARY_PATH'] = ld_library_path
return env
def urlopen(url, data=None, headers=None):
if data:
data = urllib.parse.urlencode(data).encode('utf-8')
headers = headers or {}
req = urllib.request.Request(url, data=data, headers=headers)
resp = urllib.request.urlopen(req)
return resp.read()
SEAF_CLI_VERSION = ""
def randstring(size):
random.seed(time.time())
s = ''
while len(s) < size:
s += '%x' % random.randint(0, 255)
return s[:size]
device_id = None
def get_device_id(conf_dir):
global device_id
if device_id:
return device_id
idfile = join(seafile_datadir, 'id')
ccnet_conf = join(conf_dir, 'ccnet.conf')
if exists(idfile):
with open(idfile, 'r') as fp:
device_id = fp.read().strip()
return device_id
# Id file doesn't exist. We either migrate it from ccnet.conf ID
# (for existing data), or create it.
if exists(ccnet_conf):
# migrate from existing ccnet.conf ID
with open(ccnet_conf, 'r') as fp:
for line in fp:
m = re.search('ID = (.*)', line)
if m:
device_id = m.group(1)
print('Migrating device id from ccnet conf')
break
if not device_id:
# create a new id
print('New device id created')
device_id = randstring(40)
with open(idfile, 'w') as fp:
fp.write(device_id)
return device_id
def get_token(url, username, password, tfa, conf_dir):
platform = 'linux'
device_id = get_device_id(conf_dir)
device_name = 'terminal-' + os.uname()[1][:25]
client_version = SEAF_CLI_VERSION
platform_version = ''
data = {
'username': username,
'password': password,
'platform': platform,
'device_id': device_id,
'device_name': device_name,
'client_version': client_version,
'platform_version': platform_version,
}
if tfa:
headers = {
'X-SEAFILE-OTP': tfa,
}
else:
headers = None
token_json = urlopen("%s/api2/auth-token/" % url, data=data, headers=headers)
tmp = json.loads(token_json.decode('utf8'))
token = tmp['token']
return token
def get_repo_download_info(url, token):
headers = { 'Authorization': 'Token %s' % token }
repo_info = urlopen(url, headers=headers)
return json.loads(repo_info.decode('utf8'))
def get_value_from_user_config(args, section, key):
user_config = args.C
if not user_config:
user_config = DEFAULT_USER_CONF_DIR
else:
user_config = abspath(user_config)
if _user_config_valid(user_config):
try:
from configparser import ConfigParser
from configparser import NoOptionError
except ImportError:
from ConfigParser import ConfigParser
from ConfigParser import NoOptionError
cfg = ConfigParser()
cfg.read(user_config)
if len(cfg.sections()) < 1 or cfg.sections()[0] != 'account':
return None
try:
token = cfg.get(section, key)
return token
except NoOptionError:
return None
else:
return None
def get_token_from_args_or_config(args):
if args.token:
return args.token
else:
return get_value_from_user_config(args, 'account', 'token')
def seaf_init(args):
''' Initialize config directories'''
ccnet_conf_dir = DEFAULT_CONF_DIR
if args.confdir:
ccnet_conf_dir = args.confdir
if args.dir:
seafile_path = args.dir
else:
print("Must specify the parent path for put seafile-data")
sys.exit(0)
seafile_path = abspath(seafile_path)
if exists(ccnet_conf_dir):
print("%s already exists" % ccnet_conf_dir)
sys.exit(0)
os.mkdir(ccnet_conf_dir)
logsdir = join(ccnet_conf_dir, 'logs')
if not exists(logsdir):
os.mkdir(logsdir)
if not exists(seafile_path):
print("%s not exists" % seafile_path)
sys.exit(0)
seafile_ini = ccnet_conf_dir + "/seafile.ini"
seafile_data = seafile_path + "/seafile-data"
with open(seafile_ini, 'w') as fp:
fp.write(seafile_data)
if not exists(seafile_data):
os.mkdir(seafile_data)
print("Writen seafile data directory %s to %s" % (seafile_data, seafile_ini))
def seaf_start_all(args):
''' Start seafile daemon '''
seaf_start_seafile(args)
def seaf_start_seafile(args):
''' start seafile daemon '''
conf_dir = _conf_dir(args)
_check_daemon_running()
print("Starting seafile daemon ...")
cmd = [ "seaf-daemon", "--daemon", "-c", conf_dir, "-d", seafile_datadir,
"-w", seafile_worktree ]
if run_argv(cmd, env=get_env()) != 0:
print('Failed to start seafile daemon')
sys.exit(1)
seafile_rpc = get_rpc_client(conf_dir)
i = 0
while True:
try:
seafile_rpc.seafile_set_config_int("delete_confirm_threshold", 1000000)
except Exception as e:
if i > 3:
break;
i += 1
time.sleep(1)
continue
else:
break
print("Started: seafile daemon ...")
def seaf_stop(args):
'''Stop seafile daemon '''
conf_dir = _conf_dir(args)
seafile_rpc = get_rpc_client(conf_dir)
try:
# TODO: add shutdown rpc in seaf-daemon
seafile_rpc.shutdown()
except:
# ignore NetworkError("Failed to read from socket")
pass
def seaf_list(args):
'''List local libraries'''
conf_dir = _conf_dir(args)
seafile_rpc = get_rpc_client(conf_dir)
repos = seafile_rpc.get_repo_list(-1, -1)
if args.json:
repo_list = []
for repo in repos:
repo_dict = {'name':repo.name, 'id':repo.id, 'path':repo.worktree}
repo_list.append(repo_dict)
json_str = json.dumps(repo_list, ensure_ascii=False)
print(json_str)
else:
print("Name\tID\tPath")
for repo in repos:
print(repo.name, repo.id, repo.worktree)
def seaf_list_remote(args):
'''List remote libraries'''
conf_dir = _conf_dir(args)
server_from_config = get_value_from_user_config(args, 'account', 'server')
user_from_config = get_value_from_user_config(args, 'account', 'user')
url = args.server
if not url and server_from_config:
url = server_from_config
if not url:
print("Seafile server url need to be presented")
sys.exit(1)
seafile_rpc = get_rpc_client(conf_dir)
username = args.username
if not username and user_from_config:
username = user_from_config
if not username:
username = input("Enter username: ")
token = get_token_from_args_or_config(args)
password = None
tfa = args.tfa
if not token:
password = args.password
if not password:
password = getpass.getpass("Enter password for user %s : " % username)
# curl -d 'username=<USERNAME>&password=<PASSWORD>' http://127.0.0.1:8000/api2/auth-token
token = get_token(url, username, password, tfa, conf_dir)
repos = get_repo_download_info("%s/api2/repos/" % (url), token)
printed = {}
if args.json:
repo_list = []
for repo in repos:
if repo['id'] in printed:
continue
printed[repo['id']] = repo['id']
repo_dict = {'name': repo['name'], 'id':repo['id']}
repo_list.append(repo_dict)
json_str = json.dumps(repo_list, ensure_ascii=False)
print(json_str)
else:
print("Name\tID")
for repo in repos:
if repo['id'] in printed:
continue
printed[repo['id']] = repo['id']
print(repo['name'], repo['id'])
def get_base_url(url):
parse_result = urlparse(url)
scheme = parse_result.scheme
netloc = parse_result.netloc
if scheme and netloc:
return '%s://%s' % (scheme, netloc)
return None
def seaf_download(args):
'''Download a library from seafile server '''
conf_dir = _conf_dir(args)
repo = args.library
if not repo:
print("Library id is required")
sys.exit(1)
server_from_config = get_value_from_user_config(args, 'account', 'server')
user_from_config = get_value_from_user_config(args, 'account', 'user')
url = args.server
if not url and server_from_config:
url = server_from_config
if not url:
print("Seafile server url need to be presented")
sys.exit(1)
download_dir = seafile_worktree
if args.dir:
download_dir = abspath(args.dir)
seafile_rpc = get_rpc_client(conf_dir)
username = args.username
if not username and user_from_config:
username = user_from_config
if not username:
username = input("Enter username: ")
token = get_token_from_args_or_config(args)
password = None
tfa = args.tfa
if not token:
password = args.password
if not password:
password = getpass.getpass("Enter password for user %s : " % username)
# curl -d 'username=<USERNAME>&password=<PASSWORD>' http://127.0.0.1:8000/api2/auth-token
token = get_token(url, username, password, tfa, conf_dir)
tmp = get_repo_download_info("%s/api2/repos/%s/download-info/" % (url, repo), token)
encrypted = tmp['encrypted']
magic = tmp.get('magic', None)
enc_version = tmp.get('enc_version', None)
random_key = tmp.get('random_key', None)
clone_token = tmp['token']
email = tmp['email']
repo_name = tmp['repo_name']
version = tmp.get('repo_version', 0)
repo_salt = tmp.get('salt', None)
permission = tmp.get('permission', None)
is_readonly = 0
if permission == 'r':
is_readonly = 1
more_info = None
more_info_dict = {}
base_url = get_base_url(url)
if base_url:
more_info_dict.update({'server_url': base_url})
if repo_salt:
more_info_dict.update({'repo_salt': repo_salt})
more_info_dict.update({'is_readonly': is_readonly})
more_info = json.dumps(more_info_dict)
print("Starting to download ...")
print("Library %s will be downloaded to %s" % (repo, download_dir))
if encrypted == 1:
repo_passwd = args.libpasswd if args.libpasswd else getpass.getpass("Enter password for the library: ")
else:
repo_passwd = None
seafile_rpc.download(repo,
version,
repo_name,
download_dir,
clone_token,
repo_passwd, magic,
email, random_key, enc_version, more_info)
def seaf_download_by_name(args):
'''Download a library defined by name from seafile server'''
id = None
conf_dir = _conf_dir(args)
libraryname = args.libraryname
if not libraryname:
print("Library name is required")
sys.exit(1)
server_from_config = get_value_from_user_config(args, 'account', 'server')
user_from_config = get_value_from_user_config(args, 'account', 'user')
url = args.server
if not url and server_from_config:
url = server_from_config
if not url:
print("Seafile server url need to be presented")
sys.exit(1)
seafile_rpc = get_rpc_client(conf_dir)
username = args.username
if not username and user_from_config:
username = user_from_config;
if not username:
username = input("Enter username: ")
args.username = username
token = get_token_from_args_or_config(args)
password = None
tfa = args.tfa
if not token:
password = args.password
if not password:
password = getpass.getpass("Enter password for user %s : " % username)
args.password = password
# curl -d 'username=<USERNAME>&password=<PASSWORD>' http://127.0.0.1:8000/api2/auth-token
token = get_token(url, username, password, tfa, conf_dir)
tmp = get_repo_download_info("%s/api2/repos/" % (url), token)
for i in tmp:
if libraryname == i['name']:
id = i['id']
if not id:
print("Defined library name not found")
sys.exit(1)
args.library = id
seaf_download(args)
def seaf_sync(args):
''' synchronize a library from seafile server '''
conf_dir = _conf_dir(args)
repo = args.library
if not repo:
print("Library id is required")
sys.exit(1)
server_from_config = get_value_from_user_config(args, 'account', 'server')
user_from_config = get_value_from_user_config(args, 'account', 'user')
url = args.server
if not url and server_from_config:
url = server_from_config
if not url:
print("Seafile server url is required")
sys.exit(1)
folder = args.folder
if not folder:
print("The local directory is required")
sys.exit(1)
folder = abspath(folder)
if not exists(folder):
print("The local directory does not exists")
sys.exit(1)
seafile_rpc = get_rpc_client(conf_dir)
username = args.username
if not username and user_from_config:
username = user_from_config;
if not username:
username = input("Enter username: ")
password = None
token = get_token_from_args_or_config(args)
tfa = args.tfa
if not token:
password = args.password
if not password:
password = getpass.getpass("Enter password for user %s : " % username)
token = get_token(url, username, password, tfa, conf_dir)
tmp = get_repo_download_info("%s/api2/repos/%s/download-info/" % (url, repo), token)
encrypted = tmp['encrypted']
magic = tmp.get('magic', None)
enc_version = tmp.get('enc_version', None)
random_key = tmp.get('random_key', None)
clone_token = tmp['token']
email = tmp['email']
repo_name = tmp['repo_name']
version = tmp.get('repo_version', 0)
repo_salt = tmp.get('salt', None)
permission = tmp.get('permission', None)
is_readonly = 0
if permission == 'r':
is_readonly = 1
more_info = None
more_info_dict = {}
base_url = get_base_url(url)
if base_url:
more_info_dict.update({'server_url': base_url})
if repo_salt:
more_info_dict.update({'repo_salt': repo_salt})
more_info_dict.update({'is_readonly': is_readonly})
more_info = json.dumps(more_info_dict)
print("Starting to download ...")
if encrypted == 1:
repo_passwd = args.libpasswd if args.libpasswd else getpass.getpass("Enter password for the library: ")
else:
repo_passwd = None
seafile_rpc.clone(repo,
version,
repo_name,
folder,
clone_token,
repo_passwd, magic,
email, random_key, enc_version, more_info)
def seaf_desync(args):
'''Desynchronize a library from seafile server'''
conf_dir = _conf_dir(args)
repo_path = args.folder
if not repo_path:
print("Must specify the local path of the library")
sys.exit(1)
repo_path = abspath(repo_path)
seafile_rpc = get_rpc_client(conf_dir)
repos = seafile_rpc.get_repo_list(-1, -1)
repo = None
for r in repos:
if r.worktree == repo_path:
repo = r
break
if repo is not None:
if sys.version_info[0] == 2:
repo.name = repo.name.encode('utf8')
print("Desynchronize %s" % repo.name)
seafile_rpc.remove_repo(repo.id)
else:
print("%s is not a library" % args.folder)
def seaf_config(args):
'''Configure the seafile client'''
conf_dir = _conf_dir(args)
config_key = args.key
if not config_key:
print("Must specify configuration key")
sys.exit(1)
config_value = args.value
seafile_rpc = get_rpc_client(conf_dir)
if config_value:
# set configuration key
seafile_rpc.seafile_set_config(config_key, config_value)
else:
# print configuration key
val = seafile_rpc.seafile_get_config(config_key)
print("%s = %s" % (config_key, val))
def seaf_status(args):
'''Show status'''
conf_dir = _conf_dir(args)
seafile_rpc = get_rpc_client(conf_dir)
tasks = seafile_rpc.get_clone_tasks()
print('# {:<50s}\t{:<20s}\t{:<20s}'.format('Name', 'Status', 'Progress'))
for task in tasks:
if sys.version_info[0] == 2:
task.repo_name = task.repo_name.encode('utf8')
if task.state == "fetch":
tx_task = seafile_rpc.find_transfer_task(task.repo_id)
try:
print('{:<50s}\t{:<20s}\t{:<.1f}%, {:<.1f}KB/s'.format(task.repo_name, 'downloading',
tx_task.block_done / tx_task.block_total * 100,
tx_task.rate / 1024.0))
except ZeroDivisionError: pass
elif task.state == "error":
err = seafile_rpc.sync_error_id_to_str(task.error)
print('{:<50s}\t{:<20s}\t{:<20s}'.format(task.repo_name, 'error', err))
elif task.state == 'done':
# will be shown in repo status
pass
else:
print('{:<50s}\t{:<20s}'.format(task.repo_name, task.state))
repos = seafile_rpc.get_repo_list(-1, -1)
for repo in repos:
auto_sync_enabled = seafile_rpc.is_auto_sync_enabled()
if not auto_sync_enabled or not repo.auto_sync:
print('{:<50s}\t{:<20s}'.format(repo.name, 'auto sync disabled'))
continue
task = seafile_rpc.get_repo_sync_task(repo.id)
if task is None:
print('{:<50s}\t{:<20s}'.format(repo.name, 'waiting for sync'))
elif task.state == 'uploading':
tx_task = seafile_rpc.find_transfer_task(repo.id)
try:
print('{:<50s}\t{:<20s}\t{:<.1f}%, {:<.1f}KB/s'.format(repo.name, 'uploading',
tx_task.block_done / tx_task.block_total * 100,
tx_task.rate / 1024.0))
except ZeroDivisionError: pass
elif task.state == 'downloading':
tx_task = seafile_rpc.find_transfer_task(repo.id)
try:
if tx_task.rt_state == 'data':
print('{:<50s}\t{:<20s}\t{:<.1f}%, {:<.1f}KB/s'.format(repo.name, 'downloading files',
tx_task.block_done / tx_task.block_total * 100,
tx_task.rate / 1024.0))
if tx_task.rt_state == 'fs':
print('{:<50s}\t{:<20s}\t{:<.1f}%'.format(repo.name, 'downloading file list',
tx_task.fs_objects_done / tx_task.fs_objects_total * 100))
except ZeroDivisionError: pass
elif task.state == 'error':
err = seafile_rpc.sync_error_id_to_str(task.error)
print('{:<50s}\t{:<20s}\t{:<20s}'.format(repo.name, 'error', err))
else:
print('{:<50s}\t{:<20s}'.format(repo.name, task.state))
def create_repo(url, token, args):
headers = { 'Authorization': 'Token %s' % token }
data = {
'name': args.name,
'desc': args.desc,
}
if args.libpasswd:
data['passwd'] = args.libpasswd
repo_info_json = urlopen(url, data=data, headers=headers)
repo_info = json.loads(repo_info_json.decode('utf8'))
return repo_info['repo_id']
def seaf_create(args):
'''Create a library'''
conf_dir = _conf_dir(args)
server_from_config = get_value_from_user_config(args, 'account', 'server')
user_from_config = get_value_from_user_config(args, 'account', 'user')
# check username and password
username = args.username
if not username and user_from_config:
username = user_from_config;
if not username:
username = input("Enter username: ")
url = args.server
if not url and server_from_config:
url = server_from_config
if not url:
print("Seafile server url need to be presented")
sys.exit(1)
token = get_token_from_args_or_config(args)
password = None
tfa = args.tfa
if not token:
password = args.password
if not password:
password = getpass.getpass("Enter password for user %s " % username)
# curl -d 'username=<USERNAME>&password=<PASSWORD>' http://127.0.0.1:8000/api2/auth-token
token = get_token(url, username, password, tfa, conf_dir)
repo_id = create_repo("%s/api2/repos/" % (url), token, args)
print(repo_id)
def main():
''' Main entry '''
_check_seafile()
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(title='subcommands', description='')
confdir_required = DEFAULT_CONF_DIR is None
# init
parser_init = subparsers.add_parser('init', help='Initialize config directory')
parser_init.set_defaults(func=seaf_init)
parser_init.add_argument('-c', '--confdir', help='the config directory', type=str, required=confdir_required)
parser_init.add_argument('-d', '--dir', help='the parent directory to put seafile-data', type=str)
# start
parser_start = subparsers.add_parser('start',
help='Start seafile daemon')
parser_start.set_defaults(func=seaf_start_all)
parser_start.add_argument('-c', '--confdir', help='the config directory', type=str, required=confdir_required)
# stop
parser_stop = subparsers.add_parser('stop',
help='Stop seafile daemon')
parser_stop.set_defaults(func=seaf_stop)
parser_stop.add_argument('-c', '--confdir', help='the config directory', type=str, required=confdir_required)
# list
parser_list = subparsers.add_parser('list', help='List local libraries')
parser_list.set_defaults(func=seaf_list)
parser_list.add_argument('-c', '--confdir', help='the config directory', type=str, required=confdir_required)
parser_list.add_argument('--json', help='output json format result', action='store_true')
# list-remote
parser_download = subparsers.add_parser('list-remote', help='List remote libraries')
parser_download.set_defaults(func=seaf_list_remote)
parser_download.add_argument('-c', '--confdir', help='the config directory', type=str, required=confdir_required)
parser_download.add_argument('-C', help='the user config directory', type=str)
parser_download.add_argument('-s', '--server', help='URL for seafile server', type=str)
parser_download.add_argument('-u', '--username', help='username', type=str)
parser_download.add_argument('-p', '--password', help='password', type=str)
parser_download.add_argument('-T', '--token', help='token', type=str)
parser_download.add_argument('-a', '--tfa', help='two-factor authentication', type=str)
parser_download.add_argument('--json', help='output json format result', action='store_true')
# status
parser_status = subparsers.add_parser('status', help='Show syncing status')
parser_status.set_defaults(func=seaf_status)
parser_status.add_argument('-c', '--confdir', help='the config directory', type=str, required=confdir_required)
# download
parser_download = subparsers.add_parser('download',
help='Download a library from seafile server')
parser_download.set_defaults(func=seaf_download)
parser_download.add_argument('-c', '--confdir', help='the config directory', type=str, required=confdir_required)
parser_download.add_argument('-C', help='the user config directory', type=str)
parser_download.add_argument('-l', '--library', help='library id', type=str)
parser_download.add_argument('-s', '--server', help='URL for seafile server', type=str)
parser_download.add_argument('-d', '--dir', help='the directory to put the library', type=str)
parser_download.add_argument('-u', '--username', help='username', type=str)
parser_download.add_argument('-p', '--password', help='password', type=str)
parser_download.add_argument('-T', '--token', help='token', type=str)
parser_download.add_argument('-a', '--tfa', help='two-factor authentication', type=str)
parser_download.add_argument('-e', '--libpasswd', help='library password', type=str)
# download-by-name
parser_download = subparsers.add_parser('download-by-name',
help='Download a library defined by name from seafile server')
parser_download.set_defaults(func=seaf_download_by_name)
parser_download.add_argument('-c', '--confdir', help='the config directory', type=str, required=confdir_required)
parser_download.add_argument('-C', help='the user config directory', type=str)
parser_download.add_argument('-L', '--libraryname', help='library name', type=str)
parser_download.add_argument('-s', '--server', help='URL for seafile server', type=str)
parser_download.add_argument('-d', '--dir', help='the directory to put the library', type=str)
parser_download.add_argument('-u', '--username', help='username', type=str)
parser_download.add_argument('-p', '--password', help='password', type=str)
parser_download.add_argument('-T', '--token', help='token', type=str)
parser_download.add_argument('-a', '--tfa', help='two-factor authentication', type=str)
parser_download.add_argument('-e', '--libpasswd', help='library password', type=str)
# sync
parser_sync = subparsers.add_parser('sync',
help='Sync a library with an existing foler')
parser_sync.set_defaults(func=seaf_sync)
parser_sync.add_argument('-c', '--confdir', help='the config directory', type=str, required=confdir_required)
parser_sync.add_argument('-C', help='the user config directory', type=str)
parser_sync.add_argument('-l', '--library', help='library id', type=str)
parser_sync.add_argument('-s', '--server', help='URL for seafile server', type=str)
parser_sync.add_argument('-u', '--username', help='username', type=str)
parser_sync.add_argument('-p', '--password', help='password', type=str)
parser_sync.add_argument('-T', '--token', help='token', type=str)
parser_sync.add_argument('-a', '--tfa', help='two-factor authentication', type=str)
parser_sync.add_argument('-d', '--folder', help='the existing local folder', type=str)
parser_sync.add_argument('-e', '--libpasswd', help='library password', type=str)
# desync
parser_desync = subparsers.add_parser('desync',
help='Desync a library with seafile server')
parser_desync.set_defaults(func=seaf_desync)
parser_desync.add_argument('-c', '--confdir', help='the config directory', type=str, required=confdir_required)
parser_desync.add_argument('-d', '--folder', help='the local folder', type=str)
# create
parser_create = subparsers.add_parser('create',
help='Create a library')
parser_create.set_defaults(func=seaf_create)
parser_create.add_argument('-n', '--name', help='library name', type=str)
parser_create.add_argument('-t', '--desc', help='library description', type=str)
parser_create.add_argument('-e', '--libpasswd', help='library password', type=str)
parser_create.add_argument('-s', '--server', help='URL for seafile server', type=str)
parser_create.add_argument('-u', '--username', help='username', type=str)
parser_create.add_argument('-p', '--password', help='password', type=str)
parser_create.add_argument('-T', '--token', help='token', type=str)
parser_create.add_argument('-a', '--tfa', help='two-factor authentication', type=str)
parser_create.add_argument('-c', '--confdir', help='the config directory', type=str, required=confdir_required)
parser_create.add_argument('-C', help='the user config directory', type=str)
# config
parser_config = subparsers.add_parser('config',
help='Configure seafile client')
parser_config.set_defaults(func=seaf_config)
parser_config.add_argument('-c', '--confdir', help='the config directory', type=str, required=confdir_required)
parser_config.add_argument('-k', '--key', help='configuration key', type=str)
parser_config.add_argument('-v', '--value', help='configuration value (if provided, key is set to this value)', type=str, required=False)
if len(sys.argv) == 1:
print(parser.format_help())
return
args = parser.parse_args()
args.func(args)
if __name__ == '__main__':
main()
# print('device id is {}'.format(get_device_id(DEFAULT_CONF_DIR)))
================================================
FILE: autogen.sh
================================================
#!/bin/bash
# Run this to generate all the initial makefiles, etc.
: ${AUTOCONF=autoconf}
: ${AUTOHEADER=autoheader}
: ${AUTOMAKE=automake}
: ${ACLOCAL=aclocal}
if test "$(uname)" != "Darwin"; then
: ${LIBTOOLIZE=libtoolize}
else
: ${LIBTOOLIZE=glibtoolize}
fi
: ${INTLTOOLIZE=intltoolize}
: ${LIBTOOL=libtool}
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
ORIGDIR=`pwd`
cd $srcdir
PROJECT=ccnet
TEST_TYPE=-f
FILE=net/main.c
CONFIGURE=configure.ac
DIE=0
($AUTOCONF --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile $PROJECT."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
(grep "^AC_PROG_INTLTOOL" $srcdir/$CONFIGURE >/dev/null) && {
($INTLTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have \`intltoolize' installed to compile $PROJECT."
echo "Get ftp://ftp.gnome.org/pub/GNOME/stable/sources/intltool/intltool-0.22.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
}
($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have automake installed to compile $PROJECT."
echo "Get ftp://sourceware.cygnus.com/pub/automake/automake-1.7.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
if test "$(uname)" != "Darwin"; then
(grep "^AC_PROG_LIBTOOL" $CONFIGURE >/dev/null) && {
($LIBTOOL --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`libtool' installed to compile $PROJECT."
echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.4.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
}
fi
if grep "^AM_[A-Z0-9_]\{1,\}_GETTEXT" "$CONFIGURE" >/dev/null; then
if grep "sed.*POTFILES" "$CONFIGURE" >/dev/null; then
GETTEXTIZE=""
else
if grep "^AM_GLIB_GNU_GETTEXT" "$CONFIGURE" >/dev/null; then
GETTEXTIZE="glib-gettextize"
GETTEXTIZE_URL="ftp://ftp.gtk.org/pub/gtk/v2.0/glib-2.0.0.tar.gz"
else
GETTEXTIZE="gettextize"
GETTEXTIZE_URL="ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
fi
$GETTEXTIZE --version < /dev/null > /dev/null 2>&1
if test $? -ne 0; then
echo
echo "**Error**: You must have \`$GETTEXTIZE' installed to compile $PKG_NAME."
echo "Get $GETTEXTIZE_URL"
echo "(or a newer version if it is available)"
DIE=1
fi
fi
fi
if test "$DIE" -eq 1; then
exit 1
fi
dr=`dirname .`
echo processing $dr
aclocalinclude="$aclocalinclude -I m4"
if test x"$MSYSTEM" = x"MINGW32"; then
aclocalinclude="$aclocalinclude -I /mingw32/share/aclocal"
elif test "$(uname)" = "Darwin"; then
aclocalinclude="$aclocalinclude -I /opt/local/share/aclocal"
fi
echo "Creating $dr/aclocal.m4 ..."
test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
echo "Running glib-gettextize... Ignore non-fatal messages."
echo "no" | glib-gettextize --force --copy
echo "Making $dr/aclocal.m4 writable ..."
test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
echo "Running intltoolize..."
intltoolize --copy --force --automake
echo "Running $LIBTOOLIZE..."
$LIBTOOLIZE --force --copy
echo "Running $ACLOCAL $aclocalinclude ..."
$ACLOCAL $aclocalinclude
echo "Running $AUTOHEADER..."
$AUTOHEADER
echo "Running $AUTOMAKE --gnu $am_opt ..."
$AUTOMAKE --add-missing --gnu $am_opt
echo "Running $AUTOCONF ..."
$AUTOCONF
================================================
FILE: common/Makefile.am
================================================
SUBDIRS = cdc index
noinst_HEADERS = \
diff-simple.h \
seafile-crypt.h \
common.h \
branch-mgr.h \
fs-mgr.h \
block-mgr.h \
commit-mgr.h \
log.h \
vc-common.h \
obj-store.h \
obj-backend.h \
block-backend.h \
block.h \
mq-mgr.h \
curl-init.h
================================================
FILE: common/block-backend-fs.c
================================================
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x500
#endif
#include "common.h"
#include "utils.h"
#include "log.h"
#include <sys/stat.h>
#include <fcntl.h>
#ifndef WIN32
#include <dirent.h>
#endif
#include "block-backend.h"
#include "obj-store.h"
struct _BHandle {
char *store_id;
int version;
char block_id[41];
int fd;
int rw_type;
char *tmp_file;
};
typedef struct {
char *v0_block_dir;
int v0_block_dir_len;
char *block_dir;
int block_dir_len;
char *tmp_dir;
int tmp_dir_len;
} FsPriv;
static char *
get_block_path (BlockBackend *bend,
const char *block_sha1,
char path[],
const char *store_id,
int version);
static int
open_tmp_file (BlockBackend *bend,
const char *basename,
char **path);
static BHandle *
block_backend_fs_open_block (BlockBackend *bend,
const char *store_id,
int version,
const char *block_id,
int rw_type)
{
BHandle *handle;
int fd = -1;
char *tmp_file;
g_return_val_if_fail (block_id != NULL, NULL);
g_return_val_if_fail (strlen(block_id) == 40, NULL);
g_return_val_if_fail (rw_type == BLOCK_READ || rw_type == BLOCK_WRITE, NULL);
if (rw_type == BLOCK_READ) {
char path[SEAF_PATH_MAX];
get_block_path (bend, block_id, path, store_id, version);
fd = g_open (path, O_RDONLY | O_BINARY, 0);
if (fd < 0) {
ccnet_warning ("[block bend] failed to open block %s for read: %s\n",
block_id, strerror(errno));
return NULL;
}
} else {
fd = open_tmp_file (bend, block_id, &tmp_file);
if (fd < 0) {
ccnet_warning ("[block bend] failed to open block %s for write: %s\n",
block_id, strerror(errno));
return NULL;
}
}
handle = g_new0(BHandle, 1);
handle->fd = fd;
memcpy (handle->block_id, block_id, 41);
handle->rw_type = rw_type;
if (rw_type == BLOCK_WRITE)
handle->tmp_file = tmp_file;
if (store_id)
handle->store_id = g_strdup(store_id);
handle->version = version;
return handle;
}
static int
block_backend_fs_read_block (BlockBackend *bend,
BHandle *handle,
void *buf, int len)
{
return (readn (handle->fd, buf, len));
}
static int
block_backend_fs_write_block (BlockBackend *bend,
BHandle *handle,
const void *buf, int len)
{
return (writen (handle->fd, buf, len));
}
static int
block_backend_fs_close_block (BlockBackend *bend,
BHandle *handle)
{
int ret;
ret = close (handle->fd);
return ret;
}
static void
block_backend_fs_block_handle_free (BlockBackend *bend,
BHandle *handle)
{
if (handle->rw_type == BLOCK_WRITE) {
/* make sure the tmp file is removed even on failure. */
g_unlink (handle->tmp_file);
g_free (handle->tmp_file);
}
g_free (handle->store_id);
g_free (handle);
}
static int
create_parent_path (const char *path)
{
char *dir = g_path_get_dirname (path);
if (!dir)
return -1;
if (g_file_test (dir, G_FILE_TEST_EXISTS)) {
g_free (dir);
return 0;
}
if (checkdir_with_mkdir (dir) < 0) {
seaf_warning ("Failed to create object parent path: %s.\n", dir);
g_free (dir);
return -1;
}
g_free (dir);
return 0;
}
static int
block_backend_fs_commit_block (BlockBackend *bend,
BHandle *handle)
{
char path[SEAF_PATH_MAX];
g_return_val_if_fail (handle->rw_type == BLOCK_WRITE, -1);
get_block_path (bend, handle->block_id, path, handle->store_id, handle->version);
if (create_parent_path (path) < 0) {
seaf_warning ("Failed to create path for block %s:%s.\n",
handle->store_id, handle->block_id);
return -1;
}
if (g_rename (handle->tmp_file, path) < 0) {
seaf_warning ("[block bend] failed to commit block %s:%s: %s\n",
handle->store_id, handle->block_id, strerror(errno));
return -1;
}
return 0;
}
static gboolean
block_backend_fs_block_exists (BlockBackend *bend,
const char *store_id,
int version,
const char *block_sha1)
{
char block_path[SEAF_PATH_MAX];
get_block_path (bend, block_sha1, block_path, store_id, version);
if (g_access (block_path, F_OK) == 0)
return TRUE;
else
return FALSE;
}
static int
block_backend_fs_remove_block (BlockBackend *bend,
const char *store_id,
int version,
const char *block_id)
{
char path[SEAF_PATH_MAX];
get_block_path (bend, block_id, path, store_id, version);
return g_unlink (path);
}
static BMetadata *
block_backend_fs_stat_block (BlockBackend *bend,
const char *store_id,
int version,
const char *block_id)
{
char path[SEAF_PATH_MAX];
SeafStat st;
BMetadata *block_md;
get_block_path (bend, block_id, path, store_id, version);
if (seaf_stat (path, &st) < 0) {
seaf_warning ("[block bend] Failed to stat block %s:%s at %s: %s.\n",
store_id, block_id, path, strerror(errno));
return NULL;
}
block_md = g_new0(BMetadata, 1);
memcpy (block_md->id, block_id, 40);
block_md->size = (uint32_t) st.st_size;
return block_md;
}
static BMetadata *
block_backend_fs_stat_block_by_handle (BlockBackend *bend,
BHandle *handle)
{
SeafStat st;
BMetadata *block_md;
if (seaf_fstat (handle->fd, &st) < 0) {
seaf_warning ("[block bend] Failed to stat block %s:%s.\n",
handle->store_id, handle->block_id);
return NULL;
}
block_md = g_new0(BMetadata, 1);
memcpy (block_md->id, handle->block_id, 40);
block_md->size = (uint32_t) st.st_size;
return block_md;
}
static int
block_backend_fs_foreach_block (BlockBackend *bend,
const char *store_id,
int version,
SeafBlockFunc process,
void *user_data)
{
FsPriv *priv = bend->be_priv;
char *block_dir = NULL;
int dir_len;
GDir *dir1 = NULL, *dir2;
const char *dname1, *dname2;
char block_id[128];
char path[SEAF_PATH_MAX], *pos;
int ret = 0;
#if defined MIGRATION
if (version > 0)
block_dir = g_build_filename (priv->block_dir, store_id, NULL);
else
block_dir = g_strdup(priv->v0_block_dir);
#else
block_dir = g_build_filename (priv->block_dir, store_id, NULL);
#endif
dir_len = strlen (block_dir);
dir1 = g_dir_open (block_dir, 0, NULL);
if (!dir1) {
goto out;
}
memcpy (path, block_dir, dir_len);
pos = path + dir_len;
while ((dname1 = g_dir_read_name(dir1)) != NULL) {
snprintf (pos, sizeof(path) - dir_len, "/%s", dname1);
dir2 = g_dir_open (path, 0, NULL);
if (!dir2) {
seaf_warning ("Failed to open block dir %s.\n", path);
continue;
}
while ((dname2 = g_dir_read_name(dir2)) != NULL) {
snprintf (block_id, sizeof(block_id), "%s%s", dname1, dname2);
if (!process (store_id, version, block_id, user_data)) {
g_dir_close (dir2);
goto out;
}
}
g_dir_close (dir2);
}
out:
if (dir1)
g_dir_close (dir1);
g_free (block_dir);
return ret;
}
static int
block_backend_fs_copy (BlockBackend *bend,
const char *src_store_id,
int src_version,
const char *dst_store_id,
int dst_version,
const char *block_id)
{
char src_path[SEAF_PATH_MAX];
char dst_path[SEAF_PATH_MAX];
get_block_path (bend, block_id, src_path, src_store_id, src_version);
get_block_path (bend, block_id, dst_path, dst_store_id, dst_version);
if (g_file_test (dst_path, G_FILE_TEST_EXISTS))
return 0;
if (create_parent_path (dst_path) < 0) {
seaf_warning ("Failed to create dst path %s for block %s.\n",
dst_path, block_id);
return -1;
}
#ifdef WIN32
if (!CreateHardLinkA (dst_path, src_path, NULL)) {
seaf_warning ("Failed to link %s to %s: %lu.\n",
src_path, dst_path, GetLastError());
return -1;
}
return 0;
#else
int ret = link (src_path, dst_path);
if (ret < 0 && errno != EEXIST) {
seaf_warning ("Failed to link %s to %s: %s.\n",
src_path, dst_path, strerror(errno));
return -1;
}
return ret;
#endif
}
static int
block_backend_fs_remove_store (BlockBackend *bend, const char *store_id)
{
FsPriv *priv = bend->be_priv;
char *block_dir = NULL;
GDir *dir1, *dir2;
const char *dname1, *dname2;
char *path1, *path2;
block_dir = g_build_filename (priv->block_dir, store_id, NULL);
dir1 = g_dir_open (block_dir, 0, NULL);
if (!dir1) {
g_free (block_dir);
return 0;
}
while ((dname1 = g_dir_read_name(dir1)) != NULL) {
path1 = g_build_filename (block_dir, dname1, NULL);
dir2 = g_dir_open (path1, 0, NULL);
if (!dir2) {
seaf_warning ("Failed to open block dir %s.\n", path1);
g_dir_close (dir1);
g_free (path1);
g_free (block_dir);
return -1;
}
while ((dname2 = g_dir_read_name(dir2)) != NULL) {
path2 = g_build_filename (path1, dname2, NULL);
g_unlink (path2);
g_free (path2);
}
g_dir_close (dir2);
g_rmdir (path1);
g_free (path1);
}
g_dir_close (dir1);
g_rmdir (block_dir);
g_free (block_dir);
return 0;
}
static int
block_backend_fs_rewind_block (BlockBackend *bend,
BHandle *handle)
{
return seaf_util_lseek (handle->fd, 0, SEEK_SET);
}
static char *
get_block_path (BlockBackend *bend,
const char *block_sha1,
char path[],
const char *store_id,
int version)
{
FsPriv *priv = bend->be_priv;
char *pos = path;
int n;
#if defined MIGRATION
if (version > 0) {
n = snprintf (path, SEAF_PATH_MAX, "%s/%s/", priv->block_dir, store_id);
pos += n;
} else {
memcpy (pos, priv->v0_block_dir, priv->v0_block_dir_len);
pos[priv->v0_block_dir_len] = '/';
pos += priv->v0_block_dir_len + 1;
}
#else
n = snprintf (path, SEAF_PATH_MAX, "%s/%s/", priv->block_dir, store_id);
pos += n;
#endif
memcpy (pos, block_sha1, 2);
pos[2] = '/';
pos += 3;
memcpy (pos, block_sha1 + 2, 41 - 2);
return path;
}
static int
open_tmp_file (BlockBackend *bend,
const char *basename,
char **path)
{
FsPriv *priv = bend->be_priv;
int fd;
*path = g_strdup_printf ("%s/%s.XXXXXX", priv->tmp_dir, basename);
fd = g_mkstemp (*path);
if (fd < 0)
g_free (*path);
return fd;
}
BlockBackend *
block_backend_fs_new (const char *seaf_dir, const char *tmp_dir)
{
BlockBackend *bend;
FsPriv *priv;
bend = g_new0(BlockBackend, 1);
priv = g_new0(FsPriv, 1);
bend->be_priv = priv;
priv->v0_block_dir = g_build_filename (seaf_dir, "blocks", NULL);
priv->v0_block_dir_len = strlen(priv->v0_block_dir);
priv->block_dir = g_build_filename (seaf_dir, "storage", "blocks", NULL);
priv->block_dir_len = strlen (priv->block_dir);
priv->tmp_dir = g_strdup (tmp_dir);
priv->tmp_dir_len = strlen (tmp_dir);
if (checkdir_with_mkdir (priv->block_dir) < 0) {
seaf_warning ("Block dir %s does not exist and"
" is unable to create\n", priv->block_dir);
goto onerror;
}
if (checkdir_with_mkdir (tmp_dir) < 0) {
seaf_warning ("Blocks tmp dir %s does not exist and"
" is unable to create\n", tmp_dir);
goto onerror;
}
bend->open_block = block_backend_fs_open_block;
bend->read_block = block_backend_fs_read_block;
bend->write_block = block_backend_fs_write_block;
bend->commit_block = block_backend_fs_commit_block;
bend->close_block = block_backend_fs_close_block;
bend->exists = block_backend_fs_block_exists;
bend->remove_block = block_backend_fs_remove_block;
bend->stat_block = block_backend_fs_stat_block;
bend->stat_block_by_handle = block_backend_fs_stat_block_by_handle;
bend->block_handle_free = block_backend_fs_block_handle_free;
bend->foreach_block = block_backend_fs_foreach_block;
bend->remove_store = block_backend_fs_remove_store;
bend->copy = block_backend_fs_copy;
bend->rewind_block = block_backend_fs_rewind_block;
return bend;
onerror:
g_free (bend);
g_free (bend->be_priv);
return NULL;
}
================================================
FILE: common/block-backend.c
================================================
#include "common.h"
#include "log.h"
#include "block-backend.h"
extern BlockBackend *
block_backend_fs_new (const char *block_dir, const char *tmp_dir);
BlockBackend*
load_filesystem_block_backend(GKeyFile *config)
{
BlockBackend *bend;
char *tmp_dir;
char *block_dir;
block_dir = g_key_file_get_string (config, "block_backend", "block_dir", NULL);
if (!block_dir) {
seaf_warning ("Block dir not set in config.\n");
return NULL;
}
tmp_dir = g_key_file_get_string (config, "block_backend", "tmp_dir", NULL);
if (!tmp_dir) {
seaf_warning ("Block tmp dir not set in config.\n");
return NULL;
}
bend = block_backend_fs_new (block_dir, tmp_dir);
g_free (block_dir);
g_free (tmp_dir);
return bend;
}
BlockBackend*
load_block_backend (GKeyFile *config)
{
char *backend;
BlockBackend *bend;
backend = g_key_file_get_string (config, "block_backend", "name", NULL);
if (!backend) {
return NULL;
}
if (strcmp(backend, "filesystem") == 0) {
bend = load_filesystem_block_backend(config);
g_free (backend);
return bend;
}
seaf_warning ("Unknown backend\n");
return NULL;
}
================================================
FILE: common/block-backend.h
================================================
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#ifndef BLOCK_BACKEND_H
#define BLOCK_BACKEND_H
#include "block.h"
typedef struct BlockBackend BlockBackend;
struct BlockBackend {
BHandle* (*open_block) (BlockBackend *bend,
const char *store_id, int version,
const char *block_id, int rw_type);
int (*read_block) (BlockBackend *bend, BHandle *handle, void *buf, int len);
int (*write_block) (BlockBackend *bend, BHandle *handle, const void *buf, int len);
int (*commit_block) (BlockBackend *bend, BHandle *handle);
int (*close_block) (BlockBackend *bend, BHandle *handle);
int (*exists) (BlockBackend *bend,
const char *store_id, int version,
const char *block_id);
int (*remove_block) (BlockBackend *bend,
const char *store_id, int version,
const char *block_id);
BMetadata* (*stat_block) (BlockBackend *bend,
const char *store_id, int version,
const char *block_id);
BMetadata* (*stat_block_by_handle) (BlockBackend *bend, BHandle *handle);
void (*block_handle_free) (BlockBackend *bend, BHandle *handle);
int (*foreach_block) (BlockBackend *bend,
const char *store_id,
int version,
SeafBlockFunc process,
void *user_data);
int (*copy) (BlockBackend *bend,
const char *src_store_id,
int src_version,
const char *dst_store_id,
int dst_version,
const char *block_id);
/* Only valid for version 1 repo. Remove all blocks for the repo. */
int (*remove_store) (BlockBackend *bend,
const char *store_id);
int (*rewind_block) (BlockBackend *bend,
BHandle *handle);
void* be_priv; /* backend private field */
};
BlockBackend* load_block_backend (GKeyFile *config);
#endif
================================================
FILE: common/block-mgr.c
================================================
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include "common.h"
#include "seafile-session.h"
#include "utils.h"
#include "block-mgr.h"
#include "log.h"
#include <stdio.h>
#include <errno.h>
#ifndef WIN32
#include <unistd.h>
#include <dirent.h>
#endif
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/types.h>
#include <glib/gstdio.h>
#include "block-backend.h"
#define SEAF_BLOCK_DIR "blocks"
extern BlockBackend *
block_backend_fs_new (const char *block_dir, const char *tmp_dir);
SeafBlockManager *
seaf_block_manager_new (struct _SeafileSession *seaf,
const char *seaf_dir)
{
SeafBlockManager *mgr;
mgr = g_new0 (SeafBlockManager, 1);
mgr->seaf = seaf;
mgr->backend = block_backend_fs_new (seaf_dir, seaf->tmp_file_dir);
if (!mgr->backend) {
seaf_warning ("[Block mgr] Failed to load backend.\n");
goto onerror;
}
return mgr;
onerror:
g_free (mgr);
return NULL;
}
int
seaf_block_manager_init (SeafBlockManager *mgr)
{
return 0;
}
BlockHandle *
seaf_block_manager_open_block (SeafBlockManager *mgr,
const char *store_id,
int version,
const char *block_id,
int rw_type)
{
if (!store_id || !is_uuid_valid(store_id) ||
!block_id || !is_object_id_valid(block_id))
return NULL;
return mgr->backend->open_block (mgr->backend,
store_id, version,
block_id, rw_type);
}
int
seaf_block_manager_read_block (SeafBlockManager *mgr,
BlockHandle *handle,
void *buf, int len)
{
return mgr->backend->read_block (mgr->backend, handle, buf, len);
}
int
seaf_block_manager_write_block (SeafBlockManager *mgr,
BlockHandle *handle,
const void *buf, int len)
{
return mgr->backend->write_block (mgr->backend, handle, buf, len);
}
int
seaf_block_manager_close_block (SeafBlockManager *mgr,
BlockHandle *handle)
{
return mgr->backend->close_block (mgr->backend, handle);
}
void
seaf_block_manager_block_handle_free (SeafBlockManager *mgr,
BlockHandle *handle)
{
mgr->backend->block_handle_free (mgr->backend, handle);
}
int
seaf_block_manager_commit_block (SeafBlockManager *mgr,
BlockHandle *handle)
{
return mgr->backend->commit_block (mgr->backend, handle);
}
gboolean seaf_block_manager_block_exists (SeafBlockManager *mgr,
const char *store_id,
int version,
const char *block_id)
{
if (!store_id || !is_uuid_valid(store_id) ||
!block_id || !is_object_id_valid(block_id))
return FALSE;
return mgr->backend->exists (mgr->backend, store_id, version, block_id);
}
int
seaf_block_manager_remove_block (SeafBlockManager *mgr,
const char *store_id,
int version,
const char *block_id)
{
if (!store_id || !is_uuid_valid(store_id) ||
!block_id || !is_object_id_valid(block_id))
return -1;
return mgr->backend->remove_block (mgr->backend, store_id, version, block_id);
}
BlockMetadata *
seaf_block_manager_stat_block (SeafBlockManager *mgr,
const char *store_id,
int version,
const char *block_id)
{
if (!store_id || !is_uuid_valid(store_id) ||
!block_id || !is_object_id_valid(block_id))
return NULL;
return mgr->backend->stat_block (mgr->backend, store_id, version, block_id);
}
BlockMetadata *
seaf_block_manager_stat_block_by_handle (SeafBlockManager *mgr,
BlockHandle *handle)
{
return mgr->backend->stat_block_by_handle (mgr->backend, handle);
}
int
seaf_block_manager_foreach_block (SeafBlockManager *mgr,
const char *store_id,
int version,
SeafBlockFunc process,
void *user_data)
{
return mgr->backend->foreach_block (mgr->backend,
store_id, version,
process, user_data);
}
int
seaf_block_manager_copy_block (SeafBlockManager *mgr,
const char *src_store_id,
int src_version,
const char *dst_store_id,
int dst_version,
const char *block_id)
{
if (strcmp (block_id, EMPTY_SHA1) == 0)
return 0;
return mgr->backend->copy (mgr->backend,
src_store_id,
src_version,
dst_store_id,
dst_version,
block_id);
}
static gboolean
get_block_number (const char *store_id,
int version,
const char *block_id,
void *data)
{
guint64 *n_blocks = data;
++(*n_blocks);
return TRUE;
}
guint64
seaf_block_manager_get_block_number (SeafBlockManager *mgr,
const char *store_id,
int version)
{
guint64 n_blocks = 0;
seaf_block_manager_foreach_block (mgr, store_id, version,
get_block_number, &n_blocks);
return n_blocks;
}
gboolean
seaf_block_manager_verify_block (SeafBlockManager *mgr,
const char *store_id,
int version,
const char *block_id,
gboolean *io_error)
{
BlockHandle *h;
char buf[10240];
int n;
GChecksum *cs;
const char *check_id;
gboolean ret;
h = seaf_block_manager_open_block (mgr,
store_id, version,
block_id, BLOCK_READ);
if (!h) {
seaf_warning ("Failed to open block %s:%.8s.\n", store_id, block_id);
*io_error = TRUE;
return FALSE;
}
cs = g_checksum_new (G_CHECKSUM_SHA1);
while (1) {
n = seaf_block_manager_read_block (mgr, h, buf, sizeof(buf));
if (n < 0) {
seaf_warning ("Failed to read block %s:%.8s.\n", store_id, block_id);
*io_error = TRUE;
g_checksum_free (cs);
return FALSE;
}
if (n == 0)
break;
g_checksum_update (cs, (guchar *)buf, n);
}
seaf_block_manager_close_block (mgr, h);
seaf_block_manager_block_handle_free (mgr, h);
check_id = g_checksum_get_string (cs);
if (strcmp (check_id, block_id) == 0)
ret = TRUE;
else
ret = FALSE;
g_checksum_free (cs);
return ret;
}
int
seaf_block_manager_remove_store (SeafBlockManager *mgr,
const char *store_id)
{
return mgr->backend->remove_store (mgr->backend, store_id);
}
int
seaf_block_manager_rewind_block (SeafBlockManager *mgr,
BlockHandle *handle)
{
return mgr->backend->rewind_block (mgr->backend, handle);
}
================================================
FILE: common/block-mgr.h
================================================
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#ifndef SEAF_BLOCK_MGR_H
#define SEAF_BLOCK_MGR_H
#include <glib.h>
#include <glib-object.h>
#include <stdint.h>
#include "block.h"
struct _SeafileSession;
typedef struct _SeafBlockManager SeafBlockManager;
struct _SeafBlockManager {
struct _SeafileSession *seaf;
struct BlockBackend *backend;
};
SeafBlockManager *
seaf_block_manager_new (struct _SeafileSession *seaf,
const char *seaf_dir);
/*
* Open a block for read or write.
*
* @store_id: id for the block store
* @version: data format version for the repo
* @block_id: ID of block.
* @rw_type: BLOCK_READ or BLOCK_WRITE.
* Returns: A handle for the block.
*/
BlockHandle *
seaf_block_manager_open_block (SeafBlockManager *mgr,
const char *store_id,
int version,
const char *block_id,
int rw_type);
/*
* Read data from a block.
* The semantics is similar to readn.
*
* @handle: Hanlde returned by seaf_block_manager_open_block().
* @buf: Data wuold be copied into this buf.
* @len: At most @len bytes would be read.
*
* Returns: the bytes read.
*/
int
seaf_block_manager_read_block (SeafBlockManager *mgr,
BlockHandle *handle,
void *buf, int len);
/*
* Write data to a block.
* The semantics is similar to writen.
*
* @handle: Hanlde returned by seaf_block_manager_open_block().
* @buf: Data to be written to the block.
* @len: At most @len bytes would be written.
*
* Returns: the bytes written.
*/
int
seaf_block_manager_write_block (SeafBlockManager *mgr,
BlockHandle *handle,
const void *buf, int len);
/*
* Commit a block to storage.
* The block must be opened for write.
*
* @handle: Hanlde returned by seaf_block_manager_open_block().
*
* Returns: 0 on success, -1 on error.
*/
int
seaf_block_manager_commit_block (SeafBlockManager *mgr,
BlockHandle *handle);
/*
* Close an open block.
*
* @handle: Hanlde returned by seaf_block_manager_open_block().
*
* Returns: 0 on success, -1 on error.
*/
int
seaf_block_manager_close_block (SeafBlockManager *mgr,
BlockHandle *handle);
void
seaf_block_manager_block_handle_free (SeafBlockManager *mgr,
BlockHandle *handle);
gboolean
seaf_block_manager_block_exists (SeafBlockManager *mgr,
const char *store_id,
int version,
const char *block_id);
int
seaf_block_manager_remove_block (SeafBlockManager *mgr,
const char *store_id,
int version,
const char *block_id);
BlockMetadata *
seaf_block_manager_stat_block (SeafBlockManager *mgr,
const char *store_id,
int version,
const char *block_id);
BlockMetadata *
seaf_block_manager_stat_block_by_handle (SeafBlockManager *mgr,
BlockHandle *handle);
int
seaf_block_manager_foreach_block (SeafBlockManager *mgr,
const char *store_id,
int version,
SeafBlockFunc process,
void *user_data);
int
seaf_block_manager_copy_block (SeafBlockManager *mgr,
const char *src_store_id,
int src_version,
const char *dst_store_id,
int dst_version,
const char *block_id);
/* Remove all blocks for a repo. Only valid for version 1 repo. */
int
seaf_block_manager_remove_store (SeafBlockManager *mgr,
const char *store_id);
guint64
seaf_block_manager_get_block_number (SeafBlockManager *mgr,
const char *store_id,
int version);
gboolean
seaf_block_manager_verify_block (SeafBlockManager *mgr,
const char *store_id,
int version,
const char *block_id,
gboolean *io_error);
int
seaf_block_manager_rewind_block (SeafBlockManager *mgr,
BlockHandle *handle);
#endif
================================================
FILE: common/block.h
================================================
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#ifndef BLOCK_H
#define BLOCK_H
typedef struct _BMetadata BlockMetadata;
typedef struct _BMetadata BMetadata;
struct _BMetadata {
char id[41];
uint32_t size;
};
/* Opaque block handle.
*/
typedef struct _BHandle BlockHandle;
typedef struct _BHandle BHandle;
enum {
BLOCK_READ,
BLOCK_WRITE,
};
typedef gboolean (*SeafBlockFunc) (const char *store_id,
int version,
const char *block_id,
void *user_data);
#endif
================================================
FILE: common/branch-mgr.c
================================================
#include "common.h"
#include "log.h"
#ifndef SEAFILE_SERVER
#include "db.h"
#else
#include "seaf-db.h"
#endif
#include "seafile-session.h"
#include "branch-mgr.h"
#define BRANCH_DB "branch.db"
SeafBranch *
seaf_branch_new (const char *name, const char *repo_id, const char *commit_id)
{
SeafBranch *branch;
branch = g_new0 (SeafBranch, 1);
branch->name = g_strdup (name);
memcpy (branch->repo_id, repo_id, 36);
branch->repo_id[36] = '\0';
memcpy (branch->commit_id, commit_id, 40);
branch->commit_id[40] = '\0';
branch->ref = 1;
return branch;
}
void
seaf_branch_free (SeafBranch *branch)
{
if (branch == NULL) return;
g_free (branch->name);
g_free (branch);
}
void
seaf_branch_list_free (GList *blist)
{
GList *ptr;
for (ptr = blist; ptr; ptr = ptr->next) {
seaf_branch_unref (ptr->data);
}
g_list_free (blist);
}
void
seaf_branch_set_commit (SeafBranch *branch, const char *commit_id)
{
memcpy (branch->commit_id, commit_id, 40);
branch->commit_id[40] = '\0';
}
void
seaf_branch_ref (SeafBranch *branch)
{
branch->ref++;
}
void
seaf_branch_unref (SeafBranch *branch)
{
if (!branch)
return;
if (--branch->ref <= 0)
seaf_branch_free (branch);
}
struct _SeafBranchManagerPriv {
sqlite3 *db;
#ifndef SEAFILE_SERVER
pthread_mutex_t db_lock;
#endif
#if defined( SEAFILE_SERVER ) && defined( FULL_FEATURE )
uint32_t cevent_id;
#endif
};
#if defined( SEAFILE_SERVER ) && defined( FULL_FEATURE )
#include "mq-mgr.h"
#include <ccnet/cevent.h>
static void publish_repo_update_event (CEvent *event, void *data);
#endif
static int open_db (SeafBranchManager *mgr);
SeafBranchManager *
seaf_branch_manager_new (struct _SeafileSession *seaf)
{
SeafBranchManager *mgr;
mgr = g_new0 (SeafBranchManager, 1);
mgr->priv = g_new0 (SeafBranchManagerPriv, 1);
mgr->seaf = seaf;
#ifndef SEAFILE_SERVER
pthread_mutex_init (&mgr->priv->db_lock, NULL);
#endif
return mgr;
}
int
seaf_branch_manager_init (SeafBranchManager *mgr)
{
#if defined( SEAFILE_SERVER ) && defined( FULL_FEATURE )
mgr->priv->cevent_id = cevent_manager_register (seaf->ev_mgr,
(cevent_handler)publish_repo_update_event,
NULL);
#endif
return open_db (mgr);
}
static int
open_db (SeafBranchManager *mgr)
{
#ifndef SEAFILE_SERVER
char *db_path;
const char *sql;
db_path = g_build_filename (mgr->seaf->seaf_dir, BRANCH_DB, NULL);
if (sqlite_open_db (db_path, &mgr->priv->db) < 0) {
g_critical ("[Branch mgr] Failed to open branch db\n");
g_free (db_path);
return -1;
}
g_free (db_path);
sql = "CREATE TABLE IF NOT EXISTS Branch ("
"name TEXT, repo_id TEXT, commit_id TEXT);";
if (sqlite_query_exec (mgr->priv->db, sql) < 0)
return -1;
sql = "CREATE INDEX IF NOT EXISTS branch_index ON Branch(repo_id, name);";
if (sqlite_query_exec (mgr->priv->db, sql) < 0)
return -1;
#elif defined FULL_FEATURE
char *sql;
switch (seaf_db_type (mgr->seaf->db)) {
case SEAF_DB_TYPE_MYSQL:
sql = "CREATE TABLE IF NOT EXISTS Branch ("
"name VARCHAR(10), repo_id CHAR(41), commit_id CHAR(41),"
"PRIMARY KEY (repo_id, name)) ENGINE = INNODB";
if (seaf_db_query (mgr->seaf->db, sql) < 0)
return -1;
break;
case SEAF_DB_TYPE_PGSQL:
sql = "CREATE TABLE IF NOT EXISTS Branch ("
"name VARCHAR(10), repo_id CHAR(40), commit_id CHAR(40),"
"PRIMARY KEY (repo_id, name))";
if (seaf_db_query (mgr->seaf->db, sql) < 0)
return -1;
break;
case SEAF_DB_TYPE_SQLITE:
sql = "CREATE TABLE IF NOT EXISTS Branch ("
"name VARCHAR(10), repo_id CHAR(41), commit_id CHAR(41),"
"PRIMARY KEY (repo_id, name))";
if (seaf_db_query (mgr->seaf->db, sql) < 0)
return -1;
break;
}
#endif
return 0;
}
int
seaf_branch_manager_add_branch (SeafBranchManager *mgr, SeafBranch *branch)
{
#ifndef SEAFILE_SERVER
char sql[256];
pthread_mutex_lock (&mgr->priv->db_lock);
sqlite3_snprintf (sizeof(sql), sql,
"SELECT 1 FROM Branch WHERE name=%Q and repo_id=%Q",
branch->name, branch->repo_id);
if (sqlite_check_for_existence (mgr->priv->db, sql))
sqlite3_snprintf (sizeof(sql), sql,
"UPDATE Branch SET commit_id=%Q WHERE "
"name=%Q and repo_id=%Q",
branch->commit_id, branch->name, branch->repo_id);
else
sqlite3_snprintf (sizeof(sql), sql,
"INSERT INTO Branch VALUES (%Q, %Q, %Q)",
branch->name, branch->repo_id, branch->commit_id);
sqlite_query_exec (mgr->priv->db, sql);
pthread_mutex_unlock (&mgr->priv->db_lock);
return 0;
#else
char *sql;
SeafDB *db = mgr->seaf->db;
if (seaf_db_type(db) == SEAF_DB_TYPE_PGSQL) {
gboolean exists, err;
int rc;
sql = "SELECT repo_id FROM Branch WHERE name=? AND repo_id=?";
exists = seaf_db_statement_exists(db, sql, &err,
2, "string", branch->name,
"string", branch->repo_id);
if (err)
return -1;
if (exists)
rc = seaf_db_statement_query (db,
"UPDATE Branch SET commit_id=? "
"WHERE name=? AND repo_id=?",
3, "string", branch->commit_id,
"string", branch->name,
"string", branch->repo_id);
else
rc = seaf_db_statement_query (db,
"INSERT INTO Branch VALUES (?, ?, ?)",
3, "string", branch->name,
"string", branch->repo_id,
"string", branch->commit_id);
if (rc < 0)
return -1;
} else {
int rc = seaf_db_statement_query (db,
"REPLACE INTO Branch VALUES (?, ?, ?)",
3, "string", branch->name,
"string", branch->repo_id,
"string", branch->commit_id);
if (rc < 0)
return -1;
}
return 0;
#endif
}
int
seaf_branch_manager_del_branch (SeafBranchManager *mgr,
const char *repo_id,
const char *name)
{
#ifndef SEAFILE_SERVER
char *sql;
pthread_mutex_lock (&mgr->priv->db_lock);
sql = sqlite3_mprintf ("DELETE FROM Branch WHERE name = %Q AND "
"repo_id = '%s'", name, repo_id);
if (sqlite_query_exec (mgr->priv->db, sql) < 0)
seaf_warning ("Delete branch %s failed\n", name);
sqlite3_free (sql);
pthread_mutex_unlock (&mgr->priv->db_lock);
return 0;
#else
int rc = seaf_db_statement_query (mgr->seaf->db,
"DELETE FROM Branch WHERE name=? AND repo_id=?",
2, "string", name, "string", repo_id);
if (rc < 0)
return -1;
return 0;
#endif
}
int
seaf_branch_manager_update_branch (SeafBranchManager *mgr, SeafBranch *branch)
{
#ifndef SEAFILE_SERVER
sqlite3 *db;
char *sql;
pthread_mutex_lock (&mgr->priv->db_lock);
db = mgr->priv->db;
sql = sqlite3_mprintf ("UPDATE Branch SET commit_id = %Q "
"WHERE name = %Q AND repo_id = %Q",
branch->commit_id, branch->name, branch->repo_id);
sqlite_query_exec (db, sql);
sqlite3_free (sql);
pthread_mutex_unlock (&mgr->priv->db_lock);
return 0;
#else
int rc = seaf_db_statement_query (mgr->seaf->db,
"UPDATE Branch SET commit_id = ? "
"WHERE name = ? AND repo_id = ?",
3, "string", branch->commit_id,
"string", branch->name,
"string", branch->repo_id);
if (rc < 0)
return -1;
return 0;
#endif
}
#if defined( SEAFILE_SERVER ) && defined( FULL_FEATURE )
static gboolean
get_commit_id (SeafDBRow *row, void *data)
{
char *out_commit_id = data;
const char *commit_id;
commit_id = seaf_db_row_get_column_text (row, 0);
memcpy (out_commit_id, commit_id, 41);
out_commit_id[40] = '\0';
return FALSE;
}
typedef struct {
char *repo_id;
char *commit_id;
} RepoUpdateEventData;
static void
publish_repo_update_event (CEvent *event, void *data)
{
RepoUpdateEventData *rdata = event->data;
char buf[128];
snprintf (buf, sizeof(buf), "repo-update\t%s\t%s",
rdata->repo_id, rdata->commit_id);
seaf_mq_manager_publish_event (seaf->mq_mgr, buf);
g_free (rdata->repo_id);
g_free (rdata->commit_id);
g_free (rdata);
}
static void
on_branch_updated (SeafBranchManager *mgr, SeafBranch *branch)
{
if (seaf_repo_manager_is_virtual_repo (seaf->repo_mgr, branch->repo_id))
return;
RepoUpdateEventData *rdata = g_new0 (RepoUpdateEventData, 1);
rdata->repo_id = g_strdup (branch->repo_id);
rdata->commit_id = g_strdup (branch->commit_id);
cevent_manager_add_event (seaf->ev_mgr, mgr->priv->cevent_id, rdata);
}
int
seaf_branch_manager_test_and_update_branch (SeafBranchManager *mgr,
SeafBranch *branch,
const char *old_commit_id)
{
SeafDBTrans *trans;
char *sql;
char commit_id[41] = { 0 };
trans = seaf_db_begin_transaction (mgr->seaf->db);
if (!trans)
return -1;
switch (seaf_db_type (mgr->seaf->db)) {
case SEAF_DB_TYPE_MYSQL:
case SEAF_DB_TYPE_PGSQL:
sql = "SELECT commit_id FROM Branch WHERE name=? "
"AND repo_id=? FOR UPDATE";
break;
case SEAF_DB_TYPE_SQLITE:
sql = "SELECT commit_id FROM Branch WHERE name=? "
"AND repo_id=?";
break;
default:
g_return_val_if_reached (-1);
}
if (seaf_db_trans_foreach_selected_row (trans, sql,
get_commit_id, commit_id,
2, "string", branch->name,
"string", branch->repo_id) < 0) {
seaf_db_rollback (trans);
seaf_db_trans_close (trans);
return -1;
}
if (strcmp (old_commit_id, commit_id) != 0) {
seaf_db_rollback (trans);
seaf_db_trans_close (trans);
return -1;
}
sql = "UPDATE Branch SET commit_id = ? "
"WHERE name = ? AND repo_id = ?";
if (seaf_db_trans_query (trans, sql, 3, "string", branch->commit_id,
"string", branch->name,
"string", branch->repo_id) < 0) {
seaf_db_rollback (trans);
seaf_db_trans_close (trans);
return -1;
}
if (seaf_db_commit (trans) < 0) {
seaf_db_rollback (trans);
seaf_db_trans_close (trans);
return -1;
}
seaf_db_trans_close (trans);
on_branch_updated (mgr, branch);
return 0;
}
#endif
#ifndef SEAFILE_SERVER
static SeafBranch *
real_get_branch (SeafBranchManager *mgr,
const char *repo_id,
const char *name)
{
SeafBranch *branch = NULL;
sqlite3_stmt *stmt;
sqlite3 *db;
char *sql;
int result;
pthread_mutex_lock (&mgr->priv->db_lock);
db = mgr->priv->db;
sql = sqlite3_mprintf ("SELECT commit_id FROM Branch "
"WHERE name = %Q and repo_id='%s'",
name, repo_id);
if (!(stmt = sqlite_query_prepare (db, sql))) {
seaf_warning ("[Branch mgr] Couldn't prepare query %s\n", sql);
sqlite3_free (sql);
pthread_mutex_unlock (&mgr->priv->db_lock);
return NULL;
}
sqlite3_free (sql);
result = sqlite3_step (stmt);
if (result == SQLITE_ROW) {
char *commit_id = (char *)sqlite3_column_text (stmt, 0);
branch = seaf_branch_new (name, repo_id, commit_id);
pthread_mutex_unlock (&mgr->priv->db_lock);
sqlite3_finalize (stmt);
return branch;
} else if (result == SQLITE_ERROR) {
const char *str = sqlite3_errmsg (db);
seaf_warning ("Couldn't prepare query, error: %d->'%s'\n",
result, str ? str : "no error given");
}
sqlite3_finalize (stmt);
pthread_mutex_unlock (&mgr->priv->db_lock);
return NULL;
}
SeafBranch *
seaf_branch_manager_get_branch (SeafBranchManager *mgr,
const char *repo_id,
const char *name)
{
SeafBranch *branch;
/* "fetch_head" maps to "local" or "master" on client (LAN sync) */
if (strcmp (name, "fetch_head") == 0) {
branch = real_get_branch (mgr, repo_id, "local");
if (!branch) {
branch = real_get_branch (mgr, repo_id, "master");
}
return branch;
} else {
return real_get_branch (mgr, repo_id, name);
}
}
#else
static gboolean
get_branch (SeafDBRow *row, void *vid)
{
char *ret = vid;
const char *commit_id;
commit_id = seaf_db_row_get_column_text (row, 0);
memcpy (ret, commit_id, 41);
return FALSE;
}
static SeafBranch *
real_get_branch (SeafBranchManager *mgr,
const char *repo_id,
const char *name)
{
char commit_id[41];
char *sql;
commit_id[0] = 0;
sql = "SELECT commit_id FROM Branch WHERE name=? AND repo_id=?";
if (seaf_db_statement_foreach_row (mgr->seaf->db, sql,
get_branch, commit_id,
2, "string", name, "string", repo_id) < 0) {
seaf_warning ("[branch mgr] DB error when get branch %s.\n", name);
return NULL;
}
if (commit_id[0] == 0)
return NULL;
return seaf_branch_new (name, repo_id, commit_id);
}
SeafBranch *
seaf_branch_manager_get_branch (SeafBranchManager *mgr,
const char *repo_id,
const char *name)
{
SeafBranch *branch;
/* "fetch_head" maps to "master" on server. */
if (strcmp (name, "fetch_head") == 0) {
branch = real_get_branch (mgr, repo_id, "master");
return branch;
} else {
return real_get_branch (mgr, repo_id, name);
}
}
#endif /* not SEAFILE_SERVER */
gboolean
seaf_branch_manager_branch_exists (SeafBranchManager *mgr,
const char *repo_id,
const char *name)
{
#ifndef SEAFILE_SERVER
char *sql;
gboolean ret;
pthread_mutex_lock (&mgr->priv->db_lock);
sql = sqlite3_mprintf ("SELECT name FROM Branch WHERE name = %Q "
"AND repo_id='%s'", name, repo_id);
ret = sqlite_check_for_existence (mgr->priv->db, sql);
sqlite3_free (sql);
pthread_mutex_unlock (&mgr->priv->db_lock);
return ret;
#else
gboolean db_err = FALSE;
return seaf_db_statement_exists (mgr->seaf->db,
"SELECT name FROM Branch WHERE name=? "
"AND repo_id=?", &db_err,
2, "string", name, "string", repo_id);
#endif
}
#ifndef SEAFILE_SERVER
GList *
seaf_branch_manager_get_branch_list (SeafBranchManager *mgr,
const char *repo_id)
{
sqlite3 *db = mgr->priv->db;
int result;
sqlite3_stmt *stmt;
char sql[256];
char *name;
char *commit_id;
GList *ret = NULL;
SeafBranch *branch;
snprintf (sql, 256, "SELECT name, commit_id FROM branch WHERE repo_id ='%s'",
repo_id);
pthread_mutex_lock (&mgr->priv->db_lock);
if ( !(stmt = sqlite_query_prepare(db, sql)) ) {
pthread_mutex_unlock (&mgr->priv->db_lock);
return NULL;
}
while (1) {
result = sqlite3_step (stmt);
if (result == SQLITE_ROW) {
name = (char *)sqlite3_column_text(stmt, 0);
commit_id = (char *)sqlite3_column_text(stmt, 1);
branch = seaf_branch_new (name, repo_id, commit_id);
ret = g_list_prepend (ret, branch);
}
if (result == SQLITE_DONE)
break;
if (result == SQLITE_ERROR) {
const gchar *str = sqlite3_errmsg (db);
seaf_warning ("Couldn't prepare query, error: %d->'%s'\n",
result, str ? str : "no error given");
sqlite3_finalize (stmt);
seaf_branch_list_free (ret);
pthread_mutex_unlock (&mgr->priv->db_lock);
return NULL;
}
}
sqlite3_finalize (stmt);
pthread_mutex_unlock (&mgr->priv->db_lock);
return g_list_reverse(ret);
}
#else
static gboolean
get_branches (SeafDBRow *row, void *vplist)
{
GList **plist = vplist;
const char *commit_id;
const char *name;
const char *repo_id;
SeafBranch *branch;
name = seaf_db_row_get_column_text (row, 0);
repo_id = seaf_db_row_get_column_text (row, 1);
commit_id = seaf_db_row_get_column_text (row, 2);
branch = seaf_branch_new (name, repo_id, commit_id);
*plist = g_list_prepend (*plist, branch);
return TRUE;
}
GList *
seaf_branch_manager_get_branch_list (SeafBranchManager *mgr,
const char *repo_id)
{
GList *ret = NULL;
char *sql;
sql = "SELECT name, repo_id, commit_id FROM Branch WHERE repo_id=?";
if (seaf_db_statement_foreach_row (mgr->seaf->db, sql,
get_branches, &ret,
1, "string", repo_id) < 0) {
seaf_warning ("[branch mgr] DB error when get branch list.\n");
return NULL;
}
return ret;
}
#endif
================================================
FILE: common/branch-mgr.h
================================================
#ifndef SEAF_BRANCH_MGR_H
#define SEAF_BRANCH_MGR_H
#include "commit-mgr.h"
#define NO_BRANCH "-"
typedef struct _SeafBranch SeafBranch;
struct _SeafBranch {
int ref;
char *name;
char repo_id[37];
char commit_id[41];
};
SeafBranch *seaf_branch_new (const char *name,
const char *repo_id,
const char *commit_id);
void seaf_branch_free (SeafBranch *branch);
void seaf_branch_set_commit (SeafBranch *branch, const char *commit_id);
void seaf_branch_ref (SeafBranch *branch);
void seaf_branch_unref (SeafBranch *branch);
typedef struct _SeafBranchManager SeafBranchManager;
typedef struct _SeafBranchManagerPriv SeafBranchManagerPriv;
struct _SeafileSession;
struct _SeafBranchManager {
struct _SeafileSession *seaf;
SeafBranchManagerPriv *priv;
};
SeafBranchManager *seaf_branch_manager_new (struct _SeafileSession *seaf);
int seaf_branch_manager_init (SeafBranchManager *mgr);
int
seaf_branch_manager_add_branch (SeafBranchManager *mgr, SeafBranch *branch);
int
seaf_branch_manager_del_branch (SeafBranchManager *mgr,
const char *repo_id,
const char *name);
void
seaf_branch_list_free (GList *blist);
int
seaf_branch_manager_update_branch (SeafBranchManager *mgr,
SeafBranch *branch);
#ifdef SEAFILE_SERVER
/**
* Atomically test whether the current head commit id on @branch
* is the same as @old_commit_id and update branch in db.
*/
int
seaf_branch_manager_test_and_update_branch (SeafBranchManager *mgr,
SeafBranch *branch,
const char *old_commit_id);
#endif
SeafBranch *
seaf_branch_manager_get_branch (SeafBranchManager *mgr,
const char *repo_id,
const char *name);
gboolean
seaf_branch_manager_branch_exists (SeafBranchManager *mgr,
const char *repo_id,
const char *name);
GList *
seaf_branch_manager_get_branch_list (SeafBranchManager *mgr,
const char *repo_id);
gint64
seaf_branch_manager_calculate_branch_size (SeafBranchManager *mgr,
const char *repo_id,
const char *commit_id);
#endif /* SEAF_BRANCH_MGR_H */
================================================
FILE: common/cdc/Makefile.am
================================================
AM_CFLAGS = -I$(top_srcdir)/common -I$(top_srcdir)/lib \
-Wall @GLIB2_CFLAGS@ @MSVC_CFLAGS@
if MACOS
if COMPILE_UNIVERSAL
AM_CFLAGS += -arch x86_64 -arch arm64
endif
endif
noinst_LTLIBRARIES = libcdc.la
noinst_HEADERS = cdc.h rabin-checksum.h
libcdc_la_SOURCES = cdc.c rabin-checksum.c
libcdc_la_LDFLAGS = -Wl,-z -Wl,defs
libcdc_la_LIBADD = @GLIB2_LIBS@ \
$(top_builddir)/lib/libseafile_common.la
================================================
FILE: common/cdc/cdc.c
================================================
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include "common.h"
#include "log.h"
#ifndef WIN32
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <errno.h>
#include <glib/gstdio.h>
#include "utils.h"
#include "cdc.h"
#include "../seafile-crypt.h"
#include "rabin-checksum.h"
#define finger rabin_checksum
#define rolling_finger rabin_rolling_checksum
#define BLOCK_SZ (1024*1024*1)
#define BLOCK_MIN_SZ (1024*256)
#define BLOCK_MAX_SZ (1024*1024*4)
#define BLOCK_WIN_SZ 48
#define NAME_MAX_SZ 4096
#define BREAK_VALUE 0x0013 ///0x0513
#define READ_SIZE 1024 * 4
#define BYTE_TO_HEX(b) (((b)>=10)?('a'+b-10):('0'+b))
static int default_write_chunk (CDCDescriptor *chunk_descr)
{
char filename[NAME_MAX_SZ];
char chksum_str[CHECKSUM_LENGTH *2 + 1];
int fd_chunk, ret;
memset(chksum_str, 0, sizeof(chksum_str));
rawdata_to_hex (chunk_descr->checksum, chksum_str, CHECKSUM_LENGTH);
snprintf (filename, NAME_MAX_SZ, "./%s", chksum_str);
fd_chunk = g_open (filename, O_RDWR | O_CREAT | O_BINARY, 0644);
if (fd_chunk < 0)
return -1;
ret = writen (fd_chunk, chunk_descr->block_buf, chunk_descr->len);
close (fd_chunk);
return ret;
}
static int init_cdc_file_descriptor (int fd,
uint64_t file_size,
CDCFileDescriptor *file_descr)
{
int max_block_nr = 0;
int block_min_sz = 0;
file_descr->block_nr = 0;
if (file_descr->block_min_sz <= 0)
file_descr->block_min_sz = BLOCK_MIN_SZ;
if (file_descr->block_max_sz <= 0)
file_descr->block_max_sz = BLOCK_MAX_SZ;
if (file_descr->block_sz <= 0)
file_descr->block_sz = BLOCK_SZ;
if (file_descr->write_block == NULL)
file_descr->write_block = (WriteblockFunc)default_write_chunk;
block_min_sz = file_descr->block_min_sz;
max_block_nr = ((file_size + block_min_sz - 1) / block_min_sz);
file_descr->blk_sha1s = (uint8_t *)calloc (sizeof(uint8_t),
max_block_nr * CHECKSUM_LENGTH);
file_descr->max_block_nr = max_block_nr;
return 0;
}
#define WRITE_CDC_BLOCK(block_sz, write_data) \
do { \
int _block_sz = (block_sz); \
chunk_descr.len = _block_sz; \
chunk_descr.offset = offset; \
ret = file_descr->write_block (file_descr->repo_id, \
file_descr->version, \
&chunk_descr, \
crypt, chunk_descr.checksum, \
(write_data)); \
if (ret < 0) { \
free (buf); \
g_warning ("CDC: failed to write chunk.\n"); \
return -1; \
} \
memcpy (file_descr->blk_sha1s + \
file_descr->block_nr * CHECKSUM_LENGTH, \
chunk_descr.checksum, CHECKSUM_LENGTH); \
g_checksum_update (file_ctx, chunk_descr.checksum, 20); \
file_descr->block_nr++; \
offset += _block_sz; \
\
memmove (buf, buf + _block_sz, tail - _block_sz); \
tail = tail - _block_sz; \
cur = 0; \
}while(0);
/* content-defined chunking */
int file_chunk_cdc(int fd_src,
CDCFileDescriptor *file_descr,
SeafileCrypt *crypt,
gboolean write_data)
{
char *buf = NULL;
uint32_t buf_sz;
GChecksum *file_ctx = g_checksum_new (G_CHECKSUM_SHA1);
CDCDescriptor chunk_descr;
int ret = 0;
SeafStat sb;
if (seaf_fstat (fd_src, &sb) < 0) {
seaf_warning ("CDC: failed to stat: %s.\n", strerror(errno));
ret = -1;
goto out;
}
uint64_t expected_size = sb.st_size;
init_cdc_file_descriptor (fd_src, expected_size, file_descr);
uint32_t block_min_sz = file_descr->block_min_sz;
uint32_t block_mask = file_descr->block_sz - 1;
int fingerprint = 0;
int offset = 0;
int tail, cur, rsize;
buf_sz = file_descr->block_max_sz;
buf = chunk_descr.block_buf = malloc (buf_sz);
if (!buf) {
ret = -1;
goto out;
}
/* buf: a fix-sized buffer.
* cur: data behind (inclusive) this offset has been scanned.
* cur + 1 is the bytes that has been scanned.
* tail: length of data loaded into memory. buf[tail] is invalid.
*/
tail = cur = 0;
while (1) {
if (tail < block_min_sz) {
rsize = block_min_sz - tail + READ_SIZE;
} else {
rsize = (buf_sz - tail < READ_SIZE) ? (buf_sz - tail) : READ_SIZE;
}
ret = readn (fd_src, buf + tail, rsize);
if (ret < 0) {
seaf_warning ("CDC: failed to read: %s.\n", strerror(errno));
ret = -1;
goto out;
}
tail += ret;
file_descr->file_size += ret;
if (file_descr->file_size > expected_size) {
seaf_warning ("File size changed while chunking.\n");
ret = -1;
goto out;
}
/* We've read all the data in this file. Output the block immediately
* in two cases:
* 1. The data left in the file is less than block_min_sz;
* 2. We cannot find the break value until the end of this file.
*/
if (tail < block_min_sz || cur >= tail) {
if (tail > 0) {
if (file_descr->block_nr == file_descr->max_block_nr) {
seaf_warning ("Block id array is not large enough, bail out.\n");
ret = -1;
goto out;
}
WRITE_CDC_BLOCK (tail, write_data);
}
break;
}
/*
* A block is at least of size block_min_sz.
*/
if (cur < block_min_sz - 1)
cur = block_min_sz - 1;
while (cur < tail) {
fingerprint = (cur == block_min_sz - 1) ?
finger(buf + cur - BLOCK_WIN_SZ + 1, BLOCK_WIN_SZ) :
rolling_finger (fingerprint, BLOCK_WIN_SZ,
*(buf+cur-BLOCK_WIN_SZ), *(buf + cur));
/* get a chunk, write block info to chunk file */
if (((fingerprint & block_mask) == ((BREAK_VALUE & block_mask)))
|| cur + 1 >= file_descr->block_max_sz)
{
if (file_descr->block_nr == file_descr->max_block_nr) {
seaf_warning ("Block id array is not large enough, bail out.\n");
ret = -1;
goto out;
}
WRITE_CDC_BLOCK (cur + 1, write_data);
break;
} else {
cur ++;
}
}
}
gsize chk_sum_len = CHECKSUM_LENGTH;
g_checksum_get_digest (file_ctx, file_descr->file_sum, &chk_sum_len);
out:
free (buf);
g_checksum_free (file_ctx);
return ret;
}
int filename_chunk_cdc(const char *filename,
CDCFileDescriptor *file_descr,
SeafileCrypt *crypt,
gboolean write_data)
{
int fd_src = seaf_util_open (filename, O_RDONLY | O_BINARY);
if (fd_src < 0) {
seaf_warning ("CDC: failed to open %s.\n", filename);
return -1;
}
int ret = file_chunk_cdc (fd_src, file_descr, crypt, write_data);
close (fd_src);
return ret;
}
void cdc_init ()
{
rabin_init (BLOCK_WIN_SZ);
}
================================================
FILE: common/cdc/cdc.h
================================================
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#ifndef _CDC_H
#define _CDC_H
#include <glib.h>
#include <stdint.h>
#define CHECKSUM_LENGTH 20
#ifndef O_BINARY
#define O_BINARY 0
#endif
struct _CDCFileDescriptor;
struct _CDCDescriptor;
struct SeafileCrypt;
typedef int (*WriteblockFunc)(const char *repo_id,
int version,
struct _CDCDescriptor *chunk_descr,
struct SeafileCrypt *crypt,
uint8_t *checksum,
gboolean write_data);
/* define chunk file header and block entry */
typedef struct _CDCFileDescriptor {
uint32_t block_min_sz;
uint32_t block_max_sz;
uint32_t block_sz;
uint64_t file_size;
uint32_t block_nr;
uint8_t *blk_sha1s;
int max_block_nr;
uint8_t file_sum[CHECKSUM_LENGTH];
WriteblockFunc write_block;
char repo_id[37];
int version;
} CDCFileDescriptor;
typedef struct _CDCDescriptor {
uint64_t offset;
uint32_t len;
uint8_t checksum[CHECKSUM_LENGTH];
char *block_buf;
int result;
} CDCDescriptor;
int file_chunk_cdc(int fd_src,
CDCFileDescriptor *file_descr,
struct SeafileCrypt *crypt,
gboolean write_data);
int filename_chunk_cdc(const char *filename,
CDCFileDescriptor *file_descr,
struct SeafileCrypt *crypt,
gboolean write_data);
void cdc_init ();
#endif
================================================
FILE: common/cdc/rabin-checksum.c
================================================
#include <sys/types.h>
#include "rabin-checksum.h"
#ifdef WIN32
#include <stdint.h>
#ifndef u_int
typedef unsigned int u_int;
#endif
#ifndef u_char
typedef unsigned char u_char;
#endif
#ifndef u_short
typedef unsigned short u_short;
#endif
#ifndef u_long
typedef unsigned long u_long;
#endif
#ifndef u_int16_t
typedef uint16_t u_int16_t;
#endif
#ifndef u_int32_t
typedef uint32_t u_int32_t;
#endif
#ifndef u_int64_t
typedef uint64_t u_int64_t;
#endif
#endif
#define INT64(n) n##LL
#define MSB64 INT64(0x8000000000000000)
static u_int64_t poly = 0xbfe6b8a5bf378d83LL;
static u_int64_t T[256];
static u_int64_t U[256];
static int shift;
/* Highest bit set in a byte */
static const char bytemsb[0x100] = {
0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
};
/* Find last set (most significant bit) */
static inline u_int fls32 (u_int32_t v)
{
if (v & 0xffff0000) {
if (v & 0xff000000)
return 24 + bytemsb[v>>24];
else
return 16 + bytemsb[v>>16];
}
if (v & 0x0000ff00)
return 8 + bytemsb[v>>8];
else
return bytemsb[v];
}
static inline char fls64 (u_int64_t v)
{
u_int32_t h;
if ((h = v >> 32))
return 32 + fls32 (h);
else
return fls32 ((u_int32_t) v);
}
u_int64_t polymod (u_int64_t nh, u_int64_t nl, u_int64_t d)
{
int i = 0;
int k = fls64 (d) - 1;
d <<= 63 - k;
if (nh) {
if (nh & MSB64)
nh ^= d;
for (i = 62; i >= 0; i--)
if (nh & ((u_int64_t) 1) << i) {
nh ^= d >> (63 - i);
nl ^= d << (i + 1);
}
}
for (i = 63; i >= k; i--)
{
if (nl & INT64 (1) << i)
nl ^= d >> (63 - i);
}
return nl;
}
void polymult (u_int64_t *php, u_int64_t *plp, u_int64_t x, u_int64_t y)
{
int i;
u_int64_t ph = 0, pl = 0;
if (x & 1)
pl = y;
for (i = 1; i < 64; i++)
if (x & (INT64 (1) << i)) {
ph ^= y >> (64 - i);
pl ^= y << i;
}
if (php)
*php = ph;
if (plp)
*plp = pl;
}
u_int64_t polymmult (u_int64_t x, u_int64_t y, u_int64_t d)
{
u_int64_t h, l;
polymult (&h, &l, x, y);
return polymod (h, l, d);
}
static u_int64_t append8 (u_int64_t p, u_char m)
{
return ((p << 8) | m) ^ T[p >> shift];
}
static void calcT (u_int64_t poly)
{
int j = 0;
int xshift = fls64 (poly) - 1;
shift = xshift - 8;
u_int64_t T1 = polymod (0, INT64 (1) << xshift, poly);
for (j = 0; j < 256; j++) {
T[j] = polymmult (j, T1, poly) | ((u_int64_t) j << xshift);
}
}
static void calcU(int size)
{
int i;
u_int64_t sizeshift = 1;
for (i = 1; i < size; i++)
sizeshift = append8 (sizeshift, 0);
for (i = 0; i < 256; i++)
U[i] = polymmult (i, sizeshift, poly);
}
void rabin_init(int len)
{
calcT(poly);
calcU(len);
}
/*
* a simple 32 bit checksum that can be upadted from end
*/
unsigned int rabin_checksum(char *buf, int len)
{
int i;
unsigned int sum = 0;
for (i = 0; i < len; ++i) {
sum = rabin_rolling_checksum (sum, len, 0, buf[i]);
}
return sum;
}
unsigned int rabin_rolling_checksum(unsigned int csum, int len,
char c1, char c2)
{
return append8(csum ^ U[(unsigned char)c1], c2);
}
================================================
FILE: common/cdc/rabin-checksum.h
================================================
#ifndef _RABIN_CHECKSUM_H
#define _RABIN_CHECKSUM_H
unsigned int rabin_checksum(char *buf, int len);
unsigned int rabin_rolling_checksum(unsigned int csum, int len, char c1, char c2);
void rabin_init (int len);
#endif
================================================
FILE: common/commit-mgr.c
================================================
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include "common.h"
#include "log.h"
#include <jansson.h>
#include "utils.h"
#include "db.h"
#include "searpc-utils.h"
#include "seafile-session.h"
#include "commit-mgr.h"
#define MAX_TIME_SKEW 259200 /* 3 days */
struct _SeafCommitManagerPriv {
int dummy;
};
static SeafCommit *
load_commit (SeafCommitManager *mgr,
const char *repo_id, int version,
const char *commit_id);
static int
save_commit (SeafCommitManager *manager,
const char *repo_id, int version,
SeafCommit *commit);
static void
delete_commit (SeafCommitManager *mgr,
const char *repo_id, int version,
const char *id);
static json_t *
commit_to_json_object (SeafCommit *commit);
static SeafCommit *
commit_from_json_object (const char *id, json_t *object);
static void compute_commit_id (SeafCommit* commit)
{
GChecksum *ctx = g_checksum_new(G_CHECKSUM_SHA1);
uint8_t sha1[20];
gint64 ctime_n;
g_checksum_update (ctx, (guchar *)commit->root_id, 41);
g_checksum_update (ctx, (guchar *)commit->creator_id, 41);
if (commit->creator_name)
g_checksum_update (ctx, (guchar *)commit->creator_name, strlen(commit->creator_name)+1);
g_checksum_update (ctx, (guchar *)commit->desc, strlen(commit->desc)+1);
/* convert to network byte order */
ctime_n = hton64 (commit->ctime);
g_checksum_update (ctx, (guchar *)&ctime_n, sizeof(ctime_n));
gsize len = 20;
g_checksum_get_digest (ctx, sha1, &len);
rawdata_to_hex (sha1, commit->commit_id, 20);
g_checksum_free (ctx);
}
SeafCommit*
seaf_commit_new (const char *commit_id,
const char *repo_id,
const char *root_id,
const char *creator_name,
const char *creator_id,
const char *desc,
guint64 ctime)
{
SeafCommit *commit;
g_return_val_if_fail (repo_id != NULL, NULL);
g_return_val_if_fail (root_id != NULL && creator_id != NULL, NULL);
commit = g_new0 (SeafCommit, 1);
memcpy (commit->repo_id, repo_id, 36);
commit->repo_id[36] = '\0';
memcpy (commit->root_id, root_id, 40);
commit->root_id[40] = '\0';
commit->creator_name = g_strdup (creator_name);
memcpy (commit->creator_id, creator_id, 40);
commit->creator_id[40] = '\0';
commit->desc = g_strdup (desc);
if (ctime == 0) {
/* TODO: use more precise timer */
commit->ctime = (gint64)time(NULL);
} else
commit->ctime = ctime;
if (commit_id == NULL)
compute_commit_id (commit);
else {
memcpy (commit->commit_id, commit_id, 40);
commit->commit_id[40] = '\0';
}
commit->ref = 1;
return commit;
}
char *
seaf_commit_to_data (SeafCommit *commit, gsize *len)
{
json_t *object;
char *json_data;
char *ret;
object = commit_to_json_object (commit);
json_data = json_dumps (object, 0);
*len = strlen (json_data);
json_decref (object);
ret = g_strdup (json_data);
free (json_data);
return ret;
}
SeafCommit *
seaf_commit_from_data (const char *id, char *data, gsize len)
{
json_t *object;
SeafCommit *commit;
json_error_t jerror;
object = json_loadb (data, len, 0, &jerror);
if (!object) {
/* Perhaps the commit object contains invalid UTF-8 character. */
if (data[len-1] == 0)
clean_utf8_data (data, len - 1);
else
clean_utf8_data (data, len);
object = json_loadb (data, len, 0, &jerror);
if (!object) {
seaf_warning ("Failed to load commit json: %s.\n", jerror.text);
return NULL;
}
}
commit = commit_from_json_object (id, object);
json_decref (object);
return commit;
}
static void
seaf_commit_free (SeafCommit *commit)
{
g_free (commit->desc);
g_free (commit->creator_name);
if (commit->parent_id) g_free (commit->parent_id);
if (commit->second_parent_id) g_free (commit->second_parent_id);
if (commit->repo_name) g_free (commit->repo_name);
if (commit->repo_desc) g_free (commit->repo_desc);
if (commit->device_name) g_free (commit->device_name);
g_free (commit->client_version);
g_free (commit->magic);
g_free (commit->random_key);
g_free (commit->pwd_hash);
g_free (commit->pwd_hash_algo);
g_free (commit->pwd_hash_params);
g_free (commit);
}
void
seaf_commit_ref (SeafCommit *commit)
{
commit->ref++;
}
void
seaf_commit_unref (SeafCommit *commit)
{
if (!commit)
return;
if (--commit->ref <= 0)
seaf_commit_free (commit);
}
SeafCommitManager*
seaf_commit_manager_new (SeafileSession *seaf)
{
SeafCommitManager *mgr = g_new0 (SeafCommitManager, 1);
mgr->priv = g_new0 (SeafCommitManagerPriv, 1);
mgr->seaf = seaf;
mgr->obj_store = seaf_obj_store_new (mgr->seaf, "commits");
return mgr;
}
int
seaf_commit_manager_init (SeafCommitManager *mgr)
{
#ifdef SEAFILE_SERVER
#ifdef FULL_FEATURE
if (seaf_obj_store_init (mgr->obj_store, TRUE, seaf->ev_mgr) < 0) {
seaf_warning ("[commit mgr] Failed to init commit object store.\n");
return -1;
}
#else
if (seaf_obj_store_init (mgr->obj_store, FALSE, NULL) < 0) {
seaf_warning ("[commit mgr] Failed to init commit object store.\n");
return -1;
}
#endif
#else
if (seaf_obj_store_init (mgr->obj_store, TRUE, seaf->ev_mgr) < 0) {
seaf_warning ("[commit mgr] Failed to init commit object store.\n");
return -1;
}
#endif
return 0;
}
#if 0
inline static void
add_commit_to_cache (SeafCommitManager *mgr, SeafCommit *commit)
{
g_hash_table_insert (mgr->priv->commit_cache,
g_strdup(commit->commit_id),
commit);
seaf_commit_ref (commit);
}
inline static void
remove_commit_from_cache (SeafCommitManager *mgr, SeafCommit *commit)
{
g_hash_table_remove (mgr->priv->commit_cache, commit->commit_id);
seaf_commit_unref (commit);
}
#endif
int
seaf_commit_manager_add_commit (SeafCommitManager *mgr,
SeafCommit *commit)
{
int ret;
/* add_commit_to_cache (mgr, commit); */
if ((ret = save_commit (mgr, commit->repo_id, commit->version, commit)) < 0)
return -1;
return 0;
}
void
seaf_commit_manager_del_commit (SeafCommitManager *mgr,
const char *repo_id,
int version,
const char *id)
{
g_return_if_fail (id != NULL);
#if 0
commit = g_hash_table_lookup(mgr->priv->commit_cache, id);
if (!commit)
goto delete;
/*
* Catch ref count bug here. We have bug in commit ref, the
* following assert can't pass. TODO: fix the commit ref bug
*/
/* g_assert (commit->ref <= 1); */
remove_commit_from_cache (mgr, commit);
delete:
#endif
delete_commit (mgr, repo_id, version, id);
}
SeafCommit*
seaf_commit_manager_get_commit (SeafCommitManager *mgr,
const char *repo_id,
int version,
const char *id)
{
SeafCommit *commit;
#if 0
commit = g_hash_table_lookup (mgr->priv->commit_cache, id);
if (commit != NULL) {
seaf_commit_ref (commit);
return commit;
}
#endif
commit = load_commit (mgr, repo_id, version, id);
if (!commit)
return NULL;
/* add_commit_to_cache (mgr, commit); */
return commit;
}
SeafCommit *
seaf_commit_manager_get_commit_compatible (SeafCommitManager *mgr,
const char *repo_id,
const char *id)
{
SeafCommit *commit = NULL;
/* First try version 1 layout. */
commit = seaf_commit_manager_get_commit (mgr, repo_id, 1, id);
if (commit)
return commit;
#if defined MIGRATION || defined SEAFILE_CLIENT
/* For compatibility with version 0. */
commit = seaf_commit_manager_get_commit (mgr, repo_id, 0, id);
#endif
return commit;
}
static gint
compare_commit_by_time (gconstpointer a, gconstpointer b, gpointer unused)
{
const SeafCommit *commit_a = a;
const SeafCommit *commit_b = b;
/* Latest commit comes first in the list. */
return (commit_b->ctime - commit_a->ctime);
}
inline static int
insert_parent_commit (GList **list, GHashTable *hash,
const char *repo_id, int version,
const char *parent_id, gboolean allow_truncate)
{
SeafCommit *p;
char *key;
if (g_hash_table_lookup (hash, parent_id) != NULL)
return 0;
p = seaf_commit_manager_get_commit (seaf->commit_mgr,
repo_id, version,
parent_id);
if (!p) {
if (allow_truncate)
return 0;
seaf_warning ("Failed to find commit %s\n", parent_id);
return -1;
}
*list = g_list_insert_sorted_with_data (*list, p,
compare_commit_by_time,
NULL);
key = g_strdup (parent_id);
g_hash_table_replace (hash, key, key);
return 0;
}
gboolean
seaf_commit_manager_traverse_commit_tree_with_limit (SeafCommitManager *mgr,
const char *repo_id,
int version,
const char *head,
CommitTraverseFunc func,
int limit,
void *data,
gboolean skip_errors)
{
SeafCommit *commit;
GList *list = NULL;
GHashTable *commit_hash;
gboolean ret = TRUE;
/* A hash table for recording id of traversed commits. */
commit_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
commit = seaf_commit_manager_get_commit (mgr, repo_id, version, head);
if (!commit) {
seaf_warning ("Failed to find commit %s.\n", head);
return FALSE;
}
list = g_list_insert_sorted_with_data (list, commit,
compare_commit_by_time,
NULL);
char *key = g_strdup (commit->commit_id);
g_hash_table_replace (commit_hash, key, key);
int count = 0;
while (list) {
gboolean stop = FALSE;
commit = list->data;
list = g_list_delete_link (list, list);
if (!func (commit, data, &stop)) {
if (!skip_errors) {
seaf_commit_unref (commit);
ret = FALSE;
goto out;
}
}
/* Stop when limit is reached. If limit < 0, there is no limit; */
if (limit > 0 && ++count == limit) {
seaf_commit_unref (commit);
break;
}
if (stop) {
seaf_commit_unref (commit);
/* stop traverse down from this commit,
* but not stop traversing the tree
*/
continue;
}
if (commit->parent_id) {
if (insert_parent_commit (&list, commit_hash, repo_id, version,
commit->parent_id, FALSE) < 0) {
if (!skip_errors) {
seaf_commit_unref (commit);
ret = FALSE;
goto out;
}
}
}
if (commit->second_parent_id) {
if (insert_parent_commit (&list, commit_hash, repo_id, version,
commit->second_parent_id, FALSE) < 0) {
if (!skip_errors) {
seaf_commit_unref (commit);
ret = FALSE;
goto out;
}
}
}
seaf_commit_unref (commit);
}
out:
g_hash_table_destroy (commit_hash);
while (list) {
commit = list->data;
seaf_commit_unref (commit);
list = g_list_delete_link (list, list);
}
return ret;
}
static gboolean
traverse_commit_tree_common (SeafCommitManager *mgr,
const char *repo_id,
int version,
const char *head,
CommitTraverseFunc func,
void *data,
gboolean skip_errors,
gboolean allow_truncate)
{
SeafCommit *commit;
GList *list = NULL;
GHashTable *commit_hash;
gboolean ret = TRUE;
commit = seaf_commit_manager_get_commit (mgr, repo_id, version, head);
if (!commit) {
seaf_warning ("Failed to find commit %s.\n", head);
// For head commit corrupted, directly return FALSE
// user can repair head by fsck then retraverse the tree
return FALSE;
}
/* A hash table for recording id of traversed commits. */
commit_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
list = g_list_insert_sorted_with_data (list, commit,
compare_commit_by_time,
NULL);
char *key = g_strdup (commit->commit_id);
g_hash_table_replace (commit_hash, key, key);
while (list) {
gboolean stop = FALSE;
commit = list->data;
list = g_list_delete_link (list, list);
if (!func (commit, data, &stop)) {
seaf_warning("[comit-mgr] CommitTraverseFunc failed\n");
/* If skip errors, continue to traverse parents. */
if (!skip_errors) {
seaf_commit_unref (commit);
ret = FALSE;
goto out;
}
}
if (stop) {
seaf_commit_unref (commit);
/* stop traverse down from this commit,
* but not stop traversing the tree
*/
continue;
}
if (commit->parent_id) {
if (insert_parent_commit (&list, commit_hash, repo_id, version,
commit->parent_id, allow_truncate) < 0) {
seaf_warning("[comit-mgr] insert parent commit failed\n");
/* If skip errors, try insert second parent. */
if (!skip_errors) {
seaf_commit_unref (commit);
ret = FALSE;
goto out;
}
}
}
if (commit->second_parent_id) {
if (insert_parent_commit (&list, commit_hash, repo_id, version,
commit->second_parent_id, allow_truncate) < 0) {
seaf_warning("[comit-mgr]insert second parent commit failed\n");
if (!skip_errors) {
seaf_commit_unref (commit);
ret = FALSE;
goto out;
}
}
}
seaf_commit_unref (commit);
}
out:
g_hash_table_destroy (commit_hash);
while (list) {
commit = list->data;
seaf_commit_unref (commit);
list = g_list_delete_link (list, list);
}
return ret;
}
gboolean
seaf_commit_manager_traverse_commit_tree (SeafCommitManager *mgr,
const char *repo_id,
int version,
const char *head,
CommitTraverseFunc func,
void *data,
gboolean skip_errors)
{
return traverse_commit_tree_common (mgr, repo_id, version, head,
func, data, skip_errors, FALSE);
}
gboolean
seaf_commit_manager_traverse_commit_tree_truncated (SeafCommitManager *mgr,
const char *repo_id,
int version,
const char *head,
CommitTraverseFunc func,
void *data,
gboolean skip_errors)
{
return traverse_commit_tree_common (mgr, repo_id, version, head,
func, data, skip_errors, TRUE);
}
gboolean
seaf_commit_manager_commit_exists (SeafCommitManager *mgr,
const char *repo_id,
int version,
const char *id)
{
#if 0
commit = g_hash_table_lookup (mgr->priv->commit_cache, id);
if (commit != NULL)
return TRUE;
#endif
return seaf_obj_store_obj_exists (mgr->obj_store, repo_id, version, id);
}
static json_t *
commit_to_json_object (SeafCommit *commit)
{
json_t *object;
object = json_object ();
json_object_set_string_member (object, "commit_id", commit->commit_id);
json_object_set_string_member (object, "root_id", commit->root_id);
json_object_set_string_member (object, "repo_id", commit->repo_id);
if (commit->creator_name)
json_object_set_string_member (object, "creator_name", commit->creator_name);
json_object_set_string_member (object, "creator", commit->creator_id);
json_object_set_string_member (object, "description", commit->desc);
json_object_set_int_member (object, "ctime", (gint64)commit->ctime);
json_object_set_string_or_null_member (object, "parent_id", commit->parent_id);
json_object_set_string_or_null_member (object, "second_parent_id",
commit->second_parent_id);
/*
* also save repo's properties to commit file, for easy sharing of
* repo info
*/
json_object_set_string_member (object, "repo_name", commit->repo_name);
json_object_set_string_member (object, "repo_desc",
commit->repo_desc);
json_object_set_string_or_null_member (object, "repo_category",
commit->repo_category);
if (commit->device_name)
json_object_set_string_member (object, "device_name", commit->device_name);
if (commit->client_version)
json_object_set_string_member (object, "client_version", commit->client_version);
if (commit->encrypted)
json_object_set_string_member (object, "encrypted", "true");
if (commit->encrypted) {
json_object_set_int_member (object, "enc_version", commit->enc_version);
if (commit->enc_version >= 1 && !commit->pwd_hash)
json_object_set_string_member (object, "magic", commit->magic);
if (commit->enc_version >= 2)
json_object_set_string_member (object, "key", commit->random_key);
if (commit->enc_version >= 3)
json_object_set_string_member (object, "salt", commit->salt);
if (commit->pwd_hash) {
json_object_set_string_member (object, "pwd_hash", commit->pwd_hash);
json_object_set_string_member (object, "pwd_hash_algo", commit->pwd_hash_algo);
json_object_set_string_member (object, "pwd_hash_params", commit->pwd_hash_params);
}
}
if (commit->no_local_history)
json_object_set_int_member (object, "no_local_history", 1);
if (commit->version != 0)
json_object_set_int_member (object, "version", commit->version);
if (commit->conflict)
json_object_set_int_member (object, "conflict", 1);
if (commit->new_merge)
json_object_set_int_member (object, "new_merge", 1);
if (commit->repaired)
json_object_set_int_member (object, "repaired", 1);
return object;
}
static SeafCommit *
commit_from_json_object (const char *commit_id, json_t *object)
{
SeafCommit *commit = NULL;
const char *root_id;
const char *repo_id;
const char *creator_name = NULL;
const char *creator;
const char *desc;
gint64 ctime;
const char *parent_id, *second_parent_id;
const char *repo_name;
const char *repo_desc;
const char *repo_category;
const char *device_name;
const char *client_version;
const char *encrypted = NULL;
int enc_version = 0;
const char *magic = NULL;
const char *random_key = NULL;
const char *salt = NULL;
const char *pwd_hash = NULL;
const char *pwd_hash_algo = NULL;
const char *pwd_hash_params = NULL;
int no_local_history = 0;
int version = 0;
int conflict = 0, new_merge = 0;
int repaired = 0;
root_id = json_object_get_string_member (object, "root_id");
repo_id = json_object_get_string_member (object, "repo_id");
if (json_object_has_member (object, "creator_name"))
creator_name = json_object_get_string_or_null_member (object, "creator_name");
creator = json_object_get_string_member (object, "creator");
desc = json_object_get_string_member (object, "description");
if (!desc)
desc = "";
ctime = (guint64) json_object_get_int_member (object, "ctime");
parent_id = json_object_get_string_or_null_member (object, "parent_id");
second_parent_id = json_object_get_string_or_null_member (object, "second_parent_id");
repo_name = json_object_get_string_member (object, "repo_name");
if (!repo_name)
repo_name = "";
repo_desc = json_object_get_string_member (object, "repo_desc");
if (!repo_desc)
repo_desc = "";
repo_category = json_object_get_string_or_null_member (object, "repo_category");
device_name = json_object_get_string_or_null_member (object, "device_name");
client_version = json_object_get_string_or_null_member (object, "client_version");
if (json_object_has_member (object, "encrypted"))
encrypted = json_object_get_string_or_null_member (object, "encrypted");
if (encrypted && strcmp(encrypted, "true") == 0
&& json_object_has_member (object, "enc_version")) {
enc_version = json_object_get_int_member (object, "enc_version");
magic = json_object_get_string_member (object, "magic");
pwd_hash = json_object_get_string_member (object, "pwd_hash");
pwd_hash_algo = json_object_get_string_member (object, "pwd_hash_algo");
pwd_hash_params = json_object_get_string_member (object, "pwd_hash_params");
}
if (enc_version >= 2)
random_key = json_object_get_string_member (object, "key");
if (enc_version >= 3)
salt = json_object_get_string_member (object, "salt");
if (json_object_has_member (object, "no_local_history"))
no_local_history = json_object_get_int_member (object, "no_local_history");
if (json_object_has_member (object, "version"))
version = json_object_get_int_member (object, "version");
if (json_object_has_member (object, "new_merge"))
new_merge = json_object_get_int_member (object, "new_merge");
if (json_object_has_member (object, "conflict"))
conflict = json_object_get_int_member (object, "conflict");
if (json_object_has_member (object, "repaired"))
repaired = json_object_get_int_member (object, "repaired");
/* sanity check for incoming values. */
if (!repo_id || !is_uuid_valid(repo_id) ||
!root_id || !is_object_id_valid(root_id) ||
!creator || strlen(creator) != 40 ||
(parent_id && !is_object_id_valid(parent_id)) ||
(second_parent_id && !is_object_id_valid(second_parent_id)))
return commit;
// If pwd_hash is set, the magic field is no longer included in the commit of the newly created repo.
if (!magic)
magic = pwd_hash;
switch (enc_version) {
case 0:
break;
case 1:
if (!magic || strlen(magic) != 32)
return NULL;
break;
case 2:
if (!magic || strlen(magic) != 64)
return NULL;
if (!random_key || strlen(random_key) != 96)
return NULL;
break;
case 3:
if (!magic || strlen(magic) != 64)
return NULL;
if (!random_key || strlen(random_key) != 96)
return NULL;
if (!salt || strlen(salt) != 64)
return NULL;
break;
case 4:
if (!magic || strlen(magic) != 64)
return NULL;
if (!random_key || strlen(random_key) != 96)
return NULL;
if (!salt || strlen(salt) != 64)
return NULL;
break;
default:
seaf_warning ("Unknown encryption version %d.\n", enc_version);
return NULL;
}
char *creator_name_l = creator_name ? g_ascii_strdown (creator_name, -1) : NULL;
commit = seaf_commit_new (commit_id, repo_id, root_id,
creator_name_l, creator, desc, ctime);
g_free (creator_name_l);
commit->parent_id = parent_id ? g_strdup(parent_id) : NULL;
commit->second_parent_id = second_parent_id ? g_strdup(second_parent_id) : NULL;
commit->repo_name = g_strdup(repo_name);
commit->repo_desc = g_strdup(repo_desc);
if (encrypted && strcmp(encrypted, "true") == 0)
commit->encrypted = TRUE;
else
commit->encrypted = FALSE;
if (repo_category)
commit->repo_category = g_strdup(repo_category);
commit->device_name = g_strdup(device_name);
commit->client_version = g_strdup(client_version);
if (commit->encrypted) {
commit->enc_version = enc_version;
if (enc_version >= 1 && !pwd_hash)
commit->magic = g_strdup(magic);
if (enc_version >= 2)
commit->random_key = g_strdup (random_key);
if (enc_version >= 3)
commit->salt = g_strdup(salt);
if (pwd_hash) {
commit->pwd_hash = g_strdup (pwd_hash);
commit->pwd_hash_algo = g_strdup (pwd_hash_algo);
commit->pwd_hash_params = g_strdup (pwd_hash_params);
}
}
if (no_local_history)
commit->no_local_history = TRUE;
commit->version = version;
if (new_merge)
commit->new_merge = TRUE;
if (conflict)
commit->conflict = TRUE;
if (repaired)
commit->repaired = TRUE;
return commit;
}
static SeafCommit *
load_commit (SeafCommitManager *mgr,
const char *repo_id,
int version,
const char *commit_id)
{
char *data = NULL;
int len;
SeafCommit *commit = NULL;
json_t *object = NULL;
json_error_t jerror;
if (!commit_id || strlen(commit_id) != 40)
return NULL;
if (seaf_obj_store_read_obj (mgr->obj_store, repo_id, version,
commit_id, (void **)&data, &len) < 0)
return NULL;
object = json_loadb (data, len, 0, &jerror);
if (!object) {
/* Perhaps the commit object contains invalid UTF-8 character. */
if (data[len-1] == 0)
clean_utf8_data (data, len - 1);
else
clean_utf8_data (data, len);
object = json_loadb (data, len, 0, &jerror);
if (!object) {
seaf_warning ("Failed to load commit json object: %s.\n", jerror.text);
goto out;
}
}
commit = commit_from_json_object (commit_id, object);
if (commit)
commit->manager = mgr;
out:
if (object) json_decref (object);
g_free (data);
return commit;
}
static int
save_commit (SeafCommitManager *manager,
const char *repo_id,
int version,
SeafCommit *commit)
{
json_t *object = NULL;
char *data;
gsize len;
object = commit_to_json_object (commit);
data = json_dumps (object, 0);
len = strlen (data);
json_decref (object);
#ifdef SEAFILE_SERVER
if (seaf_obj_store_write_obj (manager->obj_store,
repo_id, version,
commit->commit_id,
data, (int)len, TRUE) < 0) {
g_free (data);
return -1;
}
#else
if (seaf_obj_store_write_obj (manager->obj_store,
repo_id, version,
commit->commit_id,
data, (int)len, FALSE) < 0) {
g_free (data);
return -1;
}
#endif
free (data);
return 0;
}
static void
delete_commit (SeafCommitManager *mgr,
const char *repo_id,
int version,
const char *id)
{
seaf_obj_store_delete_obj (mgr->obj_store, repo_id, version, id);
}
int
seaf_commit_manager_remove_store (SeafCommitManager *mgr,
const char *store_id)
{
return seaf_obj_store_remove_store (mgr->obj_store, store_id);
}
================================================
FILE: common/commit-mgr.h
================================================
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#ifndef SEAF_COMMIT_MGR_H
#define SEAF_COMMIT_MGR_H
struct _SeafCommitManager;
typedef struct _SeafCommit SeafCommit;
#include <glib/gstdio.h>
#include "db.h"
#include "obj-store.h"
struct _SeafCommit {
struct _SeafCommitManager *manager;
int ref;
char commit_id[41];
char repo_id[37];
char root_id[41]; /* the fs root */
char *desc;
char *creator_name; // creator_name is user's email.
char creator_id[41];
guint64 ctime; /* creation time */
char *parent_id;
char *second_parent_id;
char *repo_name;
char *repo_desc;
char *repo_category;
char *device_name;
char *client_version;
gboolean encrypted;
int enc_version;
char *magic;
char *random_key;
char *salt;
char *pwd_hash;
char *pwd_hash_algo;
char *pwd_hash_params;
gboolean no_local_history;
int version;
gboolean new_merge;
gboolean conflict;
gboolean repaired;
};
/**
* @commit_id: if this is NULL, will create a new id.
* @ctime: if this is 0, will use current time.
*
* Any new commit should be added to commit manager before used.
*/
SeafCommit *
seaf_commit_new (const char *commit_id,
const char *repo_id,
const char *root_id,
const char *author_name,
const char *creator_id,
const char *desc,
guint64 ctime);
char *
seaf_commit_to_data (SeafCommit *commit, gsize *len);
SeafCommit *
seaf_commit_from_data (const char *id, char *data, gsize len);
void
seaf_commit_ref (SeafCommit *commit);
void
seaf_commit_unref (SeafCommit *commit);
/* Set stop to TRUE if you want to stop traversing a branch in the history graph.
Note, if currently there are multi branches, this function will be called again.
So, set stop to TRUE not always stop traversing the history graph.
*/
typedef gboolean (*CommitTraverseFunc) (SeafCommit *commit, void *data, gboolean *stop);
struct _SeafileSession;
typedef struct _SeafCommitManager SeafCommitManager;
typedef struct _SeafCommitManagerPriv SeafCommitManagerPriv;
struct _SeafCommitManager {
struct _SeafileSession *seaf;
sqlite3 *db;
struct SeafObjStore *obj_store;
SeafCommitManagerPriv *priv;
};
SeafCommitManager *
seaf_commit_manager_new (struct _SeafileSession *seaf);
int
seaf_commit_manager_init (SeafCommitManager *mgr);
/**
* Add a commit to commit manager and persist it to disk.
* Any new commit should be added to commit manager before used.
* This function increments ref count of the commit object.
* Not MT safe.
*/
int
seaf_commit_manager_add_commit (SeafCommitManager *mgr, SeafCommit *commit);
/**
* Delete a commit from commit manager and permanently remove it from disk.
* A commit object to be deleted should have ref cournt <= 1.
* Not MT safe.
*/
void
seaf_commit_manager_del_commit (SeafCommitManager *mgr,
const char *repo_id,
int version,
const char *id);
/**
* Find a commit object.
* This function increments ref count of returned object.
* Not MT safe.
*/
SeafCommit*
seaf_commit_manager_get_commit (SeafCommitManager *mgr,
const char *repo_id,
int version,
const char *id);
/**
* Get a commit object, with compatibility between version 0 and version 1.
* It will first try to get commit with version 1 layout; if fails, will
* try version 0 layout for compatibility.
* This is useful for loading a repo. In that case, we don't know the version
* of the repo before loading its head commit.
*/
SeafCommit *
seaf_commit_manager_get_commit_compatible (SeafCommitManager *mgr,
const char *repo_id,
const char *id);
/**
* Traverse the commits DAG start from head in topological order.
* The ordering is based on commit time.
* return FALSE if some commits is missing, TRUE otherwise.
*/
gboolean
seaf_commit_manager_traverse_commit_tree (SeafCommitManager *mgr,
const char *repo_id,
int version,
const char *head,
CommitTraverseFunc func,
void *data,
gboolean skip_errors);
/*
* The same as the above function, but stops traverse down if parent commit
* doesn't exists, instead of returning error.
*/
gboolean
seaf_commit_manager_traverse_commit_tree_truncated (SeafCommitManager *mgr,
const char *repo_id,
int version,
const char *head,
CommitTraverseFunc func,
void *data,
gboolean skip_errors);
/**
* Works the same as seaf_commit_manager_traverse_commit_tree, but stops
* traversing when a total number of _limit_ commits is reached. If
* limit <= 0, there is no limit
*/
gboolean
seaf_commit_manager_traverse_commit_tree_with_limit (SeafCommitManager *mgr,
const char *repo_id,
int version,
const char *head,
CommitTraverseFunc func,
int limit,
void *data,
gboolean skip_errors);
gboolean
seaf_commit_manager_commit_exists (SeafCommitManager *mgr,
const char *repo_id,
int version,
const char *id);
int
seaf_commit_manager_remove_store (SeafCommitManager *mgr,
const char *store_id);
#endif
================================================
FILE: common/common.h
================================================
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#ifndef COMMON_H
#define COMMON_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifndef WIN32
#include <unistd.h>
#include <utime.h>
#endif
#include <stdlib.h>
#include <stdint.h> /* uint32_t */
#include <sys/types.h> /* size_t */
#include <errno.h>
#include <string.h>
#include <limits.h>
#include <stdio.h>
#include <glib.h>
#include <glib/gstdio.h>
#ifdef WIN32
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#if !defined S_ISDIR
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
#define F_OK 0
#endif
#define EMPTY_SHA1 "0000000000000000000000000000000000000000"
#define CURRENT_ENC_VERSION 3
#define DEFAULT_PROTO_VERSION 1
#define CURRENT_PROTO_VERSION 7
#define CURRENT_REPO_VERSION 1
#define CURRENT_SYNC_PROTO_VERSION 2
/* For compatibility with the old protocol, use an UUID for signature.
* Listen manager on the server will use the new block tx protocol if it
* receives this signature as "token".
*/
#define BLOCK_PROTOCOL_SIGNATURE "529319a0-577f-4d6b-a6c3-3c20f56f290c"
#define SEAF_PATH_MAX 4096
#endif
================================================
FILE: common/curl-init.c
================================================
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include "common.h"
#ifndef USE_GPL_CRYPTO
#include <curl/curl.h>
#include <openssl/crypto.h>
#include <pthread.h>
#include "curl-init.h"
pthread_mutex_t* curl_locks = NULL;
void seafile_curl_locking_callback(int mode, int n, const char* file, int line)
{
if (mode & CRYPTO_LOCK) {
pthread_mutex_lock (&curl_locks[n]);
} else {
pthread_mutex_unlock (&curl_locks[n]);
}
}
void seafile_curl_init()
{
int i;
curl_locks = malloc (sizeof(pthread_mutex_t) * CRYPTO_num_locks());
for (i = 0; i < CRYPTO_num_locks(); ++i) {
pthread_mutex_init (&curl_locks[i], NULL);
}
#ifndef WIN32
/* On Windows it's better to use the default id_function.
* As per http://linux.die.net/man/3/crypto_set_id_callback,
* the default id_functioin uses system's default thread
* identifying API.
*/
CRYPTO_set_id_callback (pthread_self);
#endif
CRYPTO_set_locking_callback (seafile_curl_locking_callback);
}
void seafile_curl_deinit()
{
int i;
CRYPTO_set_id_callback (0);
CRYPTO_set_locking_callback (0);
for (i = 0; i < CRYPTO_num_locks(); ++i) {
pthread_mutex_destroy (&curl_locks[i]);
}
free (curl_locks);
}
#endif
================================================
FILE: common/curl-init.h
================================================
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#ifndef __CURL_INIT_H__
#define __CURL_INIT_H__
void seafile_curl_init(void);
void seafile_curl_deinit(void);
#endif
================================================
FILE: common/diff-simple.c
================================================
#include "common.h"
#include "diff-simple.h"
#include "utils.h"
#include "log.h"
DiffEntry *
diff_entry_new (char type, char status, unsigned char *sha1, const char *name)
{
DiffEntry *de = g_new0 (DiffEntry, 1);
de->type = type;
de->status = status;
memcpy (de->sha1, sha1, 20);
de->name = g_strdup(name);
return de;
}
DiffEntry *
diff_entry_new_from_dirent (char type, char status,
SeafDirent *dent, const char *basedir)
{
DiffEntry *de = g_new0 (DiffEntry, 1);
unsigned char sha1[20];
char *path;
hex_to_rawdata (dent->id, sha1, 20);
path = g_strconcat (basedir, dent->name, NULL);
de->type = type;
de->status = status;
memcpy (de->sha1, sha1, 20);
de->name = path;
if (type == DIFF_TYPE_COMMITS &&
(status == DIFF_STATUS_ADDED ||
status == DIFF_STATUS_MODIFIED ||
status == DIFF_STATUS_DIR_ADDED ||
status == DIFF_STATUS_DIR_DELETED)) {
de->mtime = dent->mtime;
de->mode = dent->mode;
de->modifier = g_strdup(dent->modifier);
de->size = dent->size;
}
return de;
}
void
diff_entry_free (DiffEntry *de)
{
g_free (de->name);
if (de->new_name)
g_free (de->new_name);
g_free (de->modifier);
g_free (de);
}
inline static gboolean
dirent_same (SeafDirent *denta, SeafDirent *dentb)
{
return (strcmp (dentb->id, denta->id) == 0 &&
denta->mode == dentb->mode &&
denta->mtime == dentb->mtime);
}
static int
diff_files (int n, SeafDirent *dents[], const char *basedir, DiffOptions *opt)
{
SeafDirent *files[3];
int i, n_files = 0;
memset (files, 0, sizeof(files[0])*n);
for (i = 0; i < n; ++i) {
if (dents[i] && S_ISREG(dents[i]->mode)) {
files[i] = dents[i];
++n_files;
}
}
if (n_files == 0)
return 0;
return opt->file_cb (n, basedir, files, opt->data);
}
static int
diff_trees_recursive (int n, SeafDir *trees[],
const char *basedir, DiffOptions *opt);
static int
diff_directories (int n, SeafDirent *dents[], const char *basedir, DiffOptions *opt)
{
SeafDirent *dirs[3];
int i, n_dirs = 0;
char *dirname = "";
int ret;
SeafDir *sub_dirs[3], *dir;
memset (dirs, 0, sizeof(dirs[0])*n);
for (i = 0; i < n; ++i) {
if (dents[i] && S_ISDIR(dents[i]->mode)) {
dirs[i] = dents[i];
++n_dirs;
}
}
if (n_dirs == 0)
return 0;
gboolean recurse = TRUE;
ret = opt->dir_cb (n, basedir, dirs, opt->data, &recurse);
if (ret < 0)
return ret;
if (!recurse)
return 0;
memset (sub_dirs, 0, sizeof(sub_dirs[0])*n);
for (i = 0; i < n; ++i) {
if (dents[i] != NULL && S_ISDIR(dents[i]->mode)) {
dir = seaf_fs_manager_get_seafdir (seaf->fs_mgr,
opt->store_id,
opt->version,
dents[i]->id);
if (!dir) {
seaf_warning ("Failed to find dir %s:%s.\n",
opt->store_id, dents[i]->id);
ret = -1;
goto free_sub_dirs;
}
sub_dirs[i] = dir;
dirname = dents[i]->name;
}
}
char *new_basedir = g_strconcat (basedir, dirname, "/", NULL);
ret = diff_trees_recursive (n, sub_dirs, new_basedir, opt);
g_free (new_basedir);
free_sub_dirs:
for (i = 0; i < n; ++i)
seaf_dir_free (sub_dirs[i]);
return ret;
}
static int
diff_trees_recursive (int n, SeafDir *trees[],
const char *basedir, DiffOptions *opt)
{
GList *ptrs[3];
SeafDirent *dents[3];
int i;
SeafDirent *dent;
char *first_name;
gboolean done;
int ret = 0;
for (i = 0; i < n; ++i) {
if (trees[i])
ptrs[i] = trees[i]->entries;
else
ptrs[i] = NULL;
}
while (1) {
first_name = NULL;
memset (dents, 0, sizeof(dents[0])*n);
done = TRUE;
/* Find the "largest" name, assuming dirents are sorted. */
for (i = 0; i < n; ++i) {
if (ptrs[i] != NULL) {
done = FALSE;
dent = ptrs[i]->data;
if (!first_name)
first_name = dent->name;
else if (strcmp(dent->name, first_name) > 0)
first_name = dent->name;
}
}
if (done)
break;
/*
* Setup dir entries for all names that equal to first_name
*/
for (i = 0; i < n; ++i) {
if (ptrs[i] != NULL) {
dent = ptrs[i]->data;
if (strcmp(first_name, dent->name) == 0) {
dents[i] = dent;
ptrs[i] = ptrs[i]->next;
}
}
}
if (n == 2 && dents[0] && dents[1] && dirent_same(dents[0], dents[1]))
continue;
if (n == 3 && dents[0] && dents[1] && dents[2] &&
dirent_same(dents[0], dents[1]) && dirent_same(dents[0], dents[2]))
continue;
/* Diff files of this level. */
ret = diff_files (n, dents, basedir, opt);
if (ret < 0)
return ret;
/* Recurse into sub level. */
ret = diff_directories (n, dents, basedir, opt);
if (ret < 0)
return ret;
}
return ret;
}
int
diff_trees (int n, const char *roots[], DiffOptions *opt)
{
SeafDir **trees, *root;
int i, ret;
g_return_val_if_fail (n == 2 || n == 3, -1);
trees = g_new0 (SeafDir *, n);
for (i = 0; i < n; ++i) {
root = seaf_fs_manager_get_seafdir (seaf->fs_mgr,
opt->store_id,
opt->version,
roots[i]);
if (!root) {
seaf_warning ("Failed to find dir %s:%s.\n", opt->store_id, roots[i]);
g_free (trees);
return -1;
}
trees[i] = root;
}
ret = diff_trees_recursive (n, trees, "", opt);
for (i = 0; i < n; ++i)
seaf_dir_free (trees[i]);
g_free (trees);
return ret;
}
typedef struct DiffData {
GList **results;
gboolean fold_dir_diff;
} DiffData;
static int
twoway_diff_files (int n, const char *basedir, SeafDirent *files[], void *vdata)
{
DiffData *data = vdata;
GList **results = data->results;
DiffEntry *de;
SeafDirent *tree1 = files[0];
SeafDirent *tree2 = files[1];
if (!tree1) {
de = diff_entry_new_from_dirent (DIFF_TYPE_COMMITS, DIFF_STATUS_ADDED,
tree2, basedir);
*results = g_list_prepend (*results, de);
return 0;
}
if (!tree2) {
de = diff_entry_new_from_dirent (DIFF_TYPE_COMMITS, DIFF_STATUS_DELETED,
tree1, basedir);
*results = g_list_prepend (*results, de);
return 0;
}
if (!dirent_same (tree1, tree2)) {
de = diff_entry_new_from_dirent (DIFF_TYPE_COMMITS, DIFF_STATUS_MODIFIED,
tree2, basedir);
*results = g_list_prepend (*results, de);
}
return 0;
}
static int
twoway_diff_dirs (int n, const char *basedir, SeafDirent *dirs[], void *vdata,
gboolean *recurse)
{
DiffData *data = vdata;
GList **results = data->results;
DiffEntry *de;
SeafDirent *tree1 = dirs[0];
SeafDirent *tree2 = dirs[1];
if (!tree1) {
if (strcmp (tree2->id, EMPTY_SHA1) == 0 || data->fold_dir_diff) {
de = diff_entry_new_from_dirent (DIFF_TYPE_COMMITS, DIFF_STATUS_DIR_ADDED,
tree2, basedir);
*results = g_list_prepend (*results, de);
*recurse = FALSE;
} else
*recurse = TRUE;
return 0;
}
if (!tree2) {
de = diff_entry_new_from_dirent (DIFF_TYPE_COMMITS,
DIFF_STATUS_DIR_DELETED,
tree1, basedir);
*results = g_list_prepend (*results, de);
if (data->fold_dir_diff) {
*recurse = FALSE;
} else
*recurse = TRUE;
return 0;
}
return 0;
}
int
diff_commits (SeafCommit *commit1, SeafCommit *commit2, GList **results,
gboolean fold_dir_diff)
{
SeafRepo *repo = NULL;
DiffOptions opt;
const char *roots[2];
repo = seaf_repo_manager_get_repo (seaf->repo_mgr, commit1->repo_id);
if (!repo) {
seaf_warning ("Failed to get repo %s.\n", commit1->repo_id);
return -1;
}
DiffData data;
memset (&data, 0, sizeof(data));
data.results = results;
data.fold_dir_diff = fold_dir_diff;
memset (&opt, 0, sizeof(opt));
memcpy (opt.store_id, repo->id, 36);
opt.version = repo->version;
opt.file_cb = twoway_diff_files;
opt.dir_cb = twoway_diff_dirs;
opt.data = &data;
roots[0] = commit1->root_id;
roots[1] = commit2->root_id;
diff_trees (2, roots, &opt);
diff_resolve_renames (results);
return 0;
}
int
diff_commit_roots (const char *store_id, int version,
const char *root1, const char *root2, GList **results,
gboolean fold_dir_diff)
{
DiffOptions opt;
const char *roots[2];
DiffData data;
memset (&data, 0, sizeof(data));
data.results = results;
data.fold_dir_diff = fold_dir_diff;
memset (&opt, 0, sizeof(opt));
memcpy (opt.store_id, store_id, 36);
opt.version = version;
opt.file_cb = twoway_diff_files;
opt.dir_cb = twoway_diff_dirs;
opt.data = &data;
roots[0] = root1;
roots[1] = root2;
diff_trees (2, roots, &opt);
diff_resolve_renames (results);
return 0;
}
static int
threeway_diff_files (int n, const char *basedir, SeafDirent *files[], void *vdata)
{
DiffData *data = vdata;
SeafDirent *m = files[0];
SeafDirent *p1 = files[1];
SeafDirent *p2 = files[2];
GList **results = data->results;
DiffEntry *de;
/* diff m with both p1 and p2. */
if (m && p1 && p2) {
if (!dirent_same(m, p1) && !dirent_same (m, p2)) {
de = diff_entry_new_from_dirent (DIFF_TYPE_COMMITS, DIFF_STATUS_MODIFIED,
m, basedir);
*results = g_list_prepend (*results, de);
}
} else if (!m && p1 && p2) {
de = diff_entry_new_from_dirent (DIFF_TYPE_COMMITS, DIFF_STATUS_DELETED,
p1, basedir);
*results = g_list_prepend (*results, de);
} else if (m && !p1 && p2) {
if (!dirent_same (m, p2)) {
de = diff_entry_new_from_dirent (DIFF_TYPE_COMMITS, DIFF_STATUS_MODIFIED,
m, basedir);
*results = g_list_prepend (*results, de);
}
} else if (m && p1 && !p2) {
if (!dirent_same (m, p1)) {
de = diff_entry_new_from_dirent (DIFF_TYPE_COMMITS, DIFF_STATUS_MODIFIED,
m, basedir);
*results = g_list_prepend (*results, de);
}
} else if (m && !p1 && !p2) {
de = diff_entry_new_from_dirent (DIFF_TYPE_COMMITS, DIFF_STATUS_ADDED,
m, basedir);
*results = g_list_prepend (*results, de);
}
/* Nothing to do for:
* 1. !m && p1 && !p2;
* 2. !m && !p1 && p2;
* 3. !m && !p1 && !p2 (should not happen)
*/
return 0;
}
static int
threeway_diff_dirs (int n, const char *basedir, SeafDirent *dirs[], void *vdata,
gboolean *recurse)
{
*recurse = TRUE;
return 0;
}
int
diff_merge (SeafCommit *merge, GList **results, gboolean fold_dir_diff)
{
SeafRepo *repo = NULL;
DiffOptions opt;
const char *roots[3];
SeafCommit *parent1, *parent2;
g_return_val_if_fail (*results == NULL, -1);
g_return_val_if_fail (merge->parent_id != NULL &&
merge->second_parent_id != NULL,
-1);
repo = seaf_repo_manager_get_repo (seaf->repo_mgr, merge->repo_id);
if (!repo) {
seaf_warning ("Failed to get repo %s.\n", merge->repo_id);
return -1;
}
parent1 = seaf_commit_manager_get_commit (seaf->commit_mgr,
repo->id,
repo->version,
merge->parent_id);
if (!parent1) {
seaf_warning ("failed to find commit %s:%s.\n", repo->id, merge->parent_id);
return -1;
}
parent2 = seaf_commit_manager_get_commit (seaf->commit_mgr,
repo->id,
repo->version,
merge->second_parent_id);
if (!parent2) {
seaf_warning ("failed to find commit %s:%s.\n",
repo->id, merge->second_parent_id);
seaf_commit_unref (parent1);
return -1;
}
DiffData data;
memset (&data, 0, sizeof(data));
data.results = results;
data.fold_dir_diff = fold_dir_diff;
memset (&opt, 0, sizeof(opt));
memcpy (opt.store_id, repo->id, 36);
opt.version = repo->version;
opt.file_cb = threeway_diff_files;
opt.dir_cb = threeway_diff_dirs;
opt.data = &data;
roots[0] = merge->root_id;
roots[1] = parent1->root_id;
roots[2] = parent2->root_id;
int ret = diff_trees (3, roots, &opt);
diff_resolve_renames (results);
seaf_commit_unref (parent1);
seaf_commit_unref (parent2);
return ret;
}
int
diff_merge_roots (const char *store_id, int version,
const char *merged_root, const char *p1_root, const char *p2_root,
GList **results, gboolean fold_dir_diff)
{
DiffOptions opt;
const char *roots[3];
g_return_val_if_fail (*results == NULL, -1);
DiffData data;
memset (&data, 0, sizeof(data));
data.results = results;
data.fold_dir_diff = fold_dir_diff;
memset (&opt, 0, sizeof(opt));
memcpy (opt.store_id, store_id, 36);
opt.version = version;
opt.file_cb = threeway_diff_files;
opt.dir_cb = threeway_diff_dirs;
opt.data = &data;
roots[0] = merged_root;
roots[1] = p1_root;
roots[2] = p2_root;
diff_trees (3, roots, &opt);
diff_resolve_renames (results);
return 0;
}
/* This function only resolve "strict" rename, i.e. two files must be
* exactly the same.
* Don't detect rename of empty files and empty dirs.
*/
void
diff_resolve_renames (GList **diff_entries)
{
GHashTable *deleted;
GList *p;
GList *added = NULL;
DiffEntry *de;
unsigned char empty_sha1[20];
memset (empty_sha1, 0, 20);
/* Hash and equal functions for raw sha1. */
deleted = g_hash_table_new (ccnet_sha1_hash, ccnet_sha1_equal);
/* Collect all "deleted" entries. */
for (p = *diff_entries; p != NULL; p = p->next) {
de = p->data;
if ((de->status == DIFF_STATUS_DELETED ||
de->status == DIFF_STATUS_DIR_DELETED) &&
memcmp (de->sha1, empty_sha1, 20) != 0)
g_hash_table_insert (deleted, de->sha1, p);
}
/* Collect all "added" entries into a separate list. */
for (p = *diff_entries; p != NULL; p = p->next) {
de = p->data;
if ((de->status == DIFF_STATUS_ADDED ||
de->status == DIFF_STATUS_DIR_ADDED) &&
memcmp (de->sha1, empty_sha1, 20) != 0)
added = g_list_prepend (added, p);
}
/* For each "added" entry, if we find a "deleted" entry with
* the same content, we find a rename pair.
*/
p = added;
while (p != NULL) {
GList *p_add, *p_del;
DiffEntry *de_add, *de_del, *de_rename;
int rename_status;
p_add = p->data;
de_add = p_add->data;
p_del = g_hash_table_lookup (deleted, de_add->sha1);
if (p_del) {
de_del = p_del->data;
if (de_add->status == DIFF_STATUS_DIR_ADDED)
rename_status = DIFF_STATUS_DIR_RENAMED;
else
rename_status = DIFF_STATUS_RENAMED;
de_rename = diff_entry_new (de_del->type, rename_status,
de_del->sha1, de_del->name);
de_rename->new_name = g_strdup(de_add->name);
*diff_entries = g_list_delete_link (*diff_entries, p_add);
*diff_entries = g_list_delete_link (*diff_entries, p_del);
*diff_entries = g_list_prepend (*diff_entries, de_rename);
g_hash_table_remove (deleted, de_add->sha1);
diff_entry_free (de_add);
diff_entry_free (de_del);
}
p = g_list_delete_link (p, p);
}
g_hash_table_destroy (deleted);
}
static gboolean
is_redundant_empty_dir (DiffEntry *de_dir, DiffEntry *de_file)
{
int dir_len;
if (de_dir->status == DIFF_STATUS_DIR_ADDED &&
de_file->status == DIFF_STATUS_DELETED)
{
dir_len = strlen (de_dir->name);
if (strlen (de_file->name) > dir_len &&
strncmp (de_dir->name, de_file->name, dir_len) == 0)
return TRUE;
}
if (de_dir->status == DIFF_STATUS_DIR_DELETED &&
de_file->status == DIFF_STATUS_ADDED)
{
dir_len = strlen (de_dir->name);
if (strlen (de_file->name) > dir_len &&
strncmp (de_dir->name, de_file->name, dir_len) == 0)
return TRUE;
}
return FALSE;
}
/*
* An empty dir entry may be added by deleting all the files under it.
* Similarly, an empty dir entry may be deleted by adding some file in it.
* In both cases, we don't want to include the empty dir entry in the
* diff results.
*/
void
diff_resolve_empty_dirs (GList **diff_entries)
{
GList *empty_dirs = NULL;
GList *p, *dir, *file;
DiffEntry *de, *de_dir, *de_file;
for (p = *diff_entries; p != NULL; p = p->next) {
de = p->data;
if (de->status == DIFF_STATUS_DIR_ADDED ||
de->status == DIFF_STATUS_DIR_DELETED)
empty_dirs = g_list_prepend (empty_dirs, p);
}
for (dir = empty_dirs; dir != NULL; dir = dir->next) {
de_dir = ((GList *)dir->data)->data;
for (file = *diff_entries; file != NULL; file = file->next) {
de_file = file->data;
if (is_redundant_empty_dir (de_dir, de_file)) {
*diff_entries = g_list_delete_link (*diff_entries, dir->data);
break;
}
}
}
g_list_free (empty_dirs);
}
int diff_unmerged_state(int mask)
{
mask >>= 1;
switch (mask) {
case 7:
return STATUS_UNMERGED_BOTH_CHANGED;
case 3:
return STATUS_UNMERGED_OTHERS_REMOVED;
case 5:
return STATUS_UNMERGED_I_REMOVED;
case 6:
return STATUS_UNMERGED_BOTH_ADDED;
case 2:
return STATUS_UNMERGED_DFC_I_ADDED_FILE;
case 4:
return STATUS_UNMERGED_DFC_OTHERS_ADDED_FILE;
default:
seaf_warning ("Unexpected unmerged case\n");
}
return 0;
}
char *
format_diff_results(GList *results)
{
GList *ptr;
GString *fmt_status;
DiffEntry *de;
fmt_status = g_string_new("");
for (ptr = results; ptr; ptr = ptr->next) {
de = ptr->data;
if (de->status != DIFF_STATUS_RENAMED)
g_string_append_printf(fmt_status, "%c %c %d %u %s\n",
de->type, de->status, de->unmerge_state,
(int)strlen(de->name), de->name);
else
g_string_append_printf(fmt_status, "%c %c %d %u %s %u %s\n",
de->type, de->status, de->unmerge_state,
(int)strlen(de->name), de->name,
(int)strlen(de->new_name), de->new_name);
}
return g_string_free(fmt_status, FALSE);
}
inline static char *
get_basename (char *path)
{
char *slash;
slash = strrchr (path, '/');
if (!slash)
return path;
return (slash + 1);
}
char *
diff_results_to_description (GList *results)
{
GList *p;
DiffEntry *de;
char *add_mod_file = NULL, *removed_file = NULL;
char *renamed_file = NULL, *renamed_dir = NULL;
char *new_dir = NULL, *removed_dir = NULL;
int n_add_mod = 0, n_removed = 0, n_renamed = 0;
int n_new_dir = 0, n_removed_dir = 0, n_renamed_dir = 0;
GString *desc;
if (results == NULL)
return NULL;
for (p = results; p != NULL; p = p->next) {
de = p->data;
switch (de->status) {
case DIFF_STATUS_ADDED:
if (n_add_mod == 0)
add_mod_file = get_basename(de->name);
n_add_mod++;
break;
case DIFF_STATUS_DELETED:
if (n_removed == 0)
removed_file = get_basename(de->name);
n_removed++;
break;
case DIFF_STATUS_RENAMED:
if (n_renamed == 0)
renamed_file = get_basename(de->name);
n_renamed++;
break;
case DIFF_STATUS_DIR_RENAMED:
if (n_renamed_dir == 0)
renamed_dir = get_basename(de->name);
n_renamed_dir++;
break;
case DIFF_STATUS_MODIFIED:
if (n_add_mod == 0)
add_mod_file = get_basename(de->name);
n_add_mod++;
break;
case DIFF_STATUS_DIR_ADDED:
if (n_new_dir == 0)
new_dir = get_basename(de->name);
n_new_dir++;
break;
case DIFF_STATUS_DIR_DELETED:
if (n_removed_dir == 0)
removed_dir = get_basename(de->name);
n_removed_dir++;
break;
}
}
desc = g_string_new ("");
if (n_add_mod == 1)
g_string_append_printf (desc, "Added or modified \"%s\".\n", add_mod_file);
else if (n_add_mod > 1)
g_string_append_printf (desc, "Added or modified \"%s\" and %d more files.\n",
add_mod_file, n_add_mod - 1);
if (n_removed == 1)
g_string_append_printf (desc, "Deleted \"%s\".\n", removed_file);
else if (n_removed > 1)
g_string_append_printf (desc, "Deleted \"%s\" and %d more files.\n",
removed_file, n_removed - 1);
if (n_renamed == 1)
g_string_append_printf (desc, "Renamed \"%s\".\n", renamed_file);
else if (n_renamed > 1)
g_string_append_printf (desc, "Renamed \"%s\" and %d more files.\n",
renamed_file, n_renamed - 1);
if (n_renamed_dir == 1)
g_string_append_printf (desc, "Renamed directory \"%s\".\n", renamed_dir);
else if (n_renamed_dir > 1)
g_string_append_printf (desc, "Renamed \"%s\" and %d more directories.\n",
renamed_dir, n_renamed_dir - 1);
if (n_new_dir == 1)
g_string_append_printf (desc, "Added directory \"%s\".\n", new_dir);
else if (n_new_dir > 1)
g_string_append_printf (desc, "Added \"%s\" and %d more directories.\n",
new_dir, n_new_dir - 1);
if (n_removed_dir == 1)
g_string_append_printf (desc, "Removed directory \"%s\".\n", removed_dir);
else if (n_removed_dir > 1)
g_string_append_printf (desc, "Removed \"%s\" and %d more directories.\n",
removed_dir, n_removed_dir - 1);
return g_string_free (desc, FALSE);
}
================================================
FILE: common/diff-simple.h
================================================
#ifndef DIFF_SIMPLE_H
#define DIFF_SIMPLE_H
#include <glib.h>
#ifndef SEAFILE_SERVER
#include "index/index.h"
#endif
#include "seafile-session.h"
#define DIFF_TYPE_WORKTREE 'W' /* diff from index to worktree */
#define DIFF_TYPE_INDEX 'I' /* diff from commit to index */
#define DIFF_TYPE_COMMITS 'C' /* diff between two commits*/
#define DIFF_STATUS_ADDED 'A'
#define DIFF_STATUS_DELETED 'D'
#define DIFF_STATUS_MODIFIED 'M'
#define DIFF_STATUS_RENAMED 'R'
#define DIFF_STATUS_UNMERGED 'U'
#define DIFF_STATUS_DIR_ADDED 'B'
#define DIFF_STATUS_DIR_DELETED 'C'
#define DIFF_STATUS_DIR_RENAMED 'E'
enum {
STATUS_UNMERGED_NONE,
/* I and others modified the same file differently. */
STATUS_UNMERGED_BOTH_CHANGED,
/* I and others created the same file with different contents. */
STATUS_UNMERGED_BOTH_ADDED,
/* I removed a file while others modified it. */
STATUS_UNMERGED_I_REMOVED,
/* Others removed a file while I modified it. */
STATUS_UNMERGED_OTHERS_REMOVED,
/* I replace a directory with a file while others modified files under the directory. */
STATUS_UNMERGED_DFC_I_ADDED_FILE,
/* Others replace a directory with a file while I modified files under the directory. */
STATUS_UNMERGED_DFC_OTHERS_ADDED_FILE,
};
typedef struct DiffEntry {
char type;
char status;
int unmerge_state;
unsigned char sha1[20]; /* used for resolve rename */
char *name;
char *new_name; /* only used in rename. */
#ifdef SEAFILE_CLIENT
/* Fields only used for ADDED, DIR_ADDED, MODIFIED types,
* used in check out files/dirs.*/
gint64 mtime;
unsigned int mode;
char *modifier;
gint64 size;
#endif
} DiffEntry;
DiffEntry *
diff_entry_new (char type, char status, unsigned char *sha1, const char *name);
void
diff_entry_free (DiffEntry *de);
#ifndef SEAFILE_SERVER
int
diff_index (const char *repo_id, int version,
struct index_state *istate, SeafDir *root, GList **results);
#endif
/*
* @fold_dir_diff: if TRUE, only the top level directory will be included
* in the diff result if a directory with files is added or removed.
* Otherwise all the files in the direcotory will be recursively
* included in the diff result.
*/
int
diff_commits (SeafCommit *commit1, SeafCommit *commit2, GList **results,
gboolean fold_dir_diff);
int
diff_commit_roots (const char *store_id, int version,
const char *root1, const char *root2, GList **results,
gboolean fold_dir_diff);
int
diff_merge (SeafCommit *merge, GList **results, gboolean fold_dir_diff);
int
diff_merge_roots (const char *store_id, int version,
const char *merged_root, const char *p1_root, const char *p2_root,
GList **results, gboolean fold_dir_diff);
void
diff_resolve_renames (GList **diff_entries);
void
diff_resolve_empty_dirs (GList **diff_entries);
int
diff_unmerged_state(int mask);
char *
format_diff_results(GList *results);
char *
diff_results_to_description (GList *results);
typedef int (*DiffFileCB) (int n,
con
gitextract_gmo0gv1b/ ├── .gitignore ├── .travis.yml ├── LICENSE.txt ├── Makefile.am ├── README.markdown ├── app/ │ ├── Makefile.am │ └── seaf-cli ├── autogen.sh ├── common/ │ ├── Makefile.am │ ├── block-backend-fs.c │ ├── block-backend.c │ ├── block-backend.h │ ├── block-mgr.c │ ├── block-mgr.h │ ├── block.h │ ├── branch-mgr.c │ ├── branch-mgr.h │ ├── cdc/ │ │ ├── Makefile.am │ │ ├── cdc.c │ │ ├── cdc.h │ │ ├── rabin-checksum.c │ │ └── rabin-checksum.h │ ├── commit-mgr.c │ ├── commit-mgr.h │ ├── common.h │ ├── curl-init.c │ ├── curl-init.h │ ├── diff-simple.c │ ├── diff-simple.h │ ├── fs-mgr.c │ ├── fs-mgr.h │ ├── index/ │ │ ├── Makefile.am │ │ ├── cache-tree.c │ │ ├── cache-tree.h │ │ ├── hash.c │ │ ├── hash.h │ │ ├── index.c │ │ ├── index.h │ │ └── name-hash.c │ ├── log.c │ ├── log.h │ ├── mq-mgr.c │ ├── mq-mgr.h │ ├── obj-backend-fs.c │ ├── obj-backend.h │ ├── obj-store.c │ ├── obj-store.h │ ├── password-hash.c │ ├── password-hash.h │ ├── rpc-service.c │ ├── seafile-crypt.c │ ├── seafile-crypt.h │ ├── vc-common.c │ └── vc-common.h ├── configure.ac ├── daemon/ │ ├── Makefile.am │ ├── c_bpwrapper.cpp │ ├── c_bpwrapper.h │ ├── cevent.c │ ├── cevent.h │ ├── change-set.c │ ├── change-set.h │ ├── clone-mgr.c │ ├── clone-mgr.h │ ├── filelock-mgr.c │ ├── filelock-mgr.h │ ├── http-tx-mgr.c │ ├── http-tx-mgr.h │ ├── job-mgr.c │ ├── job-mgr.h │ ├── notif-mgr.c │ ├── notif-mgr.h │ ├── repo-mgr.c │ ├── repo-mgr.h │ ├── seaf-daemon.c │ ├── seafile-config.c │ ├── seafile-config.h │ ├── seafile-error-impl.h │ ├── seafile-error.c │ ├── seafile-session.c │ ├── seafile-session.h │ ├── set-perm.c │ ├── set-perm.h │ ├── sync-mgr.c │ ├── sync-mgr.h │ ├── sync-status-tree.c │ ├── sync-status-tree.h │ ├── test-sync-tree.c │ ├── timer.c │ ├── timer.h │ ├── vc-utils.c │ ├── vc-utils.h │ ├── wt-monitor-linux.c │ ├── wt-monitor-macos.c │ ├── wt-monitor-structs.c │ ├── wt-monitor-structs.h │ ├── wt-monitor-win32.c │ ├── wt-monitor.c │ └── wt-monitor.h ├── debian/ │ ├── README.Debian │ ├── changelog │ ├── compat │ ├── control │ ├── copyright │ ├── dirs │ ├── docs │ ├── libseafile-dev.install │ ├── libseafile0.install │ ├── patches/ │ │ ├── fix-pkgconfig-paths.patch │ │ └── series │ ├── rules │ ├── seafile-cli.install │ ├── seafile-daemon.install │ └── source/ │ └── format ├── dmg/ │ └── seafileLayout/ │ ├── Icons/ │ │ ├── LayoutItem.042D24CE-36D9-4328-A97F-BCF3DC524509.icns │ │ ├── LayoutItem.209D5BB3-143C-4DB8-8FB9-F1175B8184F2.icns │ │ ├── LayoutItem.7DCEB33C-3B26-463C-9D52-D2E99ADD0AD0.icns │ │ ├── LayoutItem.830478CF-49D6-4772-AC6C-3A56A329536F.icns │ │ ├── LayoutItem.CFA83A1B-E783-4354-88A9-255F0F623398.icns │ │ └── LayoutItem.E417B39C-5B93-4D7D-AE5A-FC3B0CDFD9D7.icns │ ├── Info.plist │ └── Preview.icns ├── doc/ │ ├── Makefile.am │ ├── cli-readme.txt │ ├── seaf-cli.1 │ └── seaf-daemon.1 ├── include/ │ ├── Makefile.am │ ├── seafile-error.h │ ├── seafile-rpc.h │ └── seafile.h ├── integration-tests/ │ └── install-deps.sh ├── lib/ │ ├── Makefile.am │ ├── db.c │ ├── db.h │ ├── include.h │ ├── libseafile.pc.in │ ├── net.c │ ├── net.h │ ├── repo.c │ ├── repo.vala │ ├── rpc_table.py │ ├── seafile-object.h │ ├── seafile-rpc-wrapper.c │ ├── searpc-marshal.h │ ├── searpc-signature.h │ ├── task.c │ ├── task.vala │ ├── utils.c │ └── utils.h ├── m4/ │ ├── ax_lib_sqlite3.m4 │ ├── glib-gettext.m4 │ └── python.m4 ├── msi/ │ ├── Includes.wxi │ ├── MyInstallDirDlg.wxs │ ├── WixUI_InstallDir_NoLicense.wxs │ ├── custom/ │ │ ├── custom.c │ │ ├── custom.def │ │ ├── seafile_custom.sln │ │ ├── seafile_custom.vcxproj │ │ └── seafile_custom.vcxproj.filters │ ├── de_de.wxl │ ├── en_US.wxl │ ├── seafile.wxs │ ├── strip-files.py │ └── zh_CN.wxl ├── python/ │ ├── Makefile.am │ └── seafile/ │ ├── Makefile.am │ ├── __init__.py │ └── rpcclient.py ├── scripts/ │ ├── breakpad.py │ ├── build/ │ │ ├── build-cli.py │ │ ├── build-deb.py │ │ ├── build-mac-local-py3.py │ │ ├── build-mac-local.py │ │ ├── build-mac.py │ │ ├── build-msi-vs-cn.py │ │ ├── build-msi-vs.py │ │ ├── build-msi.py │ │ ├── gen-deb-src.py │ │ ├── notarize-universal.sh │ │ ├── notarize.sh │ │ └── osx.entitlements │ └── seaf-cli-wrapper.sh ├── seafile.sln ├── seafile.vcxproj ├── setupwin.py ├── tests/ │ └── sync-auto-test/ │ ├── README.md │ ├── __init__.py │ ├── cli1/ │ │ ├── ccnet.conf │ │ └── mykey.peer │ ├── cli2/ │ │ ├── ccnet.conf │ │ └── mykey.peer │ ├── requirements.txt │ ├── run.sh.template │ ├── seaf_op.py │ ├── setting.py │ ├── test.conf.template │ ├── test_cases/ │ │ ├── __init__.py │ │ ├── test_release.py │ │ └── test_simple.py │ └── util.py ├── updateversion.sh └── vcpkg.json
SYMBOL INDEX (2735 symbols across 113 files)
FILE: common/block-backend-fs.c
type _BHandle (line 23) | struct _BHandle {
type FsPriv (line 32) | typedef struct {
function BHandle (line 53) | static BHandle *
function block_backend_fs_read_block (line 99) | static int
function block_backend_fs_write_block (line 107) | static int
function block_backend_fs_close_block (line 115) | static int
function block_backend_fs_block_handle_free (line 126) | static void
function create_parent_path (line 139) | static int
function block_backend_fs_commit_block (line 161) | static int
function gboolean (line 186) | static gboolean
function block_backend_fs_remove_block (line 202) | static int
function BMetadata (line 215) | static BMetadata *
function BMetadata (line 238) | static BMetadata *
function block_backend_fs_foreach_block (line 257) | static int
function block_backend_fs_copy (line 318) | static int
function block_backend_fs_remove_store (line 359) | static int
function block_backend_fs_rewind_block (line 406) | static int
function open_tmp_file (line 447) | static int
function BlockBackend (line 463) | BlockBackend *
FILE: common/block-backend.c
function BlockBackend (line 11) | BlockBackend*
function BlockBackend (line 37) | BlockBackend*
FILE: common/block-backend.h
type BlockBackend (line 8) | typedef struct BlockBackend BlockBackend;
type BlockBackend (line 10) | struct BlockBackend {
FILE: common/block-mgr.c
function SeafBlockManager (line 30) | SeafBlockManager *
function seaf_block_manager_init (line 53) | int
function BlockHandle (line 60) | BlockHandle *
function seaf_block_manager_read_block (line 76) | int
function seaf_block_manager_write_block (line 84) | int
function seaf_block_manager_close_block (line 92) | int
function seaf_block_manager_block_handle_free (line 99) | void
function seaf_block_manager_commit_block (line 106) | int
function gboolean (line 113) | gboolean seaf_block_manager_block_exists (SeafBlockManager *mgr,
function seaf_block_manager_remove_block (line 125) | int
function BlockMetadata (line 138) | BlockMetadata *
function BlockMetadata (line 151) | BlockMetadata *
function seaf_block_manager_foreach_block (line 158) | int
function seaf_block_manager_copy_block (line 170) | int
function gboolean (line 189) | static gboolean
function guint64 (line 202) | guint64
function gboolean (line 215) | gboolean
function seaf_block_manager_remove_store (line 267) | int
function seaf_block_manager_rewind_block (line 274) | int
FILE: common/block-mgr.h
type _SeafileSession (line 12) | struct _SeafileSession
type SeafBlockManager (line 14) | typedef struct _SeafBlockManager SeafBlockManager;
type _SeafBlockManager (line 16) | struct _SeafBlockManager {
type _SeafileSession (line 24) | struct _SeafileSession
FILE: common/block.h
type BlockMetadata (line 6) | typedef struct _BMetadata BlockMetadata;
type BMetadata (line 7) | typedef struct _BMetadata BMetadata;
type _BMetadata (line 9) | struct _BMetadata {
type BlockHandle (line 16) | typedef struct _BHandle BlockHandle;
type BHandle (line 17) | typedef struct _BHandle BHandle;
type gboolean (line 24) | typedef gboolean (*SeafBlockFunc) (const char *store_id,
FILE: common/branch-mgr.c
function SeafBranch (line 17) | SeafBranch *
function seaf_branch_free (line 35) | void
function seaf_branch_list_free (line 43) | void
function seaf_branch_set_commit (line 55) | void
function seaf_branch_ref (line 62) | void
function seaf_branch_unref (line 68) | void
type _SeafBranchManagerPriv (line 78) | struct _SeafBranchManagerPriv {
function SeafBranchManager (line 99) | SeafBranchManager *
function seaf_branch_manager_init (line 115) | int
function open_db (line 127) | static int
function seaf_branch_manager_add_branch (line 184) | int
function seaf_branch_manager_del_branch (line 253) | int
function seaf_branch_manager_update_branch (line 282) | int
function gboolean (line 316) | static gboolean
type RepoUpdateEventData (line 329) | typedef struct {
function publish_repo_update_event (line 334) | static void
function on_branch_updated (line 350) | static void
function seaf_branch_manager_test_and_update_branch (line 364) | int
function SeafBranch (line 430) | static SeafBranch *
function SeafBranch (line 474) | SeafBranch *
function gboolean (line 495) | static gboolean
function SeafBranch (line 507) | static SeafBranch *
function SeafBranch (line 530) | SeafBranch *
function gboolean (line 548) | gboolean
function GList (line 577) | GList *
function gboolean (line 627) | static gboolean
function GList (line 646) | GList *
FILE: common/branch-mgr.h
type SeafBranch (line 7) | typedef struct _SeafBranch SeafBranch;
type _SeafBranch (line 9) | struct _SeafBranch {
type SeafBranchManager (line 26) | typedef struct _SeafBranchManager SeafBranchManager;
type SeafBranchManagerPriv (line 27) | typedef struct _SeafBranchManagerPriv SeafBranchManagerPriv;
type _SeafileSession (line 29) | struct _SeafileSession
type _SeafBranchManager (line 30) | struct _SeafBranchManager {
type _SeafileSession (line 36) | struct _SeafileSession
FILE: common/cdc/cdc.c
function default_write_chunk (line 40) | static int default_write_chunk (CDCDescriptor *chunk_descr)
function init_cdc_file_descriptor (line 58) | static int init_cdc_file_descriptor (int fd,
function file_chunk_cdc (line 114) | int file_chunk_cdc(int fd_src,
function filename_chunk_cdc (line 232) | int filename_chunk_cdc(const char *filename,
function cdc_init (line 248) | void cdc_init ()
FILE: common/cdc/cdc.h
type _CDCFileDescriptor (line 15) | struct _CDCFileDescriptor
type _CDCDescriptor (line 16) | struct _CDCDescriptor
type SeafileCrypt (line 17) | struct SeafileCrypt
type _CDCDescriptor (line 21) | struct _CDCDescriptor
type SeafileCrypt (line 22) | struct SeafileCrypt
type CDCFileDescriptor (line 27) | typedef struct _CDCFileDescriptor {
type CDCDescriptor (line 44) | typedef struct _CDCDescriptor {
type SeafileCrypt (line 54) | struct SeafileCrypt
type SeafileCrypt (line 59) | struct SeafileCrypt
FILE: common/cdc/rabin-checksum.c
type u_int (line 7) | typedef unsigned int u_int;
type u_char (line 11) | typedef unsigned char u_char;
type u_short (line 15) | typedef unsigned short u_short;
type u_long (line 19) | typedef unsigned long u_long;
type u_int16_t (line 23) | typedef uint16_t u_int16_t;
type u_int32_t (line 27) | typedef uint32_t u_int32_t;
type u_int64_t (line 31) | typedef uint64_t u_int64_t;
function u_int (line 59) | static inline u_int fls32 (u_int32_t v)
function fls64 (line 73) | static inline char fls64 (u_int64_t v)
function u_int64_t (line 82) | u_int64_t polymod (u_int64_t nh, u_int64_t nl, u_int64_t d)
function polymult (line 107) | void polymult (u_int64_t *php, u_int64_t *plp, u_int64_t x, u_int64_t y)
function u_int64_t (line 124) | u_int64_t polymmult (u_int64_t x, u_int64_t y, u_int64_t d)
function u_int64_t (line 131) | static u_int64_t append8 (u_int64_t p, u_char m)
function calcT (line 136) | static void calcT (u_int64_t poly)
function calcU (line 147) | static void calcU(int size)
function rabin_init (line 157) | void rabin_init(int len)
function rabin_checksum (line 166) | unsigned int rabin_checksum(char *buf, int len)
function rabin_rolling_checksum (line 176) | unsigned int rabin_rolling_checksum(unsigned int csum, int len,
FILE: common/commit-mgr.c
type _SeafCommitManagerPriv (line 18) | struct _SeafCommitManagerPriv {
function compute_commit_id (line 39) | static void compute_commit_id (SeafCommit* commit)
function SeafCommit (line 62) | SeafCommit*
function SeafCommit (line 126) | SeafCommit *
function seaf_commit_free (line 155) | static void
function seaf_commit_ref (line 174) | void
function seaf_commit_unref (line 180) | void
function SeafCommitManager (line 190) | SeafCommitManager*
function seaf_commit_manager_init (line 202) | int
function add_commit_to_cache (line 230) | inline static void
function remove_commit_from_cache (line 239) | inline static void
function seaf_commit_manager_add_commit (line 247) | int
function seaf_commit_manager_del_commit (line 260) | void
function SeafCommit (line 286) | SeafCommit*
function SeafCommit (line 311) | SeafCommit *
function gint (line 330) | static gint
function insert_parent_commit (line 340) | inline static int
function gboolean (line 371) | gboolean
function gboolean (line 463) | static gboolean
function gboolean (line 557) | gboolean
function gboolean (line 570) | gboolean
function gboolean (line 583) | gboolean
function json_t (line 598) | static json_t *
function SeafCommit (line 662) | static SeafCommit *
function SeafCommit (line 837) | static SeafCommit *
function save_commit (line 882) | static int
function delete_commit (line 921) | static void
function seaf_commit_manager_remove_store (line 930) | int
FILE: common/commit-mgr.h
type _SeafCommitManager (line 6) | struct _SeafCommitManager
type SeafCommit (line 7) | typedef struct _SeafCommit SeafCommit;
type _SeafCommit (line 14) | struct _SeafCommit {
type gboolean (line 82) | typedef gboolean (*CommitTraverseFunc) (SeafCommit *commit, void *data, ...
type _SeafileSession (line 84) | struct _SeafileSession
type SeafCommitManager (line 86) | typedef struct _SeafCommitManager SeafCommitManager;
type SeafCommitManagerPriv (line 87) | typedef struct _SeafCommitManagerPriv SeafCommitManagerPriv;
type _SeafCommitManager (line 89) | struct _SeafCommitManager {
type _SeafileSession (line 99) | struct _SeafileSession
FILE: common/curl-init.c
function seafile_curl_locking_callback (line 15) | void seafile_curl_locking_callback(int mode, int n, const char* file, in...
function seafile_curl_init (line 24) | void seafile_curl_init()
function seafile_curl_deinit (line 43) | void seafile_curl_deinit()
FILE: common/diff-simple.c
function DiffEntry (line 6) | DiffEntry *
function DiffEntry (line 19) | DiffEntry *
function diff_entry_free (line 49) | void
function gboolean (line 61) | inline static gboolean
function diff_files (line 69) | static int
function diff_directories (line 93) | static int
function diff_trees_recursive (line 152) | static int
function diff_trees (line 225) | int
type DiffData (line 256) | typedef struct DiffData {
function twoway_diff_files (line 261) | static int
function twoway_diff_dirs (line 293) | static int
function diff_commits (line 330) | int
function diff_commit_roots (line 365) | int
function threeway_diff_files (line 394) | static int
function threeway_diff_dirs (line 441) | static int
function diff_merge (line 449) | int
function diff_merge_roots (line 513) | int
function diff_resolve_renames (line 549) | void
function gboolean (line 622) | static gboolean
function diff_resolve_empty_dirs (line 654) | void
function diff_unmerged_state (line 682) | int diff_unmerged_state(int mask)
FILE: common/diff-simple.h
type DiffEntry (line 39) | typedef struct DiffEntry {
type index_state (line 66) | struct index_state
type DiffOptions (line 118) | typedef struct DiffOptions {
FILE: common/fs-mgr.c
type _SeafFSManagerPriv (line 33) | struct _SeafFSManagerPriv {
type SeafileOndisk (line 39) | typedef struct SeafileOndisk {
type SeafileOndisk (line 45) | typedef struct SeafileOndisk {
type DirentOndisk (line 53) | typedef struct DirentOndisk {
type DirentOndisk (line 60) | typedef struct DirentOndisk {
type SeafdirOndisk (line 69) | typedef struct SeafdirOndisk {
type SeafdirOndisk (line 74) | typedef struct SeafdirOndisk {
function SeafFSManager (line 90) | SeafFSManager *
function seaf_fs_manager_init (line 109) | int
function checkout_block (line 137) | static int
function free_checkout_block_aux (line 246) | void
function seaf_fs_manager_checkout_file (line 266) | int
function seaf_fs_manager_calculate_seafile_id_json (line 550) | void
function write_seafile (line 586) | static int
function calculate_chunk_size (line 633) | uint32_t
function do_write_chunk (line 646) | static int
function seafile_write_chunk (line 696) | int
function create_cdc_for_empty_file (line 758) | static void
type ChunkingData (line 764) | typedef struct ChunkingData {
function chunking_worker (line 774) | static void
function split_file_to_block (line 827) | static int
function seaf_fs_manager_index_blocks (line 919) | int
function seafile_ref (line 990) | void
function seafile_free (line 996) | static void
function seafile_unref (line 1010) | void
function Seafile (line 1020) | static Seafile *
function Seafile (line 1066) | static Seafile *
function Seafile (line 1125) | static Seafile *
function Seafile (line 1152) | static Seafile *
function Seafile (line 1161) | Seafile *
function guint8 (line 1206) | static guint8 *
function guint8 (line 1227) | static guint8 *
function guint8 (line 1257) | static guint8 *
function seafile_save (line 1280) | int
function compute_dir_id_v0 (line 1302) | static void compute_dir_id_v0 (SeafDir *dir, GList *entries)
function SeafDir (line 1334) | SeafDir *
function seaf_dir_free (line 1358) | void
function SeafDirent (line 1375) | SeafDirent *
function seaf_dirent_free (line 1406) | void
function SeafDirent (line 1416) | SeafDirent *
function SeafDir (line 1428) | static SeafDir *
function SeafDirent (line 1489) | static SeafDirent *
function SeafDir (line 1542) | static SeafDir *
function SeafDir (line 1595) | static SeafDir *
function SeafDir (line 1622) | SeafDir *
function ondisk_dirent_size (line 1632) | inline static int
function add_to_dirent_array (line 1674) | static void
function seaf_dir_save (line 1747) | int
function SeafDir (line 1766) | SeafDir *
function gint (line 1797) | static gint
function gboolean (line 1805) | static gboolean
function SeafDir (line 1828) | SeafDir *
function SeafDir (line 1849) | SeafDir *
function parse_metadata_type_v0 (line 1873) | static int
function parse_metadata_type_json (line 1884) | static int
function seaf_metadata_type_from_data (line 1911) | int
function SeafFSObject (line 1921) | SeafFSObject *
function SeafFSObject (line 1936) | SeafFSObject *
function SeafFSObject (line 1975) | SeafFSObject *
function seaf_fs_object_free (line 1986) | void
function BlockList (line 1998) | BlockList *
function block_list_free (line 2009) | void
function block_list_insert (line 2018) | void
function BlockList (line 2030) | BlockList *
function traverse_file (line 2053) | static int
function traverse_dir (line 2074) | static int
function seaf_fs_manager_traverse_tree (line 2129) | int
function traverse_dir_path (line 2144) | static int
function seaf_fs_manager_traverse_path (line 2197) | int
function gboolean (line 2223) | static gboolean
function seaf_fs_manager_populate_blocklist (line 2249) | int
function gboolean (line 2261) | gboolean
function seaf_fs_manager_delete_object (line 2274) | void
function gint64 (line 2283) | gint64
function gint64 (line 2304) | static gint64
function gint64 (line 2348) | gint64
function count_dir_files (line 2359) | static int
function seaf_fs_manager_count_fs_files (line 2391) | int
function SeafDir (line 2402) | SeafDir *
function SeafDirent (line 2596) | SeafDirent *
function gboolean (line 2644) | static gboolean
function gboolean (line 2721) | static gboolean
function gboolean (line 2741) | static gboolean
function gboolean (line 2751) | gboolean
function gboolean (line 2779) | static gboolean
function gboolean (line 2820) | static gboolean
function gboolean (line 2830) | gboolean
function gboolean (line 2858) | static gboolean
function gboolean (line 2882) | gboolean
function dir_version_from_repo_version (line 2914) | int
function seafile_version_from_repo_version (line 2923) | int
function seaf_fs_manager_remove_store (line 2932) | int
FILE: common/fs-mgr.h
type SeafFSManager (line 25) | typedef struct _SeafFSManager SeafFSManager;
type SeafFSObject (line 26) | typedef struct _SeafFSObject SeafFSObject;
type Seafile (line 27) | typedef struct _Seafile Seafile;
type SeafDir (line 28) | typedef struct _SeafDir SeafDir;
type SeafDirent (line 29) | typedef struct _SeafDirent SeafDirent;
type SeafMetadataType (line 31) | typedef enum {
type _SeafFSObject (line 39) | struct _SeafFSObject {
type _Seafile (line 43) | struct _Seafile {
type _SeafDirent (line 67) | struct _SeafDirent {
type _SeafDir (line 80) | struct _SeafDir {
type BlockList (line 133) | typedef struct {
type _SeafileSession (line 156) | struct _SeafileSession
type SeafFSManagerPriv (line 158) | typedef struct _SeafFSManagerPriv SeafFSManagerPriv;
type _SeafFSManager (line 160) | struct _SeafFSManager {
type _SeafileSession (line 169) | struct _SeafileSession
type _CheckoutBlockAux (line 177) | struct _CheckoutBlockAux {
type CheckoutBlockAux (line 184) | typedef struct _CheckoutBlockAux CheckoutBlockAux;
type _FileCheckoutData (line 191) | struct _FileCheckoutData {
type FileCheckoutData (line 207) | typedef struct _FileCheckoutData FileCheckoutData;
type gboolean (line 293) | typedef gboolean (*TraverseFSTreeCallback) (SeafFSManager *mgr,
type gboolean (line 310) | typedef gboolean (*TraverseFSPathCallback) (SeafFSManager *mgr,
type _CDCFileDescriptor (line 444) | struct _CDCFileDescriptor
type _CDCFileDescriptor (line 447) | struct _CDCFileDescriptor
FILE: common/index/cache-tree.c
type cache_tree (line 19) | struct cache_tree
type cache_tree (line 21) | struct cache_tree
type cache_tree (line 21) | struct cache_tree
function cache_tree_free (line 26) | void cache_tree_free(struct cache_tree **it_p)
function subtree_name_cmp (line 43) | static int subtree_name_cmp(const char *one, int onelen,
function subtree_pos (line 53) | static int subtree_pos(struct cache_tree *it, const char *path, int path...
type cache_tree_sub (line 74) | struct cache_tree_sub
type cache_tree (line 74) | struct cache_tree
type cache_tree_sub (line 79) | struct cache_tree_sub
type cache_tree_sub (line 108) | struct cache_tree_sub
type cache_tree (line 108) | struct cache_tree
type cache_tree_sub (line 115) | struct cache_tree_sub
type cache_tree (line 115) | struct cache_tree
function cache_tree_invalidate_path (line 121) | void cache_tree_invalidate_path(struct cache_tree *it, const char *path)
function verify_cache (line 169) | static int verify_cache(struct cache_entry **cache,
function discard_unused_subtrees (line 225) | static void discard_unused_subtrees(struct cache_tree *it)
function cache_tree_fully_valid (line 243) | int cache_tree_fully_valid(struct cache_tree *it)
function update_one (line 258) | static int update_one(const char *repo_id,
function cache_tree_update (line 336) | int cache_tree_update(const char *repo_id,
function write_one (line 358) | static void write_one(struct strbuf *buffer, struct cache_tree *it,
function cache_tree_write (line 398) | void cache_tree_write(struct strbuf *sb, struct cache_tree *root)
type cache_tree (line 403) | struct cache_tree
type cache_tree (line 409) | struct cache_tree
type cache_tree_sub (line 462) | struct cache_tree_sub
type cache_tree (line 465) | struct cache_tree
type cache_tree_sub (line 466) | struct cache_tree_sub
type cache_tree (line 486) | struct cache_tree
type cache_tree (line 493) | struct cache_tree
type cache_tree (line 493) | struct cache_tree
type cache_tree_sub (line 499) | struct cache_tree_sub
function write_cache_as_tree (line 523) | int write_cache_as_tree(unsigned char *sha1, int flags, const char *prefix)
function prime_cache_tree_rec (line 584) | static void prime_cache_tree_rec(struct cache_tree *it, struct tree *tree)
function prime_cache_tree (line 610) | void prime_cache_tree(struct cache_tree **it, struct tree *tree)
type cache_tree (line 625) | struct cache_tree
type cache_tree (line 625) | struct cache_tree
type traverse_info (line 626) | struct traverse_info
type cache_tree (line 628) | struct cache_tree
function cache_tree_matches_traversal (line 636) | int cache_tree_matches_traversal(struct cache_tree *root,
FILE: common/index/cache-tree.h
type cache_tree (line 6) | struct cache_tree
type cache_tree_sub (line 7) | struct cache_tree_sub {
type cache_tree (line 14) | struct cache_tree {
type cache_tree (line 25) | struct cache_tree
type cache_entry (line 26) | struct cache_entry
type cache_tree_sub (line 27) | struct cache_tree_sub
type cache_tree (line 27) | struct cache_tree
type cache_tree (line 30) | struct cache_tree
type cache_tree (line 31) | struct cache_tree
type cache_tree (line 32) | struct cache_tree
type cache_tree_sub (line 33) | struct cache_tree_sub
type cache_tree (line 33) | struct cache_tree
type cache_tree (line 38) | struct cache_tree
type cache_tree (line 41) | struct cache_tree
type cache_entry (line 41) | struct cache_entry
FILE: common/index/hash.c
type hash_table_entry (line 12) | struct hash_table_entry
type hash_table (line 12) | struct hash_table
type hash_table_entry (line 15) | struct hash_table_entry
type hash_table (line 36) | struct hash_table
type hash_table_entry (line 38) | struct hash_table_entry
function grow_hash_table (line 49) | static void grow_hash_table(struct hash_table *table)
type hash_table (line 69) | struct hash_table
type hash_table (line 76) | struct hash_table
function for_each_hash (line 84) | int for_each_hash(const struct hash_table *table, int (*fn)(void *, void...
function free_hash (line 104) | void free_hash(struct hash_table *table)
FILE: common/index/hash.h
type hash_table_entry (line 21) | struct hash_table_entry {
type hash_table (line 26) | struct hash_table {
type hash_table (line 31) | struct hash_table
type hash_table (line 32) | struct hash_table
type hash_table (line 33) | struct hash_table
type hash_table (line 34) | struct hash_table
function init_hash (line 36) | static inline void init_hash(struct hash_table *table)
FILE: common/index/index.c
function git_munmap (line 53) | int git_munmap(void *start, size_t length)
function set_index_entry (line 59) | static void set_index_entry(struct index_state *istate, int nr, struct c...
function replace_index_entry (line 65) | static void replace_index_entry(struct index_state *istate, int nr, stru...
function verify_hdr (line 75) | static int verify_hdr(struct cache_header *hdr, unsigned long size)
function convert_from_disk (line 101) | static int convert_from_disk(struct ondisk_cache_entry *ondisk, struct c...
function convert_from_disk2 (line 157) | static int convert_from_disk2(struct ondisk_cache_entry2 *ondisk, struct...
function read_modifiers (line 199) | static int read_modifiers (struct index_state *istate, void *data, unsig...
function read_index_extension (line 237) | static int read_index_extension(struct index_state *istate,
function alloc_index (line 250) | static void alloc_index (struct index_state *istate)
function read_index_from (line 265) | int read_index_from(struct index_state *istate, const char *path, int re...
function is_index_unborn (line 394) | int is_index_unborn(struct index_state *istate)
function unmerged_index (line 399) | int unmerged_index(const struct index_state *istate)
function cache_name_compare (line 409) | int cache_name_compare(const char *name1, int flags1, const char *name2,...
function fill_stat_cache_info (line 440) | void fill_stat_cache_info(struct cache_entry *ce, SeafStat *st)
function mark_all_ce_unused (line 459) | void mark_all_ce_unused(struct index_state *index)
function ce_match_stat_basic (line 466) | static int ce_match_stat_basic(struct cache_entry *ce, SeafStat *st)
function is_racy_timestamp (line 525) | static int is_racy_timestamp(const struct index_state *istate, struct ca...
function ce_compare_data (line 542) | static int ce_compare_data(struct cache_entry *ce, SeafStat *st)
function ce_compare_link (line 556) | static int ce_compare_link(struct cache_entry *ce, SeafStat *st)
function ce_modified_check_fs (line 567) | static int ce_modified_check_fs(struct cache_entry *ce, SeafStat *st)
function ie_match_stat (line 585) | int ie_match_stat(struct cache_entry *ce, SeafStat *st,
function df_name_compare (line 653) | int df_name_compare(const char *name1, int len1, int mode1,
function index_name_pos (line 678) | int index_name_pos(const struct index_state *istate, const char *name, i...
function remove_index_entry_at (line 700) | int remove_index_entry_at(struct index_state *istate, int pos)
function remove_marked_cache_entries (line 722) | void remove_marked_cache_entries(struct index_state *istate)
function remove_file_from_index (line 743) | int remove_file_from_index(struct index_state *istate, const char *path)
function ce_same_name (line 754) | int ce_same_name(struct cache_entry *a, struct cache_entry *b)
function ce_path_match (line 760) | int ce_path_match(const struct cache_entry *ce, const char **pathspec)
function verify_dotfile (line 794) | static int verify_dotfile(const char *rest)
function verify_path (line 824) | int verify_path(const char *path)
function remove_empty_parent_dir_entry (line 850) | void remove_empty_parent_dir_entry (struct index_state *istate, const ch...
function add_index_entry_with_check (line 872) | static int add_index_entry_with_check(struct index_state *istate, struct...
function add_index_entry (line 922) | int add_index_entry(struct index_state *istate, struct cache_entry *ce, ...
function add_to_index (line 954) | int add_to_index(const char *repo_id,
function is_garbage_empty_dir (line 1066) | static int is_garbage_empty_dir (struct index_state *istate, struct cach...
type cache_entry (line 1099) | struct cache_entry
type cache_entry (line 1103) | struct cache_entry
function add_empty_dir_to_index (line 1120) | int
function remove_from_index_with_prefix (line 1161) | int
type cache_entry (line 1236) | struct cache_entry
type cache_entry (line 1237) | struct cache_entry
type cache_entry (line 1240) | struct cache_entry
type cache_entry (line 1249) | struct cache_entry
type cache_entry (line 1260) | struct cache_entry
type index_state (line 1261) | struct index_state
type cache_entry (line 1267) | struct cache_entry
type cache_entry (line 1275) | struct cache_entry
type cache_entry (line 1328) | struct cache_entry
type cache_entry (line 1345) | struct cache_entry
function rename_index_entries (line 1352) | int
function add_empty_dir_to_index_with_check (line 1430) | int
function gboolean (line 1496) | inline static gboolean
function IndexDirent (line 1507) | static IndexDirent *
function index_dirent_free (line 1518) | void
function gint (line 1528) | static gint
function GList (line 1536) | GList *
type cache_entry (line 1623) | struct cache_entry
type cache_entry (line 1623) | struct cache_entry
type cache_entry (line 1637) | struct cache_entry
type cache_entry (line 1643) | struct cache_entry
function add_file_to_index (line 1667) | int add_file_to_index(struct index_state *istate, const char *path, int ...
function type_from_string (line 1696) | static int type_from_string(const char *str)
function hash_sha1_file (line 1708) | static void hash_sha1_file(const void *buf, unsigned long len,
function index_mem (line 1721) | static int index_mem(unsigned char *sha1, void *buf, uint64_t size,
function index_fd (line 1733) | int index_fd(unsigned char *sha1, int fd, SeafStat *st,
function index_path (line 1759) | int index_path(unsigned char *sha1, const char *path, SeafStat *st)
type WriteIndexInfo (line 1801) | typedef struct {
function ce_write_flush (line 1807) | static int ce_write_flush(WriteIndexInfo *info, int fd)
function ce_write (line 1819) | static int ce_write(WriteIndexInfo *info, int fd, void *data, unsigned i...
function write_index_ext_header (line 1841) | static int write_index_ext_header(WriteIndexInfo *info, int fd,
function ce_flush (line 1850) | static int ce_flush(WriteIndexInfo *info, int fd)
function ce_smudge_racily_clean_entry (line 1874) | static void ce_smudge_racily_clean_entry(struct cache_entry *ce)
function ce_write_entry2 (line 1923) | static int ce_write_entry2(WriteIndexInfo *info, int fd, struct cache_en...
function modifiers_to_string (line 1948) | static int
function write_index (line 1969) | int write_index(struct index_state *istate, int newfd)
function discard_index (line 2055) | int discard_index(struct index_state *istate)
function cache_entry_free (line 2080) | void cache_entry_free (struct cache_entry *ce)
function remove_name_hash (line 2086) | void remove_name_hash(struct index_state *istate, struct cache_entry *ce)
function add_name_hash (line 2097) | void add_name_hash(struct index_state *istate, struct cache_entry *ce)
type cache_entry (line 2105) | struct cache_entry
type index_state (line 2105) | struct index_state
type cache_entry (line 2113) | struct cache_entry
FILE: common/index/index.h
type SeafileCrypt (line 91) | struct SeafileCrypt
type cache_header (line 98) | struct cache_header {
type cache_time (line 109) | struct cache_time {
type ondisk_cache_entry (line 123) | struct ondisk_cache_entry {
type ondisk_cache_entry (line 137) | struct ondisk_cache_entry {
type cache_time64 (line 152) | struct cache_time64 {
type ondisk_cache_entry2 (line 158) | struct ondisk_cache_entry2 {
type ondisk_cache_entry2 (line 172) | struct ondisk_cache_entry2 {
type ondisk_cache_entry_extended (line 194) | struct ondisk_cache_entry_extended {
type ondisk_cache_entry_extended (line 210) | struct ondisk_cache_entry_extended {
type cache_ext_hdr (line 229) | struct cache_ext_hdr {
type cache_ext_hdr (line 234) | struct cache_ext_hdr {
type cache_entry (line 240) | struct cache_entry {
function copy_cache_entry (line 311) | static inline void copy_cache_entry(struct cache_entry *dst, struct cach...
function create_ce_flags (line 322) | static inline unsigned create_ce_flags(size_t len, unsigned stage)
function ce_namelen (line 329) | static inline size_t ce_namelen(const struct cache_entry *ce)
function create_ce_mode (line 346) | static inline unsigned int create_ce_mode(unsigned int mode)
function ce_mode_from_stat (line 354) | static inline unsigned int ce_mode_from_stat(struct cache_entry *ce, uns...
function ce_to_dtype (line 358) | static inline int ce_to_dtype(const struct cache_entry *ce)
function canon_mode (line 370) | static inline unsigned int canon_mode(unsigned int mode)
type index_state (line 387) | struct index_state {
type index_state (line 403) | struct index_state
type object_type (line 408) | enum object_type {
function object_type (line 422) | static inline enum object_type object_type(unsigned int mode)
type index_state (line 450) | struct index_state
type index_state (line 451) | struct index_state
type index_state (line 452) | struct index_state
type index_state (line 453) | struct index_state
type index_state (line 454) | struct index_state
type index_state (line 455) | struct index_state
type index_state (line 456) | struct index_state
type index_state (line 457) | struct index_state
type index_state (line 459) | struct index_state
type index_state (line 465) | struct index_state
type cache_entry (line 465) | struct cache_entry
type index_state (line 466) | struct index_state
type index_state (line 467) | struct index_state
type index_state (line 468) | struct index_state
type index_state (line 469) | struct index_state
type SeafileCrypt (line 481) | struct SeafileCrypt
type index_state (line 486) | struct index_state
type SeafileCrypt (line 491) | struct SeafileCrypt
type index_state (line 497) | struct index_state
type cache_entry (line 501) | struct cache_entry
type index_state (line 504) | struct index_state
type index_state (line 508) | struct index_state
type index_state (line 516) | struct index_state
type index_state (line 519) | struct index_state
type _IndexDirent (line 521) | struct _IndexDirent {
type IndexDirent (line 526) | typedef struct _IndexDirent IndexDirent;
type index_state (line 532) | struct index_state
type index_state (line 534) | struct index_state
type cache_entry (line 535) | struct cache_entry
type cache_entry (line 536) | struct cache_entry
type cache_entry (line 536) | struct cache_entry
type index_state (line 537) | struct index_state
type cache_entry (line 539) | struct cache_entry
type cache_entry (line 547) | struct cache_entry
type index_state (line 548) | struct index_state
type cache_entry (line 548) | struct cache_entry
type cache_entry (line 550) | struct cache_entry
type object_type (line 551) | enum object_type
type cache_entry (line 553) | struct cache_entry
type index_state (line 554) | struct index_state
type index_state (line 556) | struct index_state
type cache_entry (line 556) | struct cache_entry
type index_state (line 557) | struct index_state
type cache_entry (line 557) | struct cache_entry
type cache_entry (line 558) | struct cache_entry
type index_state (line 558) | struct index_state
function is_null_sha1 (line 571) | static inline int is_null_sha1(const unsigned char *sha1)
function hashcmp (line 575) | static inline int hashcmp(const unsigned char *sha1, const unsigned char...
function hashcpy (line 579) | static inline void hashcpy(unsigned char *sha_dst, const unsigned char *...
function hashclr (line 583) | static inline void hashclr(unsigned char *hash)
FILE: common/index/name-hash.c
function icase_hash (line 18) | static inline unsigned char icase_hash(unsigned char c)
function hash_name (line 23) | unsigned int hash_name(const char *name, int namelen)
function hash_index_entry_directories (line 36) | static void hash_index_entry_directories(struct index_state *istate, str...
function hash_index_entry (line 73) | static void hash_index_entry(struct index_state *istate, struct cache_en...
function lazy_init_name_hash (line 93) | static void lazy_init_name_hash(struct index_state *istate)
function add_name_hash (line 104) | void add_name_hash(struct index_state *istate, struct cache_entry *ce)
function slow_same_name (line 112) | static int slow_same_name(const char *name1, int len1, const char *name2...
function same_name (line 132) | static int same_name(const struct cache_entry *ce, const char *name, int...
type cache_entry (line 162) | struct cache_entry
type index_state (line 162) | struct index_state
type cache_entry (line 165) | struct cache_entry
FILE: common/log.c
function get_syslog_level (line 34) | static int
function seafile_log (line 53) | static void
function ccnet_log (line 85) | static void
function get_debug_level (line 117) | static int
function seafile_log_init (line 129) | int
function seafile_log_reopen (line 157) | const int
function gboolean (line 195) | gboolean
function seafile_debug_set_flags (line 201) | void
function seafile_debug_set_flags_string (line 208) | void
function seafile_debug_impl (line 218) | void
function set_syslog_config (line 231) | void
function FILE (line 243) | FILE *
function seafile_event_log_init (line 254) | int
function seafile_event_log_reopen (line 268) | static int
function seafile_event_message (line 293) | void
function check_and_reopen_log (line 314) | static void
function seafile_log_rotate_start (line 354) | int
FILE: common/log.h
type SeafileDebugFlags (line 36) | typedef enum
FILE: common/mq-mgr.c
type SeafMqManagerPriv (line 6) | typedef struct SeafMqManagerPriv {
function SeafMqManager (line 11) | SeafMqManager *
function seaf_mq_manager_init (line 23) | void
function seaf_mq_manager_publish_notification (line 30) | void
function json_t (line 52) | json_t *
FILE: common/mq-mgr.h
type SeafMqManagerPriv (line 6) | struct SeafMqManagerPriv
type SeafMqManager (line 8) | typedef struct SeafMqManager {
FILE: common/obj-backend-fs.c
type FsPriv (line 23) | typedef struct FsPriv {
function id_to_path (line 30) | static void
function obj_backend_fs_read (line 58) | static int
function fsync_obj_contents (line 101) | static int
function rename_and_sync (line 153) | static int
function save_obj_contents (line 223) | static int
function create_parent_path (line 267) | static int
function obj_backend_fs_write (line 290) | static int
function gboolean (line 327) | static gboolean
function obj_backend_fs_delete (line 344) | static void
function obj_backend_fs_foreach_obj (line 356) | static int
function obj_backend_fs_copy (line 417) | static int
function obj_backend_fs_remove_store (line 458) | static int
function ObjBackend (line 505) | ObjBackend *
FILE: common/obj-backend.h
type ObjBackend (line 7) | typedef struct ObjBackend ObjBackend;
type ObjBackend (line 9) | struct ObjBackend {
FILE: common/obj-store.c
type SeafObjStore (line 12) | struct SeafObjStore {
type SeafObjStore (line 15) | typedef struct SeafObjStore SeafObjStore;
type SeafObjStore (line 20) | struct SeafObjStore
function seaf_obj_store_init (line 38) | int
function seaf_obj_store_read_obj (line 46) | int
function seaf_obj_store_write_obj (line 63) | int
function gboolean (line 81) | gboolean
function seaf_obj_store_delete_obj (line 96) | void
function seaf_obj_store_foreach_obj (line 111) | int
function seaf_obj_store_copy_obj (line 123) | int
function seaf_obj_store_remove_store (line 139) | int
FILE: common/obj-store.h
type _SeafileSession (line 7) | struct _SeafileSession
type SeafObjStore (line 8) | struct SeafObjStore
type CEventManager (line 9) | struct CEventManager
type SeafObjStore (line 11) | struct SeafObjStore
type _SeafileSession (line 12) | struct _SeafileSession
type SeafObjStore (line 15) | struct SeafObjStore
type CEventManager (line 17) | struct CEventManager
type SeafObjStore (line 22) | struct SeafObjStore
type SeafObjStore (line 30) | struct SeafObjStore
type SeafObjStore (line 39) | struct SeafObjStore
type SeafObjStore (line 45) | struct SeafObjStore
type gboolean (line 50) | typedef gboolean (*SeafObjFunc) (const char *repo_id,
type SeafObjStore (line 56) | struct SeafObjStore
type SeafObjStore (line 63) | struct SeafObjStore
type SeafObjStore (line 71) | struct SeafObjStore
FILE: common/password-hash.c
type Pbkdf2Params (line 24) | typedef struct Pbkdf2Params {
function Pbkdf2Params (line 28) | static Pbkdf2Params *
function pbkdf2_sha256_derive_key (line 48) | static int
type Argon2idParams (line 73) | typedef struct Argon2idParams{
function Argon2idParams (line 83) | static Argon2idParams *
function argon2id_derive_key (line 122) | static int
function parse_pwd_hash_params (line 140) | void
function pwd_hash_derive_key (line 162) | int
FILE: common/password-hash.h
type PwdHashParams (line 9) | typedef struct _PwdHashParams {
FILE: common/rpc-service.c
function GObject (line 30) | static GObject*
function free_repo_obj (line 67) | static void
function GList (line 75) | static GList *
function seafile_set_config (line 101) | int
function seafile_set_config_int (line 113) | int
function seafile_get_config_int (line 119) | int
function seafile_set_upload_rate_limit (line 134) | int
function seafile_set_download_rate_limit (line 145) | int
function seafile_check_path_for_clone (line 171) | int
function seafile_cancel_clone_task (line 264) | int
function GList (line 270) | GList *
function seafile_sync (line 295) | int
function SeafileTask (line 306) | static SeafileTask *
function GObject (line 349) | GObject *
function seafile_get_upload_rate (line 361) | int
function seafile_get_download_rate (line 367) | int
function GObject (line 373) | GObject *
function seafile_set_repo_property (line 432) | int
function gchar (line 463) | gchar *
function seafile_update_repos_server_host (line 486) | int
function seafile_calc_dir_size (line 500) | int
function seafile_disable_auto_sync (line 519) | int
function seafile_enable_auto_sync (line 525) | int
function seafile_is_auto_sync_enabled (line 531) | int seafile_is_auto_sync_enabled (GError **error)
function seafile_mark_file_locked (line 571) | int
function seafile_mark_file_unlocked (line 603) | int
function json_t (line 635) | json_t *
function seafile_set_server_property (line 655) | int
function GList (line 672) | GList *
function seafile_del_file_sync_error_by_id (line 678) | int
function GList (line 684) | GList*
function GObject (line 697) | GObject*
function do_unsync_repo (line 721) | static
function cancel_clone_tasks_by_account (line 752) | static void
function seafile_unsync_repos_by_account (line 771) | int
function seafile_remove_repo_tokens_by_account (line 802) | int
function seafile_set_repo_token (line 833) | int
function seafile_destroy_repo (line 863) | int
function GObject (line 887) | GObject *
function GList (line 956) | GList *
function seafile_shutdown (line 1012) | int
function seafile_add_del_confirmation (line 1026) | int
FILE: common/seafile-crypt.c
function SeafileCrypt (line 37) | SeafileCrypt *
function seafile_derive_key (line 50) | int
function seafile_generate_repo_salt (line 137) | int
function seafile_generate_random_key (line 161) | int
function seafile_generate_magic (line 199) | void
function seafile_generate_pwd_hash (line 220) | void
function seafile_verify_repo_passwd (line 251) | int
function seafile_pwd_hash_verify_repo_passwd (line 285) | int
function seafile_decrypt_repo_enc_key (line 318) | int
function seafile_update_random_key (line 367) | int
function seafile_encrypt (line 412) | int
function seafile_decrypt (line 476) | int
function seafile_encrypt (line 539) | int
function seafile_decrypt (line 646) | int
FILE: common/seafile-crypt.h
type SeafileCrypt (line 10) | struct SeafileCrypt {
type SeafileCrypt (line 16) | typedef struct SeafileCrypt SeafileCrypt;
FILE: common/vc-common.c
function gint (line 12) | static gint
function gint (line 22) | static gint
function gboolean (line 31) | static gboolean
function GHashTable (line 42) | static GHashTable *
function GList (line 66) | static GList *
type MergeTraverseData (line 118) | typedef struct {
function gboolean (line 123) | static gboolean
function GList (line 149) | static GList *
function SeafCommit (line 212) | SeafCommit *
function gboolean (line 259) | gboolean
function VCCompareResult (line 270) | VCCompareResult
function diff_parents_with_path (line 317) | static int
function get_file_modifier_mtime_v0 (line 423) | static int
function get_file_modifier_mtime_v1 (line 499) | static int
function get_file_modifier_mtime (line 564) | int
FILE: common/vc-common.h
type VCCompareResult (line 16) | typedef enum {
FILE: daemon/c_bpwrapper.cpp
function wchar_t (line 11) | wchar_t *utf8ToWString(const std::string &src)
function wStringToUtf8 (line 31) | std::string wStringToUtf8(const wchar_t *src)
function wStringToLocale (line 53) | std::string wStringToLocale(const wchar_t *src)
function DumpCallback (line 75) | bool DumpCallback(const wchar_t *dump_path,
function CBPWrapperExceptionHandler (line 90) | CBPWrapperExceptionHandler newCBPWrapperExceptionHandler(const char *dum...
FILE: daemon/cevent.c
type Handler (line 10) | typedef struct Handler {
function CEventManager (line 15) | CEventManager* cevent_manager_new ()
function pipe_callback (line 27) | void pipe_callback (evutil_socket_t fd, short event, void *vmgr)
function cevent_manager_start (line 48) | int cevent_manager_start (CEventManager *manager)
function cevent_manager_register (line 62) | uint32_t cevent_manager_register (CEventManager *manager,
function cevent_manager_unregister (line 85) | void cevent_manager_unregister (CEventManager *manager, uint32_t id)
function cevent_manager_add_event (line 90) | void
FILE: daemon/cevent.h
type CEvent (line 23) | typedef struct CEvent CEvent;
type CEvent (line 27) | struct CEvent {
type CEventManager (line 33) | typedef struct CEventManager CEventManager;
type CEventManager (line 35) | struct CEventManager {
FILE: daemon/change-set.c
type _ChangeSetDir (line 15) | struct _ChangeSetDir {
type ChangeSetDir (line 26) | typedef struct _ChangeSetDir ChangeSetDir;
type _ChangeSetDirent (line 28) | struct _ChangeSetDirent {
type ChangeSetDirent (line 40) | typedef struct _ChangeSetDirent ChangeSetDirent;
function ChangeSetDirent (line 44) | static ChangeSetDirent *
function ChangeSetDirent (line 60) | static ChangeSetDirent *
function SeafDirent (line 67) | static SeafDirent *
function changeset_dirent_free (line 77) | static void
function add_dent_to_dir (line 93) | static void
function remove_dent_from_dir (line 106) | static void
function ChangeSetDir (line 123) | static ChangeSetDir *
function changeset_dir_free (line 149) | static void
function ChangeSetDir (line 161) | static ChangeSetDir *
function gint (line 167) | static gint
function SeafDir (line 175) | static SeafDir *
function ChangeSet (line 204) | ChangeSet *
function changeset_free (line 263) | void
function gboolean (line 274) | static gboolean
function create_new_dent (line 293) | static void
function ChangeSetDir (line 317) | static ChangeSetDir *
function handle_case_conflict (line 335) | static void
function add_to_tree (line 364) | static void
function ChangeSetDirent (line 464) | static ChangeSetDirent *
function apply_to_tree (line 542) | static void
function add_to_changeset (line 573) | void
function remove_from_changeset_recursive (line 586) | static void
function remove_from_changeset (line 615) | void
function gboolean (line 684) | gboolean
FILE: daemon/change-set.h
type _ChangeSetDir (line 9) | struct _ChangeSetDir
type _ChangeSet (line 11) | struct _ChangeSet {
type ChangeSet (line 18) | typedef struct _ChangeSet ChangeSet;
FILE: daemon/clone-mgr.c
function mark_clone_done_v2 (line 50) | static void
function start_clone_v2 (line 126) | static void
function check_head_commit_done (line 168) | static void
function http_check_head_commit (line 186) | static void
function check_http_fileserver_protocol_done (line 228) | static void
function check_http_protocol_done (line 249) | static void
function check_http_protocol (line 278) | static void
function CloneTask (line 293) | static CloneTask *
function clone_task_free (line 316) | static void
function SeafCloneManager (line 343) | SeafCloneManager *
function gboolean (line 362) | static gboolean
function load_clone_enc_info (line 378) | static int
function gboolean (line 394) | static gboolean
function load_clone_repo_version_info (line 407) | static void
function gboolean (line 420) | static gboolean
function load_clone_more_info (line 451) | static void
function gboolean (line 464) | static gboolean
function seaf_clone_manager_init (line 517) | int
function check_connect_pulse (line 553) | static int check_connect_pulse (void *vmanager)
function seaf_clone_manager_start (line 574) | int
function save_task_to_db (line 590) | static int
function remove_task_from_db (line 665) | static int
function transition_state (line 697) | static void
function transition_to_error (line 713) | static void
function add_transfer_task (line 725) | static int
function gboolean (line 749) | static gboolean
function gboolean (line 760) | static gboolean
function remove_trail_slash (line 818) | static inline void
function gboolean (line 894) | inline static gboolean is_separator (char c)
function check_dir_inclusiveness (line 904) | static int
function gboolean (line 951) | gboolean
function gboolean (line 1075) | static gboolean
function gboolean (line 1108) | static gboolean
function gboolean (line 1142) | static gboolean
function seaf_clone_manager_cancel_task (line 1483) | int
function CloneTask (line 1531) | CloneTask *
function GList (line 1538) | GList *
function on_repo_http_fetched (line 1547) | static void
function check_folder_perms_done (line 1599) | static void
function check_folder_permissions (line 1637) | static void
FILE: daemon/clone-mgr.h
type _SeafileSession (line 9) | struct _SeafileSession
type CloneTask (line 11) | typedef struct _CloneTask CloneTask;
type SeafCloneManager (line 12) | typedef struct _SeafCloneManager SeafCloneManager;
type _CloneTask (line 31) | struct _CloneTask {
type _SeafCloneManager (line 69) | struct _SeafCloneManager {
type _SeafileSession (line 77) | struct _SeafileSession
FILE: daemon/filelock-mgr.c
type _FilelockMgrPriv (line 14) | struct _FilelockMgrPriv {
type FilelockMgrPriv (line 20) | typedef struct _FilelockMgrPriv FilelockMgrPriv;
type LockInfo (line 22) | typedef struct _LockInfo {
type _SeafFilelockManager (line 31) | struct _SeafFilelockManager
type _SeafileSession (line 32) | struct _SeafileSession
function lock_info_free (line 50) | static void
function gboolean (line 56) | static gboolean
function seaf_filelock_manager_init (line 81) | int
function init_locks (line 126) | static void
function seaf_filelock_manager_start (line 140) | int
function gboolean (line 162) | gboolean
function gboolean (line 188) | gboolean
function seaf_filelock_manager_get_lock_status (line 214) | int
function seaf_filelock_manager_lock_wt_file (line 246) | void
function seaf_filelock_manager_unlock_wt_file (line 261) | void
function update_in_memory (line 282) | static void
function gint (line 377) | static gint
function update_db (line 385) | static int
function seaf_filelock_manager_update (line 449) | int
function seaf_filelock_manager_update_timestamp (line 461) | int
function gint64 (line 482) | gint64
function seaf_filelock_manager_remove (line 502) | int
function refresh_locked_path_status (line 546) | static void
function mark_file_locked_in_db (line 560) | static int
function seaf_filelock_manager_mark_file_locked (line 590) | int
function remove_locked_file_from_db (line 626) | static int
function seaf_filelock_manager_mark_file_unlocked (line 654) | int
function file_lock_info_free (line 680) | void file_lock_info_free (FileLockInfo *info)
function gboolean (line 688) | static gboolean
function GList (line 707) | GList *
function seaf_filelock_manager_lock_file (line 729) | int
function seaf_filelock_manager_unlock_file (line 749) | int
FILE: daemon/filelock-mgr.h
type _SeafileSession (line 8) | struct _SeafileSession
type _FilelockMgrPriv (line 9) | struct _FilelockMgrPriv
type _SeafFilelockManager (line 11) | struct _SeafFilelockManager {
type SeafFilelockManager (line 16) | typedef struct _SeafFilelockManager SeafFilelockManager;
type _SeafFilelockManager (line 18) | struct _SeafFilelockManager
type _SeafileSession (line 19) | struct _SeafileSession
type FileLockStatus (line 32) | typedef enum FileLockStatus {
type FileLockType (line 43) | typedef enum FileLockType {
type FileLockInfo (line 100) | struct FileLockInfo {
type FileLockInfo (line 105) | typedef struct FileLockInfo FileLockInfo;
FILE: daemon/http-tx-mgr.c
type _Connection (line 55) | struct _Connection {
type Connection (line 60) | typedef struct _Connection Connection;
type _ConnectionPool (line 62) | struct _ConnectionPool {
type ConnectionPool (line 68) | typedef struct _ConnectionPool ConnectionPool;
type _HttpTxPriv (line 70) | struct _HttpTxPriv {
type HttpTxPriv (line 87) | typedef struct _HttpTxPriv HttpTxPriv;
function HttpTxTask (line 91) | HttpTxTask *
function http_tx_task_free (line 123) | void
function Connection (line 159) | static Connection *
function connection_free (line 170) | static void
function ConnectionPool (line 177) | static ConnectionPool *
function ConnectionPool (line 187) | static ConnectionPool *
function Connection (line 203) | static Connection *
function connection_pool_clear (line 218) | static void
function connection_pool_return_connection (line 231) | static void
function HttpTxManager (line 262) | HttpTxManager *
function reset_bytes (line 311) | static int
function http_tx_manager_start (line 337) | int
function write_cert_to_pem_file (line 397) | static void
function load_ca_from_store (line 426) | static int
function create_ca_bundle (line 450) | static int
function load_ca_bundle (line 483) | static void
function load_ca_bundle (line 512) | static void
function gboolean (line 540) | static gboolean
function load_certs_from_db (line 588) | static int
function CURLcode (line 625) | static CURLcode
function set_proxy (line 644) | static void
function sockopt_callback (line 685) | static int
type HttpResponse (line 719) | typedef struct _HttpResponse {
function recv_response (line 724) | static size_t
function http_get (line 756) | static int
type HttpRequest (line 860) | typedef struct _HttpRequest {
function send_request (line 867) | static size_t
function rewind_http_request (line 887) | static size_t
function http_put (line 904) | static int
function http_post (line 1036) | static int
function http_error_to_http_task_error (line 1158) | static int
function handle_http_errors (line 1182) | static void
function curl_error_to_http_task_error (line 1188) | static int
function handle_curl_errors (line 1220) | static void
function emit_transfer_done_signal (line 1226) | static void
function transition_state (line 1235) | static void
type CheckProtocolData (line 1262) | typedef struct {
function parse_protocol_version (line 1274) | static int
function check_protocol_version_done (line 1360) | static void
function http_tx_manager_check_protocol_version (line 1378) | int
type CheckNotifServerData (line 1404) | typedef struct {
function check_notif_server_done (line 1466) | static void
function http_tx_manager_check_notif_server (line 1477) | int
type CheckHeadData (line 1505) | typedef struct {
function parse_head_commit_info (line 1521) | static int
function check_head_commit_done (line 1617) | static void
function http_tx_manager_check_head_commit (line 1637) | int
function http_folder_perm_req_free (line 1672) | void
function http_folder_perm_res_free (line 1681) | void
type GetFolderPermsData (line 1695) | typedef struct {
function GList (line 1732) | static GList *
function parse_folder_perms (line 1792) | static int
function get_folder_perms_done (line 1974) | static void
function http_tx_manager_get_folder_perms (line 1995) | int
function http_locked_files_req_free (line 2025) | void
function http_locked_files_res_free (line 2034) | void
type GetLockedFilesData (line 2044) | typedef struct {
function GHashTable (line 2055) | static GHashTable *
function parse_locked_files (line 2088) | static int
function get_locked_files_done (line 2253) | static void
function http_tx_manager_get_locked_files (line 2271) | int
function http_tx_manager_lock_file (line 2301) | int
function http_tx_manager_unlock_file (line 2356) | int
type APIGetData (line 2411) | typedef struct {
function fileserver_api_get_request_done (line 2477) | static void
function http_tx_manager_fileserver_api_get (line 2499) | int
function GHashTable (line 2553) | static GHashTable *
function GHashTable (line 2588) | GHashTable *
function gboolean (line 2653) | static gboolean
function clean_tasks_for_repo (line 2665) | static void
function check_permission (line 2675) | static int
function http_tx_manager_add_upload (line 2777) | int
function gboolean (line 2840) | static gboolean
type CalcQuotaDeltaData (line 2848) | typedef struct {
function check_quota_and_active_paths_diff_files (line 2854) | static int
function check_quota_and_active_paths_diff_dirs (line 2885) | static int
function calculate_upload_size_delta_and_active_paths (line 2905) | static int
function check_quota (line 2980) | static int
function send_commit_object (line 3018) | static int
type CalcFsListData (line 3070) | typedef struct {
function collect_file_ids (line 3075) | static int
function collect_dir_ids (line 3098) | static int
function GList (line 3122) | static GList *
function upload_check_id_list_segment (line 3199) | static int
type ObjectHeader (line 3301) | typedef struct {
type ObjectHeader (line 3308) | typedef struct {
function send_fs_objects (line 3315) | static int
type CalcBlockListData (line 3400) | typedef struct {
function add_to_block_list (line 3406) | static void
function block_list_diff_files (line 3418) | static int
function block_list_diff_dirs (line 3480) | static int
function calculate_block_list (line 3488) | static int
type SendBlockData (line 3567) | typedef struct {
function send_block_callback (line 3573) | static size_t
function rewind_block_callback (line 3618) | static size_t
function send_block (line 3639) | static int
type BlockUploadData (line 3722) | typedef struct BlockUploadData {
type BlockUploadTask (line 3728) | typedef struct BlockUploadTask {
function block_upload_task_free (line 3734) | static void
function upload_block_thread_func (line 3740) | static void
function multi_threaded_send_blocks (line 3768) | static int
function notify_permission_error (line 3849) | static void
function update_branch (line 3880) | static int
function update_master_branch (line 3939) | static void
function set_path_status_syncing (line 3957) | static void
function set_path_status_synced (line 3971) | static void
function http_upload_done (line 4173) | static void
function http_tx_manager_add_download (line 4191) | int
function get_commit_object (line 4281) | static int
function get_needed_fs_id_list (line 4338) | static int
function get_fs_objects (line 4466) | static int
type GetBlockData (line 4602) | typedef struct {
function get_block_callback (line 4608) | static size_t
function get_block (line 4653) | int
function http_tx_manager_get_block (line 4839) | int
function parse_block_map (line 4903) | static int
function http_tx_manager_get_file_block_map (line 4950) | int
function update_local_repo (line 5017) | static int
function http_download_done (line 5209) | static void
function GList (line 5222) | GList*
function GList (line 5228) | GList*
function HttpTxTask (line 5234) | HttpTxTask *
function http_tx_manager_cancel_task (line 5247) | void
function http_tx_task_get_rate (line 5276) | int
FILE: daemon/http-tx-mgr.h
type HttpTaskState (line 18) | enum HttpTaskState {
type HttpTaskRuntimeState (line 26) | enum HttpTaskRuntimeState {
type _SeafileSession (line 37) | struct _SeafileSession
type _HttpTxPriv (line 38) | struct _HttpTxPriv
type _HttpTxManager (line 40) | struct _HttpTxManager {
type HttpTxManager (line 46) | typedef struct _HttpTxManager HttpTxManager;
type _HttpTxTask (line 48) | struct _HttpTxTask {
type HttpTxTask (line 96) | typedef struct _HttpTxTask HttpTxTask;
type _SeafileSession (line 113) | struct _SeafileSession
type _HttpProtocolVersion (line 145) | struct _HttpProtocolVersion {
type HttpProtocolVersion (line 151) | typedef struct _HttpProtocolVersion HttpProtocolVersion;
type _HttpHeadCommit (line 177) | struct _HttpHeadCommit {
type HttpHeadCommit (line 184) | typedef struct _HttpHeadCommit HttpHeadCommit;
type HttpFolderPermReq (line 200) | typedef struct _HttpFolderPermReq {
type HttpFolderPermRes (line 206) | typedef struct _HttpFolderPermRes {
type _HttpFolderPerms (line 219) | struct _HttpFolderPerms {
type HttpFolderPerms (line 223) | typedef struct _HttpFolderPerms HttpFolderPerms;
type HttpLockedFilesReq (line 237) | typedef struct _HttpLockedFilesReq {
type HttpLockedFilesRes (line 243) | typedef struct _HttpLockedFilesRes {
type _HttpLockedFiles (line 255) | struct _HttpLockedFiles {
type HttpLockedFiles (line 259) | typedef struct _HttpLockedFiles HttpLockedFiles;
type _HttpAPIGetResult (line 290) | struct _HttpAPIGetResult {
type HttpAPIGetResult (line 297) | typedef struct _HttpAPIGetResult HttpAPIGetResult;
FILE: daemon/job-mgr.c
type _SeafJobManager (line 25) | struct _SeafJobManager {
type _SeafJob (line 31) | struct _SeafJob {
type SeafJob (line 44) | typedef struct _SeafJob SeafJob;
function SeafJob (line 46) | SeafJob *
function seaf_job_free (line 55) | void
function job_thread_wrapper (line 61) | static void
function job_done_cb (line 72) | static void
function job_thread_create (line 90) | int
function SeafJobManager (line 107) | SeafJobManager *
function seaf_job_manager_free (line 123) | void
function seaf_job_manager_schedule_job (line 130) | int
FILE: daemon/job-mgr.h
type _SeafJobManager (line 11) | struct _SeafJobManager
type SeafJobManager (line 12) | typedef struct _SeafJobManager SeafJobManager;
type _SeafileSession (line 14) | struct _SeafileSession
type _SeafileSession (line 25) | struct _SeafileSession
type _SeafJobManager (line 28) | struct _SeafJobManager
type _SeafJobManager (line 31) | struct _SeafJobManager
FILE: daemon/notif-mgr.c
type NotifServer (line 24) | typedef struct NotifServer {
type _SeafNotifManagerPriv (line 47) | struct _SeafNotifManagerPriv {
type Message (line 53) | typedef struct Message {
function Message (line 59) | static Message*
function notif_message_free (line 80) | static void
function SeafNotifManager (line 89) | SeafNotifManager *
type URI (line 103) | typedef struct URI {
function URI (line 110) | static URI*
type lws_context (line 160) | struct lws_context
function NotifServer (line 163) | static NotifServer*
function NotifServer (line 223) | NotifServer*
function notif_server_free (line 250) | static void
function notif_server_ref (line 269) | static void
function notif_server_unref (line 275) | static void
function seaf_notif_manager_connect_server (line 293) | void
function disconnect_server (line 329) | static void
function init_client_connect_info (line 345) | static void
function event_callback (line 373) | static int
function handle_repo_update (line 448) | static int
function handle_file_lock (line 488) | static int
function handle_folder_perm (line 562) | static int
function handle_jwt_expired (line 652) | static int
function handle_messages (line 698) | static void
type lws_protocols (line 750) | struct lws_protocols
type lws_context (line 755) | struct lws_context
type lws_context_creation_info (line 758) | struct lws_context_creation_info
type lws_context (line 759) | struct lws_context
function delete_subscribed_repos (line 786) | static void
function delete_unsent_messages (line 803) | static void
type lws_client_connect_info (line 831) | struct lws_client_connect_info
function seaf_notif_manager_subscribe_repo (line 865) | void
function seaf_notif_manager_unsubscribe_repo (line 920) | void
function gboolean (line 972) | gboolean
FILE: daemon/notif-mgr.h
type SeafNotifManager (line 5) | typedef struct _SeafNotifManager SeafNotifManager;
type SeafNotifManagerPriv (line 6) | typedef struct _SeafNotifManagerPriv SeafNotifManagerPriv;
type _SeafileSession (line 8) | struct _SeafileSession
type _SeafNotifManager (line 10) | struct _SeafNotifManager {
type _SeafileSession (line 17) | struct _SeafileSession
FILE: daemon/repo-mgr.c
type _SeafRepoManagerPriv (line 47) | struct _SeafRepoManagerPriv {
function locked_file_free (line 108) | static void
function gboolean (line 117) | static gboolean
function LockedFileSet (line 141) | LockedFileSet *
function locked_file_set_free (line 170) | void
function locked_file_set_add_update (line 179) | int
function locked_file_set_remove (line 260) | int
function LockedFile (line 295) | LockedFile *
function FolderPerm (line 303) | FolderPerm *
function folder_perm_free (line 314) | void
function GList (line 325) | static GList *
function gint (line 340) | static gint
function delete_folder_perm (line 348) | static void
function seaf_repo_manager_delete_folder_perm (line 395) | int
function seaf_repo_manager_update_folder_perm (line 450) | int
function seaf_repo_manager_update_folder_perms (line 560) | int
function gboolean (line 650) | static gboolean
function GList (line 665) | static GList *
function init_folder_perms (line 708) | static void
function remove_folder_perms (line 736) | static void
function seaf_repo_manager_update_folder_perm_timestamp (line 758) | int
function gint64 (line 779) | gint64
function gboolean (line 828) | static gboolean
function gboolean (line 864) | gboolean
function gboolean (line 878) | gboolean
function seaf_repo_manager_record_sync_error (line 892) | int
function gboolean (line 936) | static gboolean
function seaf_repo_manager_del_file_sync_error_by_id (line 965) | int
function GList (line 983) | GList *
type _SyncError (line 1009) | struct _SyncError {
type SyncError (line 1016) | typedef struct _SyncError SyncError;
function send_sync_error_notification (line 1018) | void
function check_and_send_notification (line 1044) | static void
function send_file_sync_error_notification (line 1086) | void
function SeafRepo (line 1106) | SeafRepo*
function seaf_repo_check_worktree (line 1128) | int
function gboolean (line 1164) | static gboolean
function seaf_repo_free (line 1180) | void
function set_head_common (line 1198) | static void
function seaf_repo_set_head (line 1207) | int
function SeafCommit (line 1216) | SeafCommit *
function seaf_repo_from_commit (line 1239) | void
function seaf_repo_to_commit (line 1275) | void
function gboolean (line 1309) | static gboolean
function update_repo_worktree_name (line 1320) | static void
function seaf_repo_set_name (line 1366) | void
function gboolean (line 1377) | static gboolean
function GList (line 1389) | GList *
function seaf_repo_set_readonly (line 1428) | void
function seaf_repo_unset_readonly (line 1435) | void
function gboolean (line 1442) | gboolean
function gboolean (line 1456) | static gboolean
function gboolean (line 1504) | static inline gboolean
function gboolean (line 1515) | static gboolean
function index_cb (line 1560) | static int
function gboolean (line 1579) | static gboolean
type AddOptions (line 1596) | typedef struct _AddOptions {
function add_file (line 1603) | static int
type AddParams (line 1769) | typedef struct AddParams {
function add_dir_recursive (line 1785) | static int
function add_recursive (line 1949) | static int
function gboolean (line 2021) | static gboolean
type IterCBData (line 2046) | typedef struct IterCBData {
function iter_dir_cb (line 2060) | static int
function add_dir_recursive (line 2124) | static int
function add_recursive (line 2221) | static int
function gboolean (line 2287) | static gboolean
function gboolean (line 2347) | static gboolean
function remove_deleted (line 2366) | static void
function scan_worktree_for_changes (line 2450) | static int
function gboolean (line 2472) | static gboolean
function add_path_to_index (line 2500) | static int
function add_path_to_index (line 2586) | static int
function add_remain_files (line 2651) | static int
function try_add_empty_parent_dir_entry (line 2744) | static void
function try_add_empty_parent_dir_entry_from_wt (line 2773) | static void
function update_attributes (line 2836) | static void
function scan_subtree_for_deletion (line 2875) | static void
function scan_subtree_for_deletion (line 2986) | static void
function gboolean (line 3001) | static gboolean
function update_active_file (line 3237) | static void
type UpdatePathData (line 3279) | typedef struct _UpdatePathData {
type index_state (line 3292) | struct index_state
function update_active_path_cb (line 3296) | static int
function update_active_path_recursive (line 3339) | static void
function update_active_path_recursive (line 3404) | static void
function process_active_path (line 3506) | static void
function update_path_sync_status (line 3570) | static void
function gboolean (line 3598) | static gboolean
function gboolean (line 3612) | static gboolean
function handle_rename (line 3625) | static void
type FindOfficeData (line 3752) | typedef struct FindOfficeData {
function find_office_file_cb (line 3757) | static int
function gboolean (line 3784) | static gboolean
function gboolean (line 3818) | static gboolean
function gboolean (line 3870) | static gboolean
function gboolean (line 3937) | static gboolean
function gboolean (line 3984) | static gboolean
type LockOfficeJob (line 4046) | typedef struct LockOfficeJob {
function lock_office_job_free (line 4052) | static void
function do_lock_office_file (line 4061) | static void
function do_unlock_office_file (line 4102) | static void
function unlock_closed_office_files (line 4144) | static void
function lock_office_file_on_server (line 4203) | static void
function unlock_office_file_on_server (line 4220) | static void
function apply_worktree_changes_to_index (line 4237) | static int
function index_add (line 4467) | static int
function commit_tree (line 4508) | static int
function gboolean (line 4540) | static gboolean
function print_index (line 4564) | static int
function print_event_log (line 4584) | static void
type index_state (line 4633) | struct index_state
function print_unpack_result (line 4740) | static void
function print_index (line 4758) | static int
function GList (line 4778) | GList *
function checkout_empty_dir (line 4837) | int
type cache_entry (line 4868) | struct cache_entry
type cache_entry (line 4872) | struct cache_entry
type FileTxData (line 4895) | typedef struct FileTxData {
type FileTxTask (line 4907) | typedef struct FileTxTask {
function file_tx_task_free (line 4919) | static void
type _UpdateAux (line 4929) | struct _UpdateAux {
type UpdateAux (line 4940) | typedef struct _UpdateAux UpdateAux;
function fill_block (line 4942) | static int
function update_block_cb (line 4973) | static size_t
function update_enc_block_cb (line 5017) | static size_t
function checkout_block_cb (line 5064) | static int
function gboolean (line 5133) | static gboolean
function calculate_block_offset (line 5195) | static void
function check_and_get_block_offset (line 5212) | static void
function seaf_repo_manager_checkout_file (line 5287) | int
function checkout_file_http (line 5334) | static int
function fetch_file_thread_func (line 5465) | static void
function gboolean (line 5560) | static gboolean
function gboolean (line 5595) | static gboolean
function schedule_file_fetch (line 5622) | static int
function handle_dir_added_de (line 5707) | static void
function download_files_http (line 5770) | static int
function gboolean (line 5945) | static gboolean
function expand_diff_results (line 5977) | static int
function do_rename_in_worktree (line 6022) | static int
function gboolean (line 6051) | static gboolean
function delete_worktree_dir_recursive_win32 (line 6081) | static int
function delete_worktree_dir_recursive (line 6196) | static int
function move_dir_to_recycle_bin (line 6277) | static int
function delete_worktree_dir (line 6321) | static void
function update_sync_status (line 6351) | static void
function convert_rename_to_checkout (line 6364) | static int
function gboolean (line 6419) | static gboolean
function load_crypt_from_enc_info (line 6439) | static int
function gboolean (line 6462) | static gboolean
function seaf_repo_fetch_and_checkout (line 6527) | int
function seaf_repo_manager_set_repo_worktree (line 6875) | int
function seaf_repo_manager_invalidate_repo_worktree (line 6897) | void
function seaf_repo_manager_validate_repo_worktree (line 6913) | void
function SeafRepoManager (line 6929) | SeafRepoManager*
function seaf_repo_manager_init (line 7002) | int
function watch_repos (line 7020) | static void
function remove_store (line 7043) | static int
function cleanup_deleted_stores_by_type (line 7099) | static void
type _GetBlockAux (line 7137) | struct _GetBlockAux {
type GetBlockAux (line 7141) | typedef struct _GetBlockAux GetBlockAux;
function get_enc_block_cb (line 7143) | static size_t
function decrypt_block (line 7161) | static int
function check_repo_corrupted_blocks (line 7197) | static int
function seaf_repo_manager_start (line 7386) | int
function SeafRepo (line 7416) | SeafRepo*
function seaf_repo_manager_add_repo (line 7442) | int
function seaf_repo_manager_mark_repo_deleted (line 7475) | int
function gboolean (line 7496) | static gboolean
function GList (line 7508) | GList *
function seaf_repo_manager_remove_garbage_repo (line 7523) | void
function seaf_repo_manager_remove_repo_ondisk (line 7537) | void
function seaf_repo_manager_move_repo_store (line 7648) | void
function move_repo_stores (line 7666) | static void
function seaf_repo_manager_del_repo (line 7673) | int
function SeafRepo (line 7707) | SeafRepo*
function gboolean (line 7727) | gboolean
function save_branch_repo_map (line 7747) | static int
function seaf_repo_manager_branch_repo_unmap (line 7765) | int
function load_repo_commit (line 7789) | static void
function gboolean (line 7811) | static gboolean
function load_repo_passwd (line 7831) | static int
function gboolean (line 7855) | static gboolean
function gboolean (line 7891) | static gboolean
function gboolean (line 7913) | static gboolean
function SeafRepo (line 7923) | static SeafRepo *
function sqlite3 (line 8068) | static sqlite3*
function gboolean (line 8171) | static gboolean
function gboolean (line 8184) | static gboolean
function load_repos (line 8197) | static void
function save_repo_property (line 8218) | static void
function seaf_repo_manager_set_repo_property (line 8248) | int
function seaf_repo_manager_del_repo_property (line 8352) | static void
function seaf_repo_manager_del_repo_property_by_key (line 8368) | static void
function save_repo_enc_info (line 8387) | static int
function seaf_repo_manager_set_repo_passwd (line 8411) | int
function seaf_repo_manager_save_repo_enc_info (line 8432) | int
function seaf_repo_manager_load_repo_enc_info (line 8449) | int
function GList (line 8457) | GList*
function GList (line 8482) | GList *
function seaf_repo_manager_set_repo_email (line 8507) | int
function seaf_repo_manager_set_repo_token (line 8519) | int
function seaf_repo_manager_remove_repo_token (line 8532) | int
function seaf_repo_manager_set_repo_relay_info (line 8542) | int
function seaf_repo_manager_get_repo_relay_info (line 8553) | void
function update_server_properties (line 8570) | static void
function seaf_repo_manager_update_repos_server_host (line 8595) | int
function seaf_repo_manager_set_server_property (line 8650) | int
function gboolean (line 8673) | gboolean
function GList (line 8692) | GList *seaf_repo_load_ignore_files (const char *worktree)
function gboolean (line 8736) | gboolean
function seaf_repo_free_ignore_files (line 8771) | void seaf_repo_free_ignore_files (GList *ignore_list)
FILE: daemon/repo-mgr.h
type _SeafRepoManager (line 32) | struct _SeafRepoManager
type SeafRepo (line 33) | typedef struct _SeafRepo SeafRepo;
type _ChangeSet (line 35) | struct _ChangeSet
type _SeafRepo (line 40) | struct _SeafRepo {
type SeafRepoManager (line 168) | typedef struct _SeafRepoManager SeafRepoManager;
type SeafRepoManagerPriv (line 169) | typedef struct _SeafRepoManagerPriv SeafRepoManagerPriv;
type _SeafRepoManager (line 171) | struct _SeafRepoManager {
type _SeafileSession (line 180) | struct _SeafileSession
type _TransferTask (line 345) | struct _TransferTask
type _HttpTxTask (line 346) | struct _HttpTxTask
type _HttpTxTask (line 349) | struct _HttpTxTask
type LockedFile (line 374) | typedef struct _LockedFile {
type LockedFileSet (line 380) | typedef struct _LockedFileSet {
type FolderPermType (line 407) | typedef enum FolderPermType {
type FolderPerm (line 412) | typedef struct _FolderPerm {
FILE: daemon/seaf-daemon.c
type option (line 57) | struct option
function usage (line 71) | static void usage ()
function register_rpc_service (line 82) | static void
function start_searpc_server (line 307) | static int
function set_signal_handlers (line 340) | static void
function write_pidfile (line 374) | static int
function main (line 395) | int
FILE: daemon/seafile-config.c
function gboolean (line 8) | gboolean
function gboolean (line 19) | static gboolean
function seafile_session_config_get_int (line 52) | int
function gboolean (line 74) | gboolean
function seafile_session_config_set_string (line 89) | int
function seafile_session_config_set_int (line 162) | int
function sqlite3 (line 185) | sqlite3 *
function seafile_session_config_set_allow_invalid_worktree (line 206) | int
function gboolean (line 213) | gboolean
function gboolean (line 219) | gboolean
FILE: daemon/seafile-error.c
type SyncErrorInfo (line 5) | typedef struct SyncErrorInfo {
function sync_error_level (line 222) | int
FILE: daemon/seafile-session.c
function seafile_session_class_init (line 53) | static void
function create_deleted_store_dirs (line 97) | static int
function SeafileSession (line 140) | SeafileSession *
function seafile_session_init (line 257) | static void
function load_system_proxy (line 262) | static void
function read_ccnet_conf (line 320) | static void
function seafile_session_prepare (line 357) | void
function gboolean (line 501) | static gboolean
function cleanup_unused_repo_stores (line 516) | static void
function cleanup_job_done (line 562) | static void
function on_start_cleanup (line 607) | static void
function seafile_session_start (line 616) | void
FILE: daemon/seafile-session.h
type SeafileSession (line 35) | typedef struct _SeafileSession SeafileSession;
type SeafileSessionClass (line 36) | typedef struct _SeafileSessionClass SeafileSessionClass;
type event_base (line 38) | struct event_base
type _SeafileSession (line 40) | struct _SeafileSession {
type _SeafileSessionClass (line 101) | struct _SeafileSessionClass
FILE: daemon/set-perm.c
function unset_permissions (line 25) | static int
function seaf_set_path_permission (line 71) | int
function seaf_unset_path_permission (line 154) | int
function SeafPathPerm (line 227) | SeafPathPerm
function seaf_set_path_permission (line 296) | int
function seaf_unset_path_permission (line 321) | int
function SeafPathPerm (line 327) | SeafPathPerm
FILE: daemon/set-perm.h
type SeafPathPerm (line 4) | enum SeafPathPerm {
type SeafPathPerm (line 9) | typedef enum SeafPathPerm SeafPathPerm;
FILE: daemon/sync-mgr.c
type _HttpServerState (line 39) | struct _HttpServerState {
type HttpServerState (line 75) | typedef struct _HttpServerState HttpServerState;
type DelConfirmationResult (line 77) | typedef struct DelConfirmationResult {
type _SeafSyncManagerPriv (line 81) | struct _SeafSyncManagerPriv {
type _ActivePathsInfo (line 101) | struct _ActivePathsInfo {
type ActivePathsInfo (line 106) | typedef struct _ActivePathsInfo ActivePathsInfo;
function HttpServerState (line 131) | static HttpServerState *
function http_server_state_free (line 140) | static void
function SeafSyncManager (line 150) | SeafSyncManager*
function SyncInfo (line 195) | static SyncInfo*
function SyncInfo (line 207) | SyncInfo *
function seaf_sync_manager_init (line 214) | int
function format_http_task_detail (line 220) | static void
function update_tx_state (line 256) | static int
function refresh_all_windows_on_startup (line 298) | static int
function seaf_sync_manager_start (line 316) | int
function seaf_sync_manager_add_sync_task (line 352) | int
function seaf_sync_manager_cancel_sync_task (line 404) | void
function gboolean (line 459) | static gboolean
function gboolean (line 485) | static gboolean
function notify_sync (line 499) | static void
function gboolean (line 536) | static gboolean
function update_sync_info_error_state (line 547) | static void
function transition_sync_state (line 567) | static void
function set_task_error (line 633) | static void
function seaf_sync_manager_set_task_error_code (line 666) | void
function sync_task_free (line 678) | static void
function start_upload_if_necessary (line 687) | static void
function start_fetch_if_necessary (line 710) | static void
function gboolean (line 740) | static gboolean
function GHashTable (line 756) | static GHashTable *
function gboolean (line 800) | static gboolean
function remove_blocks_done (line 845) | static void
function on_repo_deleted_on_server (line 853) | static void
function update_sync_status_v2 (line 871) | static void
function check_head_commit_done (line 923) | static void
function check_head_commit_http (line 941) | static int
type CommitResult (line 961) | struct CommitResult {
type CommitResult (line 972) | struct CommitResult
function commit_job_done (line 1004) | static void
function commit_repo (line 1056) | static void
function check_commit_state (line 1078) | static int
function SyncTask (line 1092) | static SyncTask *
function gboolean (line 1134) | static gboolean
function gboolean (line 1178) | static gboolean
function gboolean (line 1188) | static gboolean
type GetDeletedFilesAux (line 1244) | typedef struct _GetDeletedFilesAux {
function gboolean (line 1249) | static gboolean
function get_number_of_deleted_files (line 1268) | static void
function notify_delete_confirmation (line 1375) | static void
function seaf_sync_manager_add_del_confirmation (line 1391) | int
function DelConfirmationResult (line 1409) | static DelConfirmationResult *
function resync_repo (line 1428) | static void
function sync_repo_v2 (line 1501) | static int
function seaf_sync_manager_update_repo (line 1607) | void
function seaf_sync_manager_check_locks_and_folder_perms (line 1637) | void
function auto_delete_repo (line 1657) | static void
function check_http_fileserver_protocol_done (line 1707) | static void
function check_http_protocol_done (line 1725) | static void
function gboolean (line 1757) | static gboolean
function check_notif_server_done (line 1809) | static void
function gboolean (line 1850) | static gboolean
function gint (line 1893) | gint
function cleanup_file_blocks (line 1904) | static void
function gboolean (line 1921) | static gboolean
function gboolean (line 2030) | static gboolean
type index_state (line 2081) | struct index_state
function check_locked_files_done (line 2126) | static void
function check_folder_perms_done (line 2135) | static void
function check_folder_permissions_one_server_immediately (line 2177) | static void
function check_folder_permissions_one_server (line 2242) | static void
function check_folder_permissions (line 2271) | static void
function check_server_locked_files_done (line 2287) | static void
function check_locked_files_one_server_immediately (line 2327) | static void
function check_locked_files_one_server (line 2392) | static void
function check_server_locked_files (line 2421) | static void
function print_active_paths (line 2438) | static void
type GetJwtTokenAux (line 2484) | typedef struct _GetJwtTokenAux {
function fileserver_get_jwt_token_cb (line 2489) | static void
function gboolean (line 2528) | inline static gboolean
function check_and_subscribe_repo (line 2536) | static int
function auto_sync_pulse (line 2584) | static int
function on_repo_http_fetched (line 2733) | static void
function on_repo_http_uploaded (line 2765) | static void
function disable_auto_sync_for_repos (line 2813) | static void
function seaf_sync_manager_disable_auto_sync (line 2832) | int
function enable_auto_sync_for_repos (line 2847) | static void
function seaf_sync_manager_enable_auto_sync (line 2864) | int
function seaf_sync_manager_is_auto_sync_enabled (line 2879) | int
function ActivePathsInfo (line 2888) | static ActivePathsInfo *
function active_paths_info_free (line 2900) | static void
function seaf_sync_manager_update_active_path (line 2911) | void
function seaf_sync_manager_delete_active_path (line 2977) | void
function json_t (line 3113) | static json_t *
function seaf_sync_manager_active_paths_number (line 3178) | int
function seaf_sync_manager_remove_active_path_info (line 3195) | void
function wchar_t (line 3212) | static wchar_t *
function seaf_sync_manager_add_refresh_path (line 3255) | void
function seaf_sync_manager_refresh_path (line 3261) | void
function update_head_commit_ids_for_server (line 3273) | static void
FILE: daemon/sync-mgr.h
type SyncInfo (line 6) | typedef struct _SyncInfo SyncInfo;
type SyncTask (line 7) | typedef struct _SyncTask SyncTask;
type SeafSyncManager (line 9) | typedef struct _SeafSyncManager SeafSyncManager;
type SeafSyncManagerPriv (line 10) | typedef struct _SeafSyncManagerPriv SeafSyncManagerPriv;
type SeafTimer (line 12) | struct SeafTimer
type _SyncInfo (line 14) | struct _SyncInfo {
type _SyncTask (line 54) | struct _SyncTask {
type _SyncStatus (line 73) | enum _SyncStatus {
type SyncStatus (line 85) | typedef enum _SyncStatus SyncStatus;
type _SeafileSession (line 87) | struct _SeafileSession
type _SeafSyncManager (line 89) | struct _SeafSyncManager {
type _SeafileSession (line 114) | struct _SeafileSession
FILE: daemon/sync-status-tree.c
type _SyncStatusDir (line 9) | struct _SyncStatusDir {
type SyncStatusDir (line 12) | typedef struct _SyncStatusDir SyncStatusDir;
type _SyncStatusDirent (line 14) | struct _SyncStatusDirent {
type SyncStatusDirent (line 20) | typedef struct _SyncStatusDirent SyncStatusDirent;
type SyncStatusTree (line 22) | struct SyncStatusTree {
type SyncStatusTree (line 26) | typedef struct SyncStatusTree SyncStatusTree;
function SyncStatusDir (line 31) | static SyncStatusDir *
function sync_status_dir_free (line 41) | static void
function SyncStatusDirent (line 50) | static SyncStatusDirent *
function sync_status_dirent_free (line 63) | static void
function SyncStatusTree (line 73) | SyncStatusTree *
function refresh_recursive (line 84) | static void
function sync_status_tree_free (line 109) | void
function sync_status_tree_add (line 125) | void
function gboolean (line 182) | inline static gboolean
function remove_item (line 188) | static void
function delete_recursive (line 194) | static void
function sync_status_tree_del (line 227) | void
function sync_status_tree_exists (line 245) | int
FILE: daemon/sync-status-tree.h
type SyncStatusTree (line 4) | struct SyncStatusTree
type SyncStatusTree (line 6) | struct SyncStatusTree
type SyncStatusTree (line 10) | struct SyncStatusTree
type SyncStatusTree (line 17) | struct SyncStatusTree
type SyncStatusTree (line 27) | struct SyncStatusTree
type SyncStatusTree (line 31) | struct SyncStatusTree
FILE: daemon/test-sync-tree.c
function main (line 7) | int main (int argc, char **argv)
FILE: daemon/timer.c
type SeafTimer (line 21) | struct SeafTimer
function timer_callback (line 30) | static void
function seaf_timer_free (line 46) | void
function timeval_from_msec (line 66) | struct timeval
function SeafTimer (line 76) | SeafTimer*
FILE: daemon/timer.h
type SeafTimer (line 9) | struct SeafTimer
type SeafTimer (line 11) | typedef struct SeafTimer SeafTimer;
FILE: daemon/vc-utils.c
function gint (line 20) | static gint
function commit_trees_cb (line 28) | int
function update_index (line 140) | int
function seaf_remove_empty_dir (line 172) | int
function remove_hidden_file (line 215) | static int
function seaf_remove_empty_dir (line 245) | int
function compute_file_id_with_cdc (line 283) | static int
function compare_file_content (line 312) | int
function delete_path (line 396) | int
function gboolean (line 452) | static gboolean
function gboolean (line 480) | gboolean
function gboolean (line 494) | static gboolean
function gboolean (line 515) | static gboolean
function gboolean (line 587) | gboolean
function gboolean (line 598) | gboolean
function gboolean (line 654) | gboolean
FILE: daemon/vc-utils.h
type SeafileCrypt (line 12) | struct SeafileCrypt
function readlink (line 16) | static inline int readlink(const char *path, char *buf, size_t bufsiz)
type cache_tree (line 24) | struct cache_tree
type cache_entry (line 24) | struct cache_entry
type index_state (line 28) | struct index_state
type index_state (line 47) | struct index_state
type SeafileCrypt (line 52) | struct SeafileCrypt
FILE: daemon/wt-monitor-linux.c
type WatchPathMapping (line 20) | typedef struct WatchPathMapping {
type RenameInfo (line 24) | typedef struct RenameInfo {
type EventInfo (line 30) | typedef struct EventInfo {
type RepoWatchInfo (line 37) | typedef struct RepoWatchInfo {
type SeafWTMonitorPriv (line 47) | struct SeafWTMonitorPriv {
function WatchPathMapping (line 66) | static WatchPathMapping *create_mapping ()
function free_mapping (line 77) | static void free_mapping (WatchPathMapping *mapping)
function add_mapping (line 83) | static void add_mapping (WatchPathMapping *mapping,
function RenameInfo (line 92) | static RenameInfo *create_rename_info ()
function free_rename_info (line 99) | static void free_rename_info (RenameInfo *info)
function set_rename_processing_state (line 105) | inline static void
function unset_rename_processing_state (line 113) | inline static void
function RepoWatchInfo (line 124) | static RepoWatchInfo *
function free_repo_watch_info (line 140) | static void
function add_event_to_queue (line 150) | static void
function handle_rename (line 209) | static void
function gboolean (line 286) | inline static gboolean
function gboolean (line 293) | static gboolean
function process_one_event (line 315) | static void
function gboolean (line 400) | static gboolean
function add_watch_recursive (line 513) | static int
function add_watch (line 588) | static int
function handle_add_repo (line 623) | static int handle_add_repo (SeafWTMonitorPriv *priv,
function update_maxfd (line 639) | static void
function handle_rm_repo (line 657) | static int handle_rm_repo (SeafWTMonitor *monitor,
function handle_refresh_repo (line 676) | static int handle_refresh_repo (SeafWTMonitorPriv *priv, const char *rep...
function reply_watch_command (line 681) | static void
function handle_watch_command (line 691) | static void
function SeafWTMonitor (line 735) | SeafWTMonitor *
function WTStatus (line 757) | WTStatus *
FILE: daemon/wt-monitor-macos.c
type RenameInfo (line 21) | typedef struct RenameInfo {
type RepoWatchInfo (line 28) | typedef struct RepoWatchInfo {
type SeafWTMonitorPriv (line 34) | struct SeafWTMonitorPriv {
function set_rename_processing_state (line 46) | inline static void
function unset_rename_processing_state (line 56) | inline static void
function RepoWatchInfo (line 69) | static RepoWatchInfo *
function free_repo_watch_info (line 82) | static void
function gboolean (line 93) | static gboolean
function check_and_handle_rename (line 120) | static void
function handle_rename (line 160) | static void
function add_event_to_queue (line 219) | static void
function process_one_event (line 276) | static void
function process_one_event (line 352) | static void
function stream_callback (line 398) | static void
function FSEventStreamRef (line 426) | static FSEventStreamRef
function command_read_cb (line 481) | static void
function add_command_pipe (line 503) | static int
function handle_add_repo (line 533) | static int
function handle_rm_repo (line 542) | static int
function handle_refresh_repo (line 558) | static int
function reply_watch_command (line 564) | static void
function handle_watch_command (line 574) | static void
function SeafWTMonitor (line 616) | SeafWTMonitor *
function WTStatus (line 638) | WTStatus *
FILE: daemon/wt-monitor-structs.c
function WTEvent (line 7) | WTEvent *wt_event_new (int type, const char *path, const char *new_path)
function free_path (line 20) | static void free_path (gpointer data, gpointer user_data)
function wt_event_free (line 25) | void wt_event_free (WTEvent *event)
function WTStatus (line 38) | WTStatus *create_wt_status (const char *repo_id)
function free_event_cb (line 57) | static void free_event_cb (gpointer data, gpointer user_data)
function free_wt_status (line 63) | static void free_wt_status (WTStatus *status)
function wt_status_ref (line 73) | void
function wt_status_unref (line 79) | void
FILE: daemon/wt-monitor-structs.h
type WTEvent (line 16) | typedef struct WTEvent {
type WTStatus (line 32) | typedef struct WTStatus {
FILE: daemon/wt-monitor-win32.c
type DirWatchAux (line 32) | typedef struct DirWatchAux {
type RenameInfo (line 38) | typedef struct RenameInfo {
type EventInfo (line 43) | typedef struct EventInfo {
type RepoWatchInfo (line 49) | typedef struct RepoWatchInfo {
type SeafWTMonitorPriv (line 56) | struct SeafWTMonitorPriv {
function RenameInfo (line 74) | static RenameInfo *create_rename_info ()
function free_rename_info (line 81) | static void free_rename_info (RenameInfo *info)
function set_rename_processing_state (line 87) | inline static void
function unset_rename_processing_state (line 94) | inline static void
function RepoWatchInfo (line 104) | static RepoWatchInfo *
function free_repo_watch_info (line 118) | static void
function init_overlapped (line 127) | static inline void
function reset_overlapped (line 134) | static inline void
function add_event_to_queue (line 140) | static void
function BOOL (line 188) | static BOOL
function BOOL (line 254) | static BOOL
function BOOL (line 295) | static BOOL
function BOOL (line 337) | static BOOL
function handle_rename (line 375) | static void
function gboolean (line 411) | static gboolean
function process_one_event (line 460) | static void
function gboolean (line 513) | static gboolean
function HANDLE (line 636) | static HANDLE
function HANDLE (line 663) | static HANDLE add_watch (SeafWTMonitorPriv *priv,
function handle_add_repo (line 696) | static int handle_add_repo (SeafWTMonitor *monitor,
function handle_rm_repo (line 711) | static int handle_rm_repo (SeafWTMonitorPriv *priv, const char *repo_id,...
function handle_refresh_repo (line 728) | static int handle_refresh_repo (SeafWTMonitorPriv *priv, const char *rep...
function reply_watch_command (line 733) | static void
function handle_watch_command (line 743) | static void
function SeafWTMonitor (line 787) | SeafWTMonitor *
function WTStatus (line 812) | WTStatus *
FILE: daemon/wt-monitor.c
function seaf_wt_monitor_start (line 14) | int
function seaf_wt_monitor_watch_repo (line 39) | int
function seaf_wt_monitor_unwatch_repo (line 70) | int
function seaf_wt_monitor_refresh_repo (line 98) | int
FILE: daemon/wt-monitor.h
type SeafWTMonitorPriv (line 7) | typedef struct SeafWTMonitorPriv SeafWTMonitorPriv;
type _SeafileSession (line 9) | struct _SeafileSession
type CommandType (line 11) | typedef enum CommandType {
type WatchCommand (line 18) | typedef struct WatchCommand {
type SeafWTMonitor (line 24) | typedef struct SeafWTMonitor {
type _SeafileSession (line 36) | struct _SeafileSession
FILE: lib/db.c
function sqlite_open_db (line 9) | int
function sqlite_close_db (line 29) | int sqlite_close_db (sqlite3 *db)
function sqlite3_stmt (line 34) | sqlite3_stmt *
function sqlite_query_exec (line 54) | int
function sqlite_begin_transaction (line 73) | int
function sqlite_end_transaction (line 80) | int
function gboolean (line 88) | gboolean
function sqlite_foreach_selected_row (line 114) | int
function sqlite_get_int (line 149) | int sqlite_get_int (sqlite3 *db, const char *sql)
function gint64 (line 177) | gint64 sqlite_get_int64 (sqlite3 *db, const char *sql)
FILE: lib/db.h
type gboolean (line 20) | typedef gboolean (*SqliteRowFunc) (sqlite3_stmt *stmt, void *data);
FILE: lib/net.c
function inet_aton (line 48) | int inet_aton(const char *string, struct in_addr *addr)
function ccnet_netSetTOS (line 59) | int
function evutil_socket_t (line 69) | static evutil_socket_t
function evutil_socket_t (line 85) | static evutil_socket_t
function evutil_socket_t (line 112) | evutil_socket_t
function evutil_socket_t (line 147) | evutil_socket_t
function ccnet_net_make_socket_blocking (line 233) | int
function evutil_socket_t (line 260) | evutil_socket_t
function evutil_socket_t (line 277) | evutil_socket_t
type sockaddr (line 329) | struct sockaddr
type sockaddr_in (line 335) | struct sockaddr_in
type sockaddr_in (line 335) | struct sockaddr_in
type sockaddr_in6 (line 344) | struct sockaddr_in6
type sockaddr_in6 (line 344) | struct sockaddr_in6
type sockaddr_un (line 355) | struct sockaddr_un
type sockaddr_un (line 355) | struct sockaddr_un
function sock_pton (line 376) | int
function is_valid_ipaddr (line 403) | int
function sock_port (line 414) | uint16_t
function evutil_socket_t (line 436) | evutil_socket_t
function family_to_level (line 477) | int
function mcast_join (line 493) | static int
function evutil_socket_t (line 521) | evutil_socket_t
function mcast_join (line 565) | static int
function evutil_socket_t (line 658) | evutil_socket_t
function sockfd_to_family (line 695) | int
function mcast_set_loop (line 707) | int
FILE: lib/net.h
type socklen_t (line 9) | typedef int socklen_t;
type in_addr (line 42) | struct in_addr
type sockaddr (line 45) | struct sockaddr
type sockaddr_storage (line 48) | struct sockaddr_storage
type sockaddr (line 58) | struct sockaddr
type sockaddr (line 59) | struct sockaddr
type sockaddr_storage (line 67) | struct sockaddr_storage
type sockaddr (line 70) | struct sockaddr
type sockaddr (line 74) | struct sockaddr
FILE: lib/repo.c
type SeafileRepo (line 25) | typedef struct _SeafileRepo SeafileRepo;
type SeafileRepoClass (line 26) | typedef struct _SeafileRepoClass SeafileRepoClass;
type SeafileRepoPrivate (line 27) | typedef struct _SeafileRepoPrivate SeafileRepoPrivate;
type SeafileSyncTask (line 79) | typedef struct _SeafileSyncTask SeafileSyncTask;
type SeafileSyncTaskClass (line 80) | typedef struct _SeafileSyncTaskClass SeafileSyncTaskClass;
type SeafileSyncTaskPrivate (line 81) | typedef struct _SeafileSyncTaskPrivate SeafileSyncTaskPrivate;
type SeafileSessionInfo (line 99) | typedef struct _SeafileSessionInfo SeafileSessionInfo;
type SeafileSessionInfoClass (line 100) | typedef struct _SeafileSessionInfoClass SeafileSessionInfoClass;
type SeafileSessionInfoPrivate (line 101) | typedef struct _SeafileSessionInfoPrivate SeafileSessionInfoPrivate;
type SeafileDiffEntry (line 116) | typedef struct _SeafileDiffEntry SeafileDiffEntry;
type SeafileDiffEntryClass (line 117) | typedef struct _SeafileDiffEntryClass SeafileDiffEntryClass;
type SeafileDiffEntryPrivate (line 118) | typedef struct _SeafileDiffEntryPrivate SeafileDiffEntryPrivate;
type SeafileEncryptionInfo (line 135) | typedef struct _SeafileEncryptionInfo SeafileEncryptionInfo;
type SeafileEncryptionInfoClass (line 136) | typedef struct _SeafileEncryptionInfoClass SeafileEncryptionInfoClass;
type SeafileEncryptionInfoPrivate (line 137) | typedef struct _SeafileEncryptionInfoPrivate SeafileEncryptionInfoPrivate;
type SeafileFileSyncError (line 158) | typedef struct _SeafileFileSyncError SeafileFileSyncError;
type SeafileFileSyncErrorClass (line 159) | typedef struct _SeafileFileSyncErrorClass SeafileFileSyncErrorClass;
type SeafileFileSyncErrorPrivate (line 160) | typedef struct _SeafileFileSyncErrorPrivate SeafileFileSyncErrorPrivate;
type _SeafileRepo (line 173) | struct _SeafileRepo {
type _SeafileRepoClass (line 183) | struct _SeafileRepoClass {
type _SeafileRepoPrivate (line 187) | struct _SeafileRepoPrivate {
type _SeafileSyncTask (line 222) | struct _SeafileSyncTask {
type _SeafileSyncTaskClass (line 227) | struct _SeafileSyncTaskClass {
type _SeafileSyncTaskPrivate (line 231) | struct _SeafileSyncTaskPrivate {
type _SeafileSessionInfo (line 238) | struct _SeafileSessionInfo {
type _SeafileSessionInfoClass (line 243) | struct _SeafileSessionInfoClass {
type _SeafileSessionInfoPrivate (line 247) | struct _SeafileSessionInfoPrivate {
type _SeafileDiffEntry (line 251) | struct _SeafileDiffEntry {
type _SeafileDiffEntryClass (line 256) | struct _SeafileDiffEntryClass {
type _SeafileDiffEntryPrivate (line 260) | struct _SeafileDiffEntryPrivate {
type _SeafileEncryptionInfo (line 266) | struct _SeafileEncryptionInfo {
type _SeafileEncryptionInfoClass (line 271) | struct _SeafileEncryptionInfoClass {
type _SeafileEncryptionInfoPrivate (line 275) | struct _SeafileEncryptionInfoPrivate {
type _SeafileFileSyncError (line 285) | struct _SeafileFileSyncError {
type _SeafileFileSyncErrorClass (line 290) | struct _SeafileFileSyncErrorClass {
type _SeafileFileSyncErrorPrivate (line 294) | struct _SeafileFileSyncErrorPrivate {
function gpointer (line 575) | static inline gpointer
function SeafileRepo (line 581) | SeafileRepo*
function SeafileRepo (line 589) | SeafileRepo*
function gchar (line 595) | const gchar*
function seafile_repo_set_id (line 604) | void
function gchar (line 614) | const gchar*
function seafile_repo_set_name (line 625) | void
function gchar (line 637) | const gchar*
function seafile_repo_set_desc (line 648) | void
function gint (line 660) | gint
function seafile_repo_set_version (line 669) | void
function gint (line 682) | gint
function seafile_repo_set_last_modify (line 691) | void
function gint64 (line 704) | gint64
function seafile_repo_set_size (line 713) | void
function gint64 (line 726) | gint64
function seafile_repo_set_file_count (line 735) | void
function gchar (line 748) | const gchar*
function seafile_repo_set_head_cmmt_id (line 759) | void
function gchar (line 775) | const gchar*
function seafile_repo_set_root (line 786) | void
function gchar (line 802) | const gchar*
function seafile_repo_set_repo_id (line 813) | void
function gchar (line 829) | const gchar*
function seafile_repo_set_repo_name (line 840) | void
function gchar (line 856) | const gchar*
function seafile_repo_set_repo_desc (line 867) | void
function gint (line 883) | gint
function seafile_repo_set_last_modified (line 892) | void
function gboolean (line 905) | gboolean
function seafile_repo_set_encrypted (line 914) | void
function gchar (line 927) | const gchar*
function seafile_repo_set_magic (line 938) | void
function gint (line 954) | gint
function seafile_repo_set_enc_version (line 963) | void
function gchar (line 976) | const gchar*
function seafile_repo_set_random_key (line 987) | void
function gchar (line 1003) | const gchar*
function seafile_repo_set_salt (line 1014) | void
function gchar (line 1030) | const gchar*
function seafile_repo_set_worktree (line 1041) | void
function gchar (line 1053) | const gchar*
function seafile_repo_set_relay_id (line 1064) | void
function gint (line 1076) | gint
function seafile_repo_set_last_sync_time (line 1085) | void
function gboolean (line 1098) | gboolean
function seafile_repo_set_auto_sync (line 1107) | void
function gboolean (line 1120) | gboolean
function seafile_repo_set_worktree_invalid (line 1129) | void
function gboolean (line 1142) | gboolean
function seafile_repo_set_is_virtual (line 1151) | void
function gchar (line 1164) | const gchar*
function seafile_repo_set_origin_repo_id (line 1175) | void
function gchar (line 1191) | const gchar*
function seafile_repo_set_origin_repo_name (line 1202) | void
function gchar (line 1218) | const gchar*
function seafile_repo_set_origin_path (line 1229) | void
function gboolean (line 1245) | gboolean
function seafile_repo_set_is_original_owner (line 1254) | void
function gchar (line 1267) | const gchar*
function seafile_repo_set_virtual_perm (line 1278) | void
function gchar (line 1294) | const gchar*
function seafile_repo_set_store_id (line 1305) | void
function gboolean (line 1321) | gboolean
function seafile_repo_set_is_corrupted (line 1330) | void
function gboolean (line 1343) | gboolean
function seafile_repo_set_repaired (line 1352) | void
function gchar (line 1365) | const gchar*
function seafile_repo_set_share_type (line 1376) | void
function gchar (line 1392) | const gchar*
function seafile_repo_set_permission (line 1403) | void
function gchar (line 1419) | const gchar*
function seafile_repo_set_user (line 1430) | void
function gint (line 1446) | gint
function seafile_repo_set_group_id (line 1455) | void
function gboolean (line 1468) | gboolean
function seafile_repo_set_is_shared (line 1477) | void
function seafile_repo_class_init (line 1490) | static void
function seafile_repo_instance_init (line 1538) | static void
function seafile_repo_finalize (line 1545) | static void
function GType (line 1573) | static GType
function GType (line 1583) | GType
function _vala_seafile_repo_get_property (line 1595) | static void
function _vala_seafile_repo_set_property (line 1721) | static void
function gpointer (line 1847) | static inline gpointer
function SeafileSyncTask (line 1853) | SeafileSyncTask*
function SeafileSyncTask (line 1861) | SeafileSyncTask*
function gboolean (line 1867) | gboolean
function seafile_sync_task_set_force_upload (line 1876) | void
function gchar (line 1889) | const gchar*
function seafile_sync_task_set_repo_id (line 1900) | void
function gchar (line 1916) | const gchar*
function seafile_sync_task_set_state (line 1927) | void
function gint (line 1943) | gint
function seafile_sync_task_set_error (line 1952) | void
function seafile_sync_task_class_init (line 1965) | static void
function seafile_sync_task_instance_init (line 1980) | static void
function seafile_sync_task_finalize (line 1987) | static void
function GType (line 1997) | static GType
function GType (line 2007) | GType
function _vala_seafile_sync_task_get_property (line 2019) | static void
function _vala_seafile_sync_task_set_property (line 2046) | static void
function gpointer (line 2073) | static inline gpointer
function SeafileSessionInfo (line 2079) | SeafileSessionInfo*
function SeafileSessionInfo (line 2087) | SeafileSessionInfo*
function gchar (line 2093) | const gchar*
function seafile_session_info_set_datadir (line 2104) | void
function seafile_session_info_class_init (line 2120) | static void
function seafile_session_info_instance_init (line 2132) | static void
function seafile_session_info_finalize (line 2139) | static void
function GType (line 2148) | static GType
function GType (line 2158) | GType
function _vala_seafile_session_info_get_property (line 2170) | static void
function _vala_seafile_session_info_set_property (line 2188) | static void
function gpointer (line 2206) | static inline gpointer
function SeafileDiffEntry (line 2212) | SeafileDiffEntry*
function SeafileDiffEntry (line 2220) | SeafileDiffEntry*
function gchar (line 2226) | const gchar*
function seafile_diff_entry_set_status (line 2237) | void
function gchar (line 2253) | const gchar*
function seafile_diff_entry_set_name (line 2264) | void
function gchar (line 2280) | const gchar*
function seafile_diff_entry_set_new_name (line 2291) | void
function seafile_diff_entry_class_init (line 2307) | static void
function seafile_diff_entry_instance_init (line 2321) | static void
function seafile_diff_entry_finalize (line 2328) | static void
function GType (line 2339) | static GType
function GType (line 2349) | GType
function _vala_seafile_diff_entry_get_property (line 2361) | static void
function _vala_seafile_diff_entry_set_property (line 2385) | static void
function gpointer (line 2409) | static inline gpointer
function SeafileEncryptionInfo (line 2415) | SeafileEncryptionInfo*
function SeafileEncryptionInfo (line 2423) | SeafileEncryptionInfo*
function gchar (line 2429) | const gchar*
function seafile_encryption_info_set_repo_id (line 2440) | void
function gchar (line 2456) | const gchar*
function seafile_encryption_info_set_passwd (line 2467) | void
function gint (line 2483) | gint
function seafile_encryption_info_set_enc_version (line 2492) | void
function gchar (line 2505) | const gchar*
function seafile_encryption_info_set_magic (line 2516) | void
function gchar (line 2532) | const gchar*
function seafile_encryption_info_set_pwd_hash (line 2543) | void
function gchar (line 2559) | const gchar*
function seafile_encryption_info_set_random_key (line 2570) | void
function gchar (line 2586) | const gchar*
function seafile_encryption_info_set_salt (line 2597) | void
function seafile_encryption_info_class_init (line 2613) | static void
function seafile_encryption_info_instance_init (line 2631) | static void
function seafile_encryption_info_finalize (line 2638) | static void
function GType (line 2652) | static GType
function GType (line 2662) | GType
function _vala_seafile_encryption_info_get_property (line 2674) | static void
function _vala_seafile_encryption_info_set_property (line 2710) | static void
function gpointer (line 2746) | static inline gpointer
function SeafileFileSyncError (line 2752) | SeafileFileSyncError*
function SeafileFileSyncError (line 2760) | SeafileFileSyncError*
function gint (line 2766) | gint
function seafile_file_sync_error_set_id (line 2775) | void
function gchar (line 2788) | const gchar*
function seafile_file_sync_error_set_repo_id (line 2799) | void
function gchar (line 2815) | const gchar*
function seafile_file_sync_error_set_repo_name (line 2826) | void
function gchar (line 2842) | const gchar*
function seafile_file_sync_error_set_path (line 2853) | void
function gint (line 2869) | gint
function seafile_file_sync_error_set_err_id (line 2878) | void
function gint64 (line 2891) | gint64
function seafile_file_sync_error_set_timestamp (line 2900) | void
function seafile_file_sync_error_class_init (line 2913) | static void
function seafile_file_sync_error_instance_init (line 2930) | static void
function seafile_file_sync_error_finalize (line 2937) | static void
function GType (line 2948) | static GType
function GType (line 2958) | GType
function _vala_seafile_file_sync_error_get_property (line 2970) | static void
function _vala_seafile_file_sync_error_set_property (line 3003) | static void
FILE: lib/seafile-object.h
type SeafileRepo (line 28) | typedef struct _SeafileRepo SeafileRepo;
type SeafileRepoClass (line 29) | typedef struct _SeafileRepoClass SeafileRepoClass;
type SeafileRepoPrivate (line 30) | typedef struct _SeafileRepoPrivate SeafileRepoPrivate;
type SeafileSyncTask (line 39) | typedef struct _SeafileSyncTask SeafileSyncTask;
type SeafileSyncTaskClass (line 40) | typedef struct _SeafileSyncTaskClass SeafileSyncTaskClass;
type SeafileSyncTaskPrivate (line 41) | typedef struct _SeafileSyncTaskPrivate SeafileSyncTaskPrivate;
type SeafileSessionInfo (line 50) | typedef struct _SeafileSessionInfo SeafileSessionInfo;
type SeafileSessionInfoClass (line 51) | typedef struct _SeafileSessionInfoClass SeafileSessionInfoClass;
type SeafileSessionInfoPrivate (line 52) | typedef struct _SeafileSessionInfoPrivate SeafileSessionInfoPrivate;
type SeafileDiffEntry (line 61) | typedef struct _SeafileDiffEntry SeafileDiffEntry;
type SeafileDiffEntryClass (line 62) | typedef struct _SeafileDiffEntryClass SeafileDiffEntryClass;
type SeafileDiffEntryPrivate (line 63) | typedef struct _SeafileDiffEntryPrivate SeafileDiffEntryPrivate;
type SeafileEncryptionInfo (line 72) | typedef struct _SeafileEncryptionInfo SeafileEncryptionInfo;
type SeafileEncryptionInfoClass (line 73) | typedef struct _SeafileEncryptionInfoClass SeafileEncryptionInfoClass;
type SeafileEncryptionInfoPrivate (line 74) | typedef struct _SeafileEncryptionInfoPrivate SeafileEncryptionInfoPrivate;
type SeafileFileSyncError (line 83) | typedef struct _SeafileFileSyncError SeafileFileSyncError;
type SeafileFileSyncErrorClass (line 84) | typedef struct _SeafileFileSyncErrorClass SeafileFileSyncErrorClass;
type SeafileFileSyncErrorPrivate (line 85) | typedef struct _SeafileFileSyncErrorPrivate SeafileFileSyncErrorPrivate;
type SeafileTask (line 94) | typedef struct _SeafileTask SeafileTask;
type SeafileTaskClass (line 95) | typedef struct _SeafileTaskClass SeafileTaskClass;
type SeafileTaskPrivate (line 96) | typedef struct _SeafileTaskPrivate SeafileTaskPrivate;
type SeafileCloneTask (line 105) | typedef struct _SeafileCloneTask SeafileCloneTask;
type SeafileCloneTaskClass (line 106) | typedef struct _SeafileCloneTaskClass SeafileCloneTaskClass;
type SeafileCloneTaskPrivate (line 107) | typedef struct _SeafileCloneTaskPrivate SeafileCloneTaskPrivate;
type _SeafileRepo (line 109) | struct _SeafileRepo {
type _SeafileRepoClass (line 119) | struct _SeafileRepoClass {
type _SeafileSyncTask (line 123) | struct _SeafileSyncTask {
type _SeafileSyncTaskClass (line 128) | struct _SeafileSyncTaskClass {
type _SeafileSessionInfo (line 132) | struct _SeafileSessionInfo {
type _SeafileSessionInfoClass (line 137) | struct _SeafileSessionInfoClass {
type _SeafileDiffEntry (line 141) | struct _SeafileDiffEntry {
type _SeafileDiffEntryClass (line 146) | struct _SeafileDiffEntryClass {
type _SeafileEncryptionInfo (line 150) | struct _SeafileEncryptionInfo {
type _SeafileEncryptionInfoClass (line 155) | struct _SeafileEncryptionInfoClass {
type _SeafileFileSyncError (line 159) | struct _SeafileFileSyncError {
type _SeafileFileSyncErrorClass (line 164) | struct _SeafileFileSyncErrorClass {
type _SeafileTask (line 168) | struct _SeafileTask {
type _SeafileTaskClass (line 173) | struct _SeafileTaskClass {
type _SeafileCloneTask (line 177) | struct _SeafileCloneTask {
type _SeafileCloneTaskClass (line 182) | struct _SeafileCloneTaskClass {
FILE: lib/seafile-rpc-wrapper.c
function seafile_set_config (line 30) | int
function seafile_destroy_repo (line 41) | int
function seafile_set_repo_token (line 52) | int
function GList (line 77) | GList *
function GObject (line 87) | GObject *
function seafile_set_repo_property (line 99) | int
function seafile_calc_dir_size (line 127) | int
FILE: lib/searpc-marshal.h
function register_marshals (line 1483) | static void register_marshals(void)
FILE: lib/searpc-signature.h
function gchar (line 2) | inline static gchar *
function gchar (line 9) | inline static gchar *
function gchar (line 16) | inline static gchar *
function gchar (line 23) | inline static gchar *
function gchar (line 30) | inline static gchar *
function gchar (line 37) | inline static gchar *
function gchar (line 44) | inline static gchar *
function gchar (line 51) | inline static gchar *
function gchar (line 58) | inline static gchar *
function gchar (line 65) | inline static gchar *
function gchar (line 72) | inline static gchar *
function gchar (line 79) | inline static gchar *
function gchar (line 86) | inline static gchar *
function gchar (line 93) | inline static gchar *
function gchar (line 100) | inline static gchar *
function gchar (line 107) | inline static gchar *
function gchar (line 114) | inline static gchar *
function gchar (line 121) | inline static gchar *
function gchar (line 128) | inline static gchar *
function gchar (line 135) | inline static gchar *
function gchar (line 142) | inline static gchar *
function gchar (line 149) | inline static gchar *
function gchar (line 156) | inline static gchar *
function gchar (line 163) | inline static gchar *
function gchar (line 170) | inline static gchar *
function gchar (line 177) | inline static gchar *
function gchar (line 184) | inline static gchar *
function gchar (line 191) | inline static gchar *
function gchar (line 198) | inline static gchar *
function gchar (line 205) | inline static gchar *
function gchar (line 212) | inline static gchar *
function gchar (line 219) | inline static gchar *
function gchar (line 226) | inline static gchar *
function gchar (line 233) | inline static gchar *
function gchar (line 240) | inline static gchar *
function gchar (line 247) | inline static gchar *
function gchar (line 254) | inline static gchar *
function gchar (line 261) | inline static gchar *
function gchar (line 268) | inline static gchar *
function gchar (line 275) | inline static gchar *
function gchar (line 282) | inline static gchar *
function gchar (line 289) | inline static gchar *
function gchar (line 296) | inline static gchar *
function gchar (line 303) | inline static gchar *
function gchar (line 310) | inline static gchar *
function gchar (line 317) | inline static gchar *
function gchar (line 324) | inline static gchar *
function gchar (line 331) | inline static gchar *
function gchar (line 338) | inline static gchar *
function gchar (line 345) | inline static gchar *
function gchar (line 352) | inline static gchar *
function gchar (line 359) | inline static gchar *
function gchar (line 366) | inline static gchar *
function gchar (line 373) | inline static gchar *
function gchar (line 380) | inline static gchar *
function gchar (line 387) | inline static gchar *
function gchar (line 394) | inline static gchar *
function gchar (line 401) | inline static gchar *
function gchar (line 408) | inline static gchar *
function gchar (line 415) | inline static gchar *
function gchar (line 422) | inline static gchar *
function gchar (line 429) | inline static gchar *
function gchar (line 436) | inline static gchar *
function gchar (line 443) | inline static gchar *
function gchar (line 450) | inline static gchar *
function gchar (line 457) | inline static gchar *
function gchar (line 464) | inline static gchar *
function gchar (line 471) | inline static gchar *
function gchar (line 478) | inline static gchar *
function gchar (line 485) | inline static gchar *
function gchar (line 492) | inline static gchar *
function gchar (line 499) | inline static gchar *
function gchar (line 506) | inline static gchar *
function gchar (line 513) | inline static gchar *
function gchar (line 520) | inline static gchar *
function gchar (line 527) | inline static gchar *
function gchar (line 534) | inline static gchar *
function gchar (line 541) | inline static gchar *
function gchar (line 548) | inline static gchar *
function gchar (line 555) | inline static gchar *
function gchar (line 562) | inline static gchar *
function gchar (line 569) | inline static gchar *
function gchar (line 576) | inline static gchar *
function gchar (line 583) | inline static gchar *
function gchar (line 590) | inline static gchar *
function gchar (line 597) | inline static gchar *
function gchar (line 604) | inline static gchar *
function gchar (line 611) | inline static gchar *
function gchar (line 618) | inline static gchar *
FILE: lib/task.c
type SeafileTask (line 26) | typedef struct _SeafileTask SeafileTask;
type SeafileTaskClass (line 27) | typedef struct _SeafileTaskClass SeafileTaskClass;
type SeafileTaskPrivate (line 28) | typedef struct _SeafileTaskPrivate SeafileTaskPrivate;
type SeafileCloneTask (line 52) | typedef struct _SeafileCloneTask SeafileCloneTask;
type SeafileCloneTaskClass (line 53) | typedef struct _SeafileCloneTaskClass SeafileCloneTaskClass;
type SeafileCloneTaskPrivate (line 54) | typedef struct _SeafileCloneTaskPrivate SeafileCloneTaskPrivate;
type _SeafileTask (line 66) | struct _SeafileTask {
type _SeafileTaskClass (line 71) | struct _SeafileTaskClass {
type _SeafileTaskPrivate (line 75) | struct _SeafileTaskPrivate {
type _SeafileCloneTask (line 87) | struct _SeafileCloneTask {
type _SeafileCloneTaskClass (line 92) | struct _SeafileCloneTaskClass {
type _SeafileCloneTaskPrivate (line 96) | struct _SeafileCloneTaskPrivate {
function gpointer (line 180) | static inline gpointer
function SeafileTask (line 186) | SeafileTask*
function SeafileTask (line 194) | SeafileTask*
function gchar (line 200) | const gchar*
function seafile_task_set_ttype (line 211) | void
function gchar (line 227) | const gchar*
function seafile_task_set_repo_id (line 238) | void
function gchar (line 254) | const gchar*
function seafile_task_set_state (line 265) | void
function gchar (line 281) | const gchar*
function seafile_task_set_rt_state (line 292) | void
function gint64 (line 308) | gint64
function seafile_task_set_block_total (line 317) | void
function gint64 (line 330) | gint64
function seafile_task_set_block_done (line 339) | void
function gint (line 352) | gint
function seafile_task_set_fs_objects_total (line 361) | void
function gint (line 374) | gint
function seafile_task_set_fs_objects_done (line 383) | void
function gint (line 396) | gint
function seafile_task_set_rate (line 405) | void
function seafile_task_class_init (line 418) | static void
function seafile_task_instance_init (line 438) | static void
function seafile_task_finalize (line 445) | static void
function GType (line 457) | static GType
function GType (line 467) | GType
function _vala_seafile_task_get_property (line 479) | static void
function _vala_seafile_task_set_property (line 521) | static void
function gpointer (line 563) | static inline gpointer
function SeafileCloneTask (line 569) | SeafileCloneTask*
function SeafileCloneTask (line 577) | SeafileCloneTask*
function gchar (line 583) | const gchar*
function seafile_clone_task_set_state (line 594) | void
function gint (line 610) | gint
function seafile_clone_task_set_error (line 619) | void
function gchar (line 632) | const gchar*
function seafile_clone_task_set_repo_id (line 643) | void
function gchar (line 659) | const gchar*
function seafile_clone_task_set_repo_name (line 670) | void
function gchar (line 686) | const gchar*
function seafile_clone_task_set_worktree (line 697) | void
function seafile_clone_task_class_init (line 713) | static void
function seafile_clone_task_instance_init (line 729) | static void
function seafile_clone_task_finalize (line 736) | static void
function GType (line 748) | static GType
function GType (line 758) | GType
function _vala_seafile_clone_task_get_property (line 770) | static void
function _vala_seafile_clone_task_set_property (line 800) | static void
FILE: lib/utils.c
function rawdata_to_hex (line 69) | void
function hexval (line 83) | static unsigned hexval(char c)
function hex_to_rawdata (line 94) | int
function ccnet_strlcpy (line 108) | size_t
function checkdir (line 122) | int
function checkdir_with_mkdir (line 145) | int
function objstore_mkdir (line 166) | int
function objstore_get_path (line 193) | void
function __time64_t (line 214) | __time64_t
function get_utc_file_time_fd (line 225) | static int
function unix_time_to_file_time (line 250) | inline static void
function set_utc_file_time (line 260) | static int
function wchar_t (line 290) | wchar_t *
function wchar_t (line 311) | wchar_t *
function windows_error_to_errno (line 367) | static int
function seaf_stat (line 388) | int
function seaf_fstat (line 424) | int
function seaf_stat_from_find_data (line 442) | void
function seaf_set_file_time (line 461) | int
function seaf_util_unlink (line 489) | int
function seaf_util_rmdir (line 513) | int
function seaf_util_mkdir (line 537) | int
function seaf_util_open (line 561) | int
function seaf_util_create (line 604) | int
function seaf_util_rename (line 647) | int
function gboolean (line 675) | gboolean
function gint64 (line 699) | gint64
function traverse_directory_win32 (line 711) | int
function gboolean (line 780) | static inline gboolean
function gboolean (line 792) | gboolean
function readn (line 868) | ssize_t /* Read "n" bytes from a descriptor. */
function writen (line 892) | ssize_t /* Write "n" bytes to a descriptor. */
function recvn (line 916) | ssize_t /* Read "n" bytes from a descriptor. */
function sendn (line 945) | ssize_t /* Write "n" bytes to a descriptor. */
type sockaddr_in (line 975) | struct sockaddr_in
function seaf_pipe (line 980) | int
function seaf_pipe_read (line 1056) | int
function seaf_pipe_write (line 1062) | int
function seaf_pipe_close (line 1068) | int
function seaf_pipe_readn (line 1074) | ssize_t seaf_pipe_readn (seaf_pipe_t fd, void *vptr, size_t n)
function seaf_pipe_writen (line 1079) | ssize_t seaf_pipe_writen (seaf_pipe_t fd, const void *vptr, size_t n)
function seaf_pipe (line 1086) | int
function seaf_pipe_read (line 1092) | int
function seaf_pipe_write (line 1098) | int
function seaf_pipe_close (line 1104) | int
function seaf_pipe_readn (line 1110) | ssize_t seaf_pipe_readn (seaf_pipe_t fd, void *vptr, size_t n)
function seaf_pipe_writen (line 1115) | ssize_t seaf_pipe_writen (seaf_pipe_t fd, const void *vptr, size_t n)
function copy_fd (line 1122) | int copy_fd (int ifd, int ofd)
function copy_file (line 1142) | int copy_file (const char *dst, const char *src, int mode)
type passwd (line 1207) | struct passwd
function calculate_sha1 (line 1276) | int
function ccnet_sha1_hash (line 1292) | uint32_t
function ccnet_sha1_equal (line 1306) | int
function gen_uuid_inplace (line 1333) | void gen_uuid_inplace (char *buf)
function gboolean (line 1341) | gboolean
function gen_uuid_inplace (line 1368) | void gen_uuid_inplace (char *buf)
function gboolean (line 1379) | gboolean
function gboolean (line 1393) | gboolean
function gboolean (line 1531) | gboolean is_ipaddr_valid (const char *ip)
function parse_key_value_pairs (line 1544) | void parse_key_value_pairs (char *string, KeyValueFunc func, void *data)
function parse_key_value_pairs2 (line 1574) | void parse_key_value_pairs2 (char *string, KeyValueFunc2 func, void *data)
function gchar (line 1608) | gchar*
function gboolean (line 1636) | gboolean
function GList (line 1656) | GList*
function GList (line 1668) | GList *
function GList (line 1682) | GList *
function string_list_free (line 1699) | void
function string_list_join (line 1713) | void
function GList (line 1729) | GList *
function GList (line 1748) | GList *
function gboolean (line 1756) | gboolean
function nfree_string_array (line 1785) | void
function gint64 (line 1795) | gint64
function HANDLE (line 1858) | static HANDLE
function count_process (line 1903) | int count_process (const char *process_name_in)
function gboolean (line 1950) | gboolean
function win32_kill_process (line 1963) | int
function win32_spawn_process (line 1977) | int
function wchar_t (line 2080) | wchar_t *
function find_process_in_dirent (line 2125) | static int
function gboolean (line 2154) | gboolean process_is_running (const char *process_name)
function count_process (line 2179) | int count_process(const char *process_name)
function gboolean (line 2206) | gboolean process_is_running (const char *process_name)
function win_stat64_utf8 (line 2233) | static inline int
function gint64 (line 2247) | static gint64
function gint64 (line 2291) | gint64
function gboolean (line 2345) | gboolean
function gint64 (line 2351) | gint64
function json_object_set_string_member (line 2358) | void
function json_object_set_int_member (line 2364) | void
function clean_utf8_data (line 2370) | void
function seaf_compress (line 2405) | int
function seaf_decompress (line 2447) | int
function gboolean (line 2522) | gboolean
function gboolean (line 2528) | gboolean
function gboolean (line 2538) | gboolean
function gboolean (line 2563) | static gboolean
function gboolean (line 2616) | static gboolean
function gboolean (line 2677) | static gboolean
function gboolean (line 2684) | gboolean
function seaf_getxattr (line 2699) | ssize_t
function seaf_setxattr (line 2766) | int
function seaf_removexattr (line 2820) | int
FILE: lib/utils.h
type IgnoreReason (line 161) | typedef enum IgnoreReason {
type gboolean (line 255) | typedef gboolean (*KeyValueFunc2) (void *data, const char *key,
function bswap64 (line 285) | static inline uint64_t
function hton64 (line 304) | static inline uint64_t
function ntoh64 (line 314) | static inline uint64_t
function put64bit (line 324) | static inline void put64bit(uint8_t **ptr,uint64_t val)
function put32bit (line 331) | static inline void put32bit(uint8_t **ptr,uint32_t val)
function put16bit (line 338) | static inline void put16bit(uint8_t **ptr,uint16_t val)
function get64bit (line 345) | static inline uint64_t get64bit(const uint8_t **ptr)
function get32bit (line 352) | static inline uint32_t get32bit(const uint8_t **ptr)
function get16bit (line 359) | static inline uint16_t get16bit(const uint8_t **ptr)
FILE: msi/custom/custom.c
function msgbox (line 18) | void msgbox(const char *msg)
function BOOL (line 23) | BOOL readRegValue(HKEY root, const char *subkey, const char *name, char ...
function UINT (line 71) | UINT __stdcall RemoveExtDll(HANDLE hModule)
FILE: msi/strip-files.py
function do_strip (line 9) | def do_strip(fn):
FILE: python/seafile/__init__.py
class TaskType (line 4) | class TaskType(object):
FILE: python/seafile/rpcclient.py
class SeafileRpcClient (line 4) | class SeafileRpcClient(NamedPipeClient):
method __init__ (line 7) | def __init__(self, socket_path, *args, **kwargs):
method seafile_sync_error_id_to_str (line 17) | def seafile_sync_error_id_to_str():
method seafile_del_file_sync_error_by_id (line 22) | def seafile_del_file_sync_error_by_id():
method seafile_calc_dir_size (line 27) | def seafile_calc_dir_size(path):
method seafile_get_total_block_size (line 32) | def seafile_get_total_block_size():
method seafile_get_config (line 37) | def seafile_get_config(key):
method seafile_set_config (line 42) | def seafile_set_config(key, value):
method seafile_get_config_int (line 47) | def seafile_get_config_int(key):
method seafile_set_config_int (line 52) | def seafile_set_config_int(key, value):
method seafile_set_upload_rate_limit (line 57) | def seafile_set_upload_rate_limit(limit):
method seafile_set_download_rate_limit (line 62) | def seafile_set_download_rate_limit(limit):
method seafile_get_repo_list (line 68) | def seafile_get_repo_list():
method seafile_get_repo (line 73) | def seafile_get_repo():
method seafile_create_repo (line 78) | def seafile_create_repo(name, desc, passwd, base, relay_id, keep_histo...
method seafile_destroy_repo (line 83) | def seafile_destroy_repo(repo_id):
method seafile_diff (line 88) | def seafile_diff():
method seafile_get_commit (line 93) | def seafile_get_commit(repo_id, version, commit_id):
method seafile_get_commit_list (line 98) | def seafile_get_commit_list():
method seafile_branch_gets (line 103) | def seafile_branch_gets(repo_id):
method seafile_branch_add (line 108) | def seafile_branch_add(repo_id, branch):
method gen_default_worktree (line 114) | def gen_default_worktree(worktree_parent, repo_name):
method seafile_clone (line 118) | def seafile_clone(repo_id, repo_version, repo_name, worktree, token, p...
method seafile_download (line 123) | def seafile_download(repo_id, repo_version, repo_name, wt_parent, toke...
method seafile_cancel_clone_task (line 128) | def seafile_cancel_clone_task(repo_id):
method seafile_get_clone_tasks (line 133) | def seafile_get_clone_tasks():
method seafile_find_transfer_task (line 138) | def seafile_find_transfer_task(repo_id):
method seafile_sync (line 144) | def seafile_sync(repo_id, peer_id):
method seafile_get_repo_sync_task (line 149) | def seafile_get_repo_sync_task():
method seafile_is_auto_sync_enabled (line 154) | def seafile_is_auto_sync_enabled():
method seafile_get_file_sync_errors (line 159) | def seafile_get_file_sync_errors():
method seafile_set_repo_passwd (line 166) | def seafile_set_repo_passwd(repo_id, passwd):
method seafile_set_repo_property (line 171) | def seafile_set_repo_property(repo_id, key, value):
method seafile_get_repo_property (line 176) | def seafile_get_repo_property(repo_id, key):
method seafile_get_repo_relay_address (line 181) | def seafile_get_repo_relay_address(repo_id):
method seafile_get_repo_relay_port (line 186) | def seafile_get_repo_relay_port(repo_id):
method seafile_update_repo_relay_info (line 191) | def seafile_update_repo_relay_info(repo_id, addr, port):
method seafile_set_repo_token (line 196) | def seafile_set_repo_token(repo_id, token):
method seafile_get_repo_token (line 201) | def seafile_get_repo_token(repo_id):
method seafile_generate_magic_and_random_key (line 206) | def seafile_generate_magic_and_random_key(enc_version, repo_id, passwo...
method seafile_shutdown (line 211) | def seafile_shutdown():
method seafile_add_del_confirmation (line 216) | def seafile_add_del_confirmation(key, value):
FILE: scripts/breakpad.py
function call (line 19) | def call(*a, **kw):
function get_command_output (line 24) | def get_command_output(cmd, **kw):
function generate_seafile_breakpad_symbol (line 29) | def generate_seafile_breakpad_symbol(project_dir, program_name, symbols_...
function generate_seafile_gui_breakpad_symbol (line 59) | def generate_seafile_gui_breakpad_symbol(project_dir, program_name, symb...
function main (line 80) | def main():
FILE: scripts/build/build-cli.py
function highlight (line 53) | def highlight(content, is_error=False):
function info (line 60) | def info(msg):
function exist_in_path (line 63) | def exist_in_path(prog):
function prepend_env_value (line 75) | def prepend_env_value(name, value, seperator=':'):
function error (line 88) | def error(msg=None, usage=None):
function run_argv (line 95) | def run_argv(argv, cwd=None, env=None, suppress_stdout=False, suppress_s...
function run (line 118) | def run(cmdline, cwd=None, env=None, suppress_stdout=False, suppress_std...
function must_mkdir (line 139) | def must_mkdir(path):
function must_copy (line 146) | def must_copy(src, dst):
class Project (line 153) | class Project(object):
method __init__ (line 161) | def __init__(self):
method get_version (line 170) | def get_version(self):
method get_source_commit_id (line 174) | def get_source_commit_id(self):
method append_cflags (line 185) | def append_cflags(self, macros):
method uncompress (line 191) | def uncompress(self):
method before_build (line 198) | def before_build(self):
method build (line 202) | def build(self):
class Libsearpc (line 210) | class Libsearpc(Project):
method __init__ (line 213) | def __init__(self):
method get_version (line 221) | def get_version(self):
class Ccnet (line 224) | class Ccnet(Project):
method __init__ (line 226) | def __init__(self):
method get_version (line 234) | def get_version(self):
method before_build (line 237) | def before_build(self):
class Seafile (line 244) | class Seafile(Project):
method __init__ (line 246) | def __init__(self):
method get_version (line 254) | def get_version(self):
method update_cli_version (line 257) | def update_cli_version(self):
method before_build (line 273) | def before_build(self):
function check_targz_src (line 280) | def check_targz_src(proj, version, srcdir):
function validate_args (line 285) | def validate_args(usage, options):
function show_build_info (line 359) | def show_build_info():
function prepare_builddir (line 377) | def prepare_builddir(builddir):
function parse_args (line 391) | def parse_args():
function setup_build_env (line 449) | def setup_build_env():
function copy_scripts_and_libs (line 478) | def copy_scripts_and_libs():
function get_dependent_libs (line 510) | def get_dependent_libs(executable):
function copy_shared_libs (line 531) | def copy_shared_libs():
function strip_symbols (line 561) | def strip_symbols():
function create_tarball (line 592) | def create_tarball(tarball_name):
function gen_tarball (line 635) | def gen_tarball():
function main (line 675) | def main():
FILE: scripts/build/build-deb.py
function highlight (line 57) | def highlight(content, is_error=False):
function info (line 64) | def info(msg):
function exist_in_path (line 67) | def exist_in_path(prog):
function prepend_env_value (line 79) | def prepend_env_value(name, value, seperator=':'):
function error (line 92) | def error(msg=None, usage=None):
function run_argv (line 99) | def run_argv(argv, cwd=None, env=None, suppress_stdout=False, suppress_s...
function run (line 122) | def run(cmdline, cwd=None, env=None, suppress_stdout=False, suppress_std...
function must_mkdir (line 143) | def must_mkdir(path):
function must_copy (line 150) | def must_copy(src, dst):
class Project (line 157) | class Project(object):
method __init__ (line 165) | def __init__(self):
method get_version (line 172) | def get_version(self):
method get_source_commit_id (line 176) | def get_source_commit_id(self):
method append_cflags (line 187) | def append_cflags(self, macros):
method uncompress (line 193) | def uncompress(self):
method before_build (line 200) | def before_build(self):
method build (line 204) | def build(self):
class Libsearpc (line 212) | class Libsearpc(Project):
method get_version (line 215) | def get_version(self):
class Ccnet (line 218) | class Ccnet(Project):
method get_version (line 221) | def get_version(self):
method before_build (line 224) | def before_build(self):
class SeafileClient (line 231) | class SeafileClient(Project):
method get_version (line 234) | def get_version(self):
method before_build (line 237) | def before_build(self):
class Seafile (line 240) | class Seafile(Project):
method __init__ (line 242) | def __init__(self):
method get_version (line 248) | def get_version(self):
method before_build (line 251) | def before_build(self):
function check_targz_src (line 257) | def check_targz_src(proj, version, srcdir):
function validate_args (line 262) | def validate_args(usage, options):
function show_build_info (line 340) | def show_build_info():
function prepare_builddir (line 359) | def prepare_builddir(builddir):
function parse_args (line 371) | def parse_args():
function setup_build_env (line 434) | def setup_build_env():
function move_deb (line 457) | def move_deb():
function main (line 474) | def main():
FILE: scripts/build/build-mac-local-py3.py
function highlight (line 50) | def highlight(content, is_error=False):
function info (line 57) | def info(msg):
function cd (line 61) | def cd(path):
function exist_in_path (line 69) | def exist_in_path(prog):
function prepend_env_value (line 73) | def prepend_env_value(name, value, seperator=':'):
function find_in_path (line 86) | def find_in_path(prog):
function error (line 98) | def error(msg=None, usage=None):
function run_argv (line 105) | def run_argv(argv, cwd=None, env=None, suppress_stdout=False, suppress_s...
function run (line 129) | def run(cmdline, cwd=None, env=None, suppress_stdout=False, suppress_std...
function must_run (line 151) | def must_run(cmdline, *a, **kw):
function check_remove (line 156) | def check_remove(path):
function must_mkdir (line 170) | def must_mkdir(path):
function must_copy (line 178) | def must_copy(src, dst):
function must_copytree (line 185) | def must_copytree(src, dst):
function check_project_version (line 192) | def check_project_version(version):
function check_cmd_para (line 197) | def check_cmd_para():
class Project (line 206) | class Project(object):
method __init__ (line 214) | def __init__(self):
method get_version (line 220) | def get_version(self):
method get_source_commit_id (line 224) | def get_source_commit_id(self):
method append_cflags (line 235) | def append_cflags(self, macros):
method before_build (line 241) | def before_build(self):
method build (line 245) | def build(self):
function concurrent_make (line 253) | def concurrent_make():
class Libsearpc (line 256) | class Libsearpc(Project):
method __init__ (line 259) | def __init__(self):
class Seafile (line 268) | class Seafile(Project):
method __init__ (line 270) | def __init__(self):
method update_cli_version (line 279) | def update_cli_version(self):
method before_build (line 295) | def before_build(self):
class SeafileClient (line 302) | class SeafileClient(Project):
method __init__ (line 306) | def __init__(self):
method before_build (line 335) | def before_build(self):
class SeafileDMGLayout (line 338) | class SeafileDMGLayout(Seafile):
method __init__ (line 340) | def __init__(self):
class SeafileFinderSyncPlugin (line 345) | class SeafileFinderSyncPlugin(SeafileClient):
method __init__ (line 347) | def __init__(self):
function prepare_builddir (line 358) | def prepare_builddir(builddir):
function parse_args (line 372) | def parse_args():
function validate_args (line 403) | def validate_args(usage, options):
function setup_build_env (line 442) | def setup_build_env():
function get_dependent_libs (line 486) | def get_dependent_libs(executable):
function copy_shared_libs (line 505) | def copy_shared_libs():
function change_rpaths (line 534) | def change_rpaths():
function gen_dmg (line 611) | def gen_dmg():
function sign_in_parallel (line 662) | def sign_in_parallel(files_to_sign):
function sign_files (line 703) | def sign_files(appdir):
function unlock_keychain (line 757) | def unlock_keychain():
function do_sign (line 767) | def do_sign(path, extra_args=None, preserve_entitlemenets=True):
function copy_dmg (line 790) | def copy_dmg():
function notarize_dmg (line 804) | def notarize_dmg():
function build_and_sign_fsplugin (line 814) | def build_and_sign_fsplugin():
function copy_fsplugin (line 838) | def copy_fsplugin(plugins_dir):
function copy_sparkle_framework (line 844) | def copy_sparkle_framework():
function build_projects (line 852) | def build_projects():
function local_workflow (line 868) | def local_workflow():
function generate_app_tar_gz (line 878) | def generate_app_tar_gz():
function setup_logging (line 883) | def setup_logging(level=logging.INFO):
function main (line 895) | def main():
FILE: scripts/build/build-mac-local.py
function highlight (line 57) | def highlight(content, is_error=False):
function info (line 64) | def info(msg):
function cd (line 68) | def cd(path):
function exist_in_path (line 76) | def exist_in_path(prog):
function prepend_env_value (line 80) | def prepend_env_value(name, value, seperator=':'):
function find_in_path (line 93) | def find_in_path(prog):
function error (line 105) | def error(msg=None, usage=None):
function run_argv (line 112) | def run_argv(argv, cwd=None, env=None, suppress_stdout=False, suppress_s...
function run (line 136) | def run(cmdline, cwd=None, env=None, suppress_stdout=False, suppress_std...
function must_run (line 158) | def must_run(cmdline, *a, **kw):
function check_remove (line 163) | def check_remove(path):
function must_mkdir (line 177) | def must_mkdir(path):
function must_copy (line 185) | def must_copy(src, dst):
function must_copytree (line 192) | def must_copytree(src, dst):
function check_project_version (line 199) | def check_project_version(version):
function check_cmd_para (line 204) | def check_cmd_para():
class Project (line 213) | class Project(object):
method __init__ (line 221) | def __init__(self):
method get_version (line 227) | def get_version(self):
method get_source_commit_id (line 231) | def get_source_commit_id(self):
method append_cflags (line 242) | def append_cflags(self, macros):
method before_build (line 248) | def before_build(self):
method build (line 252) | def build(self):
function concurrent_make (line 260) | def concurrent_make():
class Libsearpc (line 263) | class Libsearpc(Project):
method __init__ (line 266) | def __init__(self):
class Seafile (line 275) | class Seafile(Project):
method __init__ (line 277) | def __init__(self):
method update_cli_version (line 286) | def update_cli_version(self):
method before_build (line 302) | def before_build(self):
class SeafileClient (line 309) | class SeafileClient(Project):
method __init__ (line 313) | def __init__(self):
method before_build (line 342) | def before_build(self):
class SeafileDMGLayout (line 345) | class SeafileDMGLayout(Seafile):
method __init__ (line 347) | def __init__(self):
class SeafileFinderSyncPlugin (line 352) | class SeafileFinderSyncPlugin(SeafileClient):
method __init__ (line 354) | def __init__(self):
function prepare_builddir (line 365) | def prepare_builddir(builddir):
function parse_args (line 379) | def parse_args():
function validate_args (line 410) | def validate_args(usage, options):
function setup_build_env (line 449) | def setup_build_env():
function get_dependent_libs (line 493) | def get_dependent_libs(executable):
function copy_shared_libs (line 512) | def copy_shared_libs():
function change_rpaths (line 541) | def change_rpaths():
function gen_dmg (line 618) | def gen_dmg():
function sign_in_parallel (line 669) | def sign_in_parallel(files_to_sign):
function sign_files (line 710) | def sign_files(appdir):
function unlock_keychain (line 762) | def unlock_keychain():
function do_sign (line 772) | def do_sign(path, extra_args=None, preserve_entitlemenets=True):
function copy_dmg (line 795) | def copy_dmg():
function notarize_dmg (line 809) | def notarize_dmg():
function build_and_sign_fsplugin (line 819) | def build_and_sign_fsplugin():
function copy_fsplugin (line 843) | def copy_fsplugin(plugins_dir):
function copy_sparkle_framework (line 849) | def copy_sparkle_framework():
function build_projects (line 857) | def build_projects():
function local_workflow (line 873) | def local_workflow():
function generate_app_tar_gz (line 883) | def generate_app_tar_gz():
function setup_logging (line 888) | def setup_logging(level=logging.INFO):
function main (line 900) | def main():
FILE: scripts/build/build-mac.py
function highlight (line 82) | def highlight(content, is_error=False):
function info (line 89) | def info(msg):
function cd (line 93) | def cd(path):
function exist_in_path (line 101) | def exist_in_path(prog):
function prepend_env_value (line 105) | def prepend_env_value(name, value, seperator=':'):
function find_in_path (line 118) | def find_in_path(prog):
function error (line 130) | def error(msg=None, usage=None):
function run_argv (line 137) | def run_argv(argv, cwd=None, env=None, suppress_stdout=False, suppress_s...
function run (line 161) | def run(cmdline, cwd=None, env=None, suppress_stdout=False, suppress_std...
function must_run (line 183) | def must_run(cmdline, *a, **kw):
function check_remove (line 188) | def check_remove(path):
function must_mkdir (line 202) | def must_mkdir(path):
function must_copy (line 210) | def must_copy(src, dst):
function must_copytree (line 217) | def must_copytree(src, dst):
class Project (line 224) | class Project(object):
method __init__ (line 232) | def __init__(self):
method get_version (line 240) | def get_version(self):
method get_source_commit_id (line 244) | def get_source_commit_id(self):
method append_cflags (line 255) | def append_cflags(self, macros):
method uncompress (line 261) | def uncompress(self):
method before_build (line 268) | def before_build(self):
method build (line 272) | def build(self):
function concurrent_make (line 280) | def concurrent_make():
class Libsearpc (line 283) | class Libsearpc(Project):
method __init__ (line 286) | def __init__(self):
method get_version (line 294) | def get_version(self):
class Seafile (line 297) | class Seafile(Project):
method __init__ (line 299) | def __init__(self):
method get_version (line 307) | def get_version(self):
method update_cli_version (line 310) | def update_cli_version(self):
method before_build (line 326) | def before_build(self):
class SeafileClient (line 333) | class SeafileClient(Project):
method __init__ (line 337) | def __init__(self):
method get_version (line 357) | def get_version(self):
method before_build (line 360) | def before_build(self):
class SeafileDMGLayout (line 363) | class SeafileDMGLayout(Seafile):
method __init__ (line 365) | def __init__(self):
class SeafileFinderSyncPlugin (line 370) | class SeafileFinderSyncPlugin(SeafileClient):
method __init__ (line 372) | def __init__(self):
function check_targz_src (line 378) | def check_targz_src(proj, version, srcdir):
function validate_args (line 383) | def validate_args(usage, options):
function show_build_info (line 482) | def show_build_info():
function prepare_builddir (line 500) | def prepare_builddir(builddir):
function parse_args (line 514) | def parse_args():
function setup_build_env (line 592) | def setup_build_env():
function get_dependent_libs (line 636) | def get_dependent_libs(executable):
function copy_shared_libs (line 655) | def copy_shared_libs():
function change_rpaths (line 684) | def change_rpaths():
function gen_dmg (line 761) | def gen_dmg():
function sign_in_parallel (line 813) | def sign_in_parallel(files_to_sign):
function sign_files (line 854) | def sign_files(appdir):
function unlock_keychain (line 906) | def unlock_keychain():
function do_sign (line 916) | def do_sign(path, extra_args=None, preserve_entitlemenets=True):
function send_file_to_slave (line 939) | def send_file_to_slave(src, dst):
function get_file_from_slave (line 944) | def get_file_from_slave(src, dst):
function send_project_tarball (line 950) | def send_project_tarball(project):
function slave_run (line 956) | def slave_run(cmd, **kw):
function prepare_dirs_on_slave (line 962) | def prepare_dirs_on_slave():
function send_sources_to_slave (line 967) | def send_sources_to_slave():
function build_on_slave (line 979) | def build_on_slave():
function get_app_tgz_from_slave (line 994) | def get_app_tgz_from_slave():
function copy_dmg (line 1000) | def copy_dmg():
function notarize_dmg (line 1014) | def notarize_dmg():
function build_and_sign_fsplugin (line 1024) | def build_and_sign_fsplugin():
function copy_fsplugin (line 1049) | def copy_fsplugin(plugins_dir):
function copy_sparkle_framework (line 1055) | def copy_sparkle_framework():
function build_projects (line 1063) | def build_projects():
function local_workflow (line 1081) | def local_workflow():
function master_workflow (line 1090) | def master_workflow():
function slave_workflow (line 1100) | def slave_workflow():
function generate_app_tar_gz (line 1104) | def generate_app_tar_gz():
function setup_logging (line 1110) | def setup_logging(level=logging.INFO):
function main (line 1122) | def main():
FILE: scripts/build/build-msi-vs-cn.py
function highlight (line 59) | def highlight(content, is_error=False):
function info (line 68) | def info(msg):
function error (line 71) | def error(msg=None, usage=None):
function find_in_path (line 78) | def find_in_path(prog):
function run (line 90) | def run(cmdline, cwd=None, env=None, suppress_stdout=False, suppress_std...
function must_copy (line 116) | def must_copy(src, dst):
function must_copytree (line 123) | def must_copytree(src, dst):
function must_rmtree (line 130) | def must_rmtree(path):
function must_rename (line 137) | def must_rename(src, dst):
function must_mkdir (line 145) | def must_mkdir(path):
function dump_env (line 154) | def dump_env():
function do_sign (line 160) | def do_sign(fn, desc=None):
function initworkspace (line 179) | def initworkspace():
function check_project_version (line 187) | def check_project_version(version):
function check_cmd_para (line 192) | def check_cmd_para():
class Project (line 201) | class Project(object):
method __init__ (line 209) | def __init__(self):
method before_build (line 214) | def before_build(self):
method build (line 218) | def build(self):
method after_build (line 228) | def after_build(self):
class Libsearpc (line 232) | class Libsearpc(Project):
method __init__ (line 235) | def __init__(self):
method after_build (line 241) | def after_build(self):
class Seafile (line 246) | class Seafile(Project):
method __init__ (line 248) | def __init__(self):
method before_build (line 255) | def before_build(self):
method after_build (line 258) | def after_build(self):
class SeafileGUI (line 278) | class SeafileGUI(Project):
method __init__ (line 281) | def __init__(self):
method before_build (line 287) | def before_build(self):
method after_build (line 290) | def after_build(self):
class SeafileShellExt (line 334) | class SeafileShellExt(Project):
method __init__ (line 336) | def __init__(self):
method before_build (line 342) | def before_build(self):
method after_build (line 345) | def after_build(self):
function wix_build (line 354) | def wix_build(language):
function prepare_msi (line 398) | def prepare_msi():
function edit_fragment_wxs (line 435) | def edit_fragment_wxs():
function signinstaller (line 457) | def signinstaller(msi_file_path, language):
function build_and_sign_msi (line 468) | def build_and_sign_msi():
function main (line 476) | def main():
FILE: scripts/build/build-msi-vs.py
function highlight (line 59) | def highlight(content, is_error=False):
function info (line 68) | def info(msg):
function error (line 71) | def error(msg=None, usage=None):
function find_in_path (line 78) | def find_in_path(prog):
function run (line 90) | def run(cmdline, cwd=None, env=None, suppress_stdout=False, suppress_std...
function must_copy (line 116) | def must_copy(src, dst):
function must_copytree (line 123) | def must_copytree(src, dst):
function must_rmtree (line 130) | def must_rmtree(path):
function must_rename (line 137) | def must_rename(src, dst):
function must_mkdir (line 145) | def must_mkdir(path):
function dump_env (line 154) | def dump_env():
function do_sign (line 160) | def do_sign(certfile, fn, desc=None):
function initworkspace (line 179) | def initworkspace():
function check_project_version (line 187) | def check_project_version(version):
function check_cmd_para (line 192) | def check_cmd_para():
class Project (line 201) | class Project(object):
method __init__ (line 209) | def __init__(self):
method before_build (line 214) | def before_build(self):
method build (line 218) | def build(self):
method after_build (line 228) | def after_build(self):
class Libsearpc (line 232) | class Libsearpc(Project):
method __init__ (line 235) | def __init__(self):
method after_build (line 241) | def after_build(self):
class Seafile (line 246) | class Seafile(Project):
method __init__ (line 248) | def __init__(self):
method before_build (line 255) | def before_build(self):
method after_build (line 258) | def after_build(self):
class SeafileGUI (line 278) | class SeafileGUI(Project):
method __init__ (line 281) | def __init__(self):
method before_build (line 287) | def before_build(self):
method after_build (line 290) | def after_build(self):
class SeafileShellExt (line 334) | class SeafileShellExt(Project):
method __init__ (line 336) | def __init__(self):
method before_build (line 342) | def before_build(self):
method after_build (line 345) | def after_build(self):
function wix_build (line 354) | def wix_build(language):
function prepare_msi (line 398) | def prepare_msi():
function edit_fragment_wxs (line 435) | def edit_fragment_wxs():
function signinstaller (line 457) | def signinstaller(msi_file_path, language):
function build_and_sign_msi (line 468) | def build_and_sign_msi():
function main (line 476) | def main():
FILE: scripts/build/build-msi.py
function to_mingw_path (line 71) | def to_mingw_path(path):
function to_win_path (line 78) | def to_win_path(path):
function highlight (line 85) | def highlight(content, is_error=False):
function info (line 94) | def info(msg):
function find_in_path (line 97) | def find_in_path(prog):
function prepend_env_value (line 109) | def prepend_env_value(name, value, seperator=':'):
function error (line 122) | def error(msg=None, usage=None):
function run_argv (line 129) | def run_argv(argv, cwd=None, env=None, suppress_stdout=False, suppress_s...
function run (line 152) | def run(cmdline, cwd=None, env=None, suppress_stdout=False, suppress_std...
function must_mkdir (line 178) | def must_mkdir(path):
function must_copy (line 185) | def must_copy(src, dst):
function must_copytree (line 192) | def must_copytree(src, dst):
function must_move (line 199) | def must_move(src, dst):
class Project (line 206) | class Project(object):
method __init__ (line 214) | def __init__(self):
method get_version (line 223) | def get_version(self):
method get_source_commit_id (line 227) | def get_source_commit_id(self):
method append_cflags (line 238) | def append_cflags(self, macros):
method uncompress (line 244) | def uncompress(self):
method before_build (line 252) | def before_build(self):
method build (line 256) | def build(self):
function get_make_path (line 265) | def get_make_path():
function concurrent_make (line 268) | def concurrent_make():
class Libsearpc (line 271) | class Libsearpc(Project):
method __init__ (line 274) | def __init__(self):
method get_version (line 282) | def get_version(self):
class Seafile (line 285) | class Seafile(Project):
method __init__ (line 287) | def __init__(self):
method get_version (line 296) | def get_version(self):
method before_build (line 299) | def before_build(self):
class SeafileClient (line 305) | class SeafileClient(Project):
method __init__ (line 307) | def __init__(self):
method get_version (line 333) | def get_version(self):
method before_build (line 336) | def before_build(self):
class SeafileShellExt (line 339) | class SeafileShellExt(Project):
method __init__ (line 341) | def __init__(self):
method get_version (line 348) | def get_version(self):
function check_targz_src (line 351) | def check_targz_src(proj, version, srcdir):
function validate_args (line 356) | def validate_args(usage, options):
function show_build_info (line 468) | def show_build_info():
function prepare_builddir (line 489) | def prepare_builddir(builddir):
function parse_args (line 502) | def parse_args():
function setup_build_env (line 597) | def setup_build_env():
function dependency_walk (line 633) | def dependency_walk(applet):
function parse_depends_csv (line 647) | def parse_depends_csv(path):
function copy_shared_libs (line 679) | def copy_shared_libs(exes):
function copy_dll_exe (line 699) | def copy_dll_exe():
function copy_qt_plugins_imageformats (line 728) | def copy_qt_plugins_imageformats():
function copy_qt_plugins_platforms (line 749) | def copy_qt_plugins_platforms():
function copy_qt_translations (line 764) | def copy_qt_translations():
function prepare_msi (line 791) | def prepare_msi():
function sign_executables (line 810) | def sign_executables():
function sign_installers (line 821) | def sign_installers():
function do_sign (line 835) | def do_sign(certfile, fn, desc=None):
function strip_symbols (line 857) | def strip_symbols():
function edit_fragment_wxs (line 872) | def edit_fragment_wxs():
function generate_breakpad_symbols (line 895) | def generate_breakpad_symbols():
function build_msi (line 929) | def build_msi():
function build_english_msi (line 950) | def build_english_msi():
function build_german_msi (line 957) | def build_german_msi():
function move_msi (line 964) | def move_msi():
function check_tools (line 986) | def check_tools():
function dump_env (line 998) | def dump_env():
function need_sign (line 1003) | def need_sign():
function main (line 1006) | def main():
FILE: scripts/build/gen-deb-src.py
function highlight (line 50) | def highlight(content, is_error=False):
function info (line 57) | def info(msg):
function exist_in_path (line 60) | def exist_in_path(prog):
function error (line 72) | def error(msg=None, usage=None):
function run_argv (line 79) | def run_argv(argv, cwd=None, env=None, suppress_stdout=False, suppress_s...
function run (line 104) | def run(cmdline, cwd=None, env=None, suppress_stdout=False, suppress_std...
function must_mkdir (line 125) | def must_mkdir(path):
function must_copy (line 132) | def must_copy(src, dst):
function check_targz_src (line 139) | def check_targz_src(proj, version, srcdir):
function remove_unused_files (line 144) | def remove_unused_files():
function gen_tarball (line 155) | def gen_tarball():
function uncompress_seafile (line 181) | def uncompress_seafile():
function uncompress_libsearpc (line 202) | def uncompress_libsearpc():
function uncompress_ccnet (line 215) | def uncompress_ccnet():
function uncompress_seafile_client (line 228) | def uncompress_seafile_client():
function remove_debian_subdir (line 241) | def remove_debian_subdir():
function parse_args (line 248) | def parse_args():
function validate_args (line 307) | def validate_args(usage, options):
function prepare_builddir (line 379) | def prepare_builddir(builddir):
function show_build_info (line 391) | def show_build_info():
function main (line 409) | def main():
FILE: setupwin.py
function usage (line 31) | def usage():
function to_mingw_path (line 40) | def to_mingw_path(path):
function to_win_path (line 47) | def to_win_path(path):
function info (line 54) | def info(msg):
function error (line 57) | def error(msg=None, usage=None):
function which (line 64) | def which(prog):
function run (line 76) | def run(cmdline, cwd=None, env=None, suppress_stdout=False, suppress_std...
function rmtree (line 101) | def rmtree(path):
function must_mkdir (line 108) | def must_mkdir(path):
function must_copy (line 115) | def must_copy(src, dst):
function must_copytree (line 123) | def must_copytree(src, dst):
function must_move (line 131) | def must_move(src, dst):
function web_py2exe (line 139) | def web_py2exe():
function parse_depends_csv (line 186) | def parse_depends_csv(path):
function copy_shared_libs (line 209) | def copy_shared_libs():
function copy_dll_exe (line 236) | def copy_dll_exe():
function main (line 256) | def main():
FILE: tests/sync-auto-test/seaf_op.py
function _check_seafile (line 83) | def _check_seafile():
function run_argv (line 106) | def run_argv(argv, cwd=None, env=None, suppress_stdout=False, suppress_s...
function get_env (line 131) | def get_env():
class NoRedirect (line 139) | class NoRedirect(urllib2.HTTPRedirectHandler):
method redirect_request (line 140) | def redirect_request(self, req, fp, code, msg, hdrs, newurl):
function urlopen (line 143) | def urlopen(url, data=None, headers=None, follow_redirect=True):
function get_token (line 158) | def get_token(url, username, password):
function get_repo_downlod_info (line 168) | def get_repo_downlod_info(url, token):
function seaf_init (line 173) | def seaf_init(conf_dir):
function seaf_start_all (line 186) | def seaf_start_all(conf_dir):
function seaf_start_ccnet (line 196) | def seaf_start_ccnet(conf_dir):
function seaf_start_seafile (line 205) | def seaf_start_seafile(conf_dir):
function seaf_stop (line 216) | def seaf_stop(conf_dir):
function get_base_url (line 229) | def get_base_url(url):
function get_netloc (line 239) | def get_netloc(url):
function seaf_sync (line 243) | def seaf_sync(conf_dir, server_url, repo_id, worktree, username, passwd):
function seaf_desync (line 288) | def seaf_desync(conf_dir, repo_path):
function seaf_create (line 307) | def seaf_create(conf_dir, server_url, username, passwd, enc_repo):
function seaf_delete (line 331) | def seaf_delete(conf_dir, server_url, username, passwd, repo_id):
function seaf_get_repo (line 345) | def seaf_get_repo(conf_dir, repo_id):
FILE: tests/sync-auto-test/setting.py
class Setting (line 6) | class Setting():
method __init__ (line 7) | def __init__(self):
method parse_config (line 12) | def parse_config(self):
FILE: tests/sync-auto-test/test_cases/__init__.py
function setup (line 6) | def setup():
function teardown (line 16) | def teardown():
FILE: tests/sync-auto-test/test_cases/test_release.py
function test_add_delete_add (line 13) | def test_add_delete_add():
function test_rename (line 33) | def test_rename():
function test_create_update (line 85) | def test_create_update():
function test_delete (line 120) | def test_delete():
function test_case_rename (line 149) | def test_case_rename():
function test_download_1 (line 173) | def test_download_1():
function test_download_2 (line 181) | def test_download_2():
function test_download_3 (line 189) | def test_download_3():
function test_download_4 (line 197) | def test_download_4():
function test_download_5 (line 205) | def test_download_5():
function test_download_6 (line 213) | def test_download_6():
function test_download_7 (line 221) | def test_download_7():
function test_download_8 (line 229) | def test_download_8():
function test_download_9 (line 237) | def test_download_9():
function test_download_10 (line 248) | def test_download_10():
function test_download_11 (line 256) | def test_download_11():
function test_download_12 (line 264) | def test_download_12():
function test_download_case_rename_1 (line 275) | def test_download_case_rename_1():
function test_download_case_rename_2 (line 285) | def test_download_case_rename_2():
FILE: tests/sync-auto-test/test_cases/test_simple.py
function test_add_file (line 7) | def test_add_file():
function test_add_file_t (line 11) | def test_add_file_t():
function test_add_dir (line 15) | def test_add_dir():
function test_add_dir_t (line 19) | def test_add_dir_t():
function test_modify_file (line 23) | def test_modify_file():
function test_rm_file (line 27) | def test_rm_file():
function test_rm_dir (line 31) | def test_rm_dir():
function test_rename_file (line 35) | def test_rename_file():
function test_rename_dir (line 41) | def test_rename_dir():
function test_each (line 47) | def test_each():
function test_unsync_resync (line 56) | def test_unsync_resync():
function test_modify_timestamp (line 70) | def test_modify_timestamp():
FILE: tests/sync-auto-test/util.py
function call_process (line 11) | def call_process(params):
class TestUtil (line 16) | class TestUtil():
method __init__ (line 17) | def __init__(self):
method set_test_root (line 31) | def set_test_root(self, root):
method clean_sync_data (line 35) | def clean_sync_data(conf):
method init_conf (line 46) | def init_conf(self):
method start_daemon (line 67) | def start_daemon(self):
method create_repo (line 71) | def create_repo(self):
method sync_cli1 (line 76) | def sync_cli1(self):
method sync_cli2 (line 80) | def sync_cli2(self):
method sync_repo (line 84) | def sync_repo(self):
method desync_cli1 (line 88) | def desync_cli1(self):
method desync_cli2 (line 91) | def desync_cli2(self):
method desync_repo (line 94) | def desync_repo(self):
method stop_daemon (line 102) | def stop_daemon(self):
method clean (line 106) | def clean(self):
method wait_sync (line 116) | def wait_sync(self):
method verify_by_rsync (line 129) | def verify_by_rsync(dir1, dir2):
method verify_result (line 153) | def verify_result(self, callable=None):
method mkdir (line 164) | def mkdir(self, worktree, path):
method rmdir (line 170) | def rmdir(self, worktree, path):
method mkfile (line 176) | def mkfile(self, worktree, fpath, con=''):
method rmfile (line 190) | def rmfile(self, worktree, fpath):
method modfile (line 196) | def modfile(self, worktree, fpath, con=''):
method move (line 207) | def move(self, worktree, org_path, dest_path):
method batchmove (line 215) | def batchmove(self, worktree, regex, dest_path):
method copy (line 227) | def copy(self, worktree, org_path, dest_path):
method touch (line 235) | def touch(self, worktree, path, time=None):
method getpath (line 241) | def getpath(self, worktree, path):
Condensed preview — 203 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,291K chars).
[
{
"path": ".gitignore",
"chars": 2319,
"preview": "*~\n*.bak\n*.o\n*.exe\ncscope*\n*#\nMakefile.in\nltmain.sh\nlibtool\n*.lo\n*.la\ninstall-sh\ndepcomp\nconfig.guess\nconfig.h\nconfig.lo"
},
{
"path": ".travis.yml",
"chars": 155,
"preview": "sudo: false\nlanguage: c\ndist: Xenial\ncompiler: gcc\nos: linux\ninstall:\n- ./integration-tests/install-deps.sh\nscript:\n - ."
},
{
"path": "LICENSE.txt",
"chars": 18673,
"preview": "This program is released under GPLv2, with the following addition\npermission to link with OpenSSL library.\n\nIf you modif"
},
{
"path": "Makefile.am",
"chars": 286,
"preview": "SUBDIRS = include lib common daemon app doc python\n\nDIST_SUBDIRS = include lib common app daemon doc python\n\nEXTRA_DIST "
},
{
"path": "README.markdown",
"chars": 3979,
"preview": "## Introduction [](http://travis-ci.org/ha"
},
{
"path": "app/Makefile.am",
"chars": 46,
"preview": "bin_SCRIPTS = seaf-cli\n\nEXTRA_DIST = seaf-cli\n"
},
{
"path": "app/seaf-cli",
"chars": 36034,
"preview": "#!/usr/bin/env python3\n#-*- coding:utf-8 -*-\n# pylint: disable=E1121\n\n'''\n\nseaf-cli is command line interface for seafil"
},
{
"path": "autogen.sh",
"chars": 3412,
"preview": "#!/bin/bash\n# Run this to generate all the initial makefiles, etc.\n\n: ${AUTOCONF=autoconf}\n: ${AUTOHEADER=autoheader}\n: "
},
{
"path": "common/Makefile.am",
"chars": 258,
"preview": "SUBDIRS = cdc index\n\nnoinst_HEADERS = \\\n\tdiff-simple.h \\\n\tseafile-crypt.h \\\n\tcommon.h \\\n\tbranch-mgr.h \\\n\tfs-mgr.h \\\n\tblo"
},
{
"path": "common/block-backend-fs.c",
"chars": 13706,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef _WIN32_WINNT\n#define _WIN32_WINNT"
},
{
"path": "common/block-backend.c",
"chars": 1228,
"preview": "\n#include \"common.h\"\n\n#include \"log.h\"\n\n#include \"block-backend.h\"\n\nextern BlockBackend *\nblock_backend_fs_new (const ch"
},
{
"path": "common/block-backend.h",
"chars": 2301,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef BLOCK_BACKEND_H\n#define BLOCK_BAC"
},
{
"path": "common/block-mgr.c",
"chars": 7655,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n\n#include \"seafile-se"
},
{
"path": "common/block-mgr.h",
"chars": 4711,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef SEAF_BLOCK_MGR_H\n#define SEAF_BLO"
},
{
"path": "common/block.h",
"chars": 627,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef BLOCK_H\n#define BLOCK_H\n\ntypedef "
},
{
"path": "common/branch-mgr.c",
"chars": 18412,
"preview": "#include \"common.h\"\n\n#include \"log.h\"\n\n#ifndef SEAFILE_SERVER\n#include \"db.h\"\n#else\n#include \"seaf-db.h\"\n#endif\n\n#includ"
},
{
"path": "common/branch-mgr.h",
"chars": 2472,
"preview": "#ifndef SEAF_BRANCH_MGR_H\n#define SEAF_BRANCH_MGR_H\n\n#include \"commit-mgr.h\"\n#define NO_BRANCH \"-\"\n\ntypedef struct _Seaf"
},
{
"path": "common/cdc/Makefile.am",
"chars": 404,
"preview": "AM_CFLAGS = -I$(top_srcdir)/common -I$(top_srcdir)/lib \\\n\t-Wall @GLIB2_CFLAGS@ @MSVC_CFLAGS@\n\nif MACOS\nif COMPILE_UNIVER"
},
{
"path": "common/cdc/cdc.c",
"chars": 8143,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n\n#include \"log.h\"\n\n#i"
},
{
"path": "common/cdc/cdc.h",
"chars": 1563,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef _CDC_H\n#define _CDC_H\n\n#include <"
},
{
"path": "common/cdc/rabin-checksum.c",
"chars": 4092,
"preview": "#include <sys/types.h>\n#include \"rabin-checksum.h\"\n\n#ifdef WIN32\n#include <stdint.h>\n#ifndef u_int\ntypedef unsigned int "
},
{
"path": "common/cdc/rabin-checksum.h",
"chars": 222,
"preview": "#ifndef _RABIN_CHECKSUM_H\n#define _RABIN_CHECKSUM_H\n\nunsigned int rabin_checksum(char *buf, int len);\n\nunsigned int rabi"
},
{
"path": "common/commit-mgr.c",
"chars": 29166,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n\n#include \"log.h\"\n\n#i"
},
{
"path": "common/commit-mgr.h",
"chars": 6542,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef SEAF_COMMIT_MGR_H\n#define SEAF_CO"
},
{
"path": "common/common.h",
"chars": 1271,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef COMMON_H\n#define COMMON_H\n\n#ifdef"
},
{
"path": "common/curl-init.c",
"chars": 1295,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n\n#ifndef USE_GPL_CRYP"
},
{
"path": "common/curl-init.h",
"chars": 198,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef __CURL_INIT_H__\n#define __CURL_IN"
},
{
"path": "common/diff-simple.c",
"chars": 23930,
"preview": "#include \"common.h\"\n#include \"diff-simple.h\"\n#include \"utils.h\"\n#include \"log.h\"\n\nDiffEntry *\ndiff_entry_new (char type,"
},
{
"path": "common/diff-simple.h",
"chars": 3829,
"preview": "#ifndef DIFF_SIMPLE_H\n#define DIFF_SIMPLE_H\n\n#include <glib.h>\n#ifndef SEAFILE_SERVER\n#include \"index/index.h\"\n#endif\n#i"
},
{
"path": "common/fs-mgr.c",
"chars": 81174,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n\n#include <sys/stat.h"
},
{
"path": "common/fs-mgr.h",
"chars": 14169,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef SEAF_FILE_MGR_H\n#define SEAF_FILE"
},
{
"path": "common/index/Makefile.am",
"chars": 433,
"preview": "AM_CPPFLAGS = -Wall -I${top_srcdir}/common -I${top_srcdir}/lib \\\n\t@MSVC_CFLAGS@\n\nif MACOS\nif COMPILE_UNIVERSAL\nAM_CPPFLA"
},
{
"path": "common/index/cache-tree.c",
"chars": 18153,
"preview": "\n#include \"common.h\"\n\n#include \"log.h\"\n\n#include \"index.h\"\n#if 0\n#include \"tree.h\"\n#include \"tree-walk.h\"\n#endif\n#includ"
},
{
"path": "common/index/cache-tree.h",
"chars": 1887,
"preview": "#ifndef CACHE_TREE_H\n#define CACHE_TREE_H\n\n#include <glib.h>\n\nstruct cache_tree;\nstruct cache_tree_sub {\n struct cach"
},
{
"path": "common/index/hash.c",
"chars": 2830,
"preview": "/*\n * Some generic hashing helpers.\n */\n#include \"index.h\"\n#include \"hash.h\"\n\n/*\n * Look up a hash entry in the hash tab"
},
{
"path": "common/index/hash.h",
"chars": 1195,
"preview": "#ifndef HASH_H\n#define HASH_H\n\n/*\n * These are some simple generic hash table helper functions.\n * Not necessarily suita"
},
{
"path": "common/index/index.c",
"chars": 59172,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n/*\n * GIT - The information manager from h"
},
{
"path": "common/index/index.h",
"chars": 17270,
"preview": "#ifndef INDEX_H\n#define INDEX_H\n\n#include \"common.h\"\n\n#ifndef WIN32\n#include <unistd.h>\n#include <sys/param.h>\n#include "
},
{
"path": "common/index/name-hash.c",
"chars": 5421,
"preview": "/*\n * name-hash.c\n *\n * Hashing names in the index state\n *\n * Copyright (C) 2008 Linus Torvalds\n */\n#define NO_THE_INDE"
},
{
"path": "common/log.c",
"chars": 8539,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n\n#include <stdio.h>\n#"
},
{
"path": "common/log.h",
"chars": 1646,
"preview": "#ifndef LOG_H\n#define LOG_H\n\n#define SEAFILE_DOMAIN g_quark_from_string(\"seafile\")\n\n#ifndef seaf_warning\n#ifndef WIN32\n#"
},
{
"path": "common/mq-mgr.c",
"chars": 1778,
"preview": "#include \"common.h\"\n#include \"log.h\"\n#include \"utils.h\"\n#include \"mq-mgr.h\"\n\ntypedef struct SeafMqManagerPriv {\n // c"
},
{
"path": "common/mq-mgr.h",
"chars": 478,
"preview": "#ifndef SEAF_MQ_MANAGER_H\n#define SEAF_MQ_MANAGER_H\n\n#define SEAFILE_NOTIFY_CHAN \"seafile.notification\"\n\nstruct SeafMqMa"
},
{
"path": "common/obj-backend-fs.c",
"chars": 13872,
"preview": "#ifndef _WIN32_WINNT\n#define _WIN32_WINNT 0x500\n#endif\n\n#include \"common.h\"\n#include \"utils.h\"\n#include \"obj-backend.h\"\n"
},
{
"path": "common/obj-backend.h",
"chars": 1713,
"preview": "#ifndef OBJ_BACKEND_H\n#define OBJ_BACKEND_H\n\n#include <glib.h>\n#include \"obj-store.h\"\n\ntypedef struct ObjBackend ObjBack"
},
{
"path": "common/obj-store.c",
"chars": 3823,
"preview": "#include \"common.h\"\n\n#include \"log.h\"\n\n#include \"seafile-session.h\"\n\n#include \"utils.h\"\n\n#include \"obj-backend.h\"\n#inclu"
},
{
"path": "common/obj-store.h",
"chars": 2294,
"preview": "#ifndef OBJ_STORE_H\n#define OBJ_STORE_H\n\n#include <glib.h>\n#include <sys/types.h>\n\nstruct _SeafileSession;\nstruct SeafOb"
},
{
"path": "common/password-hash.c",
"chars": 5227,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n\n#include <string.h>\n"
},
{
"path": "common/password-hash.h",
"chars": 606,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef _PASSWORD_HASH_H\n#define _PASSWOR"
},
{
"path": "common/rpc-service.c",
"chars": 29201,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n#include <glib/gstdio"
},
{
"path": "common/seafile-crypt.c",
"chars": 21876,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n\n#include <string.h>\n"
},
{
"path": "common/seafile-crypt.h",
"chars": 3799,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef _SEAFILE_CRYPT_H\n#define _SEAFILE"
},
{
"path": "common/vc-common.c",
"chars": 18887,
"preview": "#include \"common.h\"\n\n#include \"seafile-session.h\"\n#include \"vc-common.h\"\n\n#include \"log.h\"\n#include \"seafile-error.h\"\n\ns"
},
{
"path": "common/vc-common.h",
"chars": 1421,
"preview": "#ifndef VC_COMMON_H\n#define VC_COMMON_H\n\n#include \"commit-mgr.h\"\n\nSeafCommit *\nget_merge_base (SeafCommit *head, SeafCom"
},
{
"path": "configure.ac",
"chars": 7690,
"preview": "dnl Process this file with autoconf to produce a configure script.\n\n\nAC_PREREQ(2.61)\nAC_INIT([seafile], [9.0.16], [info@"
},
{
"path": "daemon/Makefile.am",
"chars": 2325,
"preview": "\nAM_CFLAGS = -DPKGDATADIR=\\\"$(pkgdatadir)\\\" \\\n\t-DPACKAGE_DATA_DIR=\\\"\"$(pkgdatadir)\"\\\" \\\n\t-DSEAFILE_CLIENT \\\n\t-D__USE_MIN"
},
{
"path": "daemon/c_bpwrapper.cpp",
"chars": 2878,
"preview": "#ifdef ENABLE_BREAKPAD\n\n#if defined(WIN32)\n#include <client/windows/handler/exception_handler.h>\n#endif\n#include <stdio."
},
{
"path": "daemon/c_bpwrapper.h",
"chars": 207,
"preview": "#pragma once\n\ntypedef void *CBPWrapperExceptionHandler;\n#ifdef __cplusplus\nextern \"C\"\n{\n#endif\n CBPWrapperExceptionHa"
},
{
"path": "daemon/cevent.c",
"chars": 2766,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"include.h\"\n#include \"cevent.h\"\n"
},
{
"path": "daemon/cevent.h",
"chars": 1259,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n/* \n * CEvent is used for send message fr"
},
{
"path": "daemon/change-set.c",
"chars": 22418,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n\n#include \"seafile-se"
},
{
"path": "daemon/change-set.h",
"chars": 1372,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef SEAF_CHANGE_SET_H\n#define SEAF_CH"
},
{
"path": "daemon/clone-mgr.c",
"chars": 52738,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n\n#define DEBUG_FLAG S"
},
{
"path": "daemon/clone-mgr.h",
"chars": 4520,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef CLONE_MGR_H\n#define CLONE_MGR_H\n\n"
},
{
"path": "daemon/filelock-mgr.c",
"chars": 22111,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n\n#include <pthread.h>"
},
{
"path": "daemon/filelock-mgr.h",
"chars": 3757,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef SEAF_FILELOCK_MGR_H\n#define SEAF_"
},
{
"path": "daemon/http-tx-mgr.c",
"chars": 153340,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n\n#include \"net.h\"\n\n#i"
},
{
"path": "daemon/http-tx-mgr.h",
"chars": 11493,
"preview": "#ifndef HTTP_TX_MGR_H\n#define HTTP_TX_MGR_H\n\n#include <pthread.h>\n\nenum {\n HTTP_TASK_TYPE_DOWNLOAD = 0,\n HTTP_TASK"
},
{
"path": "daemon/job-mgr.c",
"chars": 3300,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n\n#if defined(__FreeBS"
},
{
"path": "daemon/job-mgr.h",
"chars": 916,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n/**\n * Job Manager manages long term jobs"
},
{
"path": "daemon/notif-mgr.c",
"chars": 27102,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n#include <libwebsocke"
},
{
"path": "daemon/notif-mgr.h",
"chars": 840,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef NOTIF_MGR_H\n#define NOTIF_MGR_H\nt"
},
{
"path": "daemon/repo-mgr.c",
"chars": 282766,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n#include <glib/gstdio"
},
{
"path": "daemon/repo-mgr.h",
"chars": 14087,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef SEAF_REPO_MGR_H\n#define SEAF_REPO"
},
{
"path": "daemon/seaf-daemon.c",
"chars": 20834,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n\n#ifdef WIN32\n#includ"
},
{
"path": "daemon/seafile-config.c",
"chars": 5892,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n#include \"db.h\"\n\n#inc"
},
{
"path": "daemon/seafile-config.h",
"chars": 3000,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef SEAFILE_CONFIG_H\n#define SEAFILE_"
},
{
"path": "daemon/seafile-error-impl.h",
"chars": 272,
"preview": "#ifndef SEAFILE_ERROR_IMPL_H\n#define SEAFILE_ERROR_IMPL_H\n\n#include \"seafile-error.h\"\n\nenum {\n SYNC_ERROR_LEVEL_REPO,"
},
{
"path": "daemon/seafile-error.c",
"chars": 6129,
"preview": "#include \"common.h\"\n\n#include \"seafile-error-impl.h\"\n\ntypedef struct SyncErrorInfo {\n int error_id;\n int error_lev"
},
{
"path": "daemon/seafile-session.c",
"chars": 19415,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n\n#include <stdint.h>\n"
},
{
"path": "daemon/seafile-session.h",
"chars": 3835,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef SEAFILE_SESSION_H\n#define SEAFILE"
},
{
"path": "daemon/set-perm.c",
"chars": 9101,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n\n#include \"utils.h\"\n#"
},
{
"path": "daemon/set-perm.h",
"chars": 418,
"preview": "#ifndef SEAF_SET_PERM_H\n#define SEAF_SET_PERM_H\n\nenum SeafPathPerm {\n SEAF_PATH_PERM_UNKNOWN = 0,\n SEAF_PATH_PERM_"
},
{
"path": "daemon/sync-mgr.c",
"chars": 104967,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n\n#include \"common.h\"\n\n#include <pthread.h"
},
{
"path": "daemon/sync-mgr.h",
"chars": 5567,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef SYNC_MGR_H\n#define SYNC_MGR_H\n\nty"
},
{
"path": "daemon/sync-status-tree.c",
"chars": 6869,
"preview": "#include \"common.h\"\n\n#include \"seafile-session.h\"\n\n#include \"sync-status-tree.h\"\n\n#include \"log.h\"\n\nstruct _SyncStatusDi"
},
{
"path": "daemon/sync-status-tree.h",
"chars": 911,
"preview": "#ifndef SYNC_STATUS_TREE_H\n#define SYNC_STATUS_TREE_H\n\nstruct SyncStatusTree;\n\nstruct SyncStatusTree *\nsync_status_tree_"
},
{
"path": "daemon/test-sync-tree.c",
"chars": 1325,
"preview": "#include <stdio.h>\n#include <sys/stat.h>\n#include <sys/types.h>\n\n#include \"sync-status-tree.h\"\n\nint main (int argc, char"
},
{
"path": "daemon/timer.c",
"chars": 2032,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#if defined(__FreeBSD__) || defined(__Net"
},
{
"path": "daemon/timer.h",
"chars": 756,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef SEAF_TIMER_H\n#define SEAF_TIMER_H"
},
{
"path": "daemon/vc-utils.c",
"chars": 20164,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n#define DEBUG_FLAG SE"
},
{
"path": "daemon/vc-utils.h",
"chars": 1311,
"preview": "#ifndef VC_UTILS_H\n#define VC_UTILS_H\n\n#include <glib.h>\n\n#include \"index/index.h\"\n#include \"index/cache-tree.h\"\n#includ"
},
{
"path": "daemon/wt-monitor-linux.c",
"chars": 24027,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n#include \"common.h\"\n\n#include <sys/select."
},
{
"path": "daemon/wt-monitor-macos.c",
"chars": 21944,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n#include \"common.h\"\n\n#include <CoreService"
},
{
"path": "daemon/wt-monitor-structs.c",
"chars": 1771,
"preview": "#include <string.h>\n\n#include \"wt-monitor-structs.h\"\n\n/* WTEvent */\n\nWTEvent *wt_event_new (int type, const char *path, "
},
{
"path": "daemon/wt-monitor-structs.h",
"chars": 1633,
"preview": "#ifndef WT_MONITOR_STRUCTS_H\n#define WT_MONITOR_STRUCTS_H\n\n#include <glib.h>\n#include <pthread.h>\n\nenum {\n WT_EVENT_C"
},
{
"path": "daemon/wt-monitor-win32.c",
"chars": 24895,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n#include \"common.h\"\n\n#ifndef _WIN32_WINNT\n"
},
{
"path": "daemon/wt-monitor.c",
"chars": 3145,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n\n#include \"seafile-se"
},
{
"path": "daemon/wt-monitor.h",
"chars": 1270,
"preview": "#ifndef SEAF_WT_MONITOR_H\n#define SEAF_WT_MONITOR_H\n\n#include \"wt-monitor-structs.h\"\n#include \"utils.h\"\n\ntypedef struct "
},
{
"path": "debian/README.Debian",
"chars": 151,
"preview": "Seafile\n-------\n\nFor more information about Seafile, please visit http://seafile.com\n\n -- plt <freeplant@gmail.com> Fri"
},
{
"path": "debian/changelog",
"chars": 10996,
"preview": "seafile-daemon (9.0.16) unstable; urgency=low\n\n * new upstream release\n\n -- Jonathan Xu <jonathan.xu@seafile.com> Wed,"
},
{
"path": "debian/compat",
"chars": 2,
"preview": "7\n"
},
{
"path": "debian/control",
"chars": 2326,
"preview": "Source: seafile-daemon\nSection: net\nPriority: extra\nMaintainer: m.eik michalke <meik.michalke@hhu.de>\nBuild-Depends:\n "
},
{
"path": "debian/copyright",
"chars": 1930,
"preview": "Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/\nUpstream-Name: seafile\nUpstream-Contact: Lingt"
},
{
"path": "debian/dirs",
"chars": 7,
"preview": "usr/bin"
},
{
"path": "debian/docs",
"chars": 0,
"preview": ""
},
{
"path": "debian/libseafile-dev.install",
"chars": 103,
"preview": "usr/include/seafile\nusr/lib/pkgconfig\nusr/lib/libseafile.a\nusr/lib/libseafile.la\nusr/lib/libseafile.so\n"
},
{
"path": "debian/libseafile0.install",
"chars": 59,
"preview": "usr/lib/*.so.*\nusr/lib/python3*/site-packages/seafile/*.py\n"
},
{
"path": "debian/patches/fix-pkgconfig-paths.patch",
"chars": 511,
"preview": "Fixing wrong pkgconfig paths.\n--- a/lib/libseafile.pc.in\n+++ b/lib/libseafile.pc.in\n@@ -1,4 +1,4 @@\n-prefix=(DESTDIR)@pr"
},
{
"path": "debian/patches/series",
"chars": 26,
"preview": "fix-pkgconfig-paths.patch\n"
},
{
"path": "debian/rules",
"chars": 487,
"preview": "#!/usr/bin/make -f\n# -*- makefile -*-\n\n%:\n\tdh $@ --with python3 --with autotools_dev\n\noverride_dh_auto_configure:\n\t./aut"
},
{
"path": "debian/seafile-cli.install",
"chars": 47,
"preview": "usr/bin/seaf-cli\nusr/share/man/man1/seaf-cli.1\n"
},
{
"path": "debian/seafile-daemon.install",
"chars": 53,
"preview": "usr/bin/seaf-daemon\nusr/share/man/man1/seaf-daemon.1\n"
},
{
"path": "debian/source/format",
"chars": 12,
"preview": "3.0 (quilt)\n"
},
{
"path": "dmg/seafileLayout/Info.plist",
"chars": 3140,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "doc/Makefile.am",
"chars": 107,
"preview": "CLIENT_MANUALS = seaf-daemon.1 seaf-cli.1\n\ndist_man1_MANS = $(CLIENT_MANUALS)\n\nEXTRA_DIST = cli-readme.txt\n"
},
{
"path": "doc/cli-readme.txt",
"chars": 1605,
"preview": " Seafile command line client\n ===========================\n\nFor the full "
},
{
"path": "doc/seaf-cli.1",
"chars": 523,
"preview": ".\\\" Manpage for seafile-client\n.\\\" Contact freeplant@gmail.com to correct errors or typos.\n.TH seafile 1 \"31 Jan 2013\" \""
},
{
"path": "doc/seaf-daemon.1",
"chars": 530,
"preview": ".\\\" Manpage for seafile-client\n.\\\" Contact freeplant@gmail.com to correct errors or typos.\n.TH seafile 1 \"31 Jan 2013\" \""
},
{
"path": "include/Makefile.am",
"chars": 95,
"preview": "\nseafiledir = $(includedir)/seafile\n\nseafile_HEADERS = seafile-rpc.h seafile.h seafile-error.h\n"
},
{
"path": "include/seafile-error.h",
"chars": 3164,
"preview": "#ifndef SEAFILE_ERROR_H\n#define SEAFILE_ERROR_H\n\n/* Error codes used in RPC. */\n\n#define SEAF_ERR_GENERAL 500\n#de"
},
{
"path": "include/seafile-rpc.h",
"chars": 5988,
"preview": "\n#ifndef _SEAFILE_RPC_H\n#define _SEAFILE_RPC_H\n\n#include <jansson.h>\n#include \"seafile-object.h\"\n\n/**\n * seafile_get_rep"
},
{
"path": "include/seafile.h",
"chars": 1308,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef SEAFILE_H\n#define SEAFILE_H\n\n#ifd"
},
{
"path": "integration-tests/install-deps.sh",
"chars": 438,
"preview": "#!/bin/bash\n\nset -e -x\n\nsudo apt update\nsudo apt install -y autoconf automake libtool libevent-dev libcurl4-openssl-dev"
},
{
"path": "lib/Makefile.am",
"chars": 1960,
"preview": "pcfiles = libseafile.pc\npkgconfig_DATA = $(pcfiles)\npkgconfigdir = $(libdir)/pkgconfig\n\nAM_CFLAGS = @GLIB2_CFLAGS@ -I$(t"
},
{
"path": "lib/db.c",
"chars": 5075,
"preview": "\n#include <glib.h>\n#ifndef WIN32\n#include <unistd.h>\n#endif\n\n#include \"db.h\"\n\nint\nsqlite_open_db (const char *db_path, s"
},
{
"path": "lib/db.h",
"chars": 885,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef DB_UTILS_H\n#define DB_UTILS_H\n\n#i"
},
{
"path": "lib/include.h",
"chars": 654,
"preview": "\n#include <stdint.h>\n#ifndef WIN32\n#include <config.h>\n#include <unistd.h>\n#endif\n#include <stdlib.h>\n#include <string.h"
},
{
"path": "lib/libseafile.pc.in",
"chars": 300,
"preview": "prefix=(DESTDIR)@prefix@\nexec_prefix=@exec_prefix@\nlibdir=@libdir@\nincludedir=@includedir@\n\nName: libseafile\nDescription"
},
{
"path": "lib/net.c",
"chars": 17493,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n#ifdef WIN32\n #define WINVER 0x0501\n "
},
{
"path": "lib/net.h",
"chars": 2225,
"preview": "\n#ifndef CCNET_NET_H\n#define CCNET_NET_H\n\n#ifdef WIN32\n #include <inttypes.h>\n #include <winsock2.h>\n #include "
},
{
"path": "lib/repo.c",
"chars": 118306,
"preview": "/* repo.c generated by valac 0.56.7, the Vala compiler\n * generated from repo.vala, do not modify */\n\n#include <glib-obj"
},
{
"path": "lib/repo.vala",
"chars": 4082,
"preview": "namespace Seafile {\n\npublic class Repo : Object {\n\n // Section 1: Basic information\n // Members in this section sh"
},
{
"path": "lib/rpc_table.py",
"chars": 4806,
"preview": "\"\"\"\nDefine RPC functions needed to generate\n\"\"\"\n\n# [ <ret-type>, [<arg_types>] ]\nfunc_table = [\n [ \"int\", [] ],\n ["
},
{
"path": "lib/seafile-object.h",
"chars": 24674,
"preview": "/* seafile-object.h generated by valac 0.56.7, the Vala compiler, do not modify */\n\n#ifndef __SEAFILE_OBJECT_H__\n#define"
},
{
"path": "lib/seafile-rpc-wrapper.c",
"chars": 3442,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#if !defined(_MSC_VER)\n#include <config.h"
},
{
"path": "lib/searpc-marshal.h",
"chars": 74133,
"preview": "\nstatic char *\nmarshal_int__void (void *func, json_t *param_array, gsize *ret_len)\n{\n GError *error = NULL;\n\n int "
},
{
"path": "lib/searpc-signature.h",
"chars": 14648,
"preview": "\ninline static gchar *\nsearpc_signature_int__void(void)\n{\n return searpc_compute_signature (\"int\", 0);\n}\n\n\ninline sta"
},
{
"path": "lib/task.c",
"chars": 30894,
"preview": "/* task.c generated by valac 0.56.7, the Vala compiler\n * generated from task.vala, do not modify */\n\n#include <glib-obj"
},
{
"path": "lib/task.vala",
"chars": 719,
"preview": "namespace Seafile {\n\npublic class Task : Object {\n\n public string ttype { get; set; }\n\n\tpublic string repo_id { get; "
},
{
"path": "lib/utils.c",
"chars": 65653,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#include \"common.h\"\n\n#ifdef WIN32\n#ifndef"
},
{
"path": "lib/utils.h",
"chars": 10870,
"preview": "/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\n\n#ifndef CCNET_UTILS_H\n#define CCNET_UTILS"
},
{
"path": "m4/ax_lib_sqlite3.m4",
"chars": 5001,
"preview": "# ===========================================================================\n# http://www.nongnu.org/autoconf-a"
},
{
"path": "m4/glib-gettext.m4",
"chars": 12541,
"preview": "# Copyright (C) 1995-2002 Free Software Foundation, Inc.\n# Copyright (C) 2001-2003,2004 Red Hat, Inc.\n#\n# This file is f"
},
{
"path": "m4/python.m4",
"chars": 1932,
"preview": "## this one is commonly used with AM_PATH_PYTHONDIR ...\ndnl AM_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-I"
},
{
"path": "msi/Includes.wxi",
"chars": 14032,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Include Id=\"SeafileInclude\">\n <?define CurrentSeafileVersion=\"9.0.16\" ?>\n\n <!-"
},
{
"path": "msi/MyInstallDirDlg.wxs",
"chars": 2518,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n Copyright (c) Microsoft Corporation. All rights reserved.\n \n The "
},
{
"path": "msi/WixUI_InstallDir_NoLicense.wxs",
"chars": 4801,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<!--\n Copyright (c) Microsoft Corporation. All rights reserved.\n \n The"
},
{
"path": "msi/custom/custom.c",
"chars": 2376,
"preview": "#include <windows.h>\n#include <string.h>\n#include <stdio.h>\n#include <string.h>\n\n#ifndef KEY_WOW64_64KEY\n#define KEY_WOW"
},
{
"path": "msi/custom/custom.def",
"chars": 44,
"preview": "LIBRARY seafile_custom\nEXPORTS\nRemoveExtDll\n"
},
{
"path": "msi/custom/seafile_custom.sln",
"chars": 1445,
"preview": "\r\nMicrosoft Visual Studio Solution File, Format Version 12.00\r\n# Visual Studio Version 16\r\nVisualStudioVersion = 16.0.3"
},
{
"path": "msi/custom/seafile_custom.vcxproj",
"chars": 8343,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/ms"
},
{
"path": "msi/custom/seafile_custom.vcxproj.filters",
"chars": 975,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbui"
},
{
"path": "msi/de_de.wxl",
"chars": 709,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<WixLocalization Culture=\"de-de\" xmlns=\"http://schemas.microsoft.com/wix/2006/loc"
},
{
"path": "msi/en_US.wxl",
"chars": 679,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<WixLocalization Culture=\"en-us\" xmlns=\"http://schemas.microsoft.com/wix/2006/loc"
},
{
"path": "msi/seafile.wxs",
"chars": 9213,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'\n xmlns:util=\"http://sch"
},
{
"path": "msi/strip-files.py",
"chars": 512,
"preview": "import glob\nimport os\n\n\nos.chdir('bin')\n\nignored = []\n\ndef do_strip(fn):\n try:\n os.system('strip \"%s\"' % fn)\n "
},
{
"path": "msi/zh_CN.wxl",
"chars": 3532,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<WixLocalization Culture=\"zh-cn\" xmlns=\"http://schemas.microsoft.com/wix/2006/loc"
},
{
"path": "python/Makefile.am",
"chars": 18,
"preview": "SUBDIRS = seafile\n"
},
{
"path": "python/seafile/Makefile.am",
"chars": 75,
"preview": "seafiledir=${pyexecdir}/seafile\n\nseafile_PYTHON = __init__.py rpcclient.py\n"
},
{
"path": "python/seafile/__init__.py",
"chars": 111,
"preview": "\nfrom .rpcclient import SeafileRpcClient as RpcClient\n\nclass TaskType(object):\n DOWNLOAD = 0\n UPLOAD = 1\n"
},
{
"path": "python/seafile/rpcclient.py",
"chars": 6655,
"preview": "from pysearpc import searpc_func, SearpcError, NamedPipeClient\n\n\nclass SeafileRpcClient(NamedPipeClient):\n \"\"\"RPC use"
},
{
"path": "scripts/breakpad.py",
"chars": 3144,
"preview": "#!/usr/bin/env python\n#coding: UTF-8\n\"\"\"Generate the breakpad symbol file and place it in the directory structure\nrequir"
},
{
"path": "scripts/build/build-cli.py",
"chars": 21967,
"preview": "#!/usr/bin/env python\n# coding: UTF-8\n\n'''This scirpt builds the seafile command line client (With no gui).\n\nSome notes:"
},
{
"path": "scripts/build/build-deb.py",
"chars": 15865,
"preview": "#!/usr/bin/env python\n# coding: UTF-8\n\n'''This scirpt builds the seafile server tarball.\n\nSome notes:\n\n1. The working di"
},
{
"path": "scripts/build/build-mac-local-py3.py",
"chars": 28179,
"preview": "#!/usr/bin/env python\n# coding: UTF-8\n\n'''This script builds the seafile mac client.\n'''\n\nimport atexit\nimport logging\nf"
},
{
"path": "scripts/build/build-mac-local.py",
"chars": 28323,
"preview": "#!/usr/bin/env python\n# coding: UTF-8\n\n'''This script builds the seafile mac client.\n'''\n\nimport atexit\nimport logging\ni"
},
{
"path": "scripts/build/build-mac.py",
"chars": 36868,
"preview": "#!/usr/bin/env python\n# coding: UTF-8\n\n'''This script builds the seafile mac client.\n'''\n\nimport atexit\nimport logging\ni"
},
{
"path": "scripts/build/build-msi-vs-cn.py",
"chars": 15435,
"preview": "#!/usr/bin/env python\n# coding: UTF-8\n\nimport sys\n\n####################\n### Requires Python 3+\n####################\nif s"
},
{
"path": "scripts/build/build-msi-vs.py",
"chars": 15416,
"preview": "#!/usr/bin/env python\n# coding: UTF-8\n\nimport sys\n\n####################\n### Requires Python 3+\n####################\nif s"
},
{
"path": "scripts/build/build-msi.py",
"chars": 34509,
"preview": "#!/usr/bin/env python\n# coding: UTF-8\n\n'''This scirpt builds the seafile windows msi installer.\n\nSome notes:\n\n1. The wor"
},
{
"path": "scripts/build/gen-deb-src.py",
"chars": 13620,
"preview": "#!/usr/bin/env python\n# coding: UTF-8\n\n'''This scirpt builds the seafile debian source tarball. In this tarball,\nlibsear"
},
{
"path": "scripts/build/notarize-universal.sh",
"chars": 883,
"preview": "#!/bin/bash\n\nset -e\nset -x\n\npkg=${1?:\"You must provide the path to the dmg file\"}\nif [[ ! -e $pkg ]]; then\n echo \"Fil"
},
{
"path": "scripts/build/notarize.sh",
"chars": 2067,
"preview": "#!/bin/bash\n\nset -e\nset -x\n\npkg=${1?:\"You must provide the path to the dmg file\"}\nif [[ ! -e $pkg ]]; then\n echo \"Fil"
},
{
"path": "scripts/build/osx.entitlements",
"chars": 657,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "scripts/seaf-cli-wrapper.sh",
"chars": 1734,
"preview": "#!/bin/bash\n\n# This is a wrapper shell script for the real seaf-cli command.\n# It prepares necessary environment variabl"
},
{
"path": "seafile.sln",
"chars": 1431,
"preview": "\r\nMicrosoft Visual Studio Solution File, Format Version 12.00\r\n# Visual Studio Version 16\r\nVisualStudioVersion = 16.0.2"
},
{
"path": "seafile.vcxproj",
"chars": 15768,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/ms"
},
{
"path": "setupwin.py",
"chars": 6992,
"preview": "#!/usr/bin/env python\n# coding: UTF-8\n\n'''This scirpt is used to bundle all needed files into the destdir to\nfaciliate w"
},
{
"path": "tests/sync-auto-test/README.md",
"chars": 424,
"preview": "## Prerequisite\n\npip install -r requirements.txt\n\n## Run\n\n1. cp run.sh.template run.sh && cp test.conf.template test.con"
},
{
"path": "tests/sync-auto-test/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "tests/sync-auto-test/cli1/ccnet.conf",
"chars": 118,
"preview": "[General]\nUSER_NAME = anonymous\nID = dbf3688a7fbddea62ad894b795c4184bfe7bd9f8\nNAME = anonymous\n\n[Client]\nPORT = 13419\n"
},
{
"path": "tests/sync-auto-test/cli1/mykey.peer",
"chars": 1675,
"preview": "-----BEGIN RSA PRIVATE KEY-----\nMIIEoQIBAAKCAQEAv6CFpIy8zAhm3kLNbvJUro+6VmVpJSBQFtnjmei+8qvM+C3Q\nuyyln41h+I64nZ3ZbJDCxfc"
},
{
"path": "tests/sync-auto-test/cli2/ccnet.conf",
"chars": 118,
"preview": "[General]\nUSER_NAME = anonymous\nID = 5525c22aebbc9e115e5a5872e525821c08b20ec3\nNAME = anonymous\n\n[Client]\nPORT = 13420\n"
},
{
"path": "tests/sync-auto-test/cli2/mykey.peer",
"chars": 1675,
"preview": "-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEAxTsfwh1gLycQgmDM22Y6gonR2EYlz/T3157IyxOipjeEZZVZ\nn2FECRH/j4NFTdCAiZ4DxPI"
},
{
"path": "tests/sync-auto-test/requirements.txt",
"chars": 5,
"preview": "nose\n"
},
{
"path": "tests/sync-auto-test/run.sh.template",
"chars": 774,
"preview": "#!/bin/bash\n\nexport PYTHONPATH=\nexport PATH=\n\nOS=`uname -s`\n\nrm_sync_data() {\n rm -rf $1/ccnet.sock $1/seafile.ini $1"
},
{
"path": "tests/sync-auto-test/seaf_op.py",
"chars": 10091,
"preview": "'''\n\nseaf-cli is command line interface for seafile client.\n\nSubcommands:\n\n init: create config files for s"
},
{
"path": "tests/sync-auto-test/setting.py",
"chars": 766,
"preview": "#coding: utf-8\n\nimport os\nimport ConfigParser\n\nclass Setting():\n def __init__(self):\n self.server_url = None\n "
},
{
"path": "tests/sync-auto-test/test.conf.template",
"chars": 38,
"preview": "[test]\nserver_url =\nuser =\npassword =\n"
},
{
"path": "tests/sync-auto-test/test_cases/__init__.py",
"chars": 546,
"preview": "from util import TestUtil\nimport time\n\ntest_util = TestUtil()\n\ndef setup():\n # init sync related stuff\n test_util."
},
{
"path": "tests/sync-auto-test/test_cases/test_release.py",
"chars": 7057,
"preview": "#coding: utf-8\n\nimport os\nimport time\nimport glob\nfrom threading import Thread\nfrom seaf_op import get_token, urlopen\nfr"
},
{
"path": "tests/sync-auto-test/test_cases/test_simple.py",
"chars": 1826,
"preview": "#coding: utf-8\n\nimport os\nimport time\nfrom . import test_util\n\ndef test_add_file():\n test_util.mkfile(1, 'a.md', 'add"
},
{
"path": "tests/sync-auto-test/util.py",
"chars": 8845,
"preview": "#coding: utf-8\n\nimport os\nimport shutil\nimport time\nimport subprocess\nimport glob\nfrom setting import Setting\nimport sea"
},
{
"path": "updateversion.sh",
"chars": 604,
"preview": "#! /bin/sh\n\nif [ $# != \"2\" ]; then\n echo \"$0 <old_version> <new_version>\"\n exit\nfi\n\nold_ver=$1\nnew_ver=$2\n\nif test"
},
{
"path": "vcpkg.json",
"chars": 1164,
"preview": "{\r\n \"builtin-baseline\": \"f63682b9182187131b564c1395e4ac8ecb0c5ea8\",\r\n \"dependencies\": [\r\n \"argon2\",\r\n "
}
]
// ... and 7 more files (download for full content)
About this extraction
This page contains the full source code of the haiwen/seafile GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 203 files (2.1 MB), approximately 556.6k tokens, and a symbol index with 2735 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.