You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(25) |
Oct
(17) |
Nov
(26) |
Dec
(59) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(76) |
Feb
(53) |
Mar
(81) |
Apr
(28) |
May
(27) |
Jun
(17) |
Jul
(4) |
Aug
(32) |
Sep
(35) |
Oct
(19) |
Nov
(23) |
Dec
(7) |
| 2008 |
Jan
(3) |
Feb
(8) |
Mar
(13) |
Apr
(42) |
May
(33) |
Jun
(6) |
Jul
(6) |
Aug
(10) |
Sep
(9) |
Oct
|
Nov
|
Dec
(30) |
| 2009 |
Jan
(7) |
Feb
(7) |
Mar
(74) |
Apr
|
May
(33) |
Jun
(14) |
Jul
(45) |
Aug
(26) |
Sep
(3) |
Oct
(8) |
Nov
(9) |
Dec
(20) |
| 2010 |
Jan
(46) |
Feb
(129) |
Mar
(138) |
Apr
(46) |
May
(41) |
Jun
(125) |
Jul
(47) |
Aug
|
Sep
(15) |
Oct
|
Nov
(61) |
Dec
(88) |
| 2011 |
Jan
(72) |
Feb
(74) |
Mar
(73) |
Apr
(94) |
May
(16) |
Jun
(38) |
Jul
(27) |
Aug
(48) |
Sep
(47) |
Oct
(8) |
Nov
(17) |
Dec
(84) |
| 2012 |
Jan
(209) |
Feb
(159) |
Mar
(205) |
Apr
(79) |
May
(58) |
Jun
(48) |
Jul
(74) |
Aug
(144) |
Sep
(96) |
Oct
(278) |
Nov
(260) |
Dec
(336) |
| 2013 |
Jan
(125) |
Feb
(116) |
Mar
(157) |
Apr
(160) |
May
(63) |
Jun
(120) |
Jul
(128) |
Aug
(152) |
Sep
(75) |
Oct
(36) |
Nov
(22) |
Dec
(56) |
| 2014 |
Jan
(49) |
Feb
(82) |
Mar
(87) |
Apr
(72) |
May
(33) |
Jun
(44) |
Jul
(34) |
Aug
(23) |
Sep
(22) |
Oct
(53) |
Nov
(10) |
Dec
(80) |
| 2015 |
Jan
(62) |
Feb
(90) |
Mar
(80) |
Apr
(62) |
May
(26) |
Jun
(80) |
Jul
(42) |
Aug
(71) |
Sep
(12) |
Oct
(19) |
Nov
(39) |
Dec
(21) |
| 2016 |
Jan
(64) |
Feb
(12) |
Mar
(29) |
Apr
(56) |
May
(13) |
Jun
(11) |
Jul
(9) |
Aug
(25) |
Sep
(32) |
Oct
(21) |
Nov
(49) |
Dec
(60) |
| 2017 |
Jan
(53) |
Feb
(16) |
Mar
(27) |
Apr
(11) |
May
(17) |
Jun
(14) |
Jul
(21) |
Aug
(31) |
Sep
(35) |
Oct
(40) |
Nov
(35) |
Dec
(21) |
| 2018 |
Jan
(15) |
Feb
(11) |
Mar
|
Apr
(3) |
May
(1) |
Jun
(11) |
Jul
(10) |
Aug
(23) |
Sep
|
Oct
(18) |
Nov
(5) |
Dec
(12) |
| 2019 |
Jan
(62) |
Feb
(52) |
Mar
(108) |
Apr
(20) |
May
(9) |
Jun
(37) |
Jul
(17) |
Aug
(40) |
Sep
(54) |
Oct
(19) |
Nov
(15) |
Dec
(2) |
| 2020 |
Jan
(10) |
Feb
(15) |
Mar
(8) |
Apr
(5) |
May
(16) |
Jun
(4) |
Jul
(4) |
Aug
(28) |
Sep
(66) |
Oct
(14) |
Nov
(7) |
Dec
(1) |
| 2021 |
Jan
(4) |
Feb
(187) |
Mar
(35) |
Apr
(11) |
May
(3) |
Jun
(41) |
Jul
(33) |
Aug
(34) |
Sep
(11) |
Oct
(25) |
Nov
(13) |
Dec
|
| 2022 |
Jan
(15) |
Feb
(97) |
Mar
(54) |
Apr
(35) |
May
(17) |
Jun
(48) |
Jul
(38) |
Aug
(43) |
Sep
(15) |
Oct
(12) |
Nov
(16) |
Dec
(16) |
| 2023 |
Jan
(17) |
Feb
(49) |
Mar
(128) |
Apr
(18) |
May
(58) |
Jun
(43) |
Jul
(32) |
Aug
(33) |
Sep
(98) |
Oct
(45) |
Nov
(33) |
Dec
(57) |
| 2024 |
Jan
(19) |
Feb
(32) |
Mar
(27) |
Apr
(10) |
May
(21) |
Jun
(11) |
Jul
(20) |
Aug
(1) |
Sep
(9) |
Oct
(13) |
Nov
(25) |
Dec
(20) |
| 2025 |
Jan
(11) |
Feb
(14) |
Mar
(10) |
Apr
(9) |
May
(27) |
Jun
(3) |
Jul
|
Aug
|
Sep
(3) |
Oct
(19) |
Nov
(1) |
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
1
|
2
|
3
(3) |
4
|
5
(1) |
6
(2) |
7
|
|
8
(1) |
9
|
10
|
11
(9) |
12
(4) |
13
(1) |
14
|
|
15
|
16
(2) |
17
(3) |
18
(5) |
19
(16) |
20
(3) |
21
(2) |
|
22
|
23
|
24
(4) |
25
(11) |
26
(2) |
27
(2) |
28
|
|
29
|
30
(3) |
31
|
|
|
|
|
|
From: <n-...@us...> - 2009-03-30 13:08:00
|
Revision: 4140
http://gfarm.svn.sourceforge.net/gfarm/?rev=4140&view=rev
Author: n-soda
Date: 2009-03-30 13:07:36 +0000 (Mon, 30 Mar 2009)
Log Message:
-----------
merge changes in gfarm2fs/branches/1.1.0 into the main trunk.
i.e. apply the following changes:
r4129 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4129
r4130 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4130
r4131 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4131
r4135 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4135
Modified Paths:
--------------
gfarm2fs/trunk/LICENSE
gfarm2fs/trunk/gfarm2fs.spec
Added Paths:
-----------
gfarm2fs/trunk/RELNOTES
Modified: gfarm2fs/trunk/LICENSE
===================================================================
--- gfarm2fs/trunk/LICENSE 2009-03-30 12:52:12 UTC (rev 4139)
+++ gfarm2fs/trunk/LICENSE 2009-03-30 13:07:36 UTC (rev 4140)
@@ -1,4 +1,4 @@
-Copyright (c) 2007-2008 Osamu Tatebe. All Rights Reserved.
+Copyright (c) 2007-2009 Osamu Tatebe. All Rights Reserved.
The authors hereby grant permission to use, copy, modify, and
distribute this software and its documentation for any purpose,
Added: gfarm2fs/trunk/RELNOTES
===================================================================
--- gfarm2fs/trunk/RELNOTES (rev 0)
+++ gfarm2fs/trunk/RELNOTES 2009-03-30 13:07:36 UTC (rev 4140)
@@ -0,0 +1,56 @@
+Release note for Gfarm2fs 1.1.0
+===============================
+
+[2009.3.26]
+
+New Feature
+* symbolic link support
+* directory listing speedup by attribute cache
+
+New Command-line Option
+* -E option to specify the expiration period of the attribute cache
+
+Release note for Gfarm2fs 1.0.2
+===============================
+
+[2008.9.27]
+
+New Feature
+* hard link support
+
+Release note for Gfarm2fs 1.0.1
+===============================
+
+[2008.5.28]
+
+New Feature
+* statfs support
+
+Release note for Gfarm2fs 1.0.0
+===============================
+
+[2007.11.28]
+
+The Gfarm2fs is a mount command for the Gfarm v2 distributed file
+system. FUSE (Filesystem in Userspace) [1] is required to build and
+use gfarm2fs.
+
+[1] http://fuse.sourceforge.net/
+
+GFARM2FS(1)
+
+NAME
+ gfarm2fs - mounts the Gfarm file system
+
+SYNOPSIS
+ gfarm2fs <mount_point> [FUSE options]
+
+DESCRIPTION
+ gfarm2fs mounts the Gfarm file system at the specified mount
+ point.
+
+ENVIRONMENT
+ GFARM_CONFIG_FILE
+ specifies the Gfarm configuration file.
+
+$Id$
Modified: gfarm2fs/trunk/gfarm2fs.spec
===================================================================
--- gfarm2fs/trunk/gfarm2fs.spec 2009-03-30 12:52:12 UTC (rev 4139)
+++ gfarm2fs/trunk/gfarm2fs.spec 2009-03-30 13:07:36 UTC (rev 4140)
@@ -1,6 +1,6 @@
Summary: GfarmFS-FUSE for Gfarm File System 2
Name: gfarm2fs
-Version: 1.0.2
+Version: 1.1.0
Release: 1%{?dist}
License: BSD
Group: Applications/Internet
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n-...@us...> - 2009-03-30 12:52:24
|
Revision: 4139
http://gfarm.svn.sourceforge.net/gfarm/?rev=4139&view=rev
Author: n-soda
Date: 2009-03-30 12:52:12 +0000 (Mon, 30 Mar 2009)
Log Message:
-----------
merge changes in gfarm_v2/branches/2.2.0 into the main trunk.
i.e. apply the following changes:
r4105 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4105
r4106 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4106
r4107 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4107
r4108 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4108
r4109 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4109
r4110 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4110
r4111 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4111
r4112 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4112
r4113 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4113
r4114 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4114
r4115 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4115
r4116 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4116
r4117 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4117
r4118 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4118
r4121 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4121
r4122 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4122
r4123 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4123
r4124 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4124
r4125 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4125
r4126 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4126
r4127 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4127
r4128 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4128
r4132 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4132
r4134 - http://gfarm.svn.sourceforge.net/viewvc/gfarm?view=rev&revision=4134
Modified Paths:
--------------
gfarm_v2/trunk/Makefile.in
gfarm_v2/trunk/RELNOTES
gfarm_v2/trunk/configure
gfarm_v2/trunk/configure.ac
gfarm_v2/trunk/doc/docbook/en/ref/man1/Makefile.inc
gfarm_v2/trunk/doc/docbook/en/ref/man5/gfarm2.conf.5.docbook
gfarm_v2/trunk/doc/docbook/ja/ref/man1/Makefile.inc
gfarm_v2/trunk/doc/docbook/ja/ref/man5/gfarm2.conf.5.docbook
gfarm_v2/trunk/doc/html/en/ref/index.html
gfarm_v2/trunk/doc/html/en/ref/man5/gfarm2.conf.5.html
gfarm_v2/trunk/doc/html/ja/ref/index.html
gfarm_v2/trunk/doc/html/ja/ref/man5/gfarm2.conf.5.html
gfarm_v2/trunk/gftool/config-gfarm/Makefile
gfarm_v2/trunk/gftool/config-gfarm/config-gfarm.in
gfarm_v2/trunk/gftool/config-gfarm/gfarm.schema
gfarm_v2/trunk/gftool/config-gfarm/slapd.conf-2.1.in
gfarm_v2/trunk/gftool/gfdump/gfdump.postgresql.in
gfarm_v2/trunk/gftool/gfstatus/Makefile
gfarm_v2/trunk/gftool/gfstatus/gfstatus.c
gfarm_v2/trunk/lib/libgfarm/gfarm/config.c
gfarm_v2/trunk/lib/libgfarm/gfarm/config.h
gfarm_v2/trunk/man/ja/man5/gfarm2.conf.5
gfarm_v2/trunk/man/man5/gfarm2.conf.5
gfarm_v2/trunk/package/redhat/gfarm.spec
gfarm_v2/trunk/server/gfmd/db_access.c
gfarm_v2/trunk/server/gfmd/db_ldap.c
gfarm_v2/trunk/server/gfmd/gfmd.c
gfarm_v2/trunk/server/gfmd/thrpool.c
Added Paths:
-----------
gfarm_v2/trunk/doc/docbook/en/ref/man1/gfln.1.docbook
gfarm_v2/trunk/doc/docbook/ja/ref/man1/gfln.1.docbook
gfarm_v2/trunk/doc/html/en/ref/man1/gfln.1.html
gfarm_v2/trunk/doc/html/ja/ref/man1/gfln.1.html
gfarm_v2/trunk/gftool/config-gfarm/config-gfarm-update.in
gfarm_v2/trunk/gftool/config-gfarm/config-gfarm-update.postgresql
gfarm_v2/trunk/man/ja/man1/gfln.1
gfarm_v2/trunk/man/man1/gfln.1
Modified: gfarm_v2/trunk/Makefile.in
===================================================================
--- gfarm_v2/trunk/Makefile.in 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/Makefile.in 2009-03-30 12:52:12 UTC (rev 4139)
@@ -28,6 +28,7 @@
$(INC_BUILDDIR)/gfarm_config.h \
Makefile makes/config.mk makes/install-doc \
gftool/config-gfarm/config-gfarm \
+ gftool/config-gfarm/config-gfarm-update \
gftool/config-gfarm/config-gfsd \
gftool/gfdump/gfdump.postgresql \
package/solaris/gfmd package/solaris/gfsd
Modified: gfarm_v2/trunk/RELNOTES
===================================================================
--- gfarm_v2/trunk/RELNOTES 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/RELNOTES 2009-03-30 12:52:12 UTC (rev 4139)
@@ -1,3 +1,63 @@
+Release note for Gfarm 2.2.0
+============================
+
+[2009.3.26]
+
+New Feature
+* symbolic link support
+* hundreds of clients support by thread pool
+* directory listing speedup by attribute cache
+
+New Command
+* gfstatus - display Gfarm configuration status
+* gfln - create a hard link or a symbolic link
+
+New Admin Command
+* config-gfarm-update - update the backend database.
+ 'config-gfarm-update --update-symlink' updates the backend database
+ to manage symbolic links. Note that the postgresql backend is only
+ supported for now.
+
+New API
+* gfs_symlink, gfs_readlink - symbolic link support
+* gfs_lstat
+
+New configuration in gfmd.conf
+* metadb_server_stack_size directive to specify a stack size of
+ threads
+* metadb_server_thread_pool_size directive to specify the maximum
+ number of threads in a thread pool
+* metadb_server_job_queue_length directive to specify the length of a
+ job request queue
+* metadb_server_heartbeat_interval directive to specify the interval
+ of heartbeat to each gfsd
+
+Documentation
+* manual pages - gfchgrp(1), gfchmod(1), gfchown(1), gfgroup(1),
+ gfhost(1), gfln(1), gfls(1), gfmv(1), gfstatus(1), gfuser(1).
+* manual pages in HTML
+
+Updated feature
+* gfls - accomodate attribute caching and support display regarding
+ symlinks and hardlinks
+* gfchmod - display more user friendly error message
+* gfmd - support hundreds of clients by introducing a thread pool
+* gfmd - authorize peers concurrently by making network related
+ functions MT safe
+* gfmd - schedule the local host only when it has enough disk space
+* gfsd - support gfmd reconnection at the start up
+* (GSI) allow to delegate a limited proxy
+* (GSI) disable GSS_C_NT_USER_NAME (spool_server_cred_type user) by
+ default since it is not supported by Globus GSI
+
+Bug fix
+* libgfarm - fix missing intialization of a pointer
+* gfmd - fix race condition
+* gfsd - fix -c and -cc options to check invalid files not only
+ invalid file replicas
+* gfsd - terminate the master process when the back channel process dies
+* (GSI) use distinguished name of delegated credential
+
Release note for Gfarm 2.1.1
============================
Modified: gfarm_v2/trunk/configure
===================================================================
--- gfarm_v2/trunk/configure 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/configure 2009-03-30 12:52:12 UTC (rev 4139)
@@ -24538,7 +24538,7 @@
test -d package || mkdir package
test -d util || mkdir util
- ac_config_files="$ac_config_files Makefile makes/config.mk makes/install-doc ${ns_makefiles} gftool/config-gfarm/config-gfarm gftool/config-gfarm/config-gfsd gftool/gfdump/gfdump.postgresql package/solaris/gfmd package/solaris/gfsd"
+ ac_config_files="$ac_config_files Makefile makes/config.mk makes/install-doc ${ns_makefiles} gftool/config-gfarm/config-gfarm gftool/config-gfarm/config-gfsd gftool/config-gfarm/config-gfarm-update gftool/gfdump/gfdump.postgresql package/solaris/gfmd package/solaris/gfsd"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -25071,6 +25071,7 @@
"${ns_makefiles}" ) CONFIG_FILES="$CONFIG_FILES ${ns_makefiles}" ;;
"gftool/config-gfarm/config-gfarm" ) CONFIG_FILES="$CONFIG_FILES gftool/config-gfarm/config-gfarm" ;;
"gftool/config-gfarm/config-gfsd" ) CONFIG_FILES="$CONFIG_FILES gftool/config-gfarm/config-gfsd" ;;
+ "gftool/config-gfarm/config-gfarm-update" ) CONFIG_FILES="$CONFIG_FILES gftool/config-gfarm/config-gfarm-update" ;;
"gftool/gfdump/gfdump.postgresql" ) CONFIG_FILES="$CONFIG_FILES gftool/gfdump/gfdump.postgresql" ;;
"package/solaris/gfmd" ) CONFIG_FILES="$CONFIG_FILES package/solaris/gfmd" ;;
"package/solaris/gfsd" ) CONFIG_FILES="$CONFIG_FILES package/solaris/gfsd" ;;
Modified: gfarm_v2/trunk/configure.ac
===================================================================
--- gfarm_v2/trunk/configure.ac 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/configure.ac 2009-03-30 12:52:12 UTC (rev 4139)
@@ -1324,7 +1324,7 @@
AC_CONFIG_FILES(Makefile makes/config.mk makes/install-doc
${ns_makefiles}
gftool/config-gfarm/config-gfarm gftool/config-gfarm/config-gfsd
- gftool/gfdump/gfdump.postgresql
+ gftool/config-gfarm/config-gfarm-update gftool/gfdump/gfdump.postgresql
package/solaris/gfmd package/solaris/gfsd
)
AC_OUTPUT
Modified: gfarm_v2/trunk/doc/docbook/en/ref/man1/Makefile.inc
===================================================================
--- gfarm_v2/trunk/doc/docbook/en/ref/man1/Makefile.inc 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/doc/docbook/en/ref/man1/Makefile.inc 2009-03-30 12:52:12 UTC (rev 4139)
@@ -6,6 +6,7 @@
gfgroup.1 \
gfhost.1 \
gfkey.1 \
+ gfln.1 \
gfls.1 \
gfmkdir.1 \
gfmv.1 \
Added: gfarm_v2/trunk/doc/docbook/en/ref/man1/gfln.1.docbook
===================================================================
--- gfarm_v2/trunk/doc/docbook/en/ref/man1/gfln.1.docbook (rev 0)
+++ gfarm_v2/trunk/doc/docbook/en/ref/man1/gfln.1.docbook 2009-03-30 12:52:12 UTC (rev 4139)
@@ -0,0 +1,61 @@
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
+
+<refentry id='gfln.1'>
+
+<refentryinfo><date>19 Mar 2009</date></refentryinfo>
+
+<refmeta>
+<refentrytitle>gfln</refentrytitle>
+<manvolnum>1</manvolnum>
+<refmiscinfo>Gfarm</refmiscinfo>
+</refmeta>
+
+<refnamediv id='name'>
+<refname>gfln</refname>
+<refpurpose>create a hardlink or a symbolic link</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv id='synopsis'>
+<cmdsynopsis>
+ <command>gfln</command>
+ <arg choice='opt'><replaceable>options</replaceable></arg>
+ <arg choice='plain'>target</arg>
+ <arg choice='plain'>link_name</arg>
+</cmdsynopsis>
+</refsynopsisdiv>
+
+<!-- body begins here -->
+
+<refsect1 id='description'><title>DESCRIPTION</title>
+
+<para>
+<command>gfln</command> creates a hardlink
+<parameter>link_name</parameter> linked to
+<parameter>target</parameter>. When the -s option is specified, it
+creates a symbolic link.
+</para>
+
+</refsect1>
+
+<refsect1 id='options'><title>OPTIONS</title>
+
+<variablelist>
+
+<varlistentry>
+<term><option>-s</option></term>
+<listitem>
+<para>Creates a symbolic link.</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><option>-?</option></term>
+<listitem>
+<para>Displays a list of command options.</para>
+</listitem>
+</varlistentry>
+
+</variablelist>
+
+</refsect1>
+</refentry>
Modified: gfarm_v2/trunk/doc/docbook/en/ref/man5/gfarm2.conf.5.docbook
===================================================================
--- gfarm_v2/trunk/doc/docbook/en/ref/man5/gfarm2.conf.5.docbook 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/doc/docbook/en/ref/man5/gfarm2.conf.5.docbook 2009-03-30 12:52:12 UTC (rev 4139)
@@ -387,6 +387,40 @@
</varlistentry>
<varlistentry>
+<term><token>metadb_server_thread_pool_size</token> <parameter>size</parameter></term>
+<listitem>
+<para>This directive specifies the maximum number of threads in a
+thread pool in the gfmd. It is effective to specify around the
+number of CPU cores of the metadata server node. Default is 16.
+</para>
+<para>
+This parameter is only available in gfmd.conf, and ignored in gfarm2.conf.
+</para>
+<para>For example,</para>
+<literallayout>
+ metadb_server_thread_pool_size 16
+</literallayout>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><token>metadb_server_job_queue_length</token> <parameter>length</parameter></term>
+<listitem>
+<para>This directive specifies the length of job queue in the gfmd.
+It is effective to specify around the maximum number of clients that
+access the Gfarm file system at the same time. Default is 160.
+</para>
+<para>
+This parameter is only available in gfmd.conf, and ignored in gfarm2.conf.
+</para>
+<para>For example,</para>
+<literallayout>
+ metadb_server_job_queue_length 160
+</literallayout>
+</listitem>
+</varlistentry>
+
+<varlistentry>
<term><token>metadb_server_heartbeat_interval</token> <parameter>seconds</parameter></term>
<listitem>
<para>This directive specifies the interval of heartbeat in seconds
@@ -984,6 +1018,8 @@
<metadb_server_cred_service_statement> |
<metadb_server_cred_name_statement> |
<metadb_server_stack_size_statement> |
+ <metadb_server_thread_pool_size_statement> |
+ <metadb_server_job_queue_length_statement> |
<metadb_server_heartbeat_interval_statement> |
<ldap_server_host_statement> |
<ldap_server_port_statement> |
@@ -1033,6 +1069,10 @@
"metadb_server_cred_name" <cred_name>
<metadb_server_stack_size_statement> ::=
"metadb_server_stack_size" <number>
+ <metadb_server_thread_pool_size_statement> ::=
+ "metadb_server_thread_pool_size" <number>
+ <metadb_server_job_queue_length_statement> ::=
+ "metadb_server_job_queue_length" <number>
<metadb_server_heartbeat_interval_statement> ::=
"metadb_server_heartbeat_interval" <number>
<ldap_server_host_statement> ::= "ldap_server_host" <hostname>
Modified: gfarm_v2/trunk/doc/docbook/ja/ref/man1/Makefile.inc
===================================================================
--- gfarm_v2/trunk/doc/docbook/ja/ref/man1/Makefile.inc 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/doc/docbook/ja/ref/man1/Makefile.inc 2009-03-30 12:52:12 UTC (rev 4139)
@@ -6,6 +6,7 @@
gfgroup.1 \
gfhost.1 \
gfkey.1 \
+ gfln.1 \
gfls.1 \
gfmkdir.1 \
gfmv.1 \
Added: gfarm_v2/trunk/doc/docbook/ja/ref/man1/gfln.1.docbook
===================================================================
--- gfarm_v2/trunk/doc/docbook/ja/ref/man1/gfln.1.docbook (rev 0)
+++ gfarm_v2/trunk/doc/docbook/ja/ref/man1/gfln.1.docbook 2009-03-30 12:52:12 UTC (rev 4139)
@@ -0,0 +1,60 @@
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
+
+<refentry id='gfln.1'>
+
+<refentryinfo><date>19 Mar 2009</date></refentryinfo>
+
+<refmeta>
+<refentrytitle>gfln</refentrytitle>
+<manvolnum>1</manvolnum>
+<refmiscinfo>Gfarm</refmiscinfo>
+</refmeta>
+
+<refnamediv id='name'>
+<refname>gfln</refname>
+<refpurpose>\xA5ϡ\xBC\xA5ɥ\xEA\xA5\xA4\xA5\xB7\xA5\xF3\xA5ܥ\xEA\xA5å\xAF\xA5\xEA\xA5\xF2\xBA\xEE\xC0\xAE\xA4\xB9\xA4\xEB</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv id='synopsis'>
+<cmdsynopsis>
+ <command>gfln</command>
+ <arg choice='opt'><replaceable>options</replaceable></arg>
+ <arg choice='plain'>target</arg>
+ <arg choice='plain'>link_name</arg>
+</cmdsynopsis>
+</refsynopsisdiv>
+
+<!-- body begins here -->
+
+<refsect1 id='description'><title>DESCRIPTION</title>
+
+<para>
+<parameter>target</parameter>\xA4\xCB\xC2Ф\xB9\xA4\xEB\xA5ϡ\xBC\xA5ɥ\xEA\xA5\xF2
+<parameter>link_name</parameter>\xA4˺\xEE\xC0\xAE\xA4\xB7\xA4ޤ\xB9\xA1\xA5
+-s \xA5\xAA\xA5ץ\xB7\xA5\xE7\xA5\xD8\xC4ꤵ\xA4\xEC\xA4\xEB\xA4ȥ\xB7\xA5\xF3\xA5ܥ\xEA\xA5å\xAF\xA5\xEA\xA5\xF2\xBA\xEE\xC0\xAE\xA4\xB7\xA4ޤ\xB9\xA1\xA5
+</para>
+
+</refsect1>
+
+<refsect1 id='options'><title>OPTIONS</title>
+
+<variablelist>
+
+<varlistentry>
+<term><option>-s</option></term>
+<listitem>
+<para>\xA5\xB7\xA5\xF3\xA5ܥ\xEA\xA5å\xAF\xA5\xEA\xA5\xF2\xBA\xEE\xC0\xAE\xA4\xB7\xA4ޤ\xB9\xA1\xA5</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><option>-?</option></term>
+<listitem>
+<para>\xB0\xFA\xBF\x{125AA5}ץ\xB7\xA5\xE7\xA5\xF3\xA4\xF2ɽ\xBC\xA8\xA4\xB7\xA4ޤ\xB9\xA1\xA5</para>
+</listitem>
+</varlistentry>
+
+</variablelist>
+
+</refsect1>
+</refentry>
Modified: gfarm_v2/trunk/doc/docbook/ja/ref/man5/gfarm2.conf.5.docbook
===================================================================
--- gfarm_v2/trunk/doc/docbook/ja/ref/man5/gfarm2.conf.5.docbook 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/doc/docbook/ja/ref/man5/gfarm2.conf.5.docbook 2009-03-30 12:52:12 UTC (rev 4139)
@@ -378,6 +378,40 @@
</varlistentry>
<varlistentry>
+<term><token>metadb_server_thread_pool_size</token> <parameter>\xA5\xB9\xA5\xEC\xA5åɿ\xF4</parameter></term>
+<listitem>
+<para>\xA5\xA5ǡ\xBC\xA5\xBF\xA5\xB5\xA1\xBC\xA5\xD0 gfmd \xA4Υ\xB9\xA5\xEC\xA5åɥס\xBC\xA5\xEB\xA4Υ\xB9\xA5\xEC\xA5åɿ\xF4\xA4\xF2\xBB\xD8\xC4ꤷ\xA4ޤ\xB9\xA1\xA3
+\xA5\xA5ǡ\xBC\xA5\xBF\xA5\xB5\xA1\xBC\xA5ХΡ\xBC\xA5ɤΥ\xB3\xA5\xA2\xBF\x{124BE4}餤\xA4\xCB\xC0\xDF\xC4ꤹ\xA4\xEB\xA4ȸ\xFA\xB2\xCCŪ\xA4Ǥ\xB9\xA1\xA3
+\xA5ǥե\xA9\xA5\xEB\xA5\xC8\xC3ͤ\xCF16\xA4Ǥ\xB9\xA1\xA3
+</para>
+<para>
+\xA4\xB3\xA4\xCEʸ\xA4\xCFgfmd.conf\xA4Τߤ\xC7ͭ\xB8\xFA\xA4Ǥ\xA2\xA4ꡢgfarm2.conf\xA4Ǥ\xCF̵\xBB뤵\xA4\xEC\xA4ޤ\xB9\xA1\xA3
+</para>
+<para>\xCE\xE3:</para>
+<literallayout>
+ metadb_server_thread_pool_size 16
+</literallayout>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><token>metadb_server_job_queue_length</token> <parameter>\xA5\xAD\xA5塼Ĺ</parameter></term>
+<listitem>
+<para>\xA5\xA5ǡ\xBC\xA5\xBF\xA5\xB5\xA1\xBC\xA5\xD0 gfmd \xA4Υ\xB8\xA5\xE7\xA5֥\xAD\xA5塼\xA4Υ\xAD\xA5塼Ĺ\xA4\xF2\xBB\xD8\xC4ꤷ\xA4ޤ\xB9\xA1\xA3
+\xB0\xEC\xC5٤\xCB\xC0\xDC³\xA4\xB9\xA4\xEB\xBA\xC7\xC2祯\xA5饤\xA5\xA2\xA5\xF3\xA5Ȥο\x{124BE4}餤\xA4\xCB\xC0\xDF\xC4ꤹ\xA4\xEB\xA4ȸ\xFA\xB2\xCCŪ\xA4Ǥ\xB9\xA1\xA3
+\xA5ǥե\xA9\xA5\xEB\xA5\xC8\xC3ͤ\xCF160\xA4Ǥ\xB9\xA1\xA3
+</para>
+<para>
+\xA4\xB3\xA4\xCEʸ\xA4\xCFgfmd.conf\xA4Τߤ\xC7ͭ\xB8\xFA\xA4Ǥ\xA2\xA4ꡢgfarm2.conf\xA4Ǥ\xCF̵\xBB뤵\xA4\xEC\xA4ޤ\xB9\xA1\xA3
+</para>
+<para>\xCE\xE3:</para>
+<literallayout>
+ metadb_server_job_queue_length 160
+</literallayout>
+</listitem>
+</varlistentry>
+
+<varlistentry>
<term><token>metadb_server_heartbeat_interval</token> <parameter>\xC9ÿ\xF4</parameter></term>
<listitem>
<para>\xA5\xA5ǡ\xBC\xA5\xBF\xA5\xB5\xA1\xBC\xA5\xD0 gfmd \xA4\xAC\xB3ƥե\xA1\xA5\xA4\xA5륷\xA5\xB9\xA5ƥॵ\xA1\xBC\xA5\xD0 gfsd
@@ -946,6 +980,8 @@
<metadb_server_cred_service_statement> |
<metadb_server_cred_name_statement> |
<metadb_server_stack_size_statement> |
+ <metadb_server_thread_pool_size_statement> |
+ <metadb_server_job_queue_length_statement> |
<metadb_server_heartbeat_interval_statement> |
<ldap_server_host_statement> |
<ldap_server_port_statement> |
@@ -995,6 +1031,10 @@
"metadb_server_cred_name" <cred_name>
<metadb_server_stack_size_statement> ::=
"metadb_server_stack_size" <number>
+ <metadb_server_thread_pool_size_statement> ::=
+ "metadb_server_thread_pool_size" <number>
+ <metadb_server_job_queue_length_statement> ::=
+ "metadb_server_job_queue_length" <number>
<metadb_server_heartbeat_interval_statement> ::=
"metadb_server_heartbeat_interval" <number>
<ldap_server_host_statement> ::= "ldap_server_host" <hostname>
Modified: gfarm_v2/trunk/doc/html/en/ref/index.html
===================================================================
--- gfarm_v2/trunk/doc/html/en/ref/index.html 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/doc/html/en/ref/index.html 2009-03-30 12:52:12 UTC (rev 4139)
@@ -31,6 +31,7 @@
<LI><A HREF="man1/gfgroup.1.html">gfgroup(1)</A>
<LI><A HREF="man1/gfhost.1.html">gfhost(1)</A>
<LI><A HREF="man1/gfkey.1.html">gfkey(1)</A>
+ <LI><A HREF="man1/gfln.1.html">gfln(1)</A>
<LI><A HREF="man1/gfls.1.html">gfls(1)</A>
<LI><A HREF="man1/gfmkdir.1.html">gfmkdir(1)</A>
<LI><A HREF="man1/gfmv.1.html">gfmv(1)</A>
Added: gfarm_v2/trunk/doc/html/en/ref/man1/gfln.1.html
===================================================================
--- gfarm_v2/trunk/doc/html/en/ref/man1/gfln.1.html (rev 0)
+++ gfarm_v2/trunk/doc/html/en/ref/man1/gfln.1.html 2009-03-30 12:52:12 UTC (rev 4139)
@@ -0,0 +1,108 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML
+><HEAD
+><TITLE
+>gfln</TITLE
+><META
+NAME="GENERATOR"
+CONTENT="Modular DocBook HTML Stylesheet Version 1.79"></HEAD
+><BODY
+CLASS="REFENTRY"
+BGCOLOR="#FFFFFF"
+TEXT="#000000"
+LINK="#0000FF"
+VLINK="#840084"
+ALINK="#0000FF"
+><H1
+><A
+NAME="GFLN.1"
+></A
+>gfln</H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="NAME"
+></A
+><H2
+>Name</H2
+>gfln -- create a hardlink or a symbolic link</DIV
+><DIV
+CLASS="REFSYNOPSISDIV"
+><A
+NAME="SYNOPSIS"
+></A
+><H2
+>Synopsis</H2
+><P
+><B
+CLASS="COMMAND"
+>gfln</B
+> [<TT
+CLASS="REPLACEABLE"
+><I
+>options</I
+></TT
+>] target link_name </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="DESCRIPTION"
+></A
+><H2
+>DESCRIPTION</H2
+><P
+><B
+CLASS="COMMAND"
+>gfln</B
+> creates a hardlink
+<TT
+CLASS="PARAMETER"
+><I
+>link_name</I
+></TT
+> linked to
+<TT
+CLASS="PARAMETER"
+><I
+>target</I
+></TT
+>. When the -s option is specified, it
+creates a symbolic link.</P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="OPTIONS"
+></A
+><H2
+>OPTIONS</H2
+><P
+></P
+><DIV
+CLASS="VARIABLELIST"
+><DL
+><DT
+><CODE
+CLASS="OPTION"
+>-s</CODE
+></DT
+><DD
+><P
+>Creates a symbolic link.</P
+></DD
+><DT
+><CODE
+CLASS="OPTION"
+>-?</CODE
+></DT
+><DD
+><P
+>Displays a list of command options.</P
+></DD
+></DL
+></DIV
+></DIV
+></BODY
+></HTML
+>
\ No newline at end of file
Modified: gfarm_v2/trunk/doc/html/en/ref/man5/gfarm2.conf.5.html
===================================================================
--- gfarm_v2/trunk/doc/html/en/ref/man5/gfarm2.conf.5.html 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/doc/html/en/ref/man5/gfarm2.conf.5.html 2009-03-30 12:52:12 UTC (rev 4139)
@@ -646,6 +646,52 @@
><DT
><SPAN
CLASS="TOKEN"
+>metadb_server_thread_pool_size</SPAN
+> <TT
+CLASS="PARAMETER"
+><I
+>size</I
+></TT
+></DT
+><DD
+><P
+>This directive specifies the maximum number of threads in a
+thread pool in the gfmd. It is effective to specify around the
+number of CPU cores of the metadata server node. Default is 16.</P
+><P
+>This parameter is only available in gfmd.conf, and ignored in gfarm2.conf.</P
+><P
+>For example,</P
+><P
+CLASS="LITERALLAYOUT"
+> metadb_server_thread_pool_size 16</P
+></DD
+><DT
+><SPAN
+CLASS="TOKEN"
+>metadb_server_job_queue_length</SPAN
+> <TT
+CLASS="PARAMETER"
+><I
+>length</I
+></TT
+></DT
+><DD
+><P
+>This directive specifies the length of job queue in the gfmd.
+It is effective to specify around the maximum number of clients that
+access the Gfarm file system at the same time. Default is 160.</P
+><P
+>This parameter is only available in gfmd.conf, and ignored in gfarm2.conf.</P
+><P
+>For example,</P
+><P
+CLASS="LITERALLAYOUT"
+> metadb_server_job_queue_length 160</P
+></DD
+><DT
+><SPAN
+CLASS="TOKEN"
>metadb_server_heartbeat_interval</SPAN
> <TT
CLASS="PARAMETER"
@@ -1467,6 +1513,8 @@
\xA0\xA0<metadb_server_cred_service_statement> |<br>
\xA0\xA0<metadb_server_cred_name_statement> |<br>
\xA0\xA0<metadb_server_stack_size_statement> |<br>
+ \xA0\xA0<metadb_server_thread_pool_size_statement> |<br>
+ \xA0\xA0<metadb_server_job_queue_length_statement> |<br>
\xA0\xA0<metadb_server_heartbeat_interval_statement> |<br>
\xA0\xA0<ldap_server_host_statement> |<br>
\xA0\xA0<ldap_server_port_statement> |<br>
@@ -1509,6 +1557,10 @@
\xA0\xA0"metadb_server_cred_name" <cred_name><br>
<metadb_server_stack_size_statement> ::=<br>
\xA0\xA0"metadb_server_stack_size" <number><br>
+ <metadb_server_thread_pool_size_statement> ::=<br>
+ \xA0\xA0"metadb_server_thread_pool_size" <number><br>
+ <metadb_server_job_queue_length_statement> ::=<br>
+ \xA0\xA0"metadb_server_job_queue_length" <number><br>
<metadb_server_heartbeat_interval_statement> ::=<br>
\xA0\xA0"metadb_server_heartbeat_interval" <number><br>
<ldap_server_host_statement> ::= "ldap_server_host" <hostname><br>
Modified: gfarm_v2/trunk/doc/html/ja/ref/index.html
===================================================================
--- gfarm_v2/trunk/doc/html/ja/ref/index.html 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/doc/html/ja/ref/index.html 2009-03-30 12:52:12 UTC (rev 4139)
@@ -30,6 +30,7 @@
<LI><A HREF="man1/gfgroup.1.html">gfgroup(1)</A>
<LI><A HREF="man1/gfhost.1.html">gfhost(1)</A>
<LI><A HREF="man1/gfkey.1.html">gfkey(1)</A>
+ <LI><A HREF="man1/gfln.1.html">gfln(1)</A>
<LI><A HREF="man1/gfls.1.html">gfls(1)</A>
<LI><A HREF="man1/gfmkdir.1.html">gfmkdir(1)</A>
<LI><A HREF="man1/gfmv.1.html">gfmv(1)</A>
Added: gfarm_v2/trunk/doc/html/ja/ref/man1/gfln.1.html
===================================================================
--- gfarm_v2/trunk/doc/html/ja/ref/man1/gfln.1.html (rev 0)
+++ gfarm_v2/trunk/doc/html/ja/ref/man1/gfln.1.html 2009-03-30 12:52:12 UTC (rev 4139)
@@ -0,0 +1,104 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML
+><HEAD
+><TITLE
+>gfln</TITLE
+><META
+NAME="GENERATOR"
+CONTENT="Modular DocBook HTML Stylesheet Version 1.79"></HEAD
+><BODY
+CLASS="REFENTRY"
+BGCOLOR="#FFFFFF"
+TEXT="#000000"
+LINK="#0000FF"
+VLINK="#840084"
+ALINK="#0000FF"
+><H1
+><A
+NAME="GFLN.1"
+></A
+>gfln</H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="NAME"
+></A
+><H2
+>Name</H2
+>gfln -- \xA5ϡ\xBC\xA5ɥ\xEA\xA5\xA4\xA5\xB7\xA5\xF3\xA5ܥ\xEA\xA5å\xAF\xA5\xEA\xA5\xF2\xBA\xEE\xC0\xAE\xA4\xB9\xA4\xEB</DIV
+><DIV
+CLASS="REFSYNOPSISDIV"
+><A
+NAME="SYNOPSIS"
+></A
+><H2
+>Synopsis</H2
+><P
+><B
+CLASS="COMMAND"
+>gfln</B
+> [<TT
+CLASS="REPLACEABLE"
+><I
+>options</I
+></TT
+>] target link_name </P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="DESCRIPTION"
+></A
+><H2
+>DESCRIPTION</H2
+><P
+><TT
+CLASS="PARAMETER"
+><I
+>target</I
+></TT
+>\xA4\xCB\xC2Ф\xB9\xA4\xEB\xA5ϡ\xBC\xA5ɥ\xEA\xA5\xF2
+<TT
+CLASS="PARAMETER"
+><I
+>link_name</I
+></TT
+>\xA4˺\xEE\xC0\xAE\xA4\xB7\xA4ޤ\xB9\xA1\xA5
+-s \xA5\xAA\xA5ץ\xB7\xA5\xE7\xA5\xD8\xC4ꤵ\xA4\xEC\xA4\xEB\xA4ȥ\xB7\xA5\xF3\xA5ܥ\xEA\xA5å\xAF\xA5\xEA\xA5\xF2\xBA\xEE\xC0\xAE\xA4\xB7\xA4ޤ\xB9\xA1\xA5</P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="OPTIONS"
+></A
+><H2
+>OPTIONS</H2
+><P
+></P
+><DIV
+CLASS="VARIABLELIST"
+><DL
+><DT
+><CODE
+CLASS="OPTION"
+>-s</CODE
+></DT
+><DD
+><P
+>\xA5\xB7\xA5\xF3\xA5ܥ\xEA\xA5å\xAF\xA5\xEA\xA5\xF2\xBA\xEE\xC0\xAE\xA4\xB7\xA4ޤ\xB9\xA1\xA5</P
+></DD
+><DT
+><CODE
+CLASS="OPTION"
+>-?</CODE
+></DT
+><DD
+><P
+>\xB0\xFA\xBF\x{125AA5}ץ\xB7\xA5\xE7\xA5\xF3\xA4\xF2ɽ\xBC\xA8\xA4\xB7\xA4ޤ\xB9\xA1\xA5</P
+></DD
+></DL
+></DIV
+></DIV
+></BODY
+></HTML
+>
\ No newline at end of file
Modified: gfarm_v2/trunk/doc/html/ja/ref/man5/gfarm2.conf.5.html
===================================================================
--- gfarm_v2/trunk/doc/html/ja/ref/man5/gfarm2.conf.5.html 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/doc/html/ja/ref/man5/gfarm2.conf.5.html 2009-03-30 12:52:12 UTC (rev 4139)
@@ -618,6 +618,52 @@
><DT
><SPAN
CLASS="TOKEN"
+>metadb_server_thread_pool_size</SPAN
+> <TT
+CLASS="PARAMETER"
+><I
+>\xA5\xB9\xA5\xEC\xA5åɿ\xF4</I
+></TT
+></DT
+><DD
+><P
+>\xA5\xA5ǡ\xBC\xA5\xBF\xA5\xB5\xA1\xBC\xA5\xD0 gfmd \xA4Υ\xB9\xA5\xEC\xA5åɥס\xBC\xA5\xEB\xA4Υ\xB9\xA5\xEC\xA5åɿ\xF4\xA4\xF2\xBB\xD8\xC4ꤷ\xA4ޤ\xB9\xA1\xA3
+\xA5\xA5ǡ\xBC\xA5\xBF\xA5\xB5\xA1\xBC\xA5ХΡ\xBC\xA5ɤΥ\xB3\xA5\xA2\xBF\x{124BE4}餤\xA4\xCB\xC0\xDF\xC4ꤹ\xA4\xEB\xA4ȸ\xFA\xB2\xCCŪ\xA4Ǥ\xB9\xA1\xA3
+\xA5ǥե\xA9\xA5\xEB\xA5\xC8\xC3ͤ\xCF16\xA4Ǥ\xB9\xA1\xA3</P
+><P
+>\xA4\xB3\xA4\xCEʸ\xA4\xCFgfmd.conf\xA4Τߤ\xC7ͭ\xB8\xFA\xA4Ǥ\xA2\xA4ꡢgfarm2.conf\xA4Ǥ\xCF̵\xBB뤵\xA4\xEC\xA4ޤ\xB9\xA1\xA3</P
+><P
+>\xCE\xE3:</P
+><P
+CLASS="LITERALLAYOUT"
+> metadb_server_thread_pool_size 16</P
+></DD
+><DT
+><SPAN
+CLASS="TOKEN"
+>metadb_server_job_queue_length</SPAN
+> <TT
+CLASS="PARAMETER"
+><I
+>\xA5\xAD\xA5塼Ĺ</I
+></TT
+></DT
+><DD
+><P
+>\xA5\xA5ǡ\xBC\xA5\xBF\xA5\xB5\xA1\xBC\xA5\xD0 gfmd \xA4Υ\xB8\xA5\xE7\xA5֥\xAD\xA5塼\xA4Υ\xAD\xA5塼Ĺ\xA4\xF2\xBB\xD8\xC4ꤷ\xA4ޤ\xB9\xA1\xA3
+\xB0\xEC\xC5٤\xCB\xC0\xDC³\xA4\xB9\xA4\xEB\xBA\xC7\xC2祯\xA5饤\xA5\xA2\xA5\xF3\xA5Ȥο\x{124BE4}餤\xA4\xCB\xC0\xDF\xC4ꤹ\xA4\xEB\xA4ȸ\xFA\xB2\xCCŪ\xA4Ǥ\xB9\xA1\xA3
+\xA5ǥե\xA9\xA5\xEB\xA5\xC8\xC3ͤ\xCF160\xA4Ǥ\xB9\xA1\xA3</P
+><P
+>\xA4\xB3\xA4\xCEʸ\xA4\xCFgfmd.conf\xA4Τߤ\xC7ͭ\xB8\xFA\xA4Ǥ\xA2\xA4ꡢgfarm2.conf\xA4Ǥ\xCF̵\xBB뤵\xA4\xEC\xA4ޤ\xB9\xA1\xA3</P
+><P
+>\xCE\xE3:</P
+><P
+CLASS="LITERALLAYOUT"
+> metadb_server_job_queue_length 160</P
+></DD
+><DT
+><SPAN
+CLASS="TOKEN"
>metadb_server_heartbeat_interval</SPAN
> <TT
CLASS="PARAMETER"
@@ -1322,6 +1368,8 @@
\xA0\xA0<metadb_server_cred_service_statement> |<br>
\xA0\xA0<metadb_server_cred_name_statement> |<br>
\xA0\xA0<metadb_server_stack_size_statement> |<br>
+ \xA0\xA0<metadb_server_thread_pool_size_statement> |<br>
+ \xA0\xA0<metadb_server_job_queue_length_statement> |<br>
\xA0\xA0<metadb_server_heartbeat_interval_statement> |<br>
\xA0\xA0<ldap_server_host_statement> |<br>
\xA0\xA0<ldap_server_port_statement> |<br>
@@ -1364,6 +1412,10 @@
\xA0\xA0"metadb_server_cred_name" <cred_name><br>
<metadb_server_stack_size_statement> ::=<br>
\xA0\xA0"metadb_server_stack_size" <number><br>
+ <metadb_server_thread_pool_size_statement> ::=<br>
+ \xA0\xA0"metadb_server_thread_pool_size" <number><br>
+ <metadb_server_job_queue_length_statement> ::=<br>
+ \xA0\xA0"metadb_server_job_queue_length" <number><br>
<metadb_server_heartbeat_interval_statement> ::=<br>
\xA0\xA0"metadb_server_heartbeat_interval" <number><br>
<ldap_server_host_statement> ::= "ldap_server_host" <hostname><br>
Modified: gfarm_v2/trunk/gftool/config-gfarm/Makefile
===================================================================
--- gfarm_v2/trunk/gftool/config-gfarm/Makefile 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/gftool/config-gfarm/Makefile 2009-03-30 12:52:12 UTC (rev 4139)
@@ -10,9 +10,11 @@
datadir=$(default_datadir)/gfarm/config
-SCRIPTS = config-gfarm config-gfsd $(srcdir)/gfarm.arch.guess
+SCRIPTS = config-gfarm config-gfarm-update config-gfsd \
+ $(srcdir)/gfarm.arch.guess
DATA = $(srcdir)/config-gfarm.postgresql \
$(srcdir)/config-gfarm.ldap \
+ $(srcdir)/config-gfarm-update.postgresql \
$(srcdir)/gfarm.conf-postgresql.in \
$(srcdir)/gfarm.conf-ldap.in \
$(srcdir)/gfarm.conf.in \
Added: gfarm_v2/trunk/gftool/config-gfarm/config-gfarm-update.in
===================================================================
--- gfarm_v2/trunk/gftool/config-gfarm/config-gfarm-update.in (rev 0)
+++ gfarm_v2/trunk/gftool/config-gfarm/config-gfarm-update.in 2009-03-30 12:52:12 UTC (rev 4139)
@@ -0,0 +1,161 @@
+#!/bin/sh
+#
+# $Id$
+
+${DEBUG:="false"} && set -xu
+PROGNAME=`basename $0`
+
+# Gfarm installation directory
+prefix="@prefix@"
+sysconfdir="@sysconfdir@"
+config_dir="@datadir@/gfarm/config"
+
+# backend initialization
+BACKEND_TYPE=postgresql
+backend_all="postgresql"
+backend_candidates="postgresql"
+
+# load backend-dependent functions.
+for i in $backend_all
+do
+ . $config_dir/config-gfarm.$i
+ . $config_dir/config-gfarm-update.$i
+done
+
+usage()
+{
+ echo >&2 "usage: $PROGNAME [--help] [--prefix prefix] [-t]"
+ echo >&2 " [--update_symlink] [-P backend_prefix]"
+ echo >&2 " [-l metadata_directory] [-p metadata_backend_port]"
+ echo >&2 " [-f backend_file]"
+ exit 1
+}
+
+ABORT()
+{
+ [ $# -gt 0 ] && echo >&2 "${PROGNAME}: $@"
+ echo >&2 "$PROGNAME failure"
+ exit 1
+}
+
+update_sanity()
+{
+ if [ ! -f $GFMD_CONF ]
+ then
+ echo "$GFMD_CONF: no such file" >&2
+ return 1
+ fi
+
+ update_sanity_$BACKEND_TYPE
+}
+
+# most $BACKEND_TYPE calls the followings
+# from display_backend_params_$BACKEND_TYPE, but some may not.
+display_backend_data_dir_param()
+{
+ echo "metadata directory [-l]: $BACKEND_DATA_DIR"
+}
+display_backend_log_dir_param()
+{
+ echo "metadata log directory [-L]: $BACKEND_LOG_DIR"
+}
+
+display_params()
+{
+ echo "prefix [--prefix]: $CONFIG_PREFIX"
+ echo "metadata backend [-b]: $BACKEND_TYPE"
+ echo "(available backend: $backend_candidates)"
+
+ display_backend_params_$BACKEND_TYPE
+ display_backend_port_params_$BACKEND_TYPE
+ display_backend_optional_params_$BACKEND_TYPE
+
+ update_sanity
+ exit 0
+}
+
+#
+# parse arguments
+#
+
+: ${BACKEND_OPTIONS:=}
+
+while [ $# -gt 0 ] ; do
+ case $1 in
+
+ # set parameters
+ --prefix) shift; [ $# -ge 1 ] || usage
+ CONFIG_PREFIX=$1
+ ;;
+ -U) shift; [ $# -ge 1 ] || usage
+ BACKEND_ADMIN_USER=$1
+ ;;
+ -P) shift; [ $# -ge 1 ] || usage
+ BACKEND_PREFIX=$1
+ ;;
+ -l) shift; [ $# -ge 1 ] || usage
+ BACKEND_DATA_DIR=$1
+ ;;
+ -p) shift; [ $# -ge 1 ] || usage
+ BACKEND_PORT=$1
+ ;;
+ -f) shift; [ $# -ge 1 ] || usage
+ BACKEND_OPTIONS="$BACKEND_OPTIONS -f $1"
+ ;;
+
+ # control options
+ --help)
+ usage
+ ;;
+ -t)
+ DISPLAY_PARAMS=true
+ ;;
+ --update-symlink)
+ UPDATE_SYMLINK=true
+ ;;
+ *)
+ usage
+ ;;
+ esac
+ shift
+done
+
+#
+# default values
+#
+
+PATH="${prefix}/bin:${prefix}/sbin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/pkg/bin:/usr/pkg/sbin:/usr/local/bin:/usr/local/sbin:$PATH"
+export PATH
+search_path="$PATH"
+
+set_default_backend_perfix_$BACKEND_TYPE
+: ${CONFIG_PREFIX:=}
+set_first_defaults_$BACKEND_TYPE
+
+: ${DISPLAY_PARAMS:=false}
+: ${UPDATE_SYMLINK:=false}
+if [ X"$CONFIG_PREFIX" != X ]; then
+ : ${GFARM_CONF_DIR:="$CONFIG_PREFIX/etc"}
+else
+ : ${GFARM_CONF_DIR:="$sysconfdir"}
+fi
+: ${GFARM_CONF:="$GFARM_CONF_DIR/gfarm2.conf"}
+: ${GFMD_CONF:="$GFARM_CONF_DIR/gfmd.conf"}
+
+update_first_set_param_$BACKEND_TYPE
+set_last_defaults_$BACKEND_TYPE
+update_last_set_param_$BACKEND_TYPE
+
+update_sanity || ABORT "aborted"
+
+# -t option; display parameters
+$DISPLAY_PARAMS && display_params
+
+update_postprocess_$BACKEND_TYPE || ABORT "aborted"
+
+#
+if $UPDATE_SYMLINK; then
+ update_symlink_$BACKEND_TYPE
+else
+ access_db_postgresql $BACKEND_OPTIONS
+fi
Added: gfarm_v2/trunk/gftool/config-gfarm/config-gfarm-update.postgresql
===================================================================
--- gfarm_v2/trunk/gftool/config-gfarm/config-gfarm-update.postgresql (rev 0)
+++ gfarm_v2/trunk/gftool/config-gfarm/config-gfarm-update.postgresql 2009-03-30 12:52:12 UTC (rev 4139)
@@ -0,0 +1,93 @@
+getvalue_postgresql() {
+ KEY=$1
+ if [ X"$KEY" != X ]; then
+ value=`egrep "^$KEY " $GFMD_CONF | awk '{ print $2 }'`
+ else
+ value=
+ fi
+ echo $value
+}
+
+# $LINE is appended to $FILE only if $LINE is not included in $FILE
+update_file_postgresql()
+{
+ FILE="$1"
+ LINE="$2"
+
+ if [ ! -f $FILE ]; then
+ echo $LINE > $FILE
+ elif ! grep "^$LINE$" $FILE > /dev/null; then
+ echo $LINE >> $FILE
+ fi
+}
+
+update_postprocess_postgresql()
+{
+ rv=0
+ PGPASS=$HOME/.pgpass
+ if [ ! -f $PGPASS ]; then
+ if ! touch $PGPASS; then
+ echo "$PGPASS: cannot create" >&2
+ rv=1
+ elif ! chmod 0600 $PGPASS; then
+ echo "$PGPASS: cannot change mode" >&2
+ rv=1
+ fi
+ fi
+ [ $rv = 0 ] || return $rv
+ # disable path expansion
+ set -f
+ update_file_postgresql $PGPASS "$BACKEND_HOSTNAME:$BACKEND_PORT:$DB_NAME:$BACKEND_USER:$password"
+ update_file_postgresql $PGPASS "localhost:$BACKEND_PORT:$DB_NAME:$BACKEND_ADMIN_USER:$admin_password"
+ return $rv
+}
+
+update_first_set_param_postgresql()
+{
+ : ${BACKEND_HOSTNAME:=`getvalue_postgresql postgresql_server_host`}
+ : ${BACKEND_PORT=`getvalue_postgresql postgresql_server_port`}
+ : ${DB_NAME:=`getvalue_postgresql postgresql_dbname`}
+ : ${BACKEND_USER:=`getvalue_postgresql postgresql_user`}
+ : ${password:=`getvalue_postgresql postgresql_password | awk -F\" '{ print $2 }'`}
+}
+
+update_last_set_param_postgresql()
+{
+ : ${admin_password:=`cat $BACKEND_DATA_DIR/admin_password`}
+}
+
+update_sanity_postgresql()
+{
+ rv=0
+ if [ X"$BACKEND_HOSTNAME" = X -o X"$BACKEND_PORT" = X \
+ -o X"$DB_NAME" = X -o X"$BACKEND_USER" = X -o X"$password" = X ]
+ then
+ echo "ERROR: postgresql backend is not configured" >&2
+ rv=1
+ fi
+ if [ X"$admin_password" = X ]
+ then
+ echo "ERROR: password for postgresql administrator cannot be read" >&2
+ rv=1
+ fi
+ return $rv
+}
+
+update_symlink_postgresql()
+{
+ cat <<EOF | $PGSQL_BINDIR/psql -p $BACKEND_PORT $DB_NAME $BACKEND_ADMIN_USER
+CREATE TABLE Symlink (
+ inumber INT8 PRIMARY KEY,
+ sourcePath VARCHAR(1024) NOT NULL
+);
+
+GRANT SELECT, INSERT, UPDATE, DELETE ON Symlink TO $BACKEND_USER;
+EOF
+}
+
+access_db_postgresql()
+{
+ OPTIONS="$*"
+
+ $PGSQL_BINDIR/psql -p $BACKEND_PORT $OPTIONS $DB_NAME $BACKEND_ADMIN_USER
+}
Modified: gfarm_v2/trunk/gftool/config-gfarm/config-gfarm.in
===================================================================
--- gfarm_v2/trunk/gftool/config-gfarm/config-gfarm.in 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/gftool/config-gfarm/config-gfarm.in 2009-03-30 12:52:12 UTC (rev 4139)
@@ -135,13 +135,15 @@
usage()
{
- echo >&2 "usage: $PROGNAME [--help] [--prefix prefix] [-t] [-f] [-W] [-w]"
- echo >&2 " [-b metadata_backend] [-V metadata_backend_version]"
+ echo >&2 "usage: $PROGNAME [--help] [--prefix prefix] [-t] [-f]"
+ echo >&2 " [-S] [-N] [-W] [-w]"
+ echo >&2 " [-h hostname] [-d domain_name] [-m gfmd_port]"
+ echo >&2 " [-A metadata_admin_user] [-D metadata_admin_gsi_dn]"
+ echo >&2 " [-a auth_type]"
+ echo >&2 " [-b metadata_backend] [-P backend_prefix]"
+ echo >&2 " [-V metadata_backend_version] [-p metadata_backend_port]"
echo >&2 " [-U backend_admin_user] [-u backend_user]"
- echo >&2 " [-d domain_name] [-h hostname]"
echo >&2 " [-l metadata_directory] [-L metadata_logging_directory]"
- echo >&2 " [-p metadata_backend_port]"
- echo >&2 " [-A metadata_admin_user] [-m gfmd_port] [-a auth_type]"
echo >&2 " $BACKEND_TYPE backend options: (must be specified after -b <backend_type>)"
usage_$BACKEND_TYPE ||
echo >&2 " no such option with backend=$BACKEND_TYPE"
Modified: gfarm_v2/trunk/gftool/config-gfarm/gfarm.schema
===================================================================
--- gfarm_v2/trunk/gftool/config-gfarm/gfarm.schema 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/gftool/config-gfarm/gfarm.schema 2009-03-30 12:52:12 UTC (rev 4139)
@@ -150,8 +150,8 @@
MUST ( inumber $ entryName $ entryINumber ) )
objectclass ( 1.3.6.1.4.1.13122.2.1.2924.101.3.8
- NAME 'GFarmSymlink' SUP top STRUCTURAL
- MUST ( inumber $ sourcePath ) )
+ NAME 'GFarmSymlink' SUP top AUXILIARY
+ MUST ( sourcePath ) )
objectclass ( 1.3.6.1.4.1.13122.2.1.2924.101.3.9
NAME 'XAttr' SUP top STRUCTURAL
Modified: gfarm_v2/trunk/gftool/config-gfarm/slapd.conf-2.1.in
===================================================================
--- gfarm_v2/trunk/gftool/config-gfarm/slapd.conf-2.1.in 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/gftool/config-gfarm/slapd.conf-2.1.in 2009-03-30 12:52:12 UTC (rev 4139)
@@ -9,7 +9,6 @@
argsfile @config_gfarm_run_dir@/gfarm-slapd.args
# disable anonymous access
-defaultaccess none
disallow bind_anon
require LDAPv3 authc
@@ -43,6 +42,10 @@
access to dn="@config_gfarm_ldap_base_dn@" attrs=children
by users write
+# to make the gfarm_ldap_sanity() function happy
+access to dn="@config_gfarm_ldap_base_dn@"
+ by users read
+
# Indices to maintain
index objectClass eq
Modified: gfarm_v2/trunk/gftool/gfdump/gfdump.postgresql.in
===================================================================
--- gfarm_v2/trunk/gftool/gfdump/gfdump.postgresql.in 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/gftool/gfdump/gfdump.postgresql.in 2009-03-30 12:52:12 UTC (rev 4139)
@@ -12,9 +12,9 @@
# CONFIG_DIR configuration directory [$PREFIX/etc]
# DATA_DIR data directory of pgsql [$PREFIX/var/gfarm-pgsql]
-PREFIX=@prefix@
-: ${CONFIG_DIR:="$PREFIX/etc"}
-: ${DATA_DIR:="$PREFIX/var/gfarm-pgsql"}
+prefix=@prefix@
+: ${CONFIG_DIR:="@sysconfdir@"}
+: ${DATA_DIR:="@localstatedir@/gfarm-pgsql"}
GFMDCONF=$CONFIG_DIR/gfmd.conf
DUMPF=db.out
MODE=UNKNOWN
@@ -77,15 +77,30 @@
err "$DUMPF: database dump file not exist"
fi
-# XXX - always overwrite ~/.pgpass
-PGPASS=~/.pgpass
-touch $PGPASS || err "$PGPASS: cannot create"
-chmod 0600 $PGPASS || err "$PGPASS: cannot change mode"
-cat > $PGPASS <<EOF
-$HOST:$PORT:$DBNAME:$USER:$PASSWD
-*:$PORT:$DBNAME:$ADMIN_USER:$ADMIN_PASSWD
-EOF
+# $LINE is appended to $FILE only if $LINE is not included in $FILE
+update_file()
+{
+ FILE="$1"
+ LINE="$2"
+ if [ ! -f $FILE ]; then
+ echo $LINE > $FILE
+ elif ! grep "^$LINE$" $FILE > /dev/null; then
+ echo $LINE >> $FILE
+ fi
+}
+
+# update $HOME/.pgpass
+PGPASS=$HOME/.pgpass
+if [ ! -f $PGPASS ]; then
+ touch $PGPASS || err "$PGPASS: cannot create"
+ chmod 0600 $PGPASS || err "$PGPASS: cannot change mode"
+fi
+# disable path expansion
+set -f
+update_file $PGPASS "$HOST:$PORT:$DBNAME:$USER:$PASSWD"
+update_file $PGPASS "localhost:$PORT:$DBNAME:$ADMIN_USER:$ADMIN_PASSWD"
+
case $MODE in
DUMP)
pg_dump -F c -h $HOST -p $PORT -U $USER -f $DUMPF $DBNAME ||
Modified: gfarm_v2/trunk/gftool/gfstatus/Makefile
===================================================================
--- gfarm_v2/trunk/gftool/gfstatus/Makefile 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/gftool/gfstatus/Makefile 2009-03-30 12:52:12 UTC (rev 4139)
@@ -19,4 +19,5 @@
###
-$(OBJS): $(DEPGFARMINC) $(GFARMLIB_SRCDIR)/config.h $(GFARMLIB_SRCDIR)/auth.h
+$(OBJS): $(DEPGFARMINC) $(GFARMLIB_SRCDIR)/config.h $(GFARMLIB_SRCDIR)/auth.h \
+ $(GFARMLIB_SRCDIR)/gfpath.h
Modified: gfarm_v2/trunk/gftool/gfstatus/gfstatus.c
===================================================================
--- gfarm_v2/trunk/gftool/gfstatus/gfstatus.c 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/gftool/gfstatus/gfstatus.c 2009-03-30 12:52:12 UTC (rev 4139)
@@ -7,6 +7,7 @@
#include <gfarm/gfarm.h>
#include "config.h"
#include "auth.h"
+#include "gfpath.h"
void
error_check(char *msg, gfarm_error_t e)
@@ -25,6 +26,21 @@
printf("%s: %s\n", msg, status);
}
+void
+print_user_config_file(char *msg)
+{
+ static char gfarm_client_rc[] = GFARM_CLIENT_RC;
+ char *rc;
+
+ /* copied from gfarm_config_read() in config_client.c */
+ printf("%s: ", msg);
+ rc = getenv("GFARM_CONFIG_FILE");
+ if (rc == NULL)
+ printf("%s/%s\n", gfarm_get_local_homedir(), gfarm_client_rc);
+ else
+ printf("%s\n", rc);
+}
+
int
main(int argc, char *argv[])
{
@@ -41,7 +57,8 @@
e = gfarm_initialize(&argc, &argv);
error_check("gfarm_initialize", e);
- print_msg("config file", gfarm_config_file);
+ print_user_config_file("user config file ");
+ print_msg("system config file", gfarm_config_file);
puts("");
print_msg("hostname ", gfarm_host_get_self_name());
Modified: gfarm_v2/trunk/lib/libgfarm/gfarm/config.c
===================================================================
--- gfarm_v2/trunk/lib/libgfarm/gfarm/config.c 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/lib/libgfarm/gfarm/config.c 2009-03-30 12:52:12 UTC (rev 4139)
@@ -336,6 +336,8 @@
gfarm_int64_t gfarm_minimum_free_disk_space = MISC_DEFAULT;
int gfarm_gfsd_connection_cache = MISC_DEFAULT;
int gfarm_metadb_stack_size = MISC_DEFAULT;
+int gfarm_metadb_thread_pool_size = MISC_DEFAULT;
+int gfarm_metadb_job_queue_length = MISC_DEFAULT;
int gfarm_metadb_heartbeat_interval = MISC_DEFAULT;
int gfarm_record_atime = MISC_DEFAULT;
@@ -1135,6 +1137,10 @@
e = parse_set_misc_int(p, &gfarm_gfsd_connection_cache);
} else if (strcmp(s, o = "metadb_server_stack_size") == 0) {
e = parse_set_misc_int(p, &gfarm_metadb_stack_size);
+ } else if (strcmp(s, o = "metadb_server_thread_pool_size") == 0) {
+ e = parse_set_misc_int(p, &gfarm_metadb_thread_pool_size);
+ } else if (strcmp(s, o = "metadb_server_job_queue_length") == 0) {
+ e = parse_set_misc_int(p, &gfarm_metadb_job_queue_length);
} else if (strcmp(s, o = "metadb_server_heartbeat_interval") == 0) {
e = parse_set_misc_int(p, &gfarm_metadb_heartbeat_interval);
} else if (strcmp(s, o = "record_atime") == 0) {
@@ -1236,6 +1242,12 @@
GFARM_GFSD_CONNECTION_CACHE_DEFAULT;
if (gfarm_metadb_stack_size == MISC_DEFAULT)
gfarm_metadb_stack_size = GFARM_METADB_STACK_SIZE_DEFAULT;
+ if (gfarm_metadb_thread_pool_size == MISC_DEFAULT)
+ gfarm_metadb_thread_pool_size =
+ GFARM_METADB_THREAD_POOL_SIZE_DEFAULT;
+ if (gfarm_metadb_job_queue_length == MISC_DEFAULT)
+ gfarm_metadb_job_queue_length =
+ GFARM_METADB_JOB_QUEUE_LENGTH_DEFAULT;
if (gfarm_metadb_heartbeat_interval == MISC_DEFAULT)
gfarm_metadb_heartbeat_interval =
GFARM_METADB_HEARTBEAT_INTERVAL_DEFAULT;
Modified: gfarm_v2/trunk/lib/libgfarm/gfarm/config.h
===================================================================
--- gfarm_v2/trunk/lib/libgfarm/gfarm/config.h 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/lib/libgfarm/gfarm/config.h 2009-03-30 12:52:12 UTC (rev 4139)
@@ -21,8 +21,12 @@
extern char *gfarm_metadb_admin_user;
extern char *gfarm_metadb_admin_user_gsi_dn;
extern int gfarm_metadb_stack_size;
+extern int gfarm_metadb_thread_pool_size;
+extern int gfarm_metadb_job_queue_length;
extern int gfarm_metadb_heartbeat_interval;
#define GFARM_METADB_STACK_SIZE_DEFAULT 0 /* use OS default */
+#define GFARM_METADB_THREAD_POOL_SIZE_DEFAULT 16 /* quadcore, quadsocket */
+#define GFARM_METADB_JOB_QUEUE_LENGTH_DEFAULT 160 /* THREAD_POOL * 10 */
#define GFARM_METADB_HEARTBEAT_INTERVAL_DEFAULT 180 /* 3 min */
/* LDAP dependent */
Added: gfarm_v2/trunk/man/ja/man1/gfln.1
===================================================================
--- gfarm_v2/trunk/man/ja/man1/gfln.1 (rev 0)
+++ gfarm_v2/trunk/man/ja/man1/gfln.1 2009-03-30 12:52:12 UTC (rev 4139)
@@ -0,0 +1,25 @@
+.\" This manpage has been automatically generated by docbook2man
+.\" from a DocBook document. This tool can be found at:
+.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
+.\" Please send any bug reports, improvements, comments, patches,
+.\" etc. to Steve Cheng <st...@gg...>.
+.TH "GFLN" "1" "19 March 2009" "Gfarm" ""
+
+.SH NAME
+gfln \- \xA5ϡ\xBC\xA5ɥ\xEA\xA5\xA4\xA5\xB7\xA5\xF3\xA5ܥ\xEA\xA5å\xAF\xA5\xEA\xA5\xF2\xBA\xEE\xC0\xAE\xA4\xB9\xA4\xEB
+.SH SYNOPSIS
+
+\fBgfln\fR [ \fB\fIoptions\fB\fR ] \fBtarget\fR \fBlink_name\fR
+
+.SH "DESCRIPTION"
+.PP
+\fItarget\fR\xA4\xCB\xC2Ф\xB9\xA4\xEB\xA5ϡ\xBC\xA5ɥ\xEA\xA5\xF2
+\fIlink_name\fR\xA4˺\xEE\xC0\xAE\xA4\xB7\xA4ޤ\xB9\xA1\xA5
+-s \xA5\xAA\xA5ץ\xB7\xA5\xE7\xA5\xD8\xC4ꤵ\xA4\xEC\xA4\xEB\xA4ȥ\xB7\xA5\xF3\xA5ܥ\xEA\xA5å\xAF\xA5\xEA\xA5\xF2\xBA\xEE\xC0\xAE\xA4\xB7\xA4ޤ\xB9\xA1\xA5
+.SH "OPTIONS"
+.TP
+\fB-s\fR
+\xA5\xB7\xA5\xF3\xA5ܥ\xEA\xA5å\xAF\xA5\xEA\xA5\xF2\xBA\xEE\xC0\xAE\xA4\xB7\xA4ޤ\xB9\xA1\xA5
+.TP
+\fB-?\fR
+\xB0\xFA\xBF\x{125AA5}ץ\xB7\xA5\xE7\xA5\xF3\xA4\xF2ɽ\xBC\xA8\xA4\xB7\xA4ޤ\xB9\xA1\xA5
Modified: gfarm_v2/trunk/man/ja/man5/gfarm2.conf.5
===================================================================
--- gfarm_v2/trunk/man/ja/man5/gfarm2.conf.5 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/man/ja/man5/gfarm2.conf.5 2009-03-30 12:52:12 UTC (rev 4139)
@@ -3,7 +3,7 @@
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <st...@gg...>.
-.TH "GFARM2.CONF" "5" "13 March 2009" "Gfarm" ""
+.TH "GFARM2.CONF" "5" "20 March 2009" "Gfarm" ""
.SH NAME
gfarm2.conf \- Gfarm\xC0\xDF\xC4\xEA\xA5ե\xA1\xA5\xA4\xA5\xEB
@@ -254,6 +254,32 @@
metadb_server_stack_size 262144
.fi
.TP
+\fBmetadb_server_thread_pool_size \fI\xA5\xB9\xA5\xEC\xA5åɿ\xF4\fB\fR
+\xA5\xA5ǡ\xBC\xA5\xBF\xA5\xB5\xA1\xBC\xA5\xD0 gfmd \xA4Υ\xB9\xA5\xEC\xA5åɥס\xBC\xA5\xEB\xA4Υ\xB9\xA5\xEC\xA5åɿ\xF4\xA4\xF2\xBB\xD8\xC4ꤷ\xA4ޤ\xB9\xA1\xA3
+\xA5\xA5ǡ\xBC\xA5\xBF\xA5\xB5\xA1\xBC\xA5ХΡ\xBC\xA5ɤΥ\xB3\xA5\xA2\xBF\x{124BE4}餤\xA4\xCB\xC0\xDF\xC4ꤹ\xA4\xEB\xA4ȸ\xFA\xB2\xCCŪ\xA4Ǥ\xB9\xA1\xA3
+\xA5ǥե\xA9\xA5\xEB\xA5\xC8\xC3ͤ\xCF16\xA4Ǥ\xB9\xA1\xA3
+
+\xA4\xB3\xA4\xCEʸ\xA4\xCFgfmd.conf\xA4Τߤ\xC7ͭ\xB8\xFA\xA4Ǥ\xA2\xA4ꡢgfarm2.conf\xA4Ǥ\xCF̵\xBB뤵\xA4\xEC\xA4ޤ\xB9\xA1\xA3
+
+\xCE\xE3:
+
+.nf
+ metadb_server_thread_pool_size 16
+.fi
+.TP
+\fBmetadb_server_job_queue_length \fI\xA5\xAD\xA5塼Ĺ\fB\fR
+\xA5\xA5ǡ\xBC\xA5\xBF\xA5\xB5\xA1\xBC\xA5\xD0 gfmd \xA4Υ\xB8\xA5\xE7\xA5֥\xAD\xA5塼\xA4Υ\xAD\xA5塼Ĺ\xA4\xF2\xBB\xD8\xC4ꤷ\xA4ޤ\xB9\xA1\xA3
+\xB0\xEC\xC5٤\xCB\xC0\xDC³\xA4\xB9\xA4\xEB\xBA\xC7\xC2祯\xA5饤\xA5\xA2\xA5\xF3\xA5Ȥο\x{124BE4}餤\xA4\xCB\xC0\xDF\xC4ꤹ\xA4\xEB\xA4ȸ\xFA\xB2\xCCŪ\xA4Ǥ\xB9\xA1\xA3
+\xA5ǥե\xA9\xA5\xEB\xA5\xC8\xC3ͤ\xCF160\xA4Ǥ\xB9\xA1\xA3
+
+\xA4\xB3\xA4\xCEʸ\xA4\xCFgfmd.conf\xA4Τߤ\xC7ͭ\xB8\xFA\xA4Ǥ\xA2\xA4ꡢgfarm2.conf\xA4Ǥ\xCF̵\xBB뤵\xA4\xEC\xA4ޤ\xB9\xA1\xA3
+
+\xCE\xE3:
+
+.nf
+ metadb_server_job_queue_length 160
+.fi
+.TP
\fBmetadb_server_heartbeat_interval \fI\xC9ÿ\xF4\fB\fR
\xA5\xA5ǡ\xBC\xA5\xBF\xA5\xB5\xA1\xBC\xA5\xD0 gfmd \xA4\xAC\xB3ƥե\xA1\xA5\xA4\xA5륷\xA5\xB9\xA5ƥॵ\xA1\xBC\xA5\xD0 gfsd
\xA4\xCB\xC2Ф\xB7ư\xBA\xEE\xB3\xCEǧ\xA4\xF2\xB9Ԥ\xA6\xA5ϡ\xBC\xA5ȥӡ\xBC\xA5Ȥδֳ֤\xF2\xC9ÿ\xF4\xA4ǻ\xD8\xC4ꤷ\xA4ޤ\xB9\xA1\xA3
@@ -593,6 +619,8 @@
\~\~<metadb_server_cred_service_statement> |
\~\~<metadb_server_cred_name_statement> |
\~\~<metadb_server_stack_size_statement> |
+ \~\~<metadb_server_thread_pool_size_statement> |
+ \~\~<metadb_server_job_queue_length_statement> |
\~\~<metadb_server_heartbeat_interval_statement> |
\~\~<ldap_server_host_statement> |
\~\~<ldap_server_port_statement> |
@@ -635,6 +663,10 @@
\~\~"metadb_server_cred_name" <cred_name>
<metadb_server_stack_size_statement> ::=
\~\~"metadb_server_stack_size" <number>
+ <metadb_server_thread_pool_size_statement> ::=
+ \~\~"metadb_server_thread_pool_size" <number>
+ <metadb_server_job_queue_length_statement> ::=
+ \~\~"metadb_server_job_queue_length" <number>
<metadb_server_heartbeat_interval_statement> ::=
\~\~"metadb_server_heartbeat_interval" <number>
<ldap_server_host_statement> ::= "ldap_server_host" <hostname>
Added: gfarm_v2/trunk/man/man1/gfln.1
===================================================================
--- gfarm_v2/trunk/man/man1/gfln.1 (rev 0)
+++ gfarm_v2/trunk/man/man1/gfln.1 2009-03-30 12:52:12 UTC (rev 4139)
@@ -0,0 +1,26 @@
+.\" This manpage has been automatically generated by docbook2man
+.\" from a DocBook document. This tool can be found at:
+.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
+.\" Please send any bug reports, improvements, comments, patches,
+.\" etc. to Steve Cheng <st...@gg...>.
+.TH "GFLN" "1" "19 March 2009" "Gfarm" ""
+
+.SH NAME
+gfln \- create a hardlink or a symbolic link
+.SH SYNOPSIS
+
+\fBgfln\fR [ \fB\fIoptions\fB\fR ] \fBtarget\fR \fBlink_name\fR
+
+.SH "DESCRIPTION"
+.PP
+\fBgfln\fR creates a hardlink
+\fIlink_name\fR linked to
+\fItarget\fR\&. When the -s option is specified, it
+creates a symbolic link.
+.SH "OPTIONS"
+.TP
+\fB-s\fR
+Creates a symbolic link.
+.TP
+\fB-?\fR
+Displays a list of command options.
Modified: gfarm_v2/trunk/man/man5/gfarm2.conf.5
===================================================================
--- gfarm_v2/trunk/man/man5/gfarm2.conf.5 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/man/man5/gfarm2.conf.5 2009-03-30 12:52:12 UTC (rev 4139)
@@ -3,7 +3,7 @@
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <st...@gg...>.
-.TH "GFARM2.CONF" "5" "13 March 2009" "Gfarm" ""
+.TH "GFARM2.CONF" "5" "20 March 2009" "Gfarm" ""
.SH NAME
gfarm2.conf \- Gfarm configuration file
@@ -276,6 +276,32 @@
metadb_server_stack_size 262144
.fi
.TP
+\fBmetadb_server_thread_pool_size \fIsize\fB\fR
+This directive specifies the maximum number of threads in a
+thread pool in the gfmd. It is effective to specify around the
+number of CPU cores of the metadata server node. Default is 16.
+
+This parameter is only available in gfmd.conf, and ignored in gfarm2.conf.
+
+For example,
+
+.nf
+ metadb_server_thread_pool_size 16
+.fi
+.TP
+\fBmetadb_server_job_queue_length \fIlength\fB\fR
+This directive specifies the length of job queue in the gfmd.
+It is effective to specify around the maximum number of clients that
+access the Gfarm file system at the same time. Default is 160.
+
+This parameter is only available in gfmd.conf, and ignored in gfarm2.conf.
+
+For example,
+
+.nf
+ metadb_server_job_queue_length 160
+.fi
+.TP
\fBmetadb_server_heartbeat_interval \fIseconds\fB\fR
This directive specifies the interval of heartbeat in seconds
for gfmd to check availability of each gfsd. Default is 180 seconds.
@@ -641,6 +667,8 @@
\~\~<metadb_server_cred_service_statement> |
\~\~<metadb_server_cred_name_statement> |
\~\~<metadb_server_stack_size_statement> |
+ \~\~<metadb_server_thread_pool_size_statement> |
+ \~\~<metadb_server_job_queue_length_statement> |
\~\~<metadb_server_heartbeat_interval_statement> |
\~\~<ldap_server_host_statement> |
\~\~<ldap_server_port_statement> |
@@ -683,6 +711,10 @@
\~\~"metadb_server_cred_name" <cred_name>
<metadb_server_stack_size_statement> ::=
\~\~"metadb_server_stack_size" <number>
+ <metadb_server_thread_pool_size_statement> ::=
+ \~\~"metadb_server_thread_pool_size" <number>
+ <metadb_server_job_queue_length_statement> ::=
+ \~\~"metadb_server_job_queue_length" <number>
<metadb_server_heartbeat_interval_statement> ::=
\~\~"metadb_server_heartbeat_interval" <number>
<ldap_server_host_statement> ::= "ldap_server_host" <hostname>
Modified: gfarm_v2/trunk/package/redhat/gfarm.spec
===================================================================
--- gfarm_v2/trunk/package/redhat/gfarm.spec 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/package/redhat/gfarm.spec 2009-03-30 12:52:12 UTC (rev 4139)
@@ -1,6 +1,6 @@
# Part 1 data definition
%define pkg gfarm
-%define ver 2.1.1
+%define ver 2.2.0
%define rel 1
# a hook to make RPM version number different from %{ver}
@@ -329,6 +329,7 @@
%{man_prefix}/man1/gfimport_text.1.gz
%endif
%{man_prefix}/man1/gfkey.1.gz
+%{man_prefix}/man1/gfln.1.gz
%{man_prefix}/man1/gfls.1.gz
%{man_prefix}/man1/gfmkdir.1.gz
%if %{gfarm_v2_not_yet}
@@ -440,6 +441,7 @@
%{man_prefix}/ja/man1/gfimport_text.1.gz
%endif
%{man_prefix}/ja/man1/gfkey.1.gz
+%{man_prefix}/ja/man1/gfln.1.gz
%{man_prefix}/ja/man1/gfls.1.gz
%{man_prefix}/ja/man1/gfmkdir.1.gz
%if %{gfarm_v2_not_yet}
@@ -564,6 +566,7 @@
%{html_prefix}/en/ref/man1/gfimport_text.1.html
%endif
%{html_prefix}/en/ref/man1/gfkey.1.html
+%{html_prefix}/en/ref/man1/gfln.1.html
%{html_prefix}/en/ref/man1/gfls.1.html
%{html_prefix}/en/ref/man1/gfmkdir.1.html
%if %{gfarm_v2_not_yet}
@@ -678,6 +681,7 @@
%{html_prefix}/ja/ref/man1/gfimport_text.1.html
%endif
%{html_prefix}/ja/ref/man1/gfkey.1.html
+%{html_prefix}/ja/ref/man1/gfln.1.html
%{html_prefix}/ja/ref/man1/gfls.1.html
%{html_prefix}/ja/ref/man1/gfmkdir.1.html
%if %{gfarm_v2_not_yet}
@@ -856,6 +860,7 @@
%{prefix}/bin/gfimport_text
%endif
%{prefix}/bin/gfkey
+%{prefix}/bin/gfln
%{prefix}/bin/gfls
%{prefix}/bin/gfmkdir
%{prefix}/bin/gfmv
@@ -949,6 +954,7 @@
%defattr(-,root,root)
%{prefix}/sbin/gfmd
%{prefix}/bin/config-gfarm
+%{prefix}/bin/config-gfarm-update
%{prefix}/bin/gfdump.postgresql
%if %{gfarm_v2_not_yet}
%{prefix}/bin/gfusage
@@ -958,6 +964,7 @@
%{share_prefix}/config/bdb.DB_CONFIG.in
%{share_prefix}/config/config-gfarm.ldap
%{share_prefix}/config/config-gfarm.postgresql
+%{share_prefix}/config/config-gfarm-update.postgresql
%{share_prefix}/config/gfarm.conf-ldap.in
%{share_prefix}/config/gfarm.conf-postgresql.in
%{share_prefix}/config/gfarm.conf.in
Modified: gfarm_v2/trunk/server/gfmd/db_access.c
===================================================================
--- gfarm_v2/trunk/server/gfmd/db_access.c 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/server/gfmd/db_access.c 2009-03-30 12:52:12 UTC (rev 4139)
@@ -34,7 +34,7 @@
void *data;
};
-#define DBQ_SIZE 1000
+#define DBQ_SIZE 10000
struct dbq {
pthread_mutex_t mutex;
Modified: gfarm_v2/trunk/server/gfmd/db_ldap.c
===================================================================
--- gfarm_v2/trunk/server/gfmd/db_ldap.c 2009-03-30 08:38:54 UTC (rev 4138)
+++ gfarm_v2/trunk/server/gfmd/db_ldap.c 2009-03-30 12:52:12 UTC (rev 4139)
@@ -2375,57 +2375,73 @@
}
static gfarm_error_t
-gfarm_ldap_db_symlink_update(
- struct db_symlink_arg *info,
- int mod_op,
- gfarm_error_t (*update_op)(void *, LDAPMod **,
- const struct gfarm_ldap_generic_info_ops *))
+gfarm_ldap_symlink_add(struct db_symlink_arg *info)
{
+ gfarm_error_t e;
int i;
- LDAPMod *modv[4];
- struct ldap_string_modify storage[ARRAY_LENGTH(modv) - 1];
+ LDAPMod *modv[3];
+ LDAPMod objectclass_modify;
+ static char *objectclass_value[] = {
+ "GFarmINode", "GFarmSymlink", NULL
+ };
+ struct ldap_string_modify path_storage;
- char ino_string[INT64STRLEN + 1];
-
struct db_inode_inum_arg key;
key.inum = info->inum;
- sprintf(ino_string, "%" GFARM_PRId64, info->inum);
+ i = 0;
- i = 0;
- set_string_mod(&modv[i], mod_op,
- "objectclass", "GFarmSymlink", &storage[i]);
+ objectclass_modify.mod_op = LDAP_MOD_REPLACE;
+ objectclass_modify.mod_type = "objectclass";
+ objectclass_modify.mod_vals.modv_strvals = objectclass_value;
+ modv[i] = &objectclass_modify;
i++;
- set_string_mod(&modv[i], mod_op,
- "inumber", ino_string, &storage[i]);
+
+ set_string_mod(&modv[i], LDAP_MOD_REPLACE,
+ "sourcePath", info->source_path, &path_storage);
i++;
- set_string_mod(&modv[i], mod_op,
- "sourcePath", info->source_path, &storage[i]);
- i++;
modv[i++] = NULL;
assert(i == ARRAY_LENGTH(modv));
- return ((*update_op)(&key, modv, &gfarm_ldap_db_symlink_ops));
-}
+ /* use "modify" instead of "add", since this is an AUXILIARY object */
+ e = gfarm_ldap_generic_info_modify(&key, modv,
+ &gfarm_ldap_db_symlink_ops);
-static gfarm_error_t
-gfarm_ldap_symlink_add(struct db_symlink_arg *info)
-{
- gfarm_error_t e;
- e = gfarm_ldap_db_symlink_update(info,
- LDAP_MOD_ADD, gfarm_ldap_generic_info_add);
free(info);
- return e;
+ return (e);
}
static gfarm_error_t
gfarm_ldap_symlink_remove(struct db_inode_inum_arg *arg)
{
gfarm_error_t e;
- e = gfarm_ldap_generic_info_remove(arg, &gfarm_ldap_db_symlink_ops);
+ int i;
+ LDAPMod *modv[3];
+ struct ldap_string_modify objectclass_storage;
+ LDAPMod source_path_storage;
+
+ struct db_inode_inum_arg key;
+
+ key.inum = arg->inum;
+
+ i = 0;
+ set_string_mod(&modv[i], LDAP_MOD_REPLACE,
+ "objectclass", "GFarmINode", &objectclass_storage);
+ i++;
+ set_delete_mod(&modv[i], "sourcePath", &source_path_storage);
+ i++;
+ modv[i++] = NULL;
+ assert(i == ARRAY_LENGTH(modv));
+
+ /*
+ * use "modify" instead of "remove", since this is an AUXILIARY object
+ */
+ e = gfarm_ldap_generic_info_modify(&key, modv,
+ &gfarm_ldap_db_symlink_ops);
+
free(arg);
- return e;
+ return (e);
}
static gfarm_error_t
Modified: gfarm_v2/trunk/server/gfmd/gfmd.c
===================================================================
--- gfarm_v2/trunk/serve...
[truncated message content] |
|
From: <uj...@us...> - 2009-03-30 08:39:07
|
Revision: 4138
http://gfarm.svn.sourceforge.net/gfarm/?rev=4138&view=rev
Author: ujihara
Date: 2009-03-30 08:38:54 +0000 (Mon, 30 Mar 2009)
Log Message:
-----------
fix Trac#48 (xattr giant_lock)
Modified Paths:
--------------
gfarm_v2/trunk/regress/gftool/gfxattr/README.txt
gfarm_v2/trunk/server/gfmd/db_ldap.c
gfarm_v2/trunk/server/gfmd/db_pgsql.c
gfarm_v2/trunk/server/gfmd/xattr.c
Added Paths:
-----------
gfarm_v2/trunk/regress/gftool/gfxattr/gffindxmlattr-large-test.sh
gfarm_v2/trunk/regress/gftool/gfxattr/xmltest/
gfarm_v2/trunk/regress/gftool/gfxattr/xmltest/aclxml
gfarm_v2/trunk/regress/gftool/gfxattr/xmltest/detailxml
gfarm_v2/trunk/regress/gftool/gfxattr/xmltest/logxml
gfarm_v2/trunk/regress/gftool/gfxattr/xmltest/testxml
Modified: gfarm_v2/trunk/regress/gftool/gfxattr/README.txt
===================================================================
--- gfarm_v2/trunk/regress/gftool/gfxattr/README.txt 2009-03-27 10:30:45 UTC (rev 4137)
+++ gfarm_v2/trunk/regress/gftool/gfxattr/README.txt 2009-03-30 08:38:54 UTC (rev 4138)
@@ -24,3 +24,8 @@
If failed, test exits at failed command.
run ./gftool/gfxattr/gfxattr-fini.sh
for finalize (remove some files etc).
+
+
+o gffindxmlattr-large-test.sh
+ cd gfarm/regress/gfxattr
+ sh ./gffindxmlattr-large-test.sh
Added: gfarm_v2/trunk/regress/gftool/gfxattr/gffindxmlattr-large-test.sh
===================================================================
--- gfarm_v2/trunk/regress/gftool/gfxattr/gffindxmlattr-large-test.sh (rev 0)
+++ gfarm_v2/trunk/regress/gftool/gfxattr/gffindxmlattr-large-test.sh 2009-03-30 08:38:54 UTC (rev 4138)
@@ -0,0 +1,206 @@
+#!/bin/bash
+
+mountp="./fusetest"
+xmltest="./xmltest"
+
+gfmkdir A
+gfmkdir B
+gfmkdir C
+gfmkdir D
+gfmkdir A/A
+gfmkdir A/B
+gfmkdir A/C
+gfmkdir A/D
+gfmkdir B/A
+gfmkdir B/B
+gfmkdir B/C
+gfmkdir B/D
+gfmkdir C/A
+gfmkdir C/B
+gfmkdir C/C
+gfmkdir C/D
+gfmkdir D/A
+gfmkdir D/B
+gfmkdir D/C
+gfmkdir D/D
+
+mkdir -p $mountp
+gfarm2fs $mountp
+
+touch $mountp/a
+touch $mountp/b
+touch $mountp/c
+touch $mountp/d
+touch $mountp/A/a
+touch $mountp/A/b
+touch $mountp/A/c
+touch $mountp/A/d
+touch $mountp/B/a
+touch $mountp/B/b
+touch $mountp/B/c
+touch $mountp/B/d
+touch $mountp/C/a
+touch $mountp/C/b
+touch $mountp/C/c
+touch $mountp/C/d
+touch $mountp/D/a
+touch $mountp/D/b
+touch $mountp/D/c
+touch $mountp/D/d
+touch $mountp/A/A/a
+touch $mountp/A/A/b
+touch $mountp/A/A/c
+touch $mountp/A/A/d
+touch $mountp/A/B/a
+touch $mountp/A/B/b
+touch $mountp/A/B/c
+touch $mountp/A/B/d
+touch $mountp/A/C/a
+touch $mountp/A/C/b
+touch $mountp/A/C/c
+touch $mountp/A/C/d
+touch $mountp/A/D/a
+touch $mountp/A/D/b
+touch $mountp/A/D/c
+touch $mountp/A/D/d
+touch $mountp/B/A/a
+touch $mountp/B/A/b
+touch $mountp/B/A/c
+touch $mountp/B/A/d
+touch $mountp/B/B/a
+touch $mountp/B/B/b
+touch $mountp/B/B/c
+touch $mountp/B/B/d
+touch $mountp/B/C/a
+touch $mountp/B/C/b
+touch $mountp/B/C/c
+touch $mountp/B/C/d
+touch $mountp/B/D/a
+touch $mountp/B/D/b
+touch $mountp/B/D/c
+touch $mountp/B/D/d
+touch $mountp/C/A/a
+touch $mountp/C/A/b
+touch $mountp/C/A/c
+touch $mountp/C/A/d
+touch $mountp/C/B/a
+touch $mountp/C/B/b
+touch $mountp/C/B/c
+touch $mountp/C/B/d
+touch $mountp/C/C/a
+touch $mountp/C/C/b
+touch $mountp/C/C/c
+touch $mountp/C/C/d
+touch $mountp/C/D/a
+touch $mountp/C/D/b
+touch $mountp/C/D/c
+touch $mountp/C/D/d
+touch $mountp/D/A/a
+touch $mountp/D/A/b
+touch $mountp/D/A/c
+touch $mountp/D/A/d
+touch $mountp/D/B/a
+touch $mountp/D/B/b
+touch $mountp/D/B/c
+touch $mountp/D/B/d
+touch $mountp/D/C/a
+touch $mountp/D/C/b
+touch $mountp/D/C/c
+touch $mountp/D/C/d
+touch $mountp/D/D/a
+touch $mountp/D/D/b
+touch $mountp/D/D/c
+touch $mountp/D/D/d
+
+gfxattr -s -c -x -f $xmltest/aclxml a acl
+gfxattr -s -c -x -f $xmltest/detailxml b detail
+gfxattr -s -c -x -f $xmltest/logxml c log
+gfxattr -s -c -x -f $xmltest/testxml d test
+gfxattr -s -c -x -f $xmltest/aclxml A/a acl
+gfxattr -s -c -x -f $xmltest/detailxml A/b detail
+gfxattr -s -c -x -f $xmltest/logxml A/c log
+gfxattr -s -c -x -f $xmltest/testxml A/d test
+gfxattr -s -c -x -f $xmltest/aclxml B/a acl
+gfxattr -s -c -x -f $xmltest/detailxml B/b detail
+gfxattr -s -c -x -f $xmltest/logxml B/c log
+gfxattr -s -c -x -f $xmltest/testxml B/d test
+gfxattr -s -c -x -f $xmltest/aclxml C/a acl
+gfxattr -s -c -x -f $xmltest/detailxml C/b detail
+gfxattr -s -c -x -f $xmltest/logxml C/c log
+gfxattr -s -c -x -f $xmltest/testxml C/d test
+gfxattr -s -c -x -f $xmltest/aclxml D/a acl
+gfxattr -s -c -x -f $xmltest/detailxml D/b detail
+gfxattr -s -c -x -f $xmltest/logxml D/c log
+gfxattr -s -c -x -f $xmltest/testxml D/d test
+
+gfxattr -s -c -x -f $xmltest/aclxml A/A/a acl
+gfxattr -s -c -x -f $xmltest/detailxml A/A/b detail
+gfxattr -s -c -x -f $xmltest/logxml A/A/c log
+gfxattr -s -c -x -f $xmltest/testxml A/A/d test
+gfxattr -s -c -x -f $xmltest/aclxml A/B/a acl
+gfxattr -s -c -x -f $xmltest/detailxml A/B/b detail
+gfxattr -s -c -x -f $xmltest/logxml A/B/c log
+gfxattr -s -c -x -f $xmltest/testxml A/B/d test
+gfxattr -s -c -x -f $xmltest/aclxml A/C/a acl
+gfxattr -s -c -x -f $xmltest/detailxml A/C/b detail
+gfxattr -s -c -x -f $xmltest/logxml A/C/c log
+gfxattr -s -c -x -f $xmltest/testxml A/C/d test
+gfxattr -s -c -x -f $xmltest/aclxml A/D/a acl
+gfxattr -s -c -x -f $xmltest/detailxml A/D/b detail
+gfxattr -s -c -x -f $xmltest/logxml A/D/c log
+gfxattr -s -c -x -f $xmltest/testxml A/D/d test
+
+gfxattr -s -c -x -f $xmltest/aclxml B/A/a acl
+gfxattr -s -c -x -f $xmltest/detailxml B/A/b detail
+gfxattr -s -c -x -f $xmltest/logxml B/A/c log
+gfxattr -s -c -x -f $xmltest/testxml B/A/d test
+gfxattr -s -c -x -f $xmltest/aclxml B/B/a acl
+gfxattr -s -c -x -f $xmltest/detailxml B/B/b detail
+gfxattr -s -c -x -f $xmltest/logxml B/B/c log
+gfxattr -s -c -x -f $xmltest/testxml B/B/d test
+gfxattr -s -c -x -f $xmltest/aclxml B/C/a acl
+gfxattr -s -c -x -f $xmltest/detailxml B/C/b detail
+gfxattr -s -c -x -f $xmltest/logxml B/C/c log
+gfxattr -s -c -x -f $xmltest/testxml B/C/d test
+gfxattr -s -c -x -f $xmltest/aclxml B/D/a acl
+gfxattr -s -c -x -f $xmltest/detailxml B/D/b detail
+gfxattr -s -c -x -f $xmltest/logxml B/D/c log
+gfxattr -s -c -x -f $xmltest/testxml B/D/d test
+
+gfxattr -s -c -x -f $xmltest/aclxml C/A/a acl
+gfxattr -s -c -x -f $xmltest/detailxml C/A/b detail
+gfxattr -s -c -x -f $xmltest/logxml C/A/c log
+gfxattr -s -c -x -f $xmltest/testxml C/A/d test
+gfxattr -s -c -x -f $xmltest/aclxml C/B/a acl
+gfxattr -s -c -x -f $xmltest/detailxml C/B/b detail
+gfxattr -s -c -x -f $xmltest/logxml C/B/c log
+gfxattr -s -c -x -f $xmltest/testxml C/B/d test
+gfxattr -s -c -x -f $xmltest/aclxml C/C/a acl
+gfxattr -s -c -x -f $xmltest/detailxml C/C/b detail
+gfxattr -s -c -x -f $xmltest/logxml C/C/c log
+gfxattr -s -c -x -f $xmltest/testxml C/C/d test
+gfxattr -s -c -x -f $xmltest/aclxml C/D/a acl
+gfxattr -s -c -x -f $xmltest/detailxml C/D/b detail
+gfxattr -s -c -x -f $xmltest/logxml C/D/c log
+gfxattr -s -c -x -f $xmltest/testxml C/D/d test
+
+gfxattr -s -c -x -f $xmltest/aclxml D/A/a acl
+gfxattr -s -c -x -f $xmltest/detailxml D/A/b detail
+gfxattr -s -c -x -f $xmltest/logxml D/A/c log
+gfxattr -s -c -x -f $xmltest/testxml D/A/d test
+gfxattr -s -c -x -f $xmltest/aclxml D/B/a acl
+gfxattr -s -c -x -f $xmltest/detailxml D/B/b detail
+gfxattr -s -c -x -f $xmltest/logxml D/B/c log
+gfxattr -s -c -x -f $xmltest/testxml D/B/d test
+gfxattr -s -c -x -f $xmltest/aclxml D/C/a acl
+gfxattr -s -c -x -f $xmltest/detailxml D/C/b detail
+gfxattr -s -c -x -f $xmltest/logxml D/C/c log
+gfxattr -s -c -x -f $xmltest/testxml D/C/d test
+gfxattr -s -c -x -f $xmltest/aclxml D/D/a acl
+gfxattr -s -c -x -f $xmltest/detailxml D/D/b detail
+gfxattr -s -c -x -f $xmltest/logxml D/D/c log
+gfxattr -s -c -x -f $xmltest/testxml D/D/d test
+
+gffindxmlattr //name /A/B
+gffindxmlattr //name /A
+gffindxmlattr //name /
Added: gfarm_v2/trunk/regress/gftool/gfxattr/xmltest/aclxml
===================================================================
--- gfarm_v2/trunk/regress/gftool/gfxattr/xmltest/aclxml (rev 0)
+++ gfarm_v2/trunk/regress/gftool/gfxattr/xmltest/aclxml 2009-03-30 08:38:54 UTC (rev 4138)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<ACL>
+ <Readable>
+ <Role>
+ <name>admin</name>
+ <name>root</name>
+ <name>gfdev</name>
+ </Role>
+ <Member>
+ <name>gfdev</name>
+ <name>root</name>
+ <name>admin</name>
+ </Member>
+ </Readable>
+ <Writable>
+ <Role>
+ <name>Admin</name>
+ <name>root</name>
+ </Role>
+ <Member>
+ <name>root</name>
+ <name>admin</name>
+ </Member>
+ </Writable>
+</ACL>
Added: gfarm_v2/trunk/regress/gftool/gfxattr/xmltest/detailxml
===================================================================
--- gfarm_v2/trunk/regress/gftool/gfxattr/xmltest/detailxml (rev 0)
+++ gfarm_v2/trunk/regress/gftool/gfxattr/xmltest/detailxml 2009-03-30 08:38:54 UTC (rev 4138)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<detail>
+ <title>Test File</title>
+ <made>2008/10/12</made>
+ <lastchanged>2009/2/5</lastchanged>
+ <desc>to test gffindxmlattr</desc>
+</detail>
Added: gfarm_v2/trunk/regress/gftool/gfxattr/xmltest/logxml
===================================================================
--- gfarm_v2/trunk/regress/gftool/gfxattr/xmltest/logxml (rev 0)
+++ gfarm_v2/trunk/regress/gftool/gfxattr/xmltest/logxml 2009-03-30 08:38:54 UTC (rev 4138)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<log>
+ <change>
+ <auther>
+ <name>gfdev</name>
+ </auther>
+ <date>
+ <year>2009</year>
+ <month>2</month>
+ <day>5</day>
+ <hour>13</hour>
+ <min>24</min>
+ <sec>23</sec>
+ </date>
+ </change>
+ <diff>None</diff>
+</log>
Added: gfarm_v2/trunk/regress/gftool/gfxattr/xmltest/testxml
===================================================================
--- gfarm_v2/trunk/regress/gftool/gfxattr/xmltest/testxml (rev 0)
+++ gfarm_v2/trunk/regress/gftool/gfxattr/xmltest/testxml 2009-03-30 08:38:54 UTC (rev 4138)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<test>
+ <test>
+ <test>
+ <name>test</name>
+ </test>
+ </test>
+</test>
Modified: gfarm_v2/trunk/server/gfmd/db_ldap.c
===================================================================
--- gfarm_v2/trunk/server/gfmd/db_ldap.c 2009-03-27 10:30:45 UTC (rev 4137)
+++ gfarm_v2/trunk/server/gfmd/db_ldap.c 2009-03-30 08:38:54 UTC (rev 4138)
@@ -2590,14 +2590,14 @@
goto quit;
}
- GFARM_MALLOC_ARRAY(query_type, 64 + INT64STRLEN + strlen(arg->attrname));
+ GFARM_MALLOC_ARRAY(query_type, 64+INT64STRLEN+strlen(arg->attrname));
if (query_type == NULL) {
e = GFARM_ERR_NO_MEMORY;
goto quit;
}
sprintf(query_type,
- "(&(objectclass=XAttr)(inumber=%" GFARM_PRId64 ")(attrname=%s))",
+ "(&(objectclass=XAttr)(inumber=%"GFARM_PRId64")(attrname=%s))",
arg->inum, arg->attrname);
rv = ldap_search_st(gfarm_ldap_server, gfarm_ldap_base_dn,
LDAP_SCOPE_SUB, query_type, attrs, 0, &tout, &res);
Modified: gfarm_v2/trunk/server/gfmd/db_pgsql.c
===================================================================
--- gfarm_v2/trunk/server/gfmd/db_pgsql.c 2009-03-27 10:30:45 UTC (rev 4137)
+++ gfarm_v2/trunk/server/gfmd/db_pgsql.c 2009-03-30 08:38:54 UTC (rev 4138)
@@ -2389,7 +2389,7 @@
* Array size > 0 if some attrvalue matched XPath expr, 0 if not.
*/
command = "SELECT attrname FROM XmlAttr "
- "WHERE inumber = $1 AND array_upper(xpath($2, attrvalue),1) > 0"
+ "WHERE inumber = $1 AND array_upper(xpath($2,attrvalue),1) > 0 "
"ORDER BY attrname";
diag = "pgsql_xmlattr_find";
Modified: gfarm_v2/trunk/server/gfmd/xattr.c
===================================================================
--- gfarm_v2/trunk/server/gfmd/xattr.c 2009-03-27 10:30:45 UTC (rev 4137)
+++ gfarm_v2/trunk/server/gfmd/xattr.c 2009-03-30 08:38:54 UTC (rev 4138)
@@ -60,7 +60,7 @@
== (XATTR_CREATE|XATTR_REPLACE))
return GFARM_ERR_INVALID_ARGUMENT;
if (flags & XATTR_REPLACE) {
- if (inode_xattr_isexists(inode, xmlMode, attrname) == 0)
+ if (!inode_xattr_isexists(inode, xmlMode, attrname))
return GFARM_ERR_NO_SUCH_OBJECT;
} else {
e = inode_xattr_add(inode, xmlMode, attrname);
@@ -137,12 +137,15 @@
if (e == GFARM_ERR_NO_ERROR) {
e = dbq_waitret(waitctx);
- giant_lock();
- if (e == GFARM_ERR_NO_ERROR)
+ if (e == GFARM_ERR_NO_ERROR) {
+ giant_lock();
inode_status_changed(inode);
- else if (addattr)
+ giant_unlock();
+ } else if (addattr) {
+ giant_lock();
inode_xattr_remove(inode, xmlMode, attrname);
- giant_unlock();
+ giant_unlock();
+ }
}
db_waitctx_fini(waitctx);
quit:
@@ -157,7 +160,8 @@
{
if (!isvalid_attrname(attrname))
return GFARM_ERR_INVALID_ARGUMENT;
-
+ if (!inode_xattr_isexists(inode, xmlMode, attrname))
+ return GFARM_ERR_NO_SUCH_OBJECT;
return db_xattr_get(xmlMode, inode_get_number(inode),
attrname, value, size, waitctx);
}
@@ -324,16 +328,23 @@
* These parameters must be smaller than DBQ_SIZE
* in db_access.c to avoid dbq_enter() waiting.
*/
-#define DEFAULT_INUM_PATH_ARRAY_SIZE 2
-#define MINIMUM_DBQ_FREE_NUM 10
+#define DEFAULT_INUM_PATH_ARRAY_SIZE 100
+#define MINIMUM_DBQ_FREE_NUM 100
+/*
+ * We use -1 as unset errno because gfarm_errno_t>=0,
+ * to distinguish whether db access is completed.
+ */
+#define UNSET_GFARM_ERRNO (-1)
+#define IS_UNSET_ERRNO(errno) ((errno) < 0)
+
struct inum_path_array;
struct inum_path_entry {
struct inum_path_array *array;
gfarm_ino_t inum;
char *path;
gfarm_error_t dberr;
- int nfound;
+ int nattrs;
char **attrnames;
};
@@ -342,18 +353,20 @@
pthread_mutex_t lock;
pthread_cond_t cond;
+ char *expr; // target XPath
+
// for cookie_path
int check_ckpath;
int check_ckname;
- int nckpathnames;
+ int ckpathdepth;
char *restartpath; // "dir1/dir2" etc
char *ckpath; // "dir1\0dir2" etc
char **ckpathnames;
// for found path and attrnames
- int nvalid;
- int nfoundsum;
- int filled;
+ int nentry;
+ int nattrssum;
+ int isfilled;
struct inum_path_entry entries[DEFAULT_INUM_PATH_ARRAY_SIZE];
// for reply
@@ -367,7 +380,7 @@
struct inum_path_entry *entry)
{
entry->array = array;
- entry->dberr = -1;
+ entry->dberr = UNSET_GFARM_ERRNO;
}
static void
@@ -376,13 +389,13 @@
int i;
free(entry->path);
- for (i = 0; i < entry->nfound; i++)
+ for (i = 0; i < entry->nattrs; i++)
free(entry->attrnames[i]);
free(entry->attrnames);
}
static void
-inum_path_array_init(struct inum_path_array *array)
+inum_path_array_init(struct inum_path_array *array, char *expr)
{
int i, err;
char *msg = "inum_path_array_init";
@@ -395,16 +408,15 @@
for (i = 0; i < GFARM_ARRAY_LENGTH(array->entries); i++)
inum_path_entry_init(array, &array->entries[i]);
+ array->expr = expr;
}
static struct inum_path_array *
-inum_path_array_alloc(void)
+inum_path_array_alloc(char *expr)
{
- struct inum_path_array *array;
-
- GFARM_MALLOC(array);
+ struct inum_path_array *array = GFARM_MALLOC(array);
if (array != NULL)
- inum_path_array_init(array);
+ inum_path_array_init(array, expr);
return array;
}
@@ -413,7 +425,7 @@
{
int i;
- for (i = 0; i < array->nvalid; i++) {
+ for (i = 0; i < array->nentry; i++) {
inum_path_entry_fini(&array->entries[i]);
}
free(array->restartpath);
@@ -433,11 +445,11 @@
}
static void
-inum_path_array_reinit(struct inum_path_array *array)
+inum_path_array_reinit(struct inum_path_array *array, char *expr)
{
if (array != NULL) {
inum_path_array_fini(array);
- inum_path_array_init(array);
+ inum_path_array_init(array, expr);
}
}
@@ -446,13 +458,13 @@
char *path)
{
int n = GFARM_ARRAY_LENGTH(array->entries);
- if (array->nvalid < n) {
- array->entries[array->nvalid].inum = inum;
- array->entries[array->nvalid].path = path;
- array->nvalid++;
- if (array->nvalid == n)
- array->filled = 1;
- return &array->entries[array->nvalid - 1];
+ if (array->nentry < n) {
+ array->entries[array->nentry].inum = inum;
+ array->entries[array->nentry].path = path;
+ array->nentry++;
+ if (array->nentry == n)
+ array->isfilled = 1;
+ return &array->entries[array->nentry - 1];
} else
return NULL;
}
@@ -477,18 +489,21 @@
struct xattr_info *vinfo = (struct xattr_info *)in;
int i;
+ if (nfound <= 0)
+ return GFARM_ERR_NO_ERROR;
+
GFARM_MALLOC_ARRAY(entry->attrnames, nfound);
if (entry->attrnames == NULL)
return GFARM_ERR_NO_MEMORY;
pthread_mutex_lock(&array->lock);
- entry->nfound = nfound;
+ entry->nattrs = nfound;
for (i = 0; i < nfound; i++) {
entry->attrnames[i] = vinfo[i].attrname;
vinfo[i].attrname = NULL; // to avoid free by caller
vinfo[i].namelen = 0;
}
- array->nfoundsum += nfound;
+ array->nattrssum += nfound;
pthread_mutex_unlock(&array->lock);
return GFARM_ERR_NO_ERROR;
@@ -496,41 +511,41 @@
static gfarm_error_t
findxmlattr_dbq_enter(struct inum_path_array *array,
- struct inum_path_entry *entry, struct gfs_xmlattr_ctx *ctxp)
+ struct inum_path_entry *entry)
{
gfarm_error_t e;
int dbbusy = 0;
if (db_getfreenum() > MINIMUM_DBQ_FREE_NUM) {
- e = db_xmlattr_find(entry->inum, ctxp->expr,
+ e = db_xmlattr_find(entry->inum, array->expr,
inum_path_array_add_attrnames, entry,
db_findxmlattr_done, entry);
} else {
- array->filled = 1;
+ array->isfilled = 1;
dbbusy = 1;
- e = (array->nvalid > 1) ? GFARM_ERR_NO_ERROR
+ e = (array->nentry > 1) ? GFARM_ERR_NO_ERROR
: GFARM_ERR_RESOURCE_TEMPORARILY_UNAVAILABLE;
}
if ((e != GFARM_ERR_NO_ERROR) || dbbusy) {
free(entry->path);
entry->path = NULL;
- array->nvalid--;
+ array->nentry--;
}
return e;
}
static gfarm_error_t
inum_path_array_add(struct inum_path_array *array, gfarm_ino_t inum,
- char *path, struct gfs_xmlattr_ctx *ctxp)
+ char *path)
{
struct inum_path_entry *entry;
entry = inum_path_array_addpath(array, inum, path);
if (entry != NULL)
- return findxmlattr_dbq_enter(array, entry, ctxp);
+ return findxmlattr_dbq_enter(array, entry);
else {
free(path);
- // path array is enough filled.
+ // path array is enough isfilled.
return GFARM_ERR_NO_SPACE;
}
}
@@ -557,7 +572,7 @@
/*
* if restartpath = "dir1/dir2",
* array->ckpath = "dir1\0dir2";
- * array->nckpathnames = 2;
+ * array->ckpathdepth = 2;
* array->ckpathnames = { "dir1", "dir2" }
*/
array->restartpath = path;
@@ -568,22 +583,22 @@
array->check_ckpath = array->check_ckname = 1;
p = array->ckpath;
- array->nckpathnames = 1;
+ array->ckpathdepth = 1;
while ((q = strchr(p, '/')) != NULL) {
- array->nckpathnames++;
+ array->ckpathdepth++;
do {
q++;
} while (*q == '/');
p = q;
}
- GFARM_MALLOC_ARRAY(array->ckpathnames, array->nckpathnames);
+ GFARM_MALLOC_ARRAY(array->ckpathnames, array->ckpathdepth);
if (array->ckpathnames == NULL) {
free(array->ckpath);
array->ckpath = NULL;
return GFARM_ERR_NO_MEMORY;
}
p = array->ckpath;
- for (i = 0; i < array->nckpathnames; i++) {
+ for (i = 0; i < array->ckpathdepth; i++) {
array->ckpathnames[i] = p;
q = strchr(p, '/');
if (q == NULL)
@@ -598,72 +613,86 @@
return GFARM_ERR_NO_ERROR;
}
+static int
+is_find_target(struct inode *inode, struct user *user)
+{
+ return inode_xattr_has_xmlattrs(inode)
+ && (inode_access(inode, user, GFS_R_OK)
+ == GFARM_ERR_NO_ERROR);
+}
+
static gfarm_error_t
-findxmlattr_make_patharray(struct inode *inode, struct process *process,
- int curdepth, char *parent_path,
- struct inum_path_array *array, struct gfs_xmlattr_ctx *ctxp)
+findxmlattr_add_selfpath(struct inode *inode, struct user *user,
+ char *path, struct inum_path_array *array)
{
+ if (!is_find_target(inode, user)){
+ return GFARM_ERR_NO_ERROR;
+ }
+ if (array->check_ckpath) {
+ if (strcmp(array->restartpath, path) != 0) {
+ return GFARM_ERR_NO_ERROR;
+ }
+ }
+ return inum_path_array_add(array, inode_get_number(inode), path);
+}
+
+static char *
+make_subpath(char *parent_path, char *name, int namelen)
+{
+ int pathlen;
+ size_t allocsz;
+ int overflow = 0;
+ char *subpath;
+
+ pathlen = (parent_path[0] == '\0') ? 0 : (strlen(parent_path) + 1);
+ allocsz = gfarm_size_add(&overflow, pathlen, namelen);
+ allocsz = gfarm_size_add(&overflow, allocsz, 1);
+ if (!overflow)
+ GFARM_MALLOC_ARRAY(subpath, allocsz);
+ if (overflow || (subpath == NULL))
+ return NULL;
+ if (pathlen > 0)
+ sprintf(subpath, "%s/", parent_path);
+ memcpy(subpath + pathlen, name, namelen);
+ subpath[pathlen + namelen] = '\0';
+ return subpath;
+}
+
+static gfarm_error_t
+findxmlattr_add_subpaths(struct inode *inode, struct user *user,
+ char *path, int curdepth, const int maxdepth,
+ struct inum_path_array *array)
+{
gfarm_error_t e = GFARM_ERR_NO_ERROR;
Dir dir;
DirEntry entry;
DirCursor cursor;
- struct user *user = process_get_user(process);
struct inode *entry_inode;
- char *name, *dir_path = NULL;
- int add_parent = 1, start_mid = 0;
- int pathlen, namelen, is_dir;
- size_t allocsz;
- int overflow;
+ char *name, *subpath = NULL;
+ int namelen, is_dir, is_tgt, skip = 0;
- if (!inode_xattr_has_xmlattrs(inode)
- || (inode_access(inode, user, GFS_R_OK) != GFARM_ERR_NO_ERROR)){
- add_parent = 0;
- e = GFARM_ERR_NO_ERROR;
- }
- if (array->check_ckpath) {
- start_mid = (curdepth < array->nckpathnames);
- if (strcmp(array->restartpath, parent_path) == 0)
- array->check_ckpath = 0;
- else
- add_parent = 0;
- }
- if (add_parent) {
- e = inum_path_array_add(array, inode_get_number(inode),
- parent_path, ctxp);
- if (e != GFARM_ERR_NO_ERROR)
- goto quit;
- }
-
- if ((curdepth >= ctxp->depth) || array->filled) {
- e = GFARM_ERR_NO_ERROR;
- goto quit;
- }
-
+ if (curdepth >= maxdepth)
+ return GFARM_ERR_NO_ERROR;
dir = inode_get_dir(inode);
- if (dir == NULL) {
- e = GFARM_ERR_NO_ERROR;
- goto quit;
- }
- if (inode_access(inode, user, GFS_X_OK) != GFARM_ERR_NO_ERROR) {
- e = GFARM_ERR_NO_ERROR;
- goto quit;
- }
+ if (dir == NULL)
+ return GFARM_ERR_NO_ERROR;
+ if (inode_access(inode, user, GFS_X_OK) != GFARM_ERR_NO_ERROR)
+ return GFARM_ERR_NO_ERROR;
- if (start_mid) {
- char *path = array->ckpathnames[curdepth];
- if (dir_cursor_lookup(dir, path, strlen(path), &cursor) == 0) {
- e = GFARM_ERR_NO_ERROR;
- goto quit;
- }
+ if ((array->check_ckpath) && (curdepth < array->ckpathdepth)) {
+ char *subpath = array->ckpathnames[curdepth];
+ if (dir_cursor_lookup(dir, subpath, strlen(subpath), &cursor)
+ == 0)
+ return GFARM_ERR_NO_ERROR;
+ if (curdepth == (array->ckpathdepth -1))
+ array->check_ckpath = 0; // it's restart path now
+ else
+ skip = 1; // doesn't find restart path yet
} else {
- if (dir_cursor_set_pos(dir, 0, &cursor) == 0) {
- e = GFARM_ERR_NO_ERROR;
- goto quit;
- }
+ if (dir_cursor_set_pos(dir, 0, &cursor) == 0)
+ return GFARM_ERR_NO_ERROR;
}
- pathlen = (parent_path[0] == '\0') ? 0 : (strlen(parent_path) + 1);
-
do {
entry = dir_cursor_get_entry(dir, &cursor);
if (entry == NULL)
@@ -673,43 +702,52 @@
continue;
entry_inode = dir_entry_get_inode(entry);
is_dir = inode_is_dir(entry_inode);
- if (!is_dir) {
- if ((inode_access(entry_inode, user, GFS_R_OK)
- != GFARM_ERR_NO_ERROR)
- || !inode_xattr_has_xmlattrs(entry_inode)) {
- continue;
- }
- }
- overflow = 0;
- allocsz = gfarm_size_add(&overflow, pathlen, namelen);
- allocsz = gfarm_size_add(&overflow, allocsz, 1);
- if (!overflow)
- GFARM_MALLOC_ARRAY(dir_path, allocsz);
- if (overflow || (dir_path == NULL)) {
+ is_tgt = (!skip && is_find_target(entry_inode, user));
+ skip = 0;
+ if (!is_dir && !is_tgt)
+ continue;
+
+ subpath = make_subpath(path, name, namelen);
+ if (subpath == NULL) {
e = GFARM_ERR_NO_MEMORY;
break;
}
- if (pathlen > 0)
- sprintf(dir_path, "%s/", parent_path);
- memcpy(dir_path + pathlen, name, namelen);
- dir_path[pathlen + namelen] = '\0';
- if (is_dir) {
- e = findxmlattr_make_patharray(entry_inode, process,
- curdepth + 1, dir_path, array, ctxp);
- } else {
+ if (is_tgt)
e = inum_path_array_add(array,
- inode_get_number(entry_inode), dir_path, ctxp);
+ inode_get_number(entry_inode), subpath);
+ if (is_dir && (e == GFARM_ERR_NO_ERROR)) {
+ e = findxmlattr_add_subpaths(entry_inode, user,
+ subpath, curdepth + 1, maxdepth, array);
}
- if (e != GFARM_ERR_NO_ERROR)
- break;
- } while ((dir_cursor_next(dir, &cursor) != 0) && !array->filled);
+ if (!is_tgt)
+ free(subpath);
+ } while ((e == GFARM_ERR_NO_ERROR) &&
+ (dir_cursor_next(dir, &cursor) != 0) && !array->isfilled);
-quit:
- if (!add_parent)
- free(parent_path);
return e;
}
+static gfarm_error_t
+findxmlattr_make_patharray(struct inode *inode, struct user *user,
+ const int maxdepth, struct inum_path_array *array)
+{
+ gfarm_error_t e;
+ char *toppath = strdup("");
+
+ if (toppath == NULL)
+ return GFARM_ERR_NO_MEMORY;
+
+ e = findxmlattr_add_selfpath(inode, user, toppath, array);
+
+ if ((e == GFARM_ERR_NO_ERROR) && inode_is_dir(inode)) {
+ e = findxmlattr_add_subpaths(
+ inode, user, toppath, 0, maxdepth, array);
+ }
+ if (array->entries[0].path != toppath)
+ free(toppath);
+ return e;
+}
+
static void
db_findxmlattr_wait(struct inum_path_array *array, int idx)
{
@@ -720,7 +758,7 @@
* NOTE: must call with array->lock
*/
entry = &array->entries[idx];
- while (entry->dberr < 0) {
+ while (IS_UNSET_ERRNO(entry->dberr)) {
err = pthread_cond_wait(&array->cond, &array->lock);
if (err != 0)
gflog_fatal("db_findxmlattr_wait: "
@@ -736,8 +774,9 @@
int j;
entry = &array->entries[array->replyentidx];
- if (strcmp(entry->path, ctxp->cookie_path) == 0) {
- for (j = 0; j < entry->nfound; j++) {
+ if (entry->path != NULL &&
+ (strcmp(entry->path, ctxp->cookie_path) == 0)) {
+ for (j = 0; j < entry->nattrs; j++) {
array->nreplied++; // already replied, skip it
if (strcmp(entry->attrnames[j],
ctxp->cookie_attrname) == 0) {
@@ -757,13 +796,13 @@
*fpathp = NULL;
*attrnamep = NULL;
- if (array->nreplied >= array->nfoundsum)
+ if (array->nreplied >= array->nattrssum)
return;
- jinit = array->replynameidx;
- for (i = array->replyentidx; i < array->nvalid; i++) {
+ j = jinit = array->replynameidx;
+ for (i = array->replyentidx; i < array->nentry; i++) {
entry = &array->entries[i];
- for (j = jinit; j < entry->nfound; j++) {
+ for (j = jinit; j < entry->nattrs; j++) {
*fpathp = entry->path;
*attrnamep = entry->attrnames[j];
array->nreplied++;
@@ -786,14 +825,14 @@
return;
pthread_mutex_lock(&array->lock);
- for (i = 0; i < array->nvalid; i++) {
+ for (i = 0; i < array->nentry; i++) {
db_findxmlattr_wait(array, i);
}
pthread_mutex_unlock(&array->lock);
}
static void
-findxmlattr_set_found_entries(struct inum_path_array *array,
+findxmlattr_set_found_attrnames(struct inum_path_array *array,
struct gfs_xmlattr_ctx *ctxp)
{
int i, nreply, nremain;
@@ -804,7 +843,7 @@
array->check_ckname = 0;
}
- nremain = array->nfoundsum - array->nreplied;
+ nremain = array->nattrssum - array->nreplied;
nreply = (nremain >= ctxp->nalloc)
? ctxp->nalloc : nremain;
for (i = 0; i < nreply; i++) {
@@ -814,8 +853,8 @@
}
ctxp->nvalid = nreply;
- ctxp->eof = ((array->filled == 0)
- && (array->nfoundsum == array->nreplied));
+ ctxp->eof = ((array->isfilled == 0)
+ && (array->nattrssum == array->nreplied));
}
static gfarm_error_t
@@ -824,29 +863,28 @@
{
gfarm_error_t e;
struct process *process = peer_get_process(peer);
- char *restartpath, *p;
+ struct user *user = process_get_user(process);
+ char *restartpath;
- if (array->nvalid == 0)
+ if (array->nentry == 0)
return GFARM_ERR_NO_ERROR;
- restartpath = strdup(array->entries[array->nvalid-1].path);
+ restartpath = strdup(array->entries[array->nentry-1].path);
if (restartpath == NULL)
return GFARM_ERR_NO_MEMORY;
- inum_path_array_reinit(array);
+ inum_path_array_reinit(array, ctxp->expr);
e = findxmlattr_set_restart_path(array, restartpath);
if (e != GFARM_ERR_NO_ERROR)
return e;
- if ((p = strdup("")) == NULL)
- return GFARM_ERR_NO_MEMORY;
giant_lock();
- e = findxmlattr_make_patharray(inode, process, 0,
- p, array, ctxp);
+ e = findxmlattr_make_patharray(inode, user,
+ ctxp->depth, array);
giant_unlock();
findxmlattr_dbq_wait_all(array, ctxp);
if (e == GFARM_ERR_NO_ERROR) {
- findxmlattr_set_found_entries(array, ctxp);
+ findxmlattr_set_found_attrnames(array, ctxp);
}
return e;
@@ -868,21 +906,18 @@
{
gfarm_error_t e;
struct process *process = peer_get_process(peer);
+ struct user *user = process_get_user(process);
struct inum_path_array *array = NULL;
- char *p;
array = peer_findxmlattrctx_get(peer);
if (array == NULL) {
if (ctx_has_cookie(ctxp)) {
e = GFARM_ERR_INVALID_ARGUMENT;
- } else if ((array = inum_path_array_alloc()) == NULL)
+ } else if ((array = inum_path_array_alloc(ctxp->expr)) == NULL)
e = GFARM_ERR_NO_MEMORY;
- else if ((p = strdup("")) == NULL) {
- inum_path_array_free(array);
- e = GFARM_ERR_NO_MEMORY;
- } else {
- e = findxmlattr_make_patharray(inode, process, 0,
- p, array, ctxp);
+ else {
+ e = findxmlattr_make_patharray(inode, user,
+ ctxp->depth, array);
}
giant_unlock();
// We must wait always even if above function was failed.
@@ -897,10 +932,10 @@
*ap = array;
if (e == GFARM_ERR_NO_ERROR)
- findxmlattr_set_found_entries(array, ctxp);
+ findxmlattr_set_found_attrnames(array, ctxp);
while ((e == GFARM_ERR_NO_ERROR) &&
- (array->filled) && (ctxp->nvalid == 0)) {
+ array->isfilled && (ctxp->nvalid == 0)) {
e = findxmlxattr_restart(peer, inode, array, ctxp);
}
if ((e == GFARM_ERR_NO_ERROR) && (ctxp->eof == 0)) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n-...@us...> - 2009-03-27 10:30:51
|
Revision: 4137
http://gfarm.svn.sourceforge.net/gfarm/?rev=4137&view=rev
Author: n-soda
Date: 2009-03-27 10:30:45 +0000 (Fri, 27 Mar 2009)
Log Message:
-----------
gfarm_pgsql_group_add() and gfarm_pgsql_group_modify() might return
a garbage value, problem introduced in r4136
Modified Paths:
--------------
gfarm_v2/trunk/server/gfmd/db_pgsql.c
Modified: gfarm_v2/trunk/server/gfmd/db_pgsql.c
===================================================================
--- gfarm_v2/trunk/server/gfmd/db_pgsql.c 2009-03-27 04:24:57 UTC (rev 4136)
+++ gfarm_v2/trunk/server/gfmd/db_pgsql.c 2009-03-27 10:30:45 UTC (rev 4137)
@@ -1175,7 +1175,7 @@
gfarm_pgsql_group_add(struct gfarm_group_info *info)
{
const char *paramValues[1];
- gfarm_error_t e;
+ gfarm_error_t e = GFARM_ERR_NO_ERROR;
if (gfarm_pgsql_begin_with_retry("pgsql_group_add")) {
@@ -1206,7 +1206,7 @@
gfarm_pgsql_group_modify(struct db_group_modify_arg *arg)
{
struct gfarm_group_info *info = &arg->gi;
- gfarm_error_t e;
+ gfarm_error_t e = GFARM_ERR_NO_ERROR;
if (gfarm_pgsql_begin_with_retry("pgsql_group_modify")) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <uj...@us...> - 2009-03-27 04:25:17
|
Revision: 4136
http://gfarm.svn.sourceforge.net/gfarm/?rev=4136&view=rev
Author: ujihara
Date: 2009-03-27 04:24:57 +0000 (Fri, 27 Mar 2009)
Log Message:
-----------
testing Trac#48 (xattr giant_lock)
still testing, especially for gffindxmlattr
next commit will be on Monday
fix dbq with callback
delete unnecessary functions
fix LDAP binary handling
fix typo etc.
Modified Paths:
--------------
gfarm_v2/trunk/gftool/config-gfarm/gfarm.schema
gfarm_v2/trunk/lib/libgfarm/gfarm/gfm_proto.h
gfarm_v2/trunk/server/gfmd/db_access.c
gfarm_v2/trunk/server/gfmd/db_access.h
gfarm_v2/trunk/server/gfmd/db_ldap.c
gfarm_v2/trunk/server/gfmd/db_none.c
gfarm_v2/trunk/server/gfmd/db_ops.h
gfarm_v2/trunk/server/gfmd/db_pgsql.c
gfarm_v2/trunk/server/gfmd/inode.c
gfarm_v2/trunk/server/gfmd/inode.h
gfarm_v2/trunk/server/gfmd/xattr.c
Modified: gfarm_v2/trunk/gftool/config-gfarm/gfarm.schema
===================================================================
--- gfarm_v2/trunk/gftool/config-gfarm/gfarm.schema 2009-03-26 14:22:07 UTC (rev 4135)
+++ gfarm_v2/trunk/gftool/config-gfarm/gfarm.schema 2009-03-27 04:24:57 UTC (rev 4136)
@@ -108,8 +108,7 @@
EQUALITY caseExactMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.13122.2.1.2924.101.2.30 NAME 'attrvalue'
- EQUALITY caseExactMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 SINGLE-VALUE )
# Object Class Definitions
# 1.3.6.1.4.1.13122.2.1.2924.101.3.x
Modified: gfarm_v2/trunk/lib/libgfarm/gfarm/gfm_proto.h
===================================================================
--- gfarm_v2/trunk/lib/libgfarm/gfarm/gfm_proto.h 2009-03-26 14:22:07 UTC (rev 4135)
+++ gfarm_v2/trunk/lib/libgfarm/gfarm/gfm_proto.h 2009-03-27 04:24:57 UTC (rev 4136)
@@ -289,7 +289,7 @@
GFJ_PROTO_RESERVE14,
GFJ_PROTO_RESERVE15,
- /* extended attribude management */
+ /* extended attribute management */
GFM_PROTO_XATTR_SET,
GFM_PROTO_XMLATTR_SET,
GFM_PROTO_XATTR_GET,
Modified: gfarm_v2/trunk/server/gfmd/db_access.c
===================================================================
--- gfarm_v2/trunk/server/gfmd/db_access.c 2009-03-26 14:22:07 UTC (rev 4135)
+++ gfarm_v2/trunk/server/gfmd/db_access.c 2009-03-27 04:24:57 UTC (rev 4136)
@@ -19,18 +19,21 @@
#define ALIGNMENT 8
#define ALIGN(offset) (((offset) + ALIGNMENT - 1) & ~(ALIGNMENT - 1))
-typedef void (*dbq_entry_func_t)(void *);
-typedef gfarm_error_t (*dbq_entry_func_witherr_t)(void *);
+typedef gfarm_error_t (*dbq_entry_func_t)(void *);
typedef void (*dbq_entry_func_callback_t)(gfarm_error_t, void *);
-struct dbq_entry {
+struct dbq_callback_arg {
dbq_entry_func_t func;
void *data;
- dbq_entry_func_witherr_t funcwitherr;
- dbq_entry_func_callback_t callback;
+ dbq_entry_func_callback_t cbfunc;
void *cbdata;
};
+struct dbq_entry {
+ dbq_entry_func_t func;
+ void *data;
+};
+
#define DBQ_SIZE 1000
struct dbq {
@@ -90,9 +93,7 @@
}
static gfarm_error_t
-dbq_enter_common(struct dbq *q, dbq_entry_func_t func,
- void *data, dbq_entry_func_witherr_t func_witherr,
- dbq_entry_func_callback_t func_callback, void *callbackdata)
+dbq_enter(struct dbq *q, dbq_entry_func_t func, void *data)
{
int err;
gfarm_error_t e;
@@ -122,9 +123,6 @@
}
q->entries[q->in].func = func;
q->entries[q->in].data = data;
- q->entries[q->in].funcwitherr = func_witherr;
- q->entries[q->in].callback = func_callback;
- q->entries[q->in].cbdata = callbackdata;
q->in++;
if (q->in >= DBQ_SIZE)
q->in = 0;
@@ -140,19 +138,38 @@
return (e);
}
-gfarm_error_t
-dbq_enter(struct dbq *q, dbq_entry_func_t func, void *data)
+static gfarm_error_t
+dbq_call_callback(void *a)
{
- return dbq_enter_common(q, func, data, NULL, NULL, NULL);
+ gfarm_error_t e;
+ struct dbq_callback_arg *arg = (struct dbq_callback_arg *)a;
+
+ e = (*arg->func)(arg->data);
+ if (arg->cbfunc != NULL) {
+ (*arg->cbfunc)(e, arg->cbdata);
+ }
+ free(arg);
+ return e;
}
static gfarm_error_t
dbq_enter_withcallback(struct dbq *q,
- dbq_entry_func_witherr_t func_witherr, void *data,
- dbq_entry_func_callback_t func_callback, void *callbackdata)
+ dbq_entry_func_t func, void *data,
+ dbq_entry_func_callback_t cbfunc, void *cbdata)
{
- return dbq_enter_common(q, NULL, data,
- func_witherr, func_callback, callbackdata);
+ gfarm_error_t e;
+ struct dbq_callback_arg *arg = GFARM_MALLOC(arg);
+
+ if (arg == NULL)
+ return GFARM_ERR_NO_MEMORY;
+ arg->func = func;
+ arg->data = data;
+ arg->cbfunc = cbfunc;
+ arg->cbdata = cbdata;
+ e = dbq_enter(q, dbq_call_callback, arg);
+ if (e != GFARM_ERR_NO_ERROR)
+ free(arg);
+ return e;
}
#define UNINITIALIZED_GFARM_ERROR (-1)
@@ -217,10 +234,9 @@
static gfarm_error_t
dbq_enter_for_waitret(struct dbq *q,
- dbq_entry_func_witherr_t func_witherr, void *data,
- struct db_waitctx *ctx)
+ dbq_entry_func_t func, void *data, struct db_waitctx *ctx)
{
- return dbq_enter_withcallback(q, func_witherr, data,
+ return dbq_enter_withcallback(q, func, data,
dbq_done_callback, ctx);
}
@@ -315,14 +331,9 @@
for (;;) {
e = dbq_delete(&dbq, &ent);
- if (e == GFARM_ERR_NO_ERROR)
- if (ent.func != NULL)
- (*ent.func)(ent.data);
- else {
- e = (*ent.funcwitherr)(ent.data);
- (*ent.callback)(e, ent.cbdata);
- }
- else if (e == GFARM_ERR_NO_SUCH_OBJECT)
+ if (e == GFARM_ERR_NO_ERROR) {
+ (*ent.func)(ent.data);
+ } else if (e == GFARM_ERR_NO_SUCH_OBJECT)
break;
}
@@ -1106,7 +1117,7 @@
* Same as db_xattr_modify().
*/
e = dbq_enter_for_waitret(&dbq,
- (dbq_entry_func_witherr_t)ops->xattr_add, arg, waitctx);
+ (dbq_entry_func_t)ops->xattr_add, arg, waitctx);
} else
e = dbq_enter(&dbq,
(dbq_entry_func_t)ops->xattr_add, arg);
@@ -1128,7 +1139,7 @@
arg->size = size;
if (waitctx != NULL)
e = dbq_enter_for_waitret(&dbq,
- (dbq_entry_func_witherr_t)ops->xattr_modify, arg, waitctx);
+ (dbq_entry_func_t)ops->xattr_modify, arg, waitctx);
else
e = dbq_enter(&dbq,
(dbq_entry_func_t)ops->xattr_modify, arg);
@@ -1149,26 +1160,25 @@
}
gfarm_error_t
-db_xattr_get(int xmlMode, gfarm_ino_t inum, char *attrname,
- void **valuep, size_t *sizep, struct db_waitctx *waitctx)
+db_xattr_removeall(int xmlMode, gfarm_ino_t inum)
{
- struct db_xattr_arg *arg = db_xattr_arg_alloc(attrname, 0);
- if (arg == NULL)
- return GFARM_ERR_NO_ERROR;
- arg->xmlMode = xmlMode;
- arg->inum = inum;
- arg->valuep = valuep;
- arg->sizep = sizep;
- return dbq_enter_for_waitret(&dbq,
- (dbq_entry_func_witherr_t)ops->xattr_get, arg, waitctx);
+ if (ops->xattr_removeall != NULL) {
+ struct db_xattr_arg *arg = db_xattr_arg_alloc(NULL, 0);
+ if (arg == NULL)
+ return GFARM_ERR_NO_ERROR;
+ arg->xmlMode = xmlMode;
+ arg->inum = inum;
+ return dbq_enter(&dbq,
+ (dbq_entry_func_t)ops->xattr_removeall, arg);
+ } else
+ return GFARM_ERR_OPERATION_NOT_SUPPORTED;
}
gfarm_error_t
-db_xattr_list(int xmlMode, gfarm_ino_t inum, void **valuep, size_t *sizep,
- struct db_waitctx *waitctx)
+db_xattr_get(int xmlMode, gfarm_ino_t inum, char *attrname,
+ void **valuep, size_t *sizep, struct db_waitctx *waitctx)
{
- struct db_xattr_arg *arg = db_xattr_arg_alloc(NULL, 0);
-
+ struct db_xattr_arg *arg = db_xattr_arg_alloc(attrname, 0);
if (arg == NULL)
return GFARM_ERR_NO_ERROR;
arg->xmlMode = xmlMode;
@@ -1176,7 +1186,7 @@
arg->valuep = valuep;
arg->sizep = sizep;
return dbq_enter_for_waitret(&dbq,
- (dbq_entry_func_witherr_t)ops->xattr_list, arg, waitctx);
+ (dbq_entry_func_t)ops->xattr_get, arg, waitctx);
}
gfarm_error_t
@@ -1202,6 +1212,6 @@
arg->foundcallback = foundcallback;
arg->foundcbdata = foundcbdata;
return dbq_enter_withcallback(&dbq,
- (dbq_entry_func_witherr_t)ops->xmlattr_find, arg,
+ (dbq_entry_func_t)ops->xmlattr_find, arg,
(dbq_entry_func_callback_t)callback, cbdata);
}
Modified: gfarm_v2/trunk/server/gfmd/db_access.h
===================================================================
--- gfarm_v2/trunk/server/gfmd/db_access.h 2009-03-26 14:22:07 UTC (rev 4135)
+++ gfarm_v2/trunk/server/gfmd/db_access.h 2009-03-27 04:24:57 UTC (rev 4136)
@@ -91,10 +91,9 @@
gfarm_error_t db_xattr_modify(int, gfarm_ino_t, char *, void *, size_t,
struct db_waitctx *);
gfarm_error_t db_xattr_remove(int, gfarm_ino_t, char *);
+gfarm_error_t db_xattr_removeall(int, gfarm_ino_t);
gfarm_error_t db_xattr_get(int, gfarm_ino_t, char *, void **, size_t *,
struct db_waitctx *);
-gfarm_error_t db_xattr_list(int, gfarm_ino_t, void **, size_t *,
- struct db_waitctx *);
gfarm_error_t db_xattr_load(void *closure,
void (*callback)(void *, struct xattr_info *));
gfarm_error_t db_xmlattr_find(gfarm_ino_t, const char *,
Modified: gfarm_v2/trunk/server/gfmd/db_ldap.c
===================================================================
--- gfarm_v2/trunk/server/gfmd/db_ldap.c 2009-03-26 14:22:07 UTC (rev 4135)
+++ gfarm_v2/trunk/server/gfmd/db_ldap.c 2009-03-27 04:24:57 UTC (rev 4136)
@@ -544,73 +544,29 @@
*modp = &storage->mod;
}
-static char *
-binary2hextext(const void *data, int size)
-{
- char *chdata;
- int chlen;
- char *src, *dst, *last;
+struct ldap_binary_modify {
+ LDAPMod mod;
+ struct berval *val[2];
+ struct berval v;
+};
- chlen = (size > 0) ? 2 * size + 1 : 2;
- GFARM_MALLOC_ARRAY(chdata, chlen);
- if (chdata == NULL)
- return NULL;
-
- if (size > 0) {
- src = (char *)data;
- dst = chdata;
- last = (src + size);
- while (src < last) {
- sprintf(dst, "%02hhx", *src);
- src += sizeof(*src);
- dst += 2 * sizeof(*dst);
- }
- *dst = '\0';
- } else {
- /*
- * NOTE: OpenLDAP denies zero length text.
- * Use "0" as empty text.
- */
- chdata[0] = '0';
- chdata[1] = '\0';
- }
-
- return chdata;
-}
-
-static void *
-hextext2binary(char *chdata, int *size)
+static void
+set_binary_mod(
+ LDAPMod **modp,
+ int op,
+ char *type,
+ void *value,
+ int size,
+ struct ldap_binary_modify *storage)
{
- char *data;
- int chlen = strlen(chdata);
- int allocsize;
- char *src, *dst, *last, v[3];
-
- if (chlen >= 2)
- allocsize = *size = chlen / 2;
- else {
- // empty data
- *size = 0;
- chlen = 0;
- allocsize = 1; // malloc(0) may returns NULL or !NULL
- }
- GFARM_MALLOC_ARRAY(data, allocsize);
- if (data == NULL)
- return NULL;
-
- src = chdata;
- dst = data;
- last = (src + chlen);
- v[2] = '\0';
- while (src < last) {
- v[0] = *src;
- v[1] = *(src + 1);
- *dst = strtol(v, NULL, 16);
- src += 2 * sizeof(*src);
- dst += sizeof(*dst);
- }
-
- return data;
+ storage->v.bv_val = value;
+ storage->v.bv_len = size;
+ storage->val[0] = &storage->v;
+ storage->val[1] = NULL;
+ storage->mod.mod_op = op | LDAP_MOD_BVALUES;
+ storage->mod.mod_type = type;
+ storage->mod.mod_vals.modv_bvals = storage->val;
+ *modp = &storage->mod;
}
static void
@@ -1152,33 +1108,39 @@
return ((*update_op)(&key, modv, &gfarm_ldap_host_info_ops));
}
-static void
+static gfarm_error_t
gfarm_ldap_host_add(struct gfarm_host_info *info)
{
- gfarm_ldap_host_info_update(info,
+ gfarm_error_t e;
+ e = gfarm_ldap_host_info_update(info,
LDAP_MOD_ADD, gfarm_ldap_generic_info_add);
free(info);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_ldap_host_modify(struct db_host_modify_arg *arg)
{
+ gfarm_error_t e;
/* XXX FIXME: should use modflags, add_aliases and del_aliases */
- gfarm_ldap_host_info_update(&arg->hi,
+ e = gfarm_ldap_host_info_update(&arg->hi,
LDAP_MOD_REPLACE, gfarm_ldap_generic_info_modify);
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_ldap_host_remove(char *hostname)
{
+ gfarm_error_t e;
struct gfarm_ldap_host_info_key key;
key.hostname = hostname;
- gfarm_ldap_generic_info_remove(&key, &gfarm_ldap_host_info_ops);
+ e = gfarm_ldap_generic_info_remove(&key, &gfarm_ldap_host_info_ops);
free(hostname);
+ return e;
}
static gfarm_error_t
@@ -1297,31 +1259,37 @@
return ((*update_op)(&key, modv, &gfarm_ldap_user_info_ops));
}
-static void
+static gfarm_error_t
gfarm_ldap_user_add(struct gfarm_user_info *info)
{
- gfarm_ldap_user_info_update(info,
+ gfarm_error_t e;
+ e = gfarm_ldap_user_info_update(info,
LDAP_MOD_ADD, gfarm_ldap_generic_info_add);
free(info);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_ldap_user_modify(struct db_user_modify_arg *arg)
{
- gfarm_ldap_user_info_update(&arg->ui,
+ gfarm_error_t e;
+ e = gfarm_ldap_user_info_update(&arg->ui,
LDAP_MOD_REPLACE, gfarm_ldap_generic_info_modify);
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_ldap_user_remove(char *username)
{
+ gfarm_error_t e;
struct gfarm_ldap_user_info_key key;
key.username = username;
- gfarm_ldap_generic_info_remove(&key, &gfarm_ldap_user_info_ops);
+ e = gfarm_ldap_generic_info_remove(&key, &gfarm_ldap_user_info_ops);
free(username);
+ return e;
}
static gfarm_error_t
@@ -1426,31 +1394,37 @@
return ((*update_op)(&key, modv, &gfarm_ldap_group_info_ops));
}
-static void
+static gfarm_error_t
gfarm_ldap_group_add(struct gfarm_group_info *info)
{
- gfarm_ldap_group_info_update(info,
+ gfarm_error_t e;
+ e = gfarm_ldap_group_info_update(info,
LDAP_MOD_ADD, gfarm_ldap_generic_info_add);
free(info);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_ldap_group_modify(struct db_group_modify_arg *arg)
{
- gfarm_ldap_group_info_update(&arg->gi,
+ gfarm_error_t e;
+ e = gfarm_ldap_group_info_update(&arg->gi,
LDAP_MOD_REPLACE, gfarm_ldap_generic_info_modify);
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_ldap_group_remove(char *groupname)
{
+ gfarm_error_t e;
struct gfarm_ldap_group_info_key key;
key.groupname = groupname;
- gfarm_ldap_generic_info_remove(&key, &gfarm_ldap_group_info_ops);
+ e = gfarm_ldap_generic_info_remove(&key, &gfarm_ldap_group_info_ops);
free(groupname);
+ return e;
}
static gfarm_error_t
@@ -1624,20 +1598,24 @@
return ((*update_op)(&key, modv, &gfarm_ldap_gfs_stat_ops));
}
-static void
+static gfarm_error_t
gfarm_ldap_inode_add(struct gfs_stat *info)
{
- gfarm_ldap_gfs_stat_update(info,
+ gfarm_error_t e;
+ e = gfarm_ldap_gfs_stat_update(info,
LDAP_MOD_ADD, gfarm_ldap_generic_info_add);
free(info);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_ldap_inode_modify(struct gfs_stat *info)
{
- gfarm_ldap_gfs_stat_update(info,
+ gfarm_error_t e;
+ e = gfarm_ldap_gfs_stat_update(info,
LDAP_MOD_REPLACE, gfarm_ldap_generic_info_modify);
free(info);
+ return e;
}
static gfarm_error_t
@@ -1743,19 +1721,19 @@
return (e);
}
-static void
+static gfarm_error_t
gfarm_ldap_inode_nlink_modify(struct db_inode_uint64_modify_arg *arg)
{
- ldap_inode_uint64_modify(arg, "nlink");
+ return ldap_inode_uint64_modify(arg, "nlink");
}
-static void
+static gfarm_error_t
gfarm_ldap_inode_size_modify(struct db_inode_uint64_modify_arg *arg)
{
- ldap_inode_uint64_modify(arg, "size");
+ return ldap_inode_uint64_modify(arg, "size");
}
-static void
+static gfarm_error_t
gfarm_ldap_inode_mode_modify(struct db_inode_uint32_modify_arg *arg)
{
gfarm_error_t e;
@@ -1785,36 +1763,37 @@
&gfarm_ldap_gfs_stat_ops);
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_ldap_inode_user_modify(struct db_inode_string_modify_arg *arg)
{
- ldap_inode_string_modify(arg, "username");
+ return ldap_inode_string_modify(arg, "username");
}
-static void
+static gfarm_error_t
gfarm_ldap_inode_group_modify(struct db_inode_string_modify_arg *arg)
{
- ldap_inode_string_modify(arg, "groupname");
+ return ldap_inode_string_modify(arg, "groupname");
}
-static void
+static gfarm_error_t
gfarm_ldap_inode_atime_modify(struct db_inode_timespec_modify_arg *arg)
{
- ldap_inode_timespec_modify(arg, "atimesec", "atimensec");
+ return ldap_inode_timespec_modify(arg, "atimesec", "atimensec");
}
-static void
+static gfarm_error_t
gfarm_ldap_inode_mtime_modify(struct db_inode_timespec_modify_arg *arg)
{
- ldap_inode_timespec_modify(arg, "mtimesec", "mtimensec");
+ return ldap_inode_timespec_modify(arg, "mtimesec", "mtimensec");
}
-static void
+static gfarm_error_t
gfarm_ldap_inode_ctime_modify(struct db_inode_timespec_modify_arg *arg)
{
- ldap_inode_timespec_modify(arg, "ctimesec", "ctimensec");
+ return ldap_inode_timespec_modify(arg, "ctimesec", "ctimensec");
}
@@ -1891,23 +1870,27 @@
return ((*update_op)(&key, modv, &gfarm_ldap_inode_cksum_ops));
}
-static void
+static gfarm_error_t
gfarm_ldap_inode_cksum_add(struct db_inode_cksum_arg *arg)
{
- gfarm_ldap_inode_cksum_update(arg,
+ gfarm_error_t e;
+ e = gfarm_ldap_inode_cksum_update(arg,
LDAP_MOD_ADD, gfarm_ldap_generic_info_modify);
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_ldap_inode_cksum_modify(struct db_inode_cksum_arg *arg)
{
- gfarm_ldap_inode_cksum_update(arg,
+ gfarm_error_t e;
+ e = gfarm_ldap_inode_cksum_update(arg,
LDAP_MOD_REPLACE, gfarm_ldap_generic_info_modify);
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_ldap_inode_cksum_remove(struct db_inode_inum_arg *arg)
{
gfarm_error_t e;
@@ -1927,6 +1910,7 @@
&gfarm_ldap_inode_cksum_ops);
free(arg);
+ return e;
}
static gfarm_error_t
@@ -2022,19 +2006,23 @@
return ((*update_op)(info, modv, &gfarm_ldap_db_filecopy_ops));
}
-static void
+static gfarm_error_t
gfarm_ldap_filecopy_add(struct db_filecopy_arg *info)
{
- gfarm_ldap_db_filecopy_update(info,
+ gfarm_error_t e;
+ e = gfarm_ldap_db_filecopy_update(info,
LDAP_MOD_ADD, gfarm_ldap_generic_info_add);
free(info);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_ldap_filecopy_remove(struct db_filecopy_arg *arg)
{
- gfarm_ldap_generic_info_remove(arg, &gfarm_ldap_db_filecopy_ops);
+ gfarm_error_t e;
+ e = gfarm_ldap_generic_info_remove(arg, &gfarm_ldap_db_filecopy_ops);
free(arg);
+ return e;
}
static gfarm_error_t
@@ -2141,19 +2129,23 @@
return ((*update_op)(info, modv, &gfarm_ldap_db_deadfilecopy_ops));
}
-static void
+static gfarm_error_t
gfarm_ldap_deadfilecopy_add(struct db_deadfilecopy_arg *info)
{
- gfarm_ldap_db_deadfilecopy_update(info,
+ gfarm_error_t e;
+ e = gfarm_ldap_db_deadfilecopy_update(info,
LDAP_MOD_ADD, gfarm_ldap_generic_info_add);
free(info);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_ldap_deadfilecopy_remove(struct db_deadfilecopy_arg *arg)
{
- gfarm_ldap_generic_info_remove(arg, &gfarm_ldap_db_deadfilecopy_ops);
+ gfarm_error_t e;
+ e = gfarm_ldap_generic_info_remove(arg, &gfarm_ldap_db_deadfilecopy_ops);
free(arg);
+ return e;
}
static gfarm_error_t
@@ -2317,19 +2309,23 @@
return ((*update_op)(&key, modv, &gfarm_ldap_db_direntry_ops));
}
-static void
+static gfarm_error_t
gfarm_ldap_direntry_add(struct db_direntry_arg *info)
{
- gfarm_ldap_db_direntry_update(info,
+ gfarm_error_t e;
+ e = gfarm_ldap_db_direntry_update(info,
LDAP_MOD_ADD, gfarm_ldap_generic_info_add);
free(info);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_ldap_direntry_remove(struct db_direntry_arg *arg)
{
- gfarm_ldap_generic_info_remove(arg, &gfarm_ldap_db_direntry_ops);
+ gfarm_error_t e;
+ e = gfarm_ldap_generic_info_remove(arg, &gfarm_ldap_db_direntry_ops);
free(arg);
+ return e;
}
static gfarm_error_t
@@ -2413,19 +2409,23 @@
return ((*update_op)(&key, modv, &gfarm_ldap_db_symlink_ops));
}
-static void
+static gfarm_error_t
gfarm_ldap_symlink_add(struct db_symlink_arg *info)
{
- gfarm_ldap_db_symlink_update(info,
+ gfarm_error_t e;
+ e = gfarm_ldap_db_symlink_update(info,
LDAP_MOD_ADD, gfarm_ldap_generic_info_add);
free(info);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_ldap_symlink_remove(struct db_inode_inum_arg *arg)
{
- gfarm_ldap_generic_info_remove(arg, &gfarm_ldap_db_symlink_ops);
+ gfarm_error_t e;
+ e = gfarm_ldap_generic_info_remove(arg, &gfarm_ldap_db_symlink_ops);
free(arg);
+ return e;
}
static gfarm_error_t
@@ -2471,8 +2471,8 @@
char *dn;
GFARM_MALLOC_ARRAY(dn, strlen(gfarm_ldap_xattr_info_ops.dn_template) +
- strlen(key->attrname) + INT64STRLEN
- + strlen(gfarm_ldap_base_dn) + 1);
+ strlen(key->attrname) + INT64STRLEN
+ + strlen(gfarm_ldap_base_dn) + 1);
if (dn == NULL)
return (NULL);
sprintf(dn, gfarm_ldap_xattr_info_ops.dn_template,
@@ -2504,17 +2504,13 @@
int i;
LDAPMod *modv[5];
struct ldap_string_modify storage[ARRAY_LENGTH(modv) - 1];
+ struct ldap_binary_modify binstorage;
char ino_string[INT64STRLEN + 1];
struct gfarm_ldap_xattr_get_info_key key;
- char *hextext;
if (arg->xmlMode)
return GFARM_ERR_OPERATION_NOT_SUPPORTED;
- hextext = binary2hextext(arg->value, arg->size);
- if (hextext == NULL)
- return GFARM_ERR_NO_MEMORY;
-
key.inumber = arg->inum;
key.attrname = arg->attrname;
@@ -2530,14 +2526,13 @@
set_string_mod(&modv[i], mod_op,
"attrname", (char *)arg->attrname, &storage[i]);
i++;
- set_string_mod(&modv[i], mod_op,
- "attrvalue", hextext, &storage[i]);
+ set_binary_mod(&modv[i], mod_op,
+ "attrvalue", (void *)arg->value, arg->size, &binstorage);
i++;
modv[i++] = NULL;
assert(i == ARRAY_LENGTH(modv));
e = ((*update_op)(&key, modv, &gfarm_ldap_xattr_info_ops));
- free(hextext);
return e;
}
@@ -2582,13 +2577,13 @@
gfarm_ldap_xattr_get(struct db_xattr_arg *arg)
{
gfarm_error_t e;
- int rv, cnt, sz;
char *query_type;
char *attrs[2] = { "attrvalue", NULL };
struct timeval tout = { 10, 0 };
+ int cnt, rv;
LDAPMessage *res = NULL, *m;
struct berval **vals;
- void *bindata;
+ void *p;
if (arg->xmlMode) {
e = GFARM_ERR_OPERATION_NOT_SUPPORTED;
@@ -2602,8 +2597,8 @@
}
sprintf(query_type,
- "(&(objectclass=XAttr)(inumber=%" GFARM_PRId64 ")(attrname=%s))",
- arg->inum, arg->attrname);
+ "(&(objectclass=XAttr)(inumber=%" GFARM_PRId64 ")(attrname=%s))",
+ arg->inum, arg->attrname);
rv = ldap_search_st(gfarm_ldap_server, gfarm_ldap_base_dn,
LDAP_SCOPE_SUB, query_type, attrs, 0, &tout, &res);
free(query_type);
@@ -2626,17 +2621,20 @@
m = ldap_first_message(gfarm_ldap_server, res);
vals = ldap_get_values_len(gfarm_ldap_server, m, attrs[0]);
if ((vals[0] != NULL) && (vals[1] == NULL)) {
- bindata = hextext2binary(vals[0]->bv_val, &sz);
- if (bindata != NULL) {
- *arg->valuep = bindata;
- *arg->sizep = sz;
- e = GFARM_ERR_NO_ERROR;
- } else {
- e = GFARM_ERR_NO_MEMORY;
- }
- } else {
+ e = GFARM_ERR_NO_ERROR;
+ *arg->sizep = vals[0]->bv_len;
+ if (vals[0]->bv_len > 0) {
+ p = malloc(vals[0]->bv_len);
+ if (p != NULL) {
+ memcpy(p, vals[0]->bv_val,
+ vals[0]->bv_len);
+ *arg->valuep = p;
+ } else
+ e = GFARM_ERR_NO_MEMORY;
+ } else
+ *arg->valuep = NULL;
+ } else
e = GFARM_ERR_UNKNOWN;
- }
ldap_value_free_len(vals);
}
ldap_msgfree(res);
@@ -2649,9 +2647,13 @@
gfarm_ldap_xattr_load(void *closure,
void (*callback)(void *, struct xattr_info *))
{
+ int xmlMode = (closure != NULL) ? *(int*)closure : 0;
struct xattr_info tmp_info;
char *attrs[] = { "inumber", "attrname", NULL };
+ if (xmlMode)
+ return GFARM_ERR_OPERATION_NOT_SUPPORTED;
+
/*
* NOTE: Without attrs, attrvalue will be loaded also.
* It's needless for initial loading.
@@ -2659,93 +2661,11 @@
return (gfarm_ldap_generic_info_get_foreach_withattrs(
gfarm_ldap_base_dn,
LDAP_SCOPE_SUBTREE, gfarm_ldap_xattr_info_ops.query_type,
- &tmp_info, (void (*)(void *, void *))callback, closure,
+ &tmp_info, (void (*)(void *, void *))callback, &xmlMode,
&gfarm_ldap_xattr_info_ops, attrs));
}
static gfarm_error_t
-gfarm_ldap_xattr_list(struct db_xattr_arg *arg)
-{
- gfarm_error_t e = GFARM_ERR_NO_ERROR;
- int rv;
- char query_type[64];
- char *attrs[2] = { "attrname", NULL };
- struct timeval tout = { 10, 0 };
- LDAPMessage *res = NULL, *m;
- struct berval **vals;
- int i;
- char *value, *p;
- int size = 0;
-
- *arg->sizep = 0;
- *arg->valuep = NULL;
-
- if (arg->xmlMode) {
- e = GFARM_ERR_OPERATION_NOT_SUPPORTED;
- goto quit;
- }
-
- snprintf(query_type, sizeof(query_type),
- "(&(objectclass=XAttr)(inumber=%" GFARM_PRId64 "))",
- arg->inum);
- rv = ldap_search_st(gfarm_ldap_server, gfarm_ldap_base_dn,
- LDAP_SCOPE_SUB, query_type, attrs, 0, &tout, &res);
- if (rv == LDAP_NO_SUCH_OBJECT)
- e = GFARM_ERR_NO_SUCH_OBJECT;
- else if (rv != LDAP_SUCCESS)
- e = GFARM_ERR_UNKNOWN;
- else if (ldap_count_messages(gfarm_ldap_server, res) <= 1)
- e = GFARM_ERR_NO_SUCH_OBJECT;
- if (e != GFARM_ERR_NO_ERROR) {
- ldap_msgfree(res);
- goto quit;
- }
-
- m = ldap_first_message(gfarm_ldap_server, res);
- while (m != NULL) {
- vals = ldap_get_values_len(gfarm_ldap_server, m, attrs[0]);
- i = 0;
- while (vals[i] != NULL) {
- size += vals[i]->bv_len + 1; // +1 for '\0'
- i++;
- }
- ldap_value_free_len(vals);
- m = ldap_next_entry(gfarm_ldap_server, m);
- }
-
- GFARM_MALLOC_ARRAY(value, size);
- if (value == NULL) {
- ldap_msgfree(res);
- e = GFARM_ERR_NO_MEMORY;
- goto quit;
- }
-
- p = value;
- m = ldap_first_message(gfarm_ldap_server, res);
- while (m != NULL) {
- vals = ldap_get_values_len(gfarm_ldap_server, m, attrs[0]);
- i = 0;
- while (vals[i] != NULL) {
- memcpy(p, vals[i]->bv_val, vals[i]->bv_len);
- p += vals[i]->bv_len;
- *p = '\0';
- p++;
- i++;
- }
- ldap_value_free_len(vals);
- m = ldap_next_entry(gfarm_ldap_server, m);
- }
-
- ldap_msgfree(res);
-
- *arg->sizep = size;
- *arg->valuep = value;
-quit:
- free(arg);
- return GFARM_ERR_NO_ERROR;
-}
-
-static gfarm_error_t
gfarm_ldap_xmlattr_find(struct db_xmlattr_find_arg *arg)
{
free(arg);
@@ -2811,8 +2731,8 @@
gfarm_ldap_xattr_add,
gfarm_ldap_xattr_modify,
gfarm_ldap_xattr_remove,
+ NULL, // gfarm_ldap_xattr_removeall not supported
gfarm_ldap_xattr_get,
- gfarm_ldap_xattr_list,
gfarm_ldap_xattr_load,
gfarm_ldap_xmlattr_find,
};
Modified: gfarm_v2/trunk/server/gfmd/db_none.c
===================================================================
--- gfarm_v2/trunk/server/gfmd/db_none.c 2009-03-26 14:22:07 UTC (rev 4135)
+++ gfarm_v2/trunk/server/gfmd/db_none.c 2009-03-27 04:24:57 UTC (rev 4136)
@@ -44,22 +44,25 @@
/**********************************************************************/
-static void
+static gfarm_error_t
gfarm_none_host_add(struct gfarm_host_info *info)
{
free(info);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
-static void
+static gfarm_error_t
gfarm_none_host_modify(struct db_host_modify_arg *arg)
{
free(arg);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
-static void
+static gfarm_error_t
gfarm_none_host_remove(char *hostname)
{
free(hostname);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
static gfarm_error_t
@@ -71,22 +74,25 @@
/**********************************************************************/
-static void
+static gfarm_error_t
gfarm_none_user_add(struct gfarm_user_info *info)
{
free(info);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
-static void
+static gfarm_error_t
gfarm_none_user_modify(struct db_user_modify_arg *arg)
{
free(arg);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
-static void
+static gfarm_error_t
gfarm_none_user_remove(char *username)
{
free(username);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
static gfarm_error_t
@@ -98,22 +104,25 @@
/**********************************************************************/
-static void
+static gfarm_error_t
gfarm_none_group_add(struct gfarm_group_info *info)
{
free(info);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
-static void
+static gfarm_error_t
gfarm_none_group_modify(struct db_group_modify_arg *arg)
{
free(arg);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
-static void
+static gfarm_error_t
gfarm_none_group_remove(char *groupname)
{
free(groupname);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
static gfarm_error_t
@@ -125,28 +134,39 @@
/**********************************************************************/
-static void
+static gfarm_error_t
+gfarm_none_inode_stat_free(struct gfs_stat *arg)
+{
+ gfs_stat_free(arg);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
+}
+
+static gfarm_error_t
gfarm_none_inode_int64_free(struct db_inode_uint64_modify_arg *arg)
{
free(arg);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
-static void
+static gfarm_error_t
gfarm_none_inode_int32_free(struct db_inode_uint32_modify_arg *arg)
{
free(arg);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
-static void
+static gfarm_error_t
gfarm_none_inode_string_free(struct db_inode_string_modify_arg *arg)
{
free(arg);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
-static void
+static gfarm_error_t
gfarm_none_inode_timespec_free(struct db_inode_timespec_modify_arg *arg)
{
free(arg);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
static gfarm_error_t
@@ -159,16 +179,18 @@
/**********************************************************************/
-static void
+static gfarm_error_t
gfarm_none_inode_cksum_free(struct db_inode_cksum_arg *arg)
{
free(arg);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
-static void
+static gfarm_error_t
gfarm_none_inode_inum_free(struct db_inode_inum_arg *arg)
{
free(arg);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
static gfarm_error_t
@@ -181,10 +203,11 @@
/**********************************************************************/
-static void
+static gfarm_error_t
gfarm_none_filecopy_free(struct db_filecopy_arg *arg)
{
free(arg);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
static gfarm_error_t
@@ -197,10 +220,11 @@
/**********************************************************************/
-static void
+static gfarm_error_t
gfarm_none_deadfilecopy_free(struct db_deadfilecopy_arg *arg)
{
free(arg);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
static gfarm_error_t
@@ -213,16 +237,18 @@
/**********************************************************************/
-static void
+static gfarm_error_t
gfarm_none_direntry_add(struct db_direntry_arg *arg)
{
free(arg);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
-static void
+static gfarm_error_t
gfarm_none_direntry_remove(struct db_direntry_arg *arg)
{
free(arg);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
static gfarm_error_t
@@ -235,10 +261,11 @@
/**********************************************************************/
-static void
+static gfarm_error_t
gfarm_none_symlink_free(struct db_symlink_arg *arg)
{
free(arg);
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
static gfarm_error_t
@@ -279,13 +306,6 @@
return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
-static gfarm_error_t
-gfarm_none_xattr_list(struct db_xattr_arg *arg)
-{
- free(arg);
- return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
-}
-
gfarm_error_t
gfarm_none_xattr_load(void *closure,
void (*callback)(void *, struct xattr_info *))
@@ -321,8 +341,8 @@
gfarm_none_group_remove,
gfarm_none_group_load,
- gfs_stat_free,
- gfs_stat_free,
+ gfarm_none_inode_stat_free,
+ gfarm_none_inode_stat_free,
gfarm_none_inode_int64_free,
gfarm_none_inode_int64_free,
gfarm_none_inode_int32_free,
@@ -359,8 +379,8 @@
gfarm_none_xattr_add,
gfarm_none_xattr_modify,
gfarm_none_xattr_remove,
+ NULL, // gfarm_none_xattr_removeall not supported
gfarm_none_xattr_get,
- gfarm_none_xattr_list,
gfarm_none_xattr_load,
gfarm_none_xmlattr_find,
};
Modified: gfarm_v2/trunk/server/gfmd/db_ops.h
===================================================================
--- gfarm_v2/trunk/server/gfmd/db_ops.h 2009-03-26 14:22:07 UTC (rev 4135)
+++ gfarm_v2/trunk/server/gfmd/db_ops.h 2009-03-27 04:24:57 UTC (rev 4136)
@@ -115,70 +115,70 @@
gfarm_error_t (*initialize)(void);
gfarm_error_t (*terminate)(void);
- void (*host_add)(struct gfarm_host_info *);
- void (*host_modify)(struct db_host_modify_arg *);
- void (*host_remove)(char *);
+ gfarm_error_t (*host_add)(struct gfarm_host_info *);
+ gfarm_error_t (*host_modify)(struct db_host_modify_arg *);
+ gfarm_error_t (*host_remove)(char *);
gfarm_error_t (*host_load)(void *,
void (*)(void *, struct gfarm_host_info *));
- void (*user_add)(struct gfarm_user_info *);
- void (*user_modify)(struct db_user_modify_arg *);
- void (*user_remove)(char *);
+ gfarm_error_t (*user_add)(struct gfarm_user_info *);
+ gfarm_error_t (*user_modify)(struct db_user_modify_arg *);
+ gfarm_error_t (*user_remove)(char *);
gfarm_error_t (*user_load)(void *,
void (*)(void *, struct gfarm_user_info *));
- void (*group_add)(struct gfarm_group_info *);
- void (*group_modify)(struct db_group_modify_arg *);
- void (*group_remove)(char *);
+ gfarm_error_t (*group_add)(struct gfarm_group_info *);
+ gfarm_error_t (*group_modify)(struct db_group_modify_arg *);
+ gfarm_error_t (*group_remove)(char *);
gfarm_error_t (*group_load)(void *,
void (*)(void *, struct gfarm_group_info *));
- void (*inode_add)(struct gfs_stat *);
- void (*inode_modify)(struct gfs_stat *);
- void (*inode_nlink_modify)(struct db_inode_uint64_modify_arg *);
- void (*inode_size_modify)(struct db_inode_uint64_modify_arg *);
- void (*inode_mode_modify)(struct db_inode_uint32_modify_arg *);
- void (*inode_user_modify)(struct db_inode_string_modify_arg *);
- void (*inode_group_modify)(struct db_inode_string_modify_arg *);
- void (*inode_atime_modify)(struct db_inode_timespec_modify_arg *);
- void (*inode_mtime_modify)(struct db_inode_timespec_modify_arg *);
- void (*inode_ctime_modify)(struct db_inode_timespec_modify_arg *);
+ gfarm_error_t (*inode_add)(struct gfs_stat *);
+ gfarm_error_t (*inode_modify)(struct gfs_stat *);
+ gfarm_error_t (*inode_nlink_modify)(struct db_inode_uint64_modify_arg *);
+ gfarm_error_t (*inode_size_modify)(struct db_inode_uint64_modify_arg *);
+ gfarm_error_t (*inode_mode_modify)(struct db_inode_uint32_modify_arg *);
+ gfarm_error_t (*inode_user_modify)(struct db_inode_string_modify_arg *);
+ gfarm_error_t (*inode_group_modify)(struct db_inode_string_modify_arg *);
+ gfarm_error_t (*inode_atime_modify)(struct db_inode_timespec_modify_arg *);
+ gfarm_error_t (*inode_mtime_modify)(struct db_inode_timespec_modify_arg *);
+ gfarm_error_t (*inode_ctime_modify)(struct db_inode_timespec_modify_arg *);
/* inode_remove: never remove any inode to keep inode->i_gen */
gfarm_error_t (*inode_load)(void *,
void (*)(void *, struct gfs_stat *));
- void (*inode_cksum_add)(struct db_inode_cksum_arg *);
- void (*inode_cksum_modify)(struct db_inode_cksum_arg *);
- void (*inode_cksum_remove)(struct db_inode_inum_arg *);
+ gfarm_error_t (*inode_cksum_add)(struct db_inode_cksum_arg *);
+ gfarm_error_t (*inode_cksum_modify)(struct db_inode_cksum_arg *);
+ gfarm_error_t (*inode_cksum_remove)(struct db_inode_inum_arg *);
gfarm_error_t (*inode_cksum_load)(void *,
void (*)(void *, gfarm_ino_t, char *, size_t, char *));
- void (*filecopy_add)(struct db_filecopy_arg *);
- void (*filecopy_remove)(struct db_filecopy_arg *);
+ gfarm_error_t (*filecopy_add)(struct db_filecopy_arg *);
+ gfarm_error_t (*filecopy_remove)(struct db_filecopy_arg *);
gfarm_error_t (*filecopy_load)(void *,
void (*)(void *, gfarm_ino_t, char *));
- void (*deadfilecopy_add)(struct db_deadfilecopy_arg *);
- void (*deadfilecopy_remove)(struct db_deadfilecopy_arg *);
+ gfarm_error_t (*deadfilecopy_add)(struct db_deadfilecopy_arg *);
+ gfarm_error_t (*deadfilecopy_remove)(struct db_deadfilecopy_arg *);
gfarm_error_t (*deadfilecopy_load)(void *,
void (*)(void *, gfarm_ino_t, gfarm_uint64_t, char *));
- void (*direntry_add)(struct db_direntry_arg *);
- void (*direntry_remove)(struct db_direntry_arg *);
+ gfarm_error_t (*direntry_add)(struct db_direntry_arg *);
+ gfarm_error_t (*direntry_remove)(struct db_direntry_arg *);
gfarm_error_t (*direntry_load)(void *,
void (*)(void *, gfarm_ino_t, char *, int, gfarm_ino_t));
- void (*symlink_add)(struct db_symlink_arg *);
- void (*symlink_remove)(struct db_inode_inum_arg *);
+ gfarm_error_t (*symlink_add)(struct db_symlink_arg *);
+ gfarm_error_t (*symlink_remove)(struct db_inode_inum_arg *);
gfarm_error_t (*symlink_load)(void *,
void (*)(void *, gfarm_ino_t, char *));
gfarm_error_t (*xattr_add)(struct db_xattr_arg *);
gfarm_error_t (*xattr_modify)(struct db_xattr_arg *);
gfarm_error_t (*xattr_remove)(struct db_xattr_arg *);
+ gfarm_error_t (*xattr_removeall)(struct db_xattr_arg *);
gfarm_error_t (*xattr_get)(struct db_xattr_arg *);
- gfarm_error_t (*xattr_list)(struct db_xattr_arg *);
gfarm_error_t (*xattr_load)(void *,
- void (*)(void *, struct xattr_info *));
+ void (*)(void *, struct xattr_info *));
gfarm_error_t (*xmlattr_find)(struct db_xmlattr_find_arg *);
};
Modified: gfarm_v2/trunk/server/gfmd/db_pgsql.c
===================================================================
--- gfarm_v2/trunk/server/gfmd/db_pgsql.c 2009-03-26 14:22:07 UTC (rev 4135)
+++ gfarm_v2/trunk/server/gfmd/db_pgsql.c 2009-03-27 04:24:57 UTC (rev 4136)
@@ -858,7 +858,7 @@
return (GFARM_ERR_NO_ERROR);
}
-static void
+static gfarm_error_t
pgsql_host_update(struct gfarm_host_info *info, const char *sql,
gfarm_error_t (*check)(PGresult *, const char *, const char *),
int remove_all_aliases_first,
@@ -872,7 +872,7 @@
char flags[GFARM_INT32STRLEN + 1];
if (!gfarm_pgsql_begin_with_retry("pgsql_host_add"))
- return;
+ return GFARM_ERR_UNKNOWN;
paramValues[0] = info->hostname;
sprintf(port, "%d", info->port);
@@ -899,42 +899,48 @@
if (e == GFARM_ERR_NO_ERROR)
e = hostaliases_set(info);
- gfarm_pgsql_exec_and_log(
+ return gfarm_pgsql_exec_and_log(
e == GFARM_ERR_NO_ERROR ? "COMMIT" : "ROLLBACK", diag);
}
-static void
+static gfarm_error_t
gfarm_pgsql_host_add(struct gfarm_host_info *info)
{
- pgsql_host_update(info,
+ gfarm_error_t e;
+
+ e = pgsql_host_update(info,
"INSERT INTO Host (hostname, port, architecture, ncpu, flags) "
"VALUES ($1, $2, $3, $4, $5)",
gfarm_pgsql_check_insert, 0, "pgsql_host_add");
free(info);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_pgsql_host_modify(struct db_host_modify_arg *arg)
{
+ gfarm_error_t e;
/* XXX FIXME: should use modflags, add_aliases and del_aliases */
- pgsql_host_update(&arg->hi,
+ e = pgsql_host_update(&arg->hi,
"UPDATE Host "
"SET port = $2, architecture = $3, ncpu = $4, flags = $5 "
"WHERE hostname = $1",
gfarm_pgsql_check_update_or_delete, 1, "pgsql_host_modify");
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_pgsql_host_remove(char *hostname)
{
+ gfarm_error_t e;
const char *paramValues[1];
paramValues[0] = hostname;
- gfarm_pgsql_update_or_delete_with_retry(
+ e = gfarm_pgsql_update_or_delete_with_retry(
"DELETE FROM Host WHERE hostname = $1",
1, /* number of params */
NULL, /* param types */
@@ -945,6 +951,7 @@
"pgsql_host_remove");
free(hostname);
+ return e;
}
static gfarm_error_t
@@ -996,7 +1003,7 @@
return (GFARM_ERR_NO_ERROR);
}
-static void
+static gfarm_error_t
pgsql_user_call(struct gfarm_user_info *info, const char *sql,
gfarm_error_t (*op)(const char *, int, const Oid *,
const char *const *, const int *, const int *, int,
@@ -1009,7 +1016,7 @@
paramValues[1] = info->homedir;
paramValues[2] = info->realname;
paramValues[3] = info->gsi_dn;
- (*op)(
+ return (*op)(
sql,
4, /* number of params */
NULL, /* param types */
@@ -1020,22 +1027,25 @@
diag);
}
-static void
+static gfarm_error_t
gfarm_pgsql_user_add(struct gfarm_user_info *info)
{
- pgsql_user_call(info,
+ gfarm_error_t e;
+ e = pgsql_user_call(info,
"INSERT INTO GfarmUser (username, homedir, realname, gsiDN) "
"VALUES ($1, $2, $3, $4)",
gfarm_pgsql_insert_with_retry,
"pgsql_user_add");
free(info);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_pgsql_user_modify(struct db_user_modify_arg *arg)
{
- pgsql_user_call(&arg->ui,
+ gfarm_error_t e;
+ e = pgsql_user_call(&arg->ui,
"UPDATE GfarmUser "
"SET homedir = $2, realname = $3, gsiDN = $4 "
"WHERE username = $1",
@@ -1043,15 +1053,17 @@
"pgsql_user_modify");
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_pgsql_user_remove(char *username)
{
+ gfarm_error_t e;
const char *paramValues[1];
paramValues[0] = username;
- gfarm_pgsql_update_or_delete_with_retry(
+ e = gfarm_pgsql_update_or_delete_with_retry(
"DELETE FROM GfarmUser WHERE username = $1",
1, /* number of params */
NULL, /* param types */
@@ -1062,6 +1074,7 @@
"pgsql_user_remove");
free(username);
+ return e;
}
static gfarm_error_t
@@ -1158,7 +1171,7 @@
return (GFARM_ERR_NO_ERROR);
}
-static void
+static gfarm_error_t
gfarm_pgsql_group_add(struct gfarm_group_info *info)
{
const char *paramValues[1];
@@ -1180,15 +1193,16 @@
if (e == GFARM_ERR_NO_ERROR)
e = grpassign_set(info);
- gfarm_pgsql_exec_and_log(
+ e = gfarm_pgsql_exec_and_log(
e == GFARM_ERR_NO_ERROR ? "COMMIT" : "ROLLBACK",
"pgsql_group_add");
}
free(info);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_pgsql_group_modify(struct db_group_modify_arg *arg)
{
struct gfarm_group_info *info = &arg->gi;
@@ -1201,20 +1215,22 @@
if (e == GFARM_ERR_NO_ERROR)
e = grpassign_set(info);
- gfarm_pgsql_exec_and_log(
+ e = gfarm_pgsql_exec_and_log(
e == GFARM_ERR_NO_ERROR ? "COMMIT" : "ROLLBACK",
"pgsql_group_modify");
}
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_pgsql_group_remove(char *groupname)
{
+ gfarm_error_t e;
const char *paramValues[1];
paramValues[0] = groupname;
- gfarm_pgsql_update_or_delete_with_retry(
+ e = gfarm_pgsql_update_or_delete_with_retry(
"DELETE FROM GfarmGroup WHERE groupname = $1",
1, /* number of params */
NULL, /* param types */
@@ -1225,6 +1241,7 @@
"pgsql_group_remove");
free(groupname);
+ return e;
}
static gfarm_error_t
@@ -1264,13 +1281,14 @@
/**********************************************************************/
-static void
+static gfarm_error_t
pgsql_inode_call(struct gfs_stat *info, const char *sql,
gfarm_error_t (*op)(const char *, int, const Oid *,
const char *const *, const int *, const int *, int,
const char *),
const char *diag)
{
+ gfarm_error_t e;
const char *paramValues[13];
char inumber[GFARM_INT64STRLEN + 1];
char igen[GFARM_INT64STRLEN + 1];
@@ -1309,7 +1327,7 @@
sprintf(ctimensec, "%d", info->st_ctimespec.tv_nsec);
paramValues[12] = ctimensec;
- (*op)(
+ e = (*op)(
sql,
13, /* number of params */
NULL, /* param types */
@@ -1320,12 +1338,13 @@
diag);
free(info);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_pgsql_inode_add(struct gfs_stat *info)
{
- pgsql_inode_call(info,
+ return pgsql_inode_call(info,
"INSERT INTO INode (inumber, igen, nlink, size, mode, "
"username, groupname, "
"atimesec, atimensec, "
@@ -1337,10 +1356,10 @@
"pgsql_inode_add");
}
-static void
+static gfarm_error_t
gfarm_pgsql_inode_modify(struct gfs_stat *info)
{
- pgsql_inode_call(info,
+ return pgsql_inode_call(info,
"UPDATE INode SET igen = $2, nlink = $3, size = $4, "
"mode = $5, username = $6, groupname = $7, "
"atimesec = $8, atimensec = $9, "
@@ -1351,10 +1370,11 @@
"pgsql_inode_modify");
}
-static void
+static gfarm_error_t
pgsql_inode_uint64_call(struct db_inode_uint64_modify_arg *arg,
const char *sql, const char *diag)
{
+ gfarm_error_t e;
const char *paramValues[2];
char inumber[GFARM_INT64STRLEN + 1];
char uint64[GFARM_INT64STRLEN + 1];
@@ -1364,7 +1384,7 @@
sprintf(uint64, "%" GFARM_PRId64, arg->uint64);
paramValues[1] = uint64;
- gfarm_pgsql_update_or_delete_with_retry(
+ e = gfarm_pgsql_update_or_delete_with_retry(
sql,
2, /* number of params */
NULL, /* param types */
@@ -1375,12 +1395,14 @@
diag);
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
pgsql_inode_uint32_call(struct db_inode_uint32_modify_arg *arg,
const char *sql, const char *diag)
{
+ gfarm_error_t e;
const char *paramValues[2];
char inumber[GFARM_INT64STRLEN + 1];
char uint32[GFARM_INT32STRLEN + 1];
@@ -1390,7 +1412,7 @@
sprintf(uint32, "%d", arg->uint32);
paramValues[1] = uint32;
- gfarm_pgsql_update_or_delete_with_retry(
+ e = gfarm_pgsql_update_or_delete_with_retry(
sql,
2, /* number of params */
NULL, /* param types */
@@ -1401,12 +1423,14 @@
diag);
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
pgsql_inode_string_call(struct db_inode_string_modify_arg *arg,
const char *sql, const char *diag)
{
+ gfarm_error_t e;
const char *paramValues[2];
char inumber[GFARM_INT64STRLEN + 1];
@@ -1414,7 +1438,7 @@
paramValues[0] = inumber;
paramValues[1] = arg->string;
- gfarm_pgsql_update_or_delete_with_retry(
+ e = gfarm_pgsql_update_or_delete_with_retry(
sql,
2, /* number of params */
NULL, /* param types */
@@ -1425,12 +1449,14 @@
diag);
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
pgsql_inode_timespec_call(struct db_inode_timespec_modify_arg *arg,
const char *sql, const char *diag)
{
+ gfarm_error_t e;
const char *paramValues[3];
char inumber[GFARM_INT64STRLEN + 1];
char sec[GFARM_INT64STRLEN + 1];
@@ -1443,7 +1469,7 @@
sprintf(nsec, "%d", arg->time.tv_nsec);
paramValues[2] = nsec;
- gfarm_pgsql_update_or_delete_with_retry(
+ e = gfarm_pgsql_update_or_delete_with_retry(
sql,
3, /* number of params */
NULL, /* param types */
@@ -1454,68 +1480,69 @@
diag);
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_pgsql_inode_nlink_modify(struct db_inode_uint64_modify_arg *arg)
{
- pgsql_inode_uint64_call(arg,
+ return pgsql_inode_uint64_call(arg,
"UPDATE INode SET nlink = $2 WHERE inumber = $1",
"pgsql_inode_nlink_modify");
}
-static void
+static gfarm_error_t
gfarm_pgsql_inode_size_modify(struct db_inode_uint64_modify_arg *arg)
{
- pgsql_inode_uint64_call(arg,
+ return pgsql_inode_uint64_call(arg,
"UPDATE INode SET size = $2 WHERE inumber = $1",
"pgsql_inode_size_modify");
}
-static void
+static gfarm_error_t
gfarm_pgsql_inode_mode_modify(struct db_inode_uint32_modify_arg *arg)
{
- pgsql_inode_uint32_call(arg,
+ return pgsql_inode_uint32_call(arg,
"UPDATE INode SET mode = $2 WHERE inumber = $1",
"pgsql_inode_mode_modify");
}
-static void
+static gfarm_error_t
gfarm_pgsql_inode_user_modify(struct db_inode_string_modify_arg *arg)
{
- pgsql_inode_string_call(arg,
+ return pgsql_inode_string_call(arg,
"UPDATE INode SET username = $2 WHERE inumber = $1",
"pgsql_inode_user_modify");
}
-static void
+static gfarm_error_t
gfarm_pgsql_inode_group_modify(struct db_inode_string_modify_arg *arg)
{
- pgsql_inode_string_call(arg,
+ return pgsql_inode_string_call(arg,
"UPDATE INode SET groupname = $2 WHERE inumber = $1",
"pgsql_inode_group_modify");
}
-static void
+static gfarm_error_t
gfarm_pgsql_inode_atime_modify(struct db_inode_timespec_modify_arg *arg)
{
- pgsql_inode_timespec_call(arg,
+ return pgsql_inode_timespec_call(arg,
"UPDATE INode SET atimesec = $2, atimensec = $3 WHERE inumber = $1",
"pgsql_inode_atime_modify");
}
-static void
+static gfarm_error_t
gfarm_pgsql_inode_mtime_modify(struct db_inode_timespec_modify_arg *arg)
{
- pgsql_inode_timespec_call(arg,
+ return pgsql_inode_timespec_call(arg,
"UPDATE INode SET mtimesec = $2, mtimensec = $3 WHERE inumber = $1",
"pgsql_inode_mtime_modify");
}
-static void
+static gfarm_error_t
gfarm_pgsql_inode_ctime_modify(struct db_inode_timespec_modify_arg *arg)
{
- pgsql_inode_timespec_call(arg,
+ return pgsql_inode_timespec_call(arg,
"UPDATE INode SET ctimesec = $2, ctimensec = $3 WHERE inumber = $1",
"pgsql_inode_ctime_modify");
}
@@ -1572,13 +1599,14 @@
/**********************************************************************/
-static void
+static gfarm_error_t
pgsql_inode_cksum_call(struct db_inode_cksum_arg *arg, const char *sql,
gfarm_error_t (*op)(const char *, int, const Oid *,
const char *const *, const int *, const int *, int,
const char *),
const char *diag)
{
+ gfarm_error_t e;
const char *paramValues[3];
char inumber[GFARM_INT64STRLEN + 1];
@@ -1586,7 +1614,7 @@
paramValues[0] = inumber;
paramValues[1] = arg->type;
paramValues[2] = arg->sum;
- (*op)(
+ e = (*op)(
sql,
3, /* number of params */
NULL, /* param types */
@@ -1597,21 +1625,23 @@
diag);
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
pgsql_inode_inum_call(struct db_inode_inum_arg *arg, const char *sql,
gfarm_error_t (*op)(const char *, int, const Oid *,
const char *const *, const int *, const int *, int,
const char *),
const char *diag)
{
+ gfarm_error_t e;
const char *paramValues[1];
char inumber[GFARM_INT64STRLEN + 1];
sprintf(inumber, "%" GFARM_PRId64, arg->inum);
paramValues[0] = inumber;
- (*op)(
+ e = (*op)(
sql,
1, /* number of params */
NULL, /* param types */
@@ -1622,30 +1652,31 @@
diag);
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_pgsql_file_info_add(struct db_inode_cksum_arg *arg)
{
- pgsql_inode_cksum_call(arg,
+ return pgsql_inode_cksum_call(arg,
"INSERT INTO FileInfo (inumber, checksumType, checksum) "
"VALUES ($1, $2, $3)",
gfarm_pgsql_insert_with_retry, "pgsql_cksum_add");
}
-static void
+static gfarm_error_t
gfarm_pgsql_file_info_modify(struct db_inode_cksum_arg *arg)
{
- pgsql_inode_cksum_call(arg,
+ return pgsql_inode_cksum_call(arg,
"UPDATE FileInfo SET checksumType = $2, checksum = $3 "
"WHERE inumber = $1",
gfarm_pgsql_update_or_delete_with_retry, "pgsql_cksum_modify");
}
-static void
+static gfarm_error_t
gfarm_pgsql_file_info_remove(struct db_inode_inum_arg *arg)
{
- pgsql_inode_inum_call(arg,
+ return pgsql_inode_inum_call(arg,
"DELETE FROM FileInfo WHERE inumber = $1",
gfarm_pgsql_update_or_delete_with_retry,
"pgsql_cksum_remove");
@@ -1691,20 +1722,21 @@
/**********************************************************************/
-static void
+static gfarm_error_t
pgsql_filecopy_call(struct db_filecopy_arg *arg, const char *sql,
gfarm_error_t (*op)(const char *, int, const Oid *,
const char *const *, const int *, const int *, int,
const char *),
const char *diag)
{
+ gfarm_error_t e;
const char *paramValues[2];
char inumber[GFARM_INT64STRLEN + 1];
sprintf(inumber, "%" GFARM_PRId64, arg->inum);
paramValues[0] = inumber;
paramValues[1] = arg->hostname;
- (*op)(
+ e = (*op)(
sql,
2, /* number of params */
NULL, /* param types */
@@ -1715,21 +1747,22 @@
diag);
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_pgsql_filecopy_add(struct db_filecopy_arg *arg)
{
- pgsql_filecopy_call(arg,
+ return pgsql_filecopy_call(arg,
"INSERT INTO FileCopy (inumber, hostname) VALUES ($1, $2)",
gfarm_pgsql_insert_with_retry,
"pgsql_filecopy_add");
}
-static void
+static gfarm_error_t
gfarm_pgsql_filecopy_remove(struct db_filecopy_arg *arg)
{
- pgsql_filecopy_call(arg,
+ return pgsql_filecopy_call(arg,
"DELETE FROM FileCopy WHERE inumber = $1 AND hostname = $2",
gfarm_pgsql_update_or_delete_with_retry,
"pgsql_filecopy_remove");
@@ -1773,13 +1806,14 @@
/**********************************************************************/
-static void
+static gfarm_error_t
pgsql_deadfilecopy_call(struct db_deadfilecopy_arg *arg, const char *sql,
gfarm_error_t (*op)(const char *, int, const Oid *,
const char *const *, const int *, const int *, int,
const char *),
const char *diag)
{
+ gfarm_error_t e;
const char *paramValues[3];
char inumber[GFARM_INT64STRLEN + 1];
char igen[GFARM_INT64STRLEN + 1];
@@ -1789,7 +1823,7 @@
sprintf(igen, "%" GFARM_PRId64, arg->igen);
paramValues[1] = igen;
paramValues[2] = arg->hostname;
- (*op)(
+ e = (*op)(
sql,
3, /* number of params */
NULL, /* param types */
@@ -1800,22 +1834,23 @@
diag);
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_pgsql_deadfilecopy_add(struct db_deadfilecopy_arg *arg)
{
- pgsql_deadfilecopy_call(arg,
+ return pgsql_deadfilecopy_call(arg,
"INSERT INTO DeadFileCopy (inumber, igen, hostname) "
"VALUES ($1, $2, $3)",
gfarm_pgsql_insert_with_retry,
"pgsql_deadfilecopy_add");
}
-static void
+static gfarm_error_t
gfarm_pgsql_deadfilecopy_remove(struct db_deadfilecopy_arg *arg)
{
- pgsql_deadfilecopy_call(arg,
+ return pgsql_deadfilecopy_call(arg,
"DELETE FROM DeadFileCopy "
"WHERE inumber = $1 AND igen = $2 AND hostname = $3",
gfarm_pgsql_update_or_delete_with_retry,
@@ -1863,9 +1898,10 @@
/**********************************************************************/
-static void
+static gfarm_error_t
gfarm_pgsql_direntry_add(struct db_direntry_arg *arg)
{
+ gfarm_error_t e;
const char *paramValues[3];
char dir_inumber[GFARM_INT64STRLEN + 1];
char entry_inumber[GFARM_INT64STRLEN + 1];
@@ -1875,7 +1911,7 @@
paramValues[1] = arg->entry_name;
sprintf(entry_inumber, "%" GFARM_PRId64, arg->entry_inum);
paramValues[2] = entry_inumber;
- gfarm_pgsql_insert_with_retry(
+ e = gfarm_pgsql_insert_with_retry(
"INSERT INTO DirEntry (dirINumber, entryName, entryINumber) "
"VALUES ($1, $2, $3)",
3, /* number of params */
@@ -1887,18 +1923,20 @@
"direntry_add");
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_pgsql_direntry_remove(struct db_direntry_arg *arg)
{
+ gfarm_error_t e;
const char *paramValues[2];
char dir_inumber[GFARM_INT64STRLEN + 1];
sprintf(dir_inumber, "%" GFARM_PRId64, arg->dir_inum);
paramValues[0] = dir_inumber;
paramValues[1] = arg->entry_name;
- gfarm_pgsql_update_or_delete_with_retry(
+ e = gfarm_pgsql_update_or_delete_with_retry(
"DELETE FROM DirEntry "
"WHERE dirINumber = $1 AND entryName = $2",
2, /* number of params */
@@ -1910,6 +1948,7 @@
"direntry_remove");
free(arg);
+ return e;
}
static void
@@ -1952,20 +1991,21 @@
/**********************************************************************/
-static void
+static gfarm_error_t
pgsql_symlink_call(struct db_symlink_arg *arg, const char *sql,
gfarm_error_t (*op)(const char *, int, const Oid *,
const char *const *, const int *, const int *, int,
const char *),
const char *diag)
{
+ gfarm_error_t e;
const char *paramValues[2];
char inumber[GFARM_INT64STRLEN + 1];
sprintf(inumber, "%" GFARM_PRId64, arg->inum);
paramValues[0] = inumber;
paramValues[1] = arg->source_path;
- (*op)(
+ e = (*op)(
sql,
2, /* number of params */
NULL, /* param types */
@@ -1976,21 +2016,22 @@
diag);
free(arg);
+ return e;
}
-static void
+static gfarm_error_t
gfarm_pgsql_symlink_add(struct db_symlink_arg *arg)
{
- pgsql_symlink_call(arg,
+ return pgsql_symlink_call(arg,
"INSERT INTO Symlink (inumber, sourcePath) VALUES ($1, $2)",
gfarm_pgsql_insert_with_retry,
"pgsql_symlink_add");
}
-static void
+static gfarm_error_t
gfarm_pgsql_symlink_remove(struct db_inode_inum_arg *arg)
{
- pgsql_inode_inum_call(arg,
+ return pgsql_inode_inum_call(arg,
"DELETE FROM Symlink WHERE inumber = $1",
gfarm_pgsql_update_or_delete_with_retry,
"pgsql_symlink_remove");
@@ -2163,6 +2204,40 @@
}
static gfarm_error_t
+gfarm_pgsql_xattr_removeall(struct db_xattr_arg *arg)
+{
+ gfarm_error_t e;
+ const char *paramValues[1];
+ char inumber[GFARM_INT64STRLEN + 1];
+ char *diag;
+ char *command;
+
+ sprintf(inumber, "%" GFARM_PRId64, arg->inum);
+ paramValues[0] = inumber;
+ if (arg->xmlMode) {
+ command = "DELETE FROM XmlAttr "
+ "WHERE inumber = $1";
+ diag = "pgsql_xmlattr_removeall";
+ } else {
+ command = "DELETE FROM XAttr "
+ "WHERE inumber = $1";
+ diag = "pgsql_xattr_removeall";
+ }
+ e = gfarm_pgsql_update_or_delete_with_retry(
+ command,
+ 1,
+ NULL, /* param types */
+ paramValues,
+ NULL, /* param lengths */
+ NULL, /* param formats */
+ 0, /* ask for text results */
+ diag);
+
+ free(arg);
+ return e;
+}
+
+static gfarm_error_t
pgsql_xattr_set_attrvalue_string(PGresult *res, int row, void *vinfo)
{
struct xattr_info *info = vinfo;
@@ -2237,82 +2312,6 @@
}
static gfarm_error_t
-pgsql_xattr_set_attrname(PGresult *res, int row, void *vinfo)
-{
- struct xattr_info *info = vinfo;
-
- info->attrname = pgsql_get_string(res, row, "attrname");
- info->namelen = strlen(info->attrname) + 1; // include '\0'
- return (GFARM_ERR_NO_ERROR);
-}
-
-static gfarm_error_t
-gfarm_pgsql_xattr_list(struct db_xattr_arg *arg)
-{
- gfarm_error_t e;
- const char *paramValues[1];
- char inumber[GFARM_INT64STRLEN + 1];
- char *diag;
- char *command;
- int i, n = 0, len;
- struct xattr_info *vinfo = NULL;
- char *buffer, *p;
-
- *arg->sizep = 0;
- *arg->valuep = NULL;
-
- sprintf(inumber, "%" GFARM_PRId64, arg->inum);
- paramValues[0] = inumber;
-
- if (arg->xmlMode) {
- command = "SELECT attrname FROM XmlAttr WHERE inumber = $1";
- diag = "pgsql_xmlattr_list";
- } else {
- command = "SELECT attrname FROM XAttr WHERE inumber = $1";
- diag = "pgsql_xattr_list";
- }
-
- e = gfarm_pgsql_generic_get_all(
- command,
- 1, paramValues,
- &n, &vinfo,
- &gfarm_base_xattr_info_ops, pgsql_xattr_set_attrname,
- diag);
- if (e == GFARM_ERR_NO_SUCH_OBJECT) {
- e = GFARM_ERR_NO_ERROR;
- goto quit;
- }
- if (e != GFARM_ERR_NO_ERROR)
- goto quit;
-
- len = 0;
- for (i = 0; i < n; i++) {
- // NOTE: namelen including '\0'
- len += vinfo[i].namelen;
- }
- GFARM_MALLOC_ARRAY(buffer, len);
- if (buffer == NULL) {
- gfarm_base_generic_info_free_all(n, vinfo,
- &gfarm_base_xattr_info_ops);
- e = GFARM_ERR_NO_MEMORY;
- goto quit;
- }
-
- p = buffer;
- for (i = 0; i < n; i++) {
- memcpy(p, vinfo[i].attrname, vinfo[i].namelen);
- p += vinfo[i].namelen;
- }
- *arg->sizep = len;
- *arg->valuep = buffer;
- gfarm_base_generic_info_free_all(n, vinfo,
- &gfarm_base_xattr_info_ops);
-quit:
- free(arg);
- return e;
-}
-
-static gfarm_error_t
pgsql_xattr_set_inum_and_attrname(PGresult *res, int row, void *vinfo)
{
struct xattr_info *info = vinfo;
@@ -2324,10 +2323,11 @@
}
static gfarm_error_t
-gfarm_pgsql_xattr_load0(int xmlMode,
+gfarm_pgsql_xattr_load(void *closure,
void (*callback)(void *, struct xattr_info *))
{
gfarm_error_t e;
+ int xmlMode = (closure != NULL) ? *(int*)closure : 0;
char *command, *diag;
struct xattr_info *vinfo;
int i, n;
@@ -2360,16 +2360,13 @@
}
static gfarm_error_t
-gfarm_pgsql_xattr_load(void *closure,
- void (*callback)(void *, struct xattr_info *))
+pgsql_xattr_set_attrname(PGresult *res, int row, void *vinfo)
{
- gfarm_error_t e;
+ struct xattr_info *info = vinfo;
- // ignore closure to distinguish xmlMode
- if ((e = gfarm_pgsql_xattr_load0(0, callback))
- == GFARM_ERR_NO_ERROR)
- e = gfarm_pgsql_xattr_load0(1, callback);
- return e;
+ info->attrname = pgsql_get_string(res, row, "attrname");
+ info->namelen = strlen(info->attrname) + 1; // include '\0'
+ return (GFARM_ERR_NO_ERROR);
}
static gfarm_error_t
@@ -2392,7 +2389,7 @@
* Array size > 0 if some attrvalue matched XPath expr, 0 if not.
*/
command = "SELECT attrname FROM XmlAttr "
- "WHERE inumber = $1 AND array_upper(xpath($2, attrvalue), 1) > 0"
+ "WHERE inumber = $1 AND array_upper(xpath($2, attrvalue),1) > 0"
"ORDER BY attrname";
diag = "pgsql_xmlattr_find";
@@ -2473,8 +2470,8 @@
gfarm_pgsql_xattr_add,
gfarm_pgsql_xattr_modify,
gfarm_pgsql_xattr_remove,
+ gfarm_pgsql_xattr_removeall,
gfarm_pgsql_xattr_get,
- gfarm_pgsql_xattr_list,
gfarm_pgsql_xattr_load,
gfarm_pgsql_xmlattr_find,
};
Modified: gfarm_v2/trunk/server/gfmd/inode.c
===================================================================
--- gfarm_v2/trunk/server/gfmd/inode.c 2009-03-26 14:22:07 UTC (rev 4135)
+++ gfarm_v2/trunk/server/gfmd/inode.c 2009-03-27 04:24:57 UTC (rev 4136)
@@ -340,6 +340,13 @@
&inode->i_xmlattrs : &inode->i_xattrs;
struct xattr_entry *entry = NULL;
+ if (xattrs->head == NULL)
+ return;
+
+ e = db_xattr_removeall(xmlMode, inode->i_number);
+ if (e != GFARM_ERR_OPERATION_NOT_SUPPORTED)
+ return;
+
entry = xattrs->head;
while (entry != NULL) {
e = db_xattr_remove(xmlMode, inode->i_number, entry->name);
@@ -2181,14 +2188,13 @@
xattr_add_one(void *closure, struct xattr_info *info)
{
struct inode *inode = inode_lookup(info->inum);
- int xmlMode;
struct xattrs *xattrs;
if (inode == NULL)
gflog_error("xattr_add_one: no file %" GFARM_PRId64,
info->inum);
else {
- xmlMode = (closure != NULL) ? *(int*)c...
[truncated message content] |
|
From: <ta...@us...> - 2009-03-26 14:22:23
|
Revision: 4135
http://gfarm.svn.sourceforge.net/gfarm/?rev=4135&view=rev
Author: tatebe
Date: 2009-03-26 14:22:07 +0000 (Thu, 26 Mar 2009)
Log Message:
-----------
version 1.1.0
Modified Paths:
--------------
gfarm2fs/branches/1.1.0/gfarm2fs.spec
Modified: gfarm2fs/branches/1.1.0/gfarm2fs.spec
===================================================================
--- gfarm2fs/branches/1.1.0/gfarm2fs.spec 2009-03-26 14:12:56 UTC (rev 4134)
+++ gfarm2fs/branches/1.1.0/gfarm2fs.spec 2009-03-26 14:22:07 UTC (rev 4135)
@@ -1,6 +1,6 @@
Summary: GfarmFS-FUSE for Gfarm File System 2
Name: gfarm2fs
-Version: 1.0.2
+Version: 1.1.0
Release: 1%{?dist}
License: BSD
Group: Applications/Internet
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ta...@us...> - 2009-03-26 14:13:20
|
Revision: 4134
http://gfarm.svn.sourceforge.net/gfarm/?rev=4134&view=rev
Author: tatebe
Date: 2009-03-26 14:12:56 +0000 (Thu, 26 Mar 2009)
Log Message:
-----------
increase DBQ_SIZE from 1000 to 10000
Modified Paths:
--------------
gfarm_v2/branches/2.2.0/server/gfmd/db_access.c
Modified: gfarm_v2/branches/2.2.0/server/gfmd/db_access.c
===================================================================
--- gfarm_v2/branches/2.2.0/server/gfmd/db_access.c 2009-03-25 10:03:42 UTC (rev 4133)
+++ gfarm_v2/branches/2.2.0/server/gfmd/db_access.c 2009-03-26 14:12:56 UTC (rev 4134)
@@ -24,7 +24,7 @@
void *data;
};
-#define DBQ_SIZE 1000
+#define DBQ_SIZE 10000
struct dbq {
pthread_mutex_t mutex;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <uj...@us...> - 2009-03-25 10:03:55
|
Revision: 4133
http://gfarm.svn.sourceforge.net/gfarm/?rev=4133&view=rev
Author: ujihara
Date: 2009-03-25 10:03:42 +0000 (Wed, 25 Mar 2009)
Log Message:
-----------
almost fixed Trac#48 (xattr giant_lock)
but still testing, especially for gffindxmlattr
fix Trac#49 (pthread_cond_wait usage)
alomost fixed Trac#50 (too long lines)
fix Trac#51 (memory allocation)
fix Trac#52 (protocol number compatibility)
Modified Paths:
--------------
gfarm_v2/trunk/gftool/config-gfarm/config-gfarm.postgresql
gfarm_v2/trunk/gftool/gffindxmlattr/gffindxmlattr.c
gfarm_v2/trunk/gftool/gfvoms-sync/lib/Makefile
gfarm_v2/trunk/gftool/gfxattr/gfxattr.c
gfarm_v2/trunk/lib/libgfarm/gfarm/gfm_client.c
gfarm_v2/trunk/lib/libgfarm/gfarm/gfm_client.h
gfarm_v2/trunk/lib/libgfarm/gfarm/gfm_proto.h
gfarm_v2/trunk/lib/libgfarm/gfarm/gfs_xattr.c
gfarm_v2/trunk/lib/libgfarm/gfarm/metadb_common.c
gfarm_v2/trunk/lib/libgfarm/gfarm/metadb_common.h
gfarm_v2/trunk/lib/libgfarm/gfarm/xattr_info.h
gfarm_v2/trunk/regress/gftool/gfxattr/gfxattr-findxmlattr.sh
gfarm_v2/trunk/regress/gftool/gfxattr/gfxattr-perm-normal.sh
gfarm_v2/trunk/regress/gftool/gfxattr/gfxattr-perm-xml.sh
gfarm_v2/trunk/server/gfmd/db_access.c
gfarm_v2/trunk/server/gfmd/db_access.h
gfarm_v2/trunk/server/gfmd/db_ldap.c
gfarm_v2/trunk/server/gfmd/db_none.c
gfarm_v2/trunk/server/gfmd/db_ops.h
gfarm_v2/trunk/server/gfmd/db_pgsql.c
gfarm_v2/trunk/server/gfmd/gfmd.c
gfarm_v2/trunk/server/gfmd/inode.c
gfarm_v2/trunk/server/gfmd/inode.h
gfarm_v2/trunk/server/gfmd/peer.c
gfarm_v2/trunk/server/gfmd/peer.h
gfarm_v2/trunk/server/gfmd/xattr.c
gfarm_v2/trunk/server/gfmd/xattr.h
Modified: gfarm_v2/trunk/gftool/config-gfarm/config-gfarm.postgresql
===================================================================
--- gfarm_v2/trunk/gftool/config-gfarm/config-gfarm.postgresql 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/gftool/config-gfarm/config-gfarm.postgresql 2009-03-25 10:03:42 UTC (rev 4133)
@@ -400,6 +400,12 @@
createuser_option=--no-createrole;;
esac
+ if [ "$SUPPORT_XML_TYPE" = "yes" ]; then
+ XMLATTR_TABLENAME=", XmlAttr "
+ else
+ XMLATTR_TABLENAME=""
+ fi
+
cat << _EOF_ | $run_with_backend_privilege || ABORT "createdb failed"
PGHOST="$BACKEND_DATA_DIR"; export PGHOST
PGPORT="$BACKEND_PORT"; export PGPORT
@@ -425,12 +431,9 @@
# -f "$config_dir/gfarm.schema-$SCHEMA_VERSION.sql" $DB_NAME
$PGSQL_BINDIR/psql -q \
-f "$config_dir/gfarm.sql" $DB_NAME
- if [ "$SUPPORT_XML_TYPE"="yes" ]; then
+ if [ "$SUPPORT_XML_TYPE" = "yes" ]; then
$PGSQL_BINDIR/psql -q \
-f "$config_dir/gfarm-xmlattr.sql" $DB_NAME
- : ${XMLATTR_TABLENAME:=", XmlAttr "}
- else
- : ${XMLATTR_TABLENAME:=""}
fi
$awk 'BEGIN {
print "GRANT SELECT, INSERT, UPDATE, DELETE"
Modified: gfarm_v2/trunk/gftool/gffindxmlattr/gffindxmlattr.c
===================================================================
--- gfarm_v2/trunk/gftool/gffindxmlattr/gffindxmlattr.c 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/gftool/gffindxmlattr/gffindxmlattr.c 2009-03-25 10:03:42 UTC (rev 4133)
@@ -20,6 +20,7 @@
#include <limits.h>
#include <gfarm/gfarm.h>
+#include "../gfutil/gfutil.h"
static gfarm_error_t
read_file(char *filename, char **bufp)
@@ -29,6 +30,8 @@
struct stat st;
ssize_t sz, msg_sz = 0;
char *buf = NULL;
+ size_t allocsz;
+ int overflow;
fd = open(filename, O_RDONLY);
if (fd == -1)
@@ -36,18 +39,24 @@
if (fstat(fd, &st) != 0)
e = gfarm_errno_to_error(errno);
- else if ((buf = malloc(st.st_size + 1)) != NULL) {
- while ((sz = read(fd, buf + msg_sz, st.st_size - msg_sz)) > 0) {
- msg_sz += sz;
- }
- if (sz == 0) {
- buf[msg_sz] = '\0';
- *bufp = buf;
- e = GFARM_ERR_NO_ERROR;
+ else {
+ overflow = 0;
+ allocsz = gfarm_size_add(&overflow, st.st_size, 1);
+ if (!overflow)
+ buf = malloc(allocsz);
+ if (buf != NULL) {
+ while ((sz = read(fd, buf + msg_sz, st.st_size - msg_sz)) > 0) {
+ msg_sz += sz;
+ }
+ if (sz == 0) {
+ buf[msg_sz] = '\0';
+ *bufp = buf;
+ e = GFARM_ERR_NO_ERROR;
+ } else
+ e = gfarm_errno_to_error(errno);
} else
- e = gfarm_errno_to_error(errno);
- } else
- e = GFARM_ERR_NO_MEMORY;
+ e = GFARM_ERR_NO_MEMORY;
+ }
close(fd);
@@ -57,7 +66,8 @@
void
usage(char *prog_name)
{
- fprintf(stderr, "Usage: %s [ -d depth ] [ -F delim ] {expr | -f expr-file-path} path\n",
+ fprintf(stderr, "Usage: %s [ -d depth ] [ -F delim ] "
+ "{expr | -f expr-file-path} path\n",
prog_name);
fprintf(stderr, "\t-d\tsearch directory depth (>= 0)\n");
fprintf(stderr, "\t-F\tdelimter of path and attrname (default is TAB)\n");
@@ -112,7 +122,8 @@
} else {
e = read_file(filename, &expr);
if (e != GFARM_ERR_NO_ERROR) {
- fprintf(stderr, "%s: %s: %s\n", prog_name, gfarm_error_string(e), filename);
+ fprintf(stderr, "%s: %s: %s\n", prog_name,
+ gfarm_error_string(e), filename);
exit(1);
}
path = argv[0];
@@ -132,7 +143,8 @@
exit(1);
}
- while ((e = gfs_getxmlent(ctxp, &fpath, &attrname)) == GFARM_ERR_NO_ERROR) {
+ while ((e = gfs_getxmlent(ctxp, &fpath, &attrname))
+ == GFARM_ERR_NO_ERROR) {
if (fpath == NULL)
break;
printf("%s%s%s\n", fpath, delim, attrname);
Modified: gfarm_v2/trunk/gftool/gfvoms-sync/lib/Makefile
===================================================================
--- gfarm_v2/trunk/gftool/gfvoms-sync/lib/Makefile 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/gftool/gfvoms-sync/lib/Makefile 2009-03-25 10:03:42 UTC (rev 4133)
@@ -31,9 +31,11 @@
$(INSTALL_DATA) $$i $(vomslib)/`basename $$i`; \
$(INSTALL_DATA) $$i $(vomslib)/`basename $$i`; \
done
- @echo $(INSTALL_DATA) $(srcdir)/$(vomsids_name) $(confpath)/`basename $(vomsids_name)`
- @$(INSTALL_DATA) $(srcdir)/$(vomsids_name) $(confpath)/`basename $(vomsids_name)`
-
+ @if ! test -e "$(confpath)/`basename $(vomsids_name)`"; then \
+ echo \
+ $(INSTALL_DATA) $(srcdir)/$(vomsids_name) $(confpath)/`basename $(vomsids_name)`; \
+ $(INSTALL_DATA) $(srcdir)/$(vomsids_name) $(confpath)/`basename $(vomsids_name)`; \
+ fi
script-clean:
@for i in -- ${vomsids_name} ${hostidpy_name}; do \
Modified: gfarm_v2/trunk/gftool/gfxattr/gfxattr.c
===================================================================
--- gfarm_v2/trunk/gftool/gfxattr/gfxattr.c 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/gftool/gfxattr/gfxattr.c 2009-03-25 10:03:42 UTC (rev 4133)
@@ -19,6 +19,7 @@
#include <errno.h>
#include <gfarm/gfarm.h>
+#include "../gfutil/gfutil.h"
#ifdef HAVE_SYS_XATTR_H
#include <sys/xattr.h>
@@ -30,10 +31,12 @@
set_xattr(int xmlMode, char *path, char *xattrname, char *filename, int flags)
{
const size_t count = 65536;
- ssize_t sz, buf_sz, msg_sz = 0;
- char *buf, *tbuf;
+ ssize_t sz;
+ size_t buf_sz, msg_sz = 0;
+ char *buf = NULL, *tbuf;
gfarm_error_t e;
int fd, need_close = 0;
+ int overflow;
if (filename != NULL) {
fd = open(filename, O_RDONLY);
@@ -48,15 +51,19 @@
}
buf_sz = count;
- buf = malloc(buf_sz + 1 /* for the last '\0' */);
+ overflow = 0;
+ buf_sz = gfarm_size_add(&overflow, buf_sz, 1);
+ if (!overflow)
+ buf = malloc(buf_sz);
if (buf == NULL)
return (GFARM_ERR_NO_MEMORY);
while ((sz = read(fd, buf + msg_sz, count)) > 0) {
msg_sz += sz;
- buf_sz += count;
- tbuf = realloc(buf, buf_sz);
- if (tbuf == NULL) {
+ buf_sz = gfarm_size_add(&overflow, buf_sz, count);
+ if (!overflow)
+ tbuf = realloc(buf, buf_sz);
+ if (overflow || (tbuf == NULL)) {
e = GFARM_ERR_NO_MEMORY;
goto free_buf;
}
@@ -77,7 +84,8 @@
}
static gfarm_error_t
-get_xattr_alloc(int xmlMode, char *path, char *xattrname, void **valuep, size_t *size)
+get_xattr_alloc(int xmlMode, char *path, char *xattrname,
+ void **valuep, size_t *size)
{
gfarm_error_t e;
void *value;
@@ -302,21 +310,23 @@
switch (mode) {
case SET_MODE:
- if (xattrname == NULL)
+ if (argc != 2)
usage(prog_name);
e = set_xattr(xmlMode, c_path, xattrname, filename, flags);
break;
case GET_MODE:
- if (xattrname == NULL)
+ if (argc != 2)
usage(prog_name);
e = get_xattr(xmlMode, c_path, xattrname, filename);
break;
case REMOVE_MODE:
- if (xattrname == NULL)
+ if (argc != 2)
usage(prog_name);
e = remove_xattr(xmlMode, c_path, xattrname);
break;
case LIST_MODE:
+ if (argc != 1)
+ usage(prog_name);
e = list_xattr(xmlMode, c_path);
break;
default:
Modified: gfarm_v2/trunk/lib/libgfarm/gfarm/gfm_client.c
===================================================================
--- gfarm_v2/trunk/lib/libgfarm/gfarm/gfm_client.c 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/lib/libgfarm/gfarm/gfm_client.c 2009-03-25 10:03:42 UTC (rev 4133)
@@ -1297,7 +1297,8 @@
*/
gfarm_error_t
gfm_client_setxattr_request(struct gfm_connection *gfm_server,
- int xmlMode, const char *name, const void *value, size_t size, int flags)
+ int xmlMode, const char *name, const void *value, size_t size,
+ int flags)
{
int command = xmlMode ? GFM_PROTO_XMLATTR_SET : GFM_PROTO_XATTR_SET;
return (gfm_client_rpc_request(gfm_server, command, "sbi",
@@ -1320,9 +1321,16 @@
gfarm_error_t
gfm_client_getxattr_result(struct gfm_connection *gfm_server,
- void **valuep, size_t *size)
+ int xmlMode, void **valuep, size_t *size)
{
- return (gfm_client_rpc_result(gfm_server, 0, "B", size, valuep));
+ gfarm_error_t e;
+
+ e = gfm_client_rpc_result(gfm_server, 0, "B", size, valuep);
+ if ((e == GFARM_ERR_NO_ERROR) && xmlMode) {
+ // value is text with '\0', drop it
+ (*size)--;
+ }
+ return e;
}
gfarm_error_t
@@ -1399,7 +1407,10 @@
free(ctxp->cookie_path);
free(ctxp->cookie_attrname);
ctxp->cookie_path = strdup(ctxp->entries[ctxp->nvalid-1].path);
- ctxp->cookie_attrname = strdup(ctxp->entries[ctxp->nvalid-1].attrname);
+ ctxp->cookie_attrname =
+ strdup(ctxp->entries[ctxp->nvalid-1].attrname);
+ if ((ctxp->cookie_path == NULL) || (ctxp->cookie_attrname == NULL))
+ return GFARM_ERR_NO_MEMORY;
}
return (GFARM_ERR_NO_ERROR);
Modified: gfarm_v2/trunk/lib/libgfarm/gfarm/gfm_client.h
===================================================================
--- gfarm_v2/trunk/lib/libgfarm/gfarm/gfm_client.h 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/lib/libgfarm/gfarm/gfm_client.h 2009-03-25 10:03:42 UTC (rev 4133)
@@ -213,21 +213,25 @@
int, const char *);
gfarm_error_t gfm_client_getxmlattr_request(struct gfm_connection *,
const char *);
-gfarm_error_t gfm_client_getxattr_result(struct gfm_connection *, void **, size_t *);
-gfarm_error_t gfm_client_getxmlattr_result(struct gfm_connection *, void **, size_t *);
+gfarm_error_t gfm_client_getxattr_result(struct gfm_connection *,
+ int, void **, size_t *);
+gfarm_error_t gfm_client_getxmlattr_result(struct gfm_connection *,
+ void **, size_t *);
gfarm_error_t gfm_client_listxattr_request(struct gfm_connection *, int);
gfarm_error_t gfm_client_listxmlattr_request(struct gfm_connection *);
-gfarm_error_t gfm_client_listxattr_result(struct gfm_connection *, char **, size_t *);
-gfarm_error_t gfm_client_listxmlattr_result(struct gfm_connection *, char **, size_t *);
+gfarm_error_t gfm_client_listxattr_result(struct gfm_connection *,
+ char **, size_t *);
+gfarm_error_t gfm_client_listxmlattr_result(struct gfm_connection *,
+ char **, size_t *);
gfarm_error_t gfm_client_removexattr_request(struct gfm_connection *,
int, const char *);
gfarm_error_t gfm_client_removexmlattr_request(struct gfm_connection *,
const char *);
gfarm_error_t gfm_client_removexattr_result(struct gfm_connection *);
gfarm_error_t gfm_client_removexmlattr_result(struct gfm_connection *);
-gfarm_error_t gfm_client_findxmlattr_request(struct gfm_connection *gfm_server,
+gfarm_error_t gfm_client_findxmlattr_request(struct gfm_connection *,
struct gfs_xmlattr_ctx *ctxp);
-gfarm_error_t gfm_client_findxmlattr_result(struct gfm_connection *gfm_server,
+gfarm_error_t gfm_client_findxmlattr_result(struct gfm_connection *,
struct gfs_xmlattr_ctx *ctxp);
/* gfs from gfsd */
Modified: gfarm_v2/trunk/lib/libgfarm/gfarm/gfm_proto.h
===================================================================
--- gfarm_v2/trunk/lib/libgfarm/gfarm/gfm_proto.h 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/lib/libgfarm/gfarm/gfm_proto.h 2009-03-25 10:03:42 UTC (rev 4133)
@@ -143,23 +143,6 @@
GFM_PROTO_DIR_OP_RESERVE14,
GFM_PROTO_DIR_OP_RESERVE15,
- GFM_PROTO_XATTR_SET,
- GFM_PROTO_XMLATTR_SET,
- GFM_PROTO_XATTR_GET,
- GFM_PROTO_XMLATTR_GET,
- GFM_PROTO_XATTR_REMOVE,
- GFM_PROTO_XMLATTR_REMOVE,
- GFM_PROTO_XATTR_LIST,
- GFM_PROTO_XMLATTR_LIST,
- GFM_PROTO_XMLATTR_FIND,
- GFM_PROTO_XATTR_OP_RESERVE9,
- GFM_PROTO_XATTR_OP_RESERVE10,
- GFM_PROTO_XATTR_OP_RESERVE11,
- GFM_PROTO_XATTR_OP_RESERVE12,
- GFM_PROTO_XATTR_OP_RESERVE13,
- GFM_PROTO_XATTR_OP_RESERVE14,
- GFM_PROTO_XATTR_OP_RESERVE15,
-
/* gfs from gfsd */
GFM_PROTO_REOPEN,
@@ -305,6 +288,24 @@
GFJ_PROTO_RESERVE13,
GFJ_PROTO_RESERVE14,
GFJ_PROTO_RESERVE15,
+
+ /* extended attribude management */
+ GFM_PROTO_XATTR_SET,
+ GFM_PROTO_XMLATTR_SET,
+ GFM_PROTO_XATTR_GET,
+ GFM_PROTO_XMLATTR_GET,
+ GFM_PROTO_XATTR_REMOVE,
+ GFM_PROTO_XMLATTR_REMOVE,
+ GFM_PROTO_XATTR_LIST,
+ GFM_PROTO_XMLATTR_LIST,
+ GFM_PROTO_XMLATTR_FIND,
+ GFM_PROTO_XATTR_OP_RESERVE9,
+ GFM_PROTO_XATTR_OP_RESERVE10,
+ GFM_PROTO_XATTR_OP_RESERVE11,
+ GFM_PROTO_XATTR_OP_RESERVE12,
+ GFM_PROTO_XATTR_OP_RESERVE13,
+ GFM_PROTO_XATTR_OP_RESERVE14,
+ GFM_PROTO_XATTR_OP_RESERVE15,
};
#define GFM_PROTO_PROCESS_KEY_TYPE_SHAREDSECRET 1
Modified: gfarm_v2/trunk/lib/libgfarm/gfarm/gfs_xattr.c
===================================================================
--- gfarm_v2/trunk/lib/libgfarm/gfarm/gfs_xattr.c 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/lib/libgfarm/gfarm/gfs_xattr.c 2009-03-25 10:03:42 UTC (rev 4133)
@@ -161,8 +161,8 @@
GFARM_FILE_LOOKUP)) != GFARM_ERR_NO_ERROR)
gflog_warning("tmp_open(%s) request: %s", path,
gfarm_error_string(e));
- else if ((e = gfm_client_getxattr_request(gfarm_metadb_server, xmlMode, name))
- != GFARM_ERR_NO_ERROR)
+ else if ((e = gfm_client_getxattr_request(gfarm_metadb_server,
+ xmlMode, name)) != GFARM_ERR_NO_ERROR)
gflog_warning("getxattr request: %s",
gfarm_error_string(e));
else if ((e = gfm_client_compound_end_request(gfarm_metadb_server))
@@ -178,8 +178,8 @@
!= GFARM_ERR_NO_ERROR)
gflog_warning("tmp_open(%s) result: %s", path,
gfarm_error_string(e));
- else if ((e = gfm_client_getxattr_result(gfarm_metadb_server, valuep, size))
- != GFARM_ERR_NO_ERROR)
+ else if ((e = gfm_client_getxattr_result(gfarm_metadb_server,
+ xmlMode, valuep, size)) != GFARM_ERR_NO_ERROR)
gflog_warning("getxattr result: %s",
gfarm_error_string(e));
else if ((e = gfm_client_compound_end_result(gfarm_metadb_server))
@@ -196,7 +196,8 @@
}
static gfarm_error_t
-gfs_fgetxattr_proccall(int xmlMode, GFS_File gf, const char *name, void **valuep, size_t *size)
+gfs_fgetxattr_proccall(int xmlMode, GFS_File gf, const char *name,
+ void **valuep, size_t *size)
{
gfarm_error_t e;
gfarm_timerval_t t1, t2;
@@ -231,8 +232,8 @@
!= GFARM_ERR_NO_ERROR)
gflog_warning("put_fd result: %s",
gfarm_error_string(e));
- else if ((e = gfm_client_getxattr_result(gfarm_metadb_server, valuep, size))
- != GFARM_ERR_NO_ERROR)
+ else if ((e = gfm_client_getxattr_result(gfarm_metadb_server,
+ xmlMode, valuep, size)) != GFARM_ERR_NO_ERROR)
gflog_warning("getxattr result: %s",
gfarm_error_string(e));
else if ((e = gfm_client_compound_end_result(gfarm_metadb_server))
@@ -290,7 +291,8 @@
}
static gfarm_error_t
-gfs_listxattr_proccall(int xmlMode, const char *path, char **listp, size_t *size)
+gfs_listxattr_proccall(int xmlMode, const char *path, char **listp,
+ size_t *size)
{
gfarm_error_t e;
gfarm_timerval_t t1, t2;
@@ -323,8 +325,8 @@
!= GFARM_ERR_NO_ERROR)
gflog_warning("tmp_open(%s) result: %s", path,
gfarm_error_string(e));
- else if ((e = gfm_client_listxattr_result(gfarm_metadb_server, listp, size))
- != GFARM_ERR_NO_ERROR)
+ else if ((e = gfm_client_listxattr_result(gfarm_metadb_server,
+ listp, size)) != GFARM_ERR_NO_ERROR)
gflog_warning("listxattr result: %s",
gfarm_error_string(e));
else if ((e = gfm_client_compound_end_result(gfarm_metadb_server))
@@ -389,8 +391,8 @@
GFARM_FILE_LOOKUP)) != GFARM_ERR_NO_ERROR)
gflog_warning("tmp_open(%s) request: %s", path,
gfarm_error_string(e));
- else if ((e = gfm_client_removexattr_request(gfarm_metadb_server, xmlMode, name))
- != GFARM_ERR_NO_ERROR)
+ else if ((e = gfm_client_removexattr_request(gfarm_metadb_server,
+ xmlMode, name)) != GFARM_ERR_NO_ERROR)
gflog_warning("removexattr request: %s",
gfarm_error_string(e));
else if ((e = gfm_client_compound_end_request(gfarm_metadb_server))
@@ -493,25 +495,34 @@
gfs_xmlattr_ctx_alloc(int nentry)
{
struct gfs_xmlattr_ctx *ctxp;
- int ctxsize = sizeof(*ctxp) + nentry * sizeof(*ctxp->entries);
+ size_t ctxsize;
+ int overflow;
+ char *p = NULL;
- if ((ctxp = calloc(1, ctxsize)) == NULL)
+ overflow = 0;
+ ctxsize = gfarm_size_add(&overflow, sizeof(*ctxp),
+ gfarm_size_mul(&overflow, nentry, sizeof(*ctxp->entries)));
+ if (!overflow)
+ p = calloc(1, ctxsize);
+ if (p != NULL) {
+ ctxp = (struct gfs_xmlattr_ctx *)p;
+ ctxp->nalloc = nentry;
+ ctxp->entries = (struct gfs_foundxattr_entry *)(ctxp + 1);
+ return ctxp;
+ } else
return NULL;
-
- ctxp->nalloc = nentry;
- ctxp->entries = (struct gfs_foundxattr_entry *)(ctxp + 1);
-
- return ctxp;
}
static void
-gfs_xmlattr_ctx_free_entries(struct gfs_xmlattr_ctx *ctxp)
+gfs_xmlattr_ctx_free_entries(struct gfs_xmlattr_ctx *ctxp, int freepath)
{
int i;
for (i = 0; i < ctxp->nvalid; i++) {
- free(ctxp->entries[i].path);
- free(ctxp->entries[i].attrname);
+ if (freepath) {
+ free(ctxp->entries[i].path);
+ free(ctxp->entries[i].attrname);
+ }
ctxp->entries[i].path = NULL;
ctxp->entries[i].attrname = NULL;
}
@@ -520,10 +531,10 @@
}
void
-gfs_xmlattr_ctx_free(struct gfs_xmlattr_ctx *ctxp)
+gfs_xmlattr_ctx_free(struct gfs_xmlattr_ctx *ctxp, int freepath)
{
if (ctxp != NULL) {
- gfs_xmlattr_ctx_free_entries(ctxp);
+ gfs_xmlattr_ctx_free_entries(ctxp, freepath);
free(ctxp->path);
free(ctxp->expr);
free(ctxp->cookie_path);
@@ -584,10 +595,11 @@
GFARM_TIMEVAL_FIX_INITIALIZE_WARNING(t1);
gfs_profile(gfarm_gettimerval(&t1));
- if ((ctxp = gfs_xmlattr_ctx_alloc(GFARM_DEFAULT_FINDXMLATTR_NENRTY)) == NULL)
+ if ((ctxp = gfs_xmlattr_ctx_alloc(GFARM_DEFAULT_FINDXMLATTR_NENRTY))
+ == NULL)
e = GFARM_ERR_NO_MEMORY;
else if ((e = gfs_findxmlattr_open(path, ctxp)) != GFARM_ERR_NO_ERROR)
- gfs_xmlattr_ctx_free(ctxp);
+ gfs_xmlattr_ctx_free(ctxp, 1);
else {
ctxp->path = strdup(path);
ctxp->expr = strdup(expr);
@@ -649,7 +661,8 @@
gfarm_error_t e = GFARM_ERR_NO_ERROR;
gfarm_timerval_t t1, t2;
char *fpath, *p;
- int pathlen, len;
+ int pathlen, overflow;
+ size_t allocsz;
*fpathp = NULL;
*namep = NULL;
@@ -658,23 +671,27 @@
gfs_profile(gfarm_gettimerval(&t1));
if ((ctxp->eof == 0) && (ctxp->index >= ctxp->nvalid)) {
- gfs_xmlattr_ctx_free_entries(ctxp);
+ gfs_xmlattr_ctx_free_entries(ctxp, 1);
e = gfs_findxmlattr_get(ctxp);
}
if (e == GFARM_ERR_NO_ERROR) {
if (ctxp->index < ctxp->nvalid) {
fpath = ctxp->entries[ctxp->index].path;
pathlen = strlen(ctxp->path);
- len = pathlen + 1 + strlen(fpath) + 1;
- p = realloc(ctxp->workpath, len);
- if (p != NULL) {
+ overflow = 0;
+ allocsz = gfarm_size_add(&overflow,
+ gfarm_size_add(&overflow, pathlen, strlen(fpath)), 2);
+ if (!overflow)
+ p = realloc(ctxp->workpath, allocsz);
+ if (!overflow && (p != NULL)) {
ctxp->workpath = p;
- if (fpath[0] == '.')
- strcpy(ctxp->workpath, ctxp->path);
- else if (ctxp->path[pathlen-1] == '/')
+ if (ctxp->path[pathlen-1] == '/')
sprintf(ctxp->workpath, "%s%s", ctxp->path, fpath);
else
sprintf(ctxp->workpath, "%s/%s", ctxp->path, fpath);
+ pathlen = strlen(ctxp->workpath);
+ if ((pathlen > 1) && (ctxp->workpath[pathlen-1] == '/'))
+ ctxp->workpath[pathlen-1] = '\0';
*fpathp = ctxp->workpath;
*namep = ctxp->entries[ctxp->index].attrname;
ctxp->index++;
@@ -700,7 +717,7 @@
if (ctxp != NULL) {
e = gfm_close_fd(ctxp->fd);
- gfs_xmlattr_ctx_free(ctxp);
+ gfs_xmlattr_ctx_free(ctxp, 1);
} else {
e = GFARM_ERR_NO_ERROR;
}
Modified: gfarm_v2/trunk/lib/libgfarm/gfarm/metadb_common.c
===================================================================
--- gfarm_v2/trunk/lib/libgfarm/gfarm/metadb_common.c 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/lib/libgfarm/gfarm/metadb_common.c 2009-03-25 10:03:42 UTC (rev 4133)
@@ -280,75 +280,47 @@
/**********************************************************************/
static void
-xattr_load_free(void *vinfo)
+xattr_info_free(void *vinfo)
{
- struct xattr_load_info *info = vinfo;
- free(info->value);
-}
+ struct xattr_info *info = vinfo;
-static void
-xattr_load_clear(void *vinfo)
-{
- struct xattr_load_info *info = vinfo;
-
- info->size = 0;
- info->value = NULL;
-}
-
-static int
-xattr_load_validate(void *vinfo)
-{
- struct xattr_load_info *info = vinfo;
-
- return ((info->size == 0 && info->value == NULL)
- || (info->size > 0 && info->value != NULL));
-}
-
-const struct gfarm_base_generic_info_ops gfarm_base_xattr_load_ops = {
- sizeof(struct xattr_load_info),
- xattr_load_free,
- xattr_load_clear,
- xattr_load_validate
-};
-
-static void
-xattr_list_free(void *vinfo)
-{
- struct xattr_list_info *info = vinfo;
-
free(info->attrname);
+ free(info->attrvalue);
}
void
-gfarm_base_xattr_list_free_array(int n, void *vinfo)
+gfarm_base_xattr_info_free_array(int n, void *vinfo)
{
int i;
- struct xattr_list_info *info = vinfo;
+ struct xattr_info *info = vinfo;
for (i = 0; i < n; i++) {
- xattr_list_free(&info[i]);
+ xattr_info_free(&info[i]);
}
free(info);
}
static void
-xattr_list_clear(void *vinfo)
+xattr_info_clear(void *vinfo)
{
- struct xattr_list_info *info = vinfo;
+ struct xattr_info *info = vinfo;
+ info->inum = 0;
info->attrname = NULL;
info->namelen = 0;
+ info->attrvalue = NULL;
+ info->attrsize = 0;
}
static int
-xattr_list_validate(void *vinfo)
+xattr_info_validate(void *vinfo)
{
return 1;
}
-const struct gfarm_base_generic_info_ops gfarm_base_xattr_list_ops = {
- sizeof(struct xattr_list_info),
- xattr_list_free,
- xattr_list_clear,
- xattr_list_validate
+const struct gfarm_base_generic_info_ops gfarm_base_xattr_info_ops = {
+ sizeof(struct xattr_info),
+ xattr_info_free,
+ xattr_info_clear,
+ xattr_info_validate
};
Modified: gfarm_v2/trunk/lib/libgfarm/gfarm/metadb_common.h
===================================================================
--- gfarm_v2/trunk/lib/libgfarm/gfarm/metadb_common.h 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/lib/libgfarm/gfarm/metadb_common.h 2009-03-25 10:03:42 UTC (rev 4133)
@@ -10,9 +10,7 @@
gfarm_base_user_info_ops,
gfarm_base_group_info_ops,
gfarm_base_gfs_stat_ops,
- gfarm_base_xattr_load_ops,
- gfarm_base_xattr_list_ops;
+ gfarm_base_xattr_info_ops;
void gfarm_base_generic_info_free_all(int, void *,
const struct gfarm_base_generic_info_ops *);
-void gfarm_base_xattr_list_free_array(int, void *);
Modified: gfarm_v2/trunk/lib/libgfarm/gfarm/xattr_info.h
===================================================================
--- gfarm_v2/trunk/lib/libgfarm/gfarm/xattr_info.h 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/lib/libgfarm/gfarm/xattr_info.h 2009-03-25 10:03:42 UTC (rev 4133)
@@ -27,14 +27,12 @@
};
struct gfs_xmlattr_ctx *gfs_xmlattr_ctx_alloc(int nentry);
-void gfs_xmlattr_ctx_free(struct gfs_xmlattr_ctx *);
+void gfs_xmlattr_ctx_free(struct gfs_xmlattr_ctx *, int);
-struct xattr_load_info {
- int size;
- void *value;
-};
-
-struct xattr_list_info {
+struct xattr_info {
+ gfarm_ino_t inum;
char *attrname;
int namelen;
+ void *attrvalue;
+ int attrsize;
};
Modified: gfarm_v2/trunk/regress/gftool/gfxattr/gfxattr-findxmlattr.sh
===================================================================
--- gfarm_v2/trunk/regress/gftool/gfxattr/gfxattr-findxmlattr.sh 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/regress/gftool/gfxattr/gfxattr-findxmlattr.sh 2009-03-25 10:03:42 UTC (rev 4133)
@@ -317,6 +317,7 @@
exit $exit_fail
fi
echo "/ $attrname" > $nameslist
+ echo "/$subsubdir $attrname" >> $nameslist
echo "/$fileX $attrname" >> $nameslist
cmp $nameslist $getfile
if [ $? != 0 ]; then
Modified: gfarm_v2/trunk/regress/gftool/gfxattr/gfxattr-perm-normal.sh
===================================================================
--- gfarm_v2/trunk/regress/gftool/gfxattr/gfxattr-perm-normal.sh 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/regress/gftool/gfxattr/gfxattr-perm-normal.sh 2009-03-25 10:03:42 UTC (rev 4133)
@@ -32,7 +32,7 @@
# normal xattr perm test - 3
{
- gfxattr -l $target $attrname
+ gfxattr -l $target
if [ $? != 0 ]; then
exit $exit_fail
fi
@@ -74,7 +74,7 @@
# normal xattr perm test - 7
{
- gfxattr -l $target $attrname
+ gfxattr -l $target
if [ $? == 0 ]; then
# msut fail
exit $exit_fail
Modified: gfarm_v2/trunk/regress/gftool/gfxattr/gfxattr-perm-xml.sh
===================================================================
--- gfarm_v2/trunk/regress/gftool/gfxattr/gfxattr-perm-xml.sh 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/regress/gftool/gfxattr/gfxattr-perm-xml.sh 2009-03-25 10:03:42 UTC (rev 4133)
@@ -32,7 +32,7 @@
# xml xattr perm test - 3
{
- gfxattr -lx $target $attrname
+ gfxattr -lx $target
if [ $? != 0 ]; then
exit $exit_fail
fi
@@ -74,7 +74,7 @@
# xml xattr perm test - 7
{
- gfxattr -lx $target $attrname
+ gfxattr -lx $target
if [ $? == 0 ]; then
# msut fail
exit $exit_fail
Modified: gfarm_v2/trunk/server/gfmd/db_access.c
===================================================================
--- gfarm_v2/trunk/server/gfmd/db_access.c 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/server/gfmd/db_access.c 2009-03-25 10:03:42 UTC (rev 4133)
@@ -20,21 +20,17 @@
#define ALIGN(offset) (((offset) + ALIGNMENT - 1) & ~(ALIGNMENT - 1))
typedef void (*dbq_entry_func_t)(void *);
-typedef gfarm_error_t (*dbq_entry_sync_func_t)(void *);
+typedef gfarm_error_t (*dbq_entry_func_witherr_t)(void *);
+typedef void (*dbq_entry_func_callback_t)(gfarm_error_t, void *);
struct dbq_entry {
dbq_entry_func_t func;
void *data;
+ dbq_entry_func_witherr_t funcwitherr;
+ dbq_entry_func_callback_t callback;
+ void *cbdata;
};
-struct dbq_entry_sync {
- pthread_mutex_t lock;
- pthread_cond_t cond;
- dbq_entry_sync_func_t func;
- void *data;
- gfarm_error_t e; // return value of func(data)
-};
-
#define DBQ_SIZE 1000
struct dbq {
@@ -93,8 +89,10 @@
return (GFARM_ERR_NO_ERROR);
}
-gfarm_error_t
-dbq_enter(struct dbq *q, dbq_entry_func_t func, void *data)
+static gfarm_error_t
+dbq_enter_common(struct dbq *q, dbq_entry_func_t func,
+ void *data, dbq_entry_func_witherr_t func_witherr,
+ dbq_entry_func_callback_t func_callback, void *callbackdata)
{
int err;
gfarm_error_t e;
@@ -124,6 +122,9 @@
}
q->entries[q->in].func = func;
q->entries[q->in].data = data;
+ q->entries[q->in].funcwitherr = func_witherr;
+ q->entries[q->in].callback = func_callback;
+ q->entries[q->in].cbdata = callbackdata;
q->in++;
if (q->in >= DBQ_SIZE)
q->in = 0;
@@ -139,63 +140,90 @@
return (e);
}
+gfarm_error_t
+dbq_enter(struct dbq *q, dbq_entry_func_t func, void *data)
+{
+ return dbq_enter_common(q, func, data, NULL, NULL, NULL);
+}
+
+static gfarm_error_t
+dbq_enter_withcallback(struct dbq *q,
+ dbq_entry_func_witherr_t func_witherr, void *data,
+ dbq_entry_func_callback_t func_callback, void *callbackdata)
+{
+ return dbq_enter_common(q, NULL, data,
+ func_witherr, func_callback, callbackdata);
+}
+
+#define UNINITIALIZED_GFARM_ERROR (-1)
+
void
-call_func_and_wait(void *d)
+db_waitctx_init(struct db_waitctx *ctx)
{
- struct dbq_entry_sync *entry = (struct dbq_entry_sync *)d;
- dbq_entry_sync_func_t func;
- void *data;
- gfarm_error_t e;
+ int err;
+ char *msg = "db_waitctx_init";
- pthread_mutex_lock(&entry->lock);
- func = entry->func;
- data = entry->data;
- pthread_mutex_unlock(&entry->lock);
+ if (ctx != NULL) {
+ if ((err = pthread_mutex_init(&ctx->lock, NULL)) != 0)
+ gflog_fatal("%s: mutex: %s", msg, strerror(err));
+ if ((err = pthread_cond_init(&ctx->cond, NULL)) != 0)
+ gflog_fatal("%s: cond: %s", msg, strerror(err));
+ ctx->e = UNINITIALIZED_GFARM_ERROR;
+ }
+}
- e = func(data);
+void
+db_waitctx_fini(struct db_waitctx *ctx)
+{
+ if (ctx != NULL) {
+ pthread_cond_destroy(&ctx->cond);
+ pthread_mutex_destroy(&ctx->lock);
+ }
+}
- pthread_mutex_lock(&entry->lock);
- entry->e = e;
- pthread_cond_signal(&entry->cond);
- pthread_mutex_unlock(&entry->lock);
+static void
+dbq_done_callback(gfarm_error_t e, void *c)
+{
+ struct db_waitctx *ctx = (struct db_waitctx *)c;
+
+ if (ctx != NULL) {
+ pthread_mutex_lock(&ctx->lock);
+ ctx->e = e;
+ pthread_cond_signal(&ctx->cond);
+ pthread_mutex_unlock(&ctx->lock);
+ }
}
gfarm_error_t
-dbq_enter_sync(struct dbq *q, dbq_entry_sync_func_t func, void *data)
+dbq_waitret(struct db_waitctx *ctx)
{
int err;
gfarm_error_t e;
- const char msg[] = "dbq_enter_sync";
- struct dbq_entry_sync *entry;
- entry = malloc(sizeof(*entry));
- if (entry == NULL)
- return GFARM_ERR_NO_MEMORY;
+ if (ctx == NULL)
+ return GFARM_ERR_NO_ERROR;
- err = pthread_mutex_init(&entry->lock, NULL);
- if (err != 0)
- gflog_fatal("%s: mutex: %s", msg, strerror(err));
- err = pthread_cond_init(&entry->cond, NULL);
- if (err != 0)
- gflog_fatal("%s: cond: %s", msg, strerror(err));
- entry->func = func;
- entry->data = data;
- entry->e = GFARM_ERR_UNKNOWN;
-
- pthread_mutex_lock(&entry->lock);
- if ((e = dbq_enter(q, call_func_and_wait, entry)) == GFARM_ERR_NO_ERROR) {
- err = pthread_cond_wait(&entry->cond, &entry->lock);
- e = (err == 0) ? entry->e : gfarm_errno_to_error(err);
+ pthread_mutex_lock(&ctx->lock);
+ while (ctx->e == UNINITIALIZED_GFARM_ERROR) {
+ err = pthread_cond_wait(&ctx->cond, &ctx->lock);
+ if (err != 0)
+ gflog_fatal("db_xattr_call_op: condwait finished: %s",
+ strerror(err));
}
- pthread_mutex_unlock(&entry->lock);
-
- pthread_cond_destroy(&entry->cond);
- pthread_mutex_destroy(&entry->lock);
- free(entry);
-
+ e = ctx->e;
+ pthread_mutex_unlock(&ctx->lock);
return e;
}
+static gfarm_error_t
+dbq_enter_for_waitret(struct dbq *q,
+ dbq_entry_func_witherr_t func_witherr, void *data,
+ struct db_waitctx *ctx)
+{
+ return dbq_enter_withcallback(q, func_witherr, data,
+ dbq_done_callback, ctx);
+}
+
gfarm_error_t
dbq_delete(struct dbq *q, struct dbq_entry *entp)
{
@@ -238,6 +266,21 @@
return (e);
}
+int
+db_getfreenum(void)
+{
+ struct dbq *q = &dbq;
+ int freenum;
+
+ /*
+ * This function is made only for gfm_server_findxmlattr().
+ */
+ pthread_mutex_lock(&q->mutex);
+ freenum = (DBQ_SIZE - q->n);
+ pthread_mutex_unlock(&q->mutex);
+ return freenum;
+}
+
static const struct db_ops *ops = &db_none_ops;
gfarm_error_t
@@ -273,7 +316,12 @@
for (;;) {
e = dbq_delete(&dbq, &ent);
if (e == GFARM_ERR_NO_ERROR)
- (*ent.func)(ent.data);
+ if (ent.func != NULL)
+ (*ent.func)(ent.data);
+ else {
+ e = (*ent.funcwitherr)(ent.data);
+ (*ent.callback)(e, ent.cbdata);
+ }
else if (e == GFARM_ERR_NO_SUCH_OBJECT)
break;
}
@@ -1014,126 +1062,146 @@
return ((*ops->symlink_load)(closure, callback));
}
+static struct db_xattr_arg *
+db_xattr_arg_alloc(char *attrname, size_t valsize)
+{
+ struct db_xattr_arg *arg;
+ size_t size = sizeof(*arg) + valsize;
+
+ if (attrname != NULL) {
+ size += strlen(attrname) + 1;
+ }
+
+ arg = malloc(size);
+ if (arg == NULL)
+ return NULL;
+
+ memset(arg, 0, sizeof(*arg));
+ // NOTE: we allow valsize== 0 as valid xattr_add/modify
+ arg->value = (void *)(arg + 1);
+ if (attrname != NULL) {
+ arg->attrname = (((char *)(arg + 1)) + valsize);
+ strcpy(arg->attrname, attrname);
+ }
+ return arg;
+}
+
gfarm_error_t
-db_xattr_add(int xmlMode, gfarm_ino_t inum, const char *attrname,
- const void *value, size_t size)
+db_xattr_add(int xmlMode, gfarm_ino_t inum, char *attrname,
+ void *value, size_t size, struct db_waitctx *waitctx)
{
gfarm_error_t e;
- struct db_xattr_arg *arg = calloc(1, sizeof(*arg));
+ struct db_xattr_arg *arg = db_xattr_arg_alloc(attrname, size);
if (arg == NULL)
- return (GFARM_ERR_NO_MEMORY);
-
+ return GFARM_ERR_NO_ERROR;
arg->xmlMode = xmlMode;
arg->inum = inum;
- arg->attrname = attrname;
- arg->value = value;
+ memcpy(arg->value, value, size);
arg->size = size;
-
- e = dbq_enter_sync(&dbq,
- (dbq_entry_sync_func_t)ops->xattr_add, arg);
- free(arg);
+ if (waitctx != NULL) {
+ /*
+ * NOTE: EINVAL returns from PostgreSQL if value is
+ * invalid XML data. We must wait to check it.
+ * Same as db_xattr_modify().
+ */
+ e = dbq_enter_for_waitret(&dbq,
+ (dbq_entry_func_witherr_t)ops->xattr_add, arg, waitctx);
+ } else
+ e = dbq_enter(&dbq,
+ (dbq_entry_func_t)ops->xattr_add, arg);
return e;
}
gfarm_error_t
-db_xattr_modify(int xmlMode, gfarm_ino_t inum, const char *attrname,
- const void *value, size_t size)
+db_xattr_modify(int xmlMode, gfarm_ino_t inum, char *attrname,
+ void *value, size_t size, struct db_waitctx *waitctx)
{
gfarm_error_t e;
- struct db_xattr_arg *arg = calloc(1, sizeof(*arg));
+ struct db_xattr_arg *arg = db_xattr_arg_alloc(attrname, size);
if (arg == NULL)
- return (GFARM_ERR_NO_MEMORY);
-
+ return GFARM_ERR_NO_ERROR;
arg->xmlMode = xmlMode;
arg->inum = inum;
- arg->attrname = attrname;
- arg->value = value;
+ memcpy(arg->value, value, size);
arg->size = size;
-
- e = dbq_enter_sync(&dbq,
- (dbq_entry_sync_func_t)ops->xattr_modify, arg);
- free(arg);
+ if (waitctx != NULL)
+ e = dbq_enter_for_waitret(&dbq,
+ (dbq_entry_func_witherr_t)ops->xattr_modify, arg, waitctx);
+ else
+ e = dbq_enter(&dbq,
+ (dbq_entry_func_t)ops->xattr_modify, arg);
return e;
}
gfarm_error_t
-db_xattr_remove(int xmlMode, gfarm_ino_t inum, const char *attrname)
+db_xattr_remove(int xmlMode, gfarm_ino_t inum, char *attrname)
{
- gfarm_error_t e;
- struct db_xattr_arg *arg = calloc(1, sizeof(*arg));
+ struct db_xattr_arg *arg = db_xattr_arg_alloc(attrname, 0);
if (arg == NULL)
- return (GFARM_ERR_NO_MEMORY);
-
+ return GFARM_ERR_NO_ERROR;
arg->xmlMode = xmlMode;
arg->inum = inum;
- arg->attrname = attrname;
-
- e = dbq_enter_sync(&dbq,
- (dbq_entry_sync_func_t)ops->xattr_remove, arg);
- free(arg);
- return e;
+ return dbq_enter(&dbq,
+ (dbq_entry_func_t)ops->xattr_remove, arg);
}
gfarm_error_t
-db_xattr_load(int xmlMode, gfarm_ino_t inum, const char *attrname, void **valuep, size_t *sizep)
+db_xattr_get(int xmlMode, gfarm_ino_t inum, char *attrname,
+ void **valuep, size_t *sizep, struct db_waitctx *waitctx)
{
- gfarm_error_t e;
- struct db_xattr_arg *arg = calloc(1, sizeof(*arg));
-
+ struct db_xattr_arg *arg = db_xattr_arg_alloc(attrname, 0);
if (arg == NULL)
- return (GFARM_ERR_NO_MEMORY);
-
+ return GFARM_ERR_NO_ERROR;
arg->xmlMode = xmlMode;
arg->inum = inum;
- arg->attrname = attrname;
arg->valuep = valuep;
arg->sizep = sizep;
-
- e = dbq_enter_sync(&dbq,
- (dbq_entry_sync_func_t)ops->xattr_load, arg);
- free(arg);
- return e;
+ return dbq_enter_for_waitret(&dbq,
+ (dbq_entry_func_witherr_t)ops->xattr_get, arg, waitctx);
}
gfarm_error_t
-db_xattr_list(int xmlMode, gfarm_ino_t inum, void **valuep, size_t *sizep)
+db_xattr_list(int xmlMode, gfarm_ino_t inum, void **valuep, size_t *sizep,
+ struct db_waitctx *waitctx)
{
- gfarm_error_t e;
- struct db_xattr_arg *arg = calloc(1, sizeof(*arg));
+ struct db_xattr_arg *arg = db_xattr_arg_alloc(NULL, 0);
if (arg == NULL)
- return (GFARM_ERR_NO_MEMORY);
-
+ return GFARM_ERR_NO_ERROR;
arg->xmlMode = xmlMode;
arg->inum = inum;
arg->valuep = valuep;
arg->sizep = sizep;
+ return dbq_enter_for_waitret(&dbq,
+ (dbq_entry_func_witherr_t)ops->xattr_list, arg, waitctx);
+}
- e = dbq_enter_sync(&dbq,
- (dbq_entry_sync_func_t)ops->xattr_list, arg);
- free(arg);
- return e;
+gfarm_error_t
+db_xattr_load(void *closure,
+ void (*callback)(void *, struct xattr_info *))
+{
+ return ((*ops->xattr_load)(closure, callback));
}
gfarm_error_t
-db_xattr_find(gfarm_ino_t inum, const char *expr,
- int *nfound, struct xattr_list_info **entries)
+db_xmlattr_find(gfarm_ino_t inum, const char *expr,
+ gfarm_error_t (*foundcallback)(void *, int, void *), void *foundcbdata,
+ void (*callback)(gfarm_error_t, void *), void *cbdata)
{
- gfarm_error_t e;
- struct db_xmlattr_find_arg *arg = malloc(sizeof(*arg));
+ struct db_xmlattr_find_arg *arg;
+ GFARM_MALLOC(arg);
if (arg == NULL)
- return (GFARM_ERR_NO_MEMORY);
+ return GFARM_ERR_NO_ERROR;
arg->inum = inum;
arg->expr = expr;
- arg->nfound = nfound;
- arg->entries = entries;
- e = dbq_enter_sync(&dbq,
- (dbq_entry_sync_func_t)ops->xmlattr_find, arg);
- free(arg);
- return e;
+ arg->foundcallback = foundcallback;
+ arg->foundcbdata = foundcbdata;
+ return dbq_enter_withcallback(&dbq,
+ (dbq_entry_func_witherr_t)ops->xmlattr_find, arg,
+ (dbq_entry_func_callback_t)callback, cbdata);
}
Modified: gfarm_v2/trunk/server/gfmd/db_access.h
===================================================================
--- gfarm_v2/trunk/server/gfmd/db_access.h 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/server/gfmd/db_access.h 2009-03-25 10:03:42 UTC (rev 4133)
@@ -7,6 +7,7 @@
gfarm_error_t db_initialize(void);
gfarm_error_t db_terminate(void);
void *db_thread(void *);
+int db_getfreenum(void);
#if 0 /* XXX for now */
gfarm_error_t db_begin(void);
@@ -83,13 +84,22 @@
gfarm_error_t db_symlink_remove(gfarm_ino_t);
gfarm_error_t db_symlink_load(void *, void (*)(void *, gfarm_ino_t, char *));
-struct xattr_list_info;
-gfarm_error_t db_xattr_add(int, gfarm_ino_t, const char *, const void *, size_t);
-gfarm_error_t db_xattr_modify(int, gfarm_ino_t, const char *, const void *, size_t);
-gfarm_error_t db_xattr_remove(int, gfarm_ino_t, const char *);
-gfarm_error_t db_xattr_load(int, gfarm_ino_t, const char *, void **, size_t *);
-gfarm_error_t db_xattr_list(int, gfarm_ino_t, void **, size_t *);
-gfarm_error_t db_xattr_find(gfarm_ino_t, const char *, int *, struct xattr_list_info **);
+struct db_waitctx;
+struct xattr_info;
+gfarm_error_t db_xattr_add(int, gfarm_ino_t, char *, void *, size_t,
+ struct db_waitctx *);
+gfarm_error_t db_xattr_modify(int, gfarm_ino_t, char *, void *, size_t,
+ struct db_waitctx *);
+gfarm_error_t db_xattr_remove(int, gfarm_ino_t, char *);
+gfarm_error_t db_xattr_get(int, gfarm_ino_t, char *, void **, size_t *,
+ struct db_waitctx *);
+gfarm_error_t db_xattr_list(int, gfarm_ino_t, void **, size_t *,
+ struct db_waitctx *);
+gfarm_error_t db_xattr_load(void *closure,
+ void (*callback)(void *, struct xattr_info *));
+gfarm_error_t db_xmlattr_find(gfarm_ino_t, const char *,
+ gfarm_error_t (*foundcallback)(void *, int, void *), void *,
+ void (*callback)(gfarm_error_t, void *), void *);
/* external interface to select metadb backend type */
@@ -97,3 +107,14 @@
gfarm_error_t db_use(const struct db_ops *);
extern const struct db_ops db_none_ops, db_ldap_ops, db_pgsql_ops;
+
+
+struct db_waitctx {
+ pthread_mutex_t lock;
+ pthread_cond_t cond;
+ gfarm_error_t e;
+};
+
+void db_waitctx_init(struct db_waitctx *);
+void db_waitctx_fini(struct db_waitctx *);
+gfarm_error_t dbq_waitret(struct db_waitctx *);
Modified: gfarm_v2/trunk/server/gfmd/db_ldap.c
===================================================================
--- gfarm_v2/trunk/server/gfmd/db_ldap.c 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/server/gfmd/db_ldap.c 2009-03-25 10:03:42 UTC (rev 4133)
@@ -552,7 +552,8 @@
char *src, *dst, *last;
chlen = (size > 0) ? 2 * size + 1 : 2;
- if ((chdata = malloc(chlen)) == NULL)
+ GFARM_MALLOC_ARRAY(chdata, chlen);
+ if (chdata == NULL)
return NULL;
if (size > 0) {
@@ -580,7 +581,7 @@
static void *
hextext2binary(char *chdata, int *size)
{
- void *data;
+ char *data;
int chlen = strlen(chdata);
int allocsize;
char *src, *dst, *last, v[3];
@@ -593,7 +594,8 @@
chlen = 0;
allocsize = 1; // malloc(0) may returns NULL or !NULL
}
- if ((data = malloc(allocsize)) == NULL)
+ GFARM_MALLOC_ARRAY(data, allocsize);
+ if (data == NULL)
return NULL;
src = chdata;
@@ -940,14 +942,15 @@
#endif /* not used */
static gfarm_error_t
-gfarm_ldap_generic_info_get_foreach(
+gfarm_ldap_generic_info_get_foreach_withattrs(
char *dn,
int scope, /* LDAP_SCOPE_ONELEVEL or LDAP_SCOPE_SUBTREE */
char *query,
void *tmp_info, /* just used as a work area */
void (*callback)(void *, void *),
void *closure,
- const struct gfarm_ldap_generic_info_ops *ops)
+ const struct gfarm_ldap_generic_info_ops *ops,
+ char *attrs[])
{
LDAPMessage *res, *e;
int i, msgid, rv;
@@ -956,7 +959,7 @@
char **vals;
/* search for entries asynchronously */
- msgid = ldap_search(gfarm_ldap_server, dn, scope, query, NULL, 0);
+ msgid = ldap_search(gfarm_ldap_server, dn, scope, query, attrs, 0);
if (msgid == -1) {
gflog_error("ldap_search(%s) - for each", dn);
return (GFARM_ERR_UNKNOWN);
@@ -1017,6 +1020,21 @@
return (GFARM_ERR_NO_ERROR);
}
+static gfarm_error_t
+gfarm_ldap_generic_info_get_foreach(
+ char *dn,
+ int scope, /* LDAP_SCOPE_ONELEVEL or LDAP_SCOPE_SUBTREE */
+ char *query,
+ void *tmp_info, /* just used as a work area */
+ void (*callback)(void *, void *),
+ void *closure,
+ const struct gfarm_ldap_generic_info_ops *ops)
+{
+ return gfarm_ldap_generic_info_get_foreach_withattrs(
+ dn, scope, query, tmp_info,
+ callback, closure, ops, NULL);
+}
+
/**********************************************************************/
static char *gfarm_ldap_host_info_make_dn(void *vkey);
@@ -2429,37 +2447,52 @@
/**********************************************************************/
-static char *gfarm_ldap_xattr_load_info_make_dn(void *vkey);
+static char *gfarm_ldap_xattr_info_make_dn(void *vkey);
+static void gfarm_ldap_db_xattr_set_field(void *vinfo,
+ char *attribute, char **vals);
-static const struct gfarm_ldap_generic_info_ops gfarm_ldap_xattr_load_ops = {
- &gfarm_base_xattr_load_ops,
- NULL,
+static const struct gfarm_ldap_generic_info_ops gfarm_ldap_xattr_info_ops = {
+ &gfarm_base_xattr_info_ops,
+ "(objectclass=XAttr)",
"attrname=%s, inumber=%" GFARM_PRId64 ", %s",
- gfarm_ldap_xattr_load_info_make_dn,
- NULL,
+ gfarm_ldap_xattr_info_make_dn,
+ gfarm_ldap_db_xattr_set_field,
};
-struct gfarm_ldap_xattr_load_info_key {
+struct gfarm_ldap_xattr_get_info_key {
gfarm_ino_t inumber;
- int xmlMode;
const char *attrname;
};
static char *
-gfarm_ldap_xattr_load_info_make_dn(void *vkey)
+gfarm_ldap_xattr_info_make_dn(void *vkey)
{
- struct gfarm_ldap_xattr_load_info_key *key = vkey;
+ struct gfarm_ldap_xattr_get_info_key *key = vkey;
char *dn;
- GFARM_MALLOC_ARRAY(dn, strlen(gfarm_ldap_xattr_load_ops.dn_template) +
- strlen(key->attrname) + INT64STRLEN + strlen(gfarm_ldap_base_dn) + 1);
+ GFARM_MALLOC_ARRAY(dn, strlen(gfarm_ldap_xattr_info_ops.dn_template) +
+ strlen(key->attrname) + INT64STRLEN
+ + strlen(gfarm_ldap_base_dn) + 1);
if (dn == NULL)
return (NULL);
- sprintf(dn, gfarm_ldap_xattr_load_ops.dn_template,
+ sprintf(dn, gfarm_ldap_xattr_info_ops.dn_template,
key->attrname, key->inumber, gfarm_ldap_base_dn);
return (dn);
}
+static void
+gfarm_ldap_db_xattr_set_field(void *vinfo, char *attribute, char **vals)
+{
+ struct xattr_info *info = vinfo;
+
+ if (strcasecmp(attribute, "inumber") == 0) {
+ info->inum = gfarm_strtoi64(vals[0], NULL);
+ } else if (strcasecmp(attribute, "attrname") == 0) {
+ info->attrname = strdup(vals[0]);
+ info->namelen = strlen(info->attrname) + 1; // include '\0'
+ }
+}
+
static gfarm_error_t
gfarm_ldap_xattr_update(
struct db_xattr_arg *arg,
@@ -2472,7 +2505,7 @@
LDAPMod *modv[5];
struct ldap_string_modify storage[ARRAY_LENGTH(modv) - 1];
char ino_string[INT64STRLEN + 1];
- struct gfarm_ldap_xattr_load_info_key key;
+ struct gfarm_ldap_xattr_get_info_key key;
char *hextext;
if (arg->xmlMode)
@@ -2483,7 +2516,6 @@
return GFARM_ERR_NO_MEMORY;
key.inumber = arg->inum;
- key.xmlMode = arg->xmlMode;
key.attrname = arg->attrname;
sprintf(ino_string, "%" GFARM_PRId64, arg->inum);
@@ -2504,7 +2536,7 @@
modv[i++] = NULL;
assert(i == ARRAY_LENGTH(modv));
- e = ((*update_op)(&key, modv, &gfarm_ldap_xattr_load_ops));
+ e = ((*update_op)(&key, modv, &gfarm_ldap_xattr_info_ops));
free(hextext);
return e;
}
@@ -2512,41 +2544,42 @@
static gfarm_error_t
gfarm_ldap_xattr_add(struct db_xattr_arg *arg)
{
- return gfarm_ldap_xattr_update(arg,
+ gfarm_error_t e;
+ e = gfarm_ldap_xattr_update(arg,
LDAP_MOD_ADD, gfarm_ldap_generic_info_add);
+ free(arg);
+ return e;
}
static gfarm_error_t
gfarm_ldap_xattr_modify(struct db_xattr_arg *arg)
{
- return gfarm_ldap_xattr_update(arg,
+ gfarm_error_t e;
+ e = gfarm_ldap_xattr_update(arg,
LDAP_MOD_REPLACE, gfarm_ldap_generic_info_modify);
+ free(arg);
+ return e;
}
static gfarm_error_t
gfarm_ldap_xattr_remove(struct db_xattr_arg *arg)
{
- struct gfarm_ldap_xattr_load_info_key key;
+ gfarm_error_t e;
+ struct gfarm_ldap_xattr_get_info_key key;
- if (arg->attrname == NULL) {
- // NOTE: gfarm_pgsql_xattr_remove() deletes
- // all xattrs if attrname==NULL.
- // see gfm_remove_all_xattrs().
- return GFARM_ERR_OPERATION_NOT_SUPPORTED;
- }
-
if (arg->xmlMode)
return GFARM_ERR_OPERATION_NOT_SUPPORTED;
key.inumber = arg->inum;
- key.xmlMode = arg->xmlMode;
key.attrname = arg->attrname;
- return gfarm_ldap_generic_info_remove(&key, &gfarm_ldap_xattr_load_ops);
+ e = gfarm_ldap_generic_info_remove(&key, &gfarm_ldap_xattr_info_ops);
+ free(arg);
+ return e;
}
static gfarm_error_t
-gfarm_ldap_xattr_load(struct db_xattr_arg *arg)
+gfarm_ldap_xattr_get(struct db_xattr_arg *arg)
{
gfarm_error_t e;
int rv, cnt, sz;
@@ -2557,12 +2590,16 @@
struct berval **vals;
void *bindata;
- if (arg->xmlMode)
- return GFARM_ERR_OPERATION_NOT_SUPPORTED;
+ if (arg->xmlMode) {
+ e = GFARM_ERR_OPERATION_NOT_SUPPORTED;
+ goto quit;
+ }
- query_type = malloc(64 + strlen(arg->attrname));
- if (query_type == NULL)
- return GFARM_ERR_NO_MEMORY;
+ GFARM_MALLOC_ARRAY(query_type, 64 + INT64STRLEN + strlen(arg->attrname));
+ if (query_type == NULL) {
+ e = GFARM_ERR_NO_MEMORY;
+ goto quit;
+ }
sprintf(query_type,
"(&(objectclass=XAttr)(inumber=%" GFARM_PRId64 ")(attrname=%s))",
@@ -2570,10 +2607,13 @@
rv = ldap_search_st(gfarm_ldap_server, gfarm_ldap_base_dn,
LDAP_SCOPE_SUB, query_type, attrs, 0, &tout, &res);
free(query_type);
- if (rv == LDAP_NO_SUCH_OBJECT)
- return GFARM_ERR_NO_SUCH_OBJECT;
- else if ((rv != LDAP_SUCCESS) || (res == NULL))
- return GFARM_ERR_UNKNOWN;
+ if (rv == LDAP_NO_SUCH_OBJECT) {
+ e = GFARM_ERR_NO_SUCH_OBJECT;
+ goto quit;
+ } else if ((rv != LDAP_SUCCESS) || (res == NULL)) {
+ e = GFARM_ERR_UNKNOWN;
+ goto quit;
+ }
cnt = ldap_count_messages(gfarm_ldap_server, res);
if (cnt <= 1) {
@@ -2600,10 +2640,29 @@
ldap_value_free_len(vals);
}
ldap_msgfree(res);
-
+quit:
+ free(arg);
return e;
}
+gfarm_error_t
+gfarm_ldap_xattr_load(void *closure,
+ void (*callback)(void *, struct xattr_info *))
+{
+ struct xattr_info tmp_info;
+ char *attrs[] = { "inumber", "attrname", NULL };
+
+ /*
+ * NOTE: Without attrs, attrvalue will be loaded also.
+ * It's needless for initial loading.
+ */
+ return (gfarm_ldap_generic_info_get_foreach_withattrs(
+ gfarm_ldap_base_dn,
+ LDAP_SCOPE_SUBTREE, gfarm_ldap_xattr_info_ops.query_type,
+ &tmp_info, (void (*)(void *, void *))callback, closure,
+ &gfarm_ldap_xattr_info_ops, attrs));
+}
+
static gfarm_error_t
gfarm_ldap_xattr_list(struct db_xattr_arg *arg)
{
@@ -2621,12 +2680,14 @@
*arg->sizep = 0;
*arg->valuep = NULL;
- if (arg->xmlMode)
- return GFARM_ERR_OPERATION_NOT_SUPPORTED;
+ if (arg->xmlMode) {
+ e = GFARM_ERR_OPERATION_NOT_SUPPORTED;
+ goto quit;
+ }
snprintf(query_type, sizeof(query_type),
- "(&(objectclass=XAttr)(inumber=%" GFARM_PRId64 "))",
- arg->inum);
+ "(&(objectclass=XAttr)(inumber=%" GFARM_PRId64 "))",
+ arg->inum);
rv = ldap_search_st(gfarm_ldap_server, gfarm_ldap_base_dn,
LDAP_SCOPE_SUB, query_type, attrs, 0, &tout, &res);
if (rv == LDAP_NO_SUCH_OBJECT)
@@ -2637,7 +2698,7 @@
e = GFARM_ERR_NO_SUCH_OBJECT;
if (e != GFARM_ERR_NO_ERROR) {
ldap_msgfree(res);
- return e;
+ goto quit;
}
m = ldap_first_message(gfarm_ldap_server, res);
@@ -2652,10 +2713,11 @@
m = ldap_next_entry(gfarm_ldap_server, m);
}
- value = malloc(size);
+ GFARM_MALLOC_ARRAY(value, size);
if (value == NULL) {
ldap_msgfree(res);
- return GFARM_ERR_NO_MEMORY;
+ e = GFARM_ERR_NO_MEMORY;
+ goto quit;
}
p = value;
@@ -2678,13 +2740,15 @@
*arg->sizep = size;
*arg->valuep = value;
-
+quit:
+ free(arg);
return GFARM_ERR_NO_ERROR;
}
static gfarm_error_t
gfarm_ldap_xmlattr_find(struct db_xmlattr_find_arg *arg)
{
+ free(arg);
return GFARM_ERR_OPERATION_NOT_SUPPORTED;
}
@@ -2747,7 +2811,8 @@
gfarm_ldap_xattr_add,
gfarm_ldap_xattr_modify,
gfarm_ldap_xattr_remove,
+ gfarm_ldap_xattr_get,
+ gfarm_ldap_xattr_list,
gfarm_ldap_xattr_load,
- gfarm_ldap_xattr_list,
gfarm_ldap_xmlattr_find,
};
Modified: gfarm_v2/trunk/server/gfmd/db_none.c
===================================================================
--- gfarm_v2/trunk/server/gfmd/db_none.c 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/server/gfmd/db_none.c 2009-03-25 10:03:42 UTC (rev 4133)
@@ -254,36 +254,49 @@
static gfarm_error_t
gfarm_none_xattr_add(struct db_xattr_arg *arg)
{
+ free(arg);
return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
static gfarm_error_t
gfarm_none_xattr_modify(struct db_xattr_arg *arg)
{
+ free(arg);
return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
static gfarm_error_t
gfarm_none_xattr_remove(struct db_xattr_arg *arg)
{
+ free(arg);
return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
static gfarm_error_t
-gfarm_none_xattr_load(struct db_xattr_arg *arg)
+gfarm_none_xattr_get(struct db_xattr_arg *arg)
{
+ free(arg);
return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
static gfarm_error_t
gfarm_none_xattr_list(struct db_xattr_arg *arg)
{
+ free(arg);
return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
+gfarm_error_t
+gfarm_none_xattr_load(void *closure,
+ void (*callback)(void *, struct xattr_info *))
+{
+ return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
+}
+
static gfarm_error_t
gfarm_none_xmlattr_find(struct db_xmlattr_find_arg *arg)
{
+ free(arg);
return (GFARM_ERR_OPERATION_NOT_SUPPORTED);
}
@@ -346,7 +359,8 @@
gfarm_none_xattr_add,
gfarm_none_xattr_modify,
gfarm_none_xattr_remove,
+ gfarm_none_xattr_get,
+ gfarm_none_xattr_list,
gfarm_none_xattr_load,
- gfarm_none_xattr_list,
gfarm_none_xmlattr_find,
};
Modified: gfarm_v2/trunk/server/gfmd/db_ops.h
===================================================================
--- gfarm_v2/trunk/server/gfmd/db_ops.h 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/server/gfmd/db_ops.h 2009-03-25 10:03:42 UTC (rev 4133)
@@ -93,9 +93,9 @@
struct db_xattr_arg {
int xmlMode;
gfarm_ino_t inum;
- const char *attrname;
+ char *attrname;
// to set
- const void *value;
+ void *value;
size_t size;
// to get
void **valuep;
@@ -105,11 +105,11 @@
struct db_xmlattr_find_arg {
gfarm_ino_t inum;
const char *expr;
- int *nfound;
- struct xattr_list_info **entries;
+ gfarm_error_t (*foundcallback)(void *,int, void *);
+ void *foundcbdata;
};
-struct xattr_list_info;
+struct xattr_info;
struct db_ops {
gfarm_error_t (*initialize)(void);
@@ -176,7 +176,9 @@
gfarm_error_t (*xattr_add)(struct db_xattr_arg *);
gfarm_error_t (*xattr_modify)(struct db_xattr_arg *);
gfarm_error_t (*xattr_remove)(struct db_xattr_arg *);
- gfarm_error_t (*xattr_load)(struct db_xattr_arg *);
+ gfarm_error_t (*xattr_get)(struct db_xattr_arg *);
gfarm_error_t (*xattr_list)(struct db_xattr_arg *);
+ gfarm_error_t (*xattr_load)(void *,
+ void (*)(void *, struct xattr_info *));
gfarm_error_t (*xmlattr_find)(struct db_xmlattr_find_arg *);
};
Modified: gfarm_v2/trunk/server/gfmd/db_pgsql.c
===================================================================
--- gfarm_v2/trunk/server/gfmd/db_pgsql.c 2009-03-25 08:28:20 UTC (rev 4132)
+++ gfarm_v2/trunk/server/gfmd/db_pgsql.c 2009-03-25 10:03:42 UTC (rev 4133)
@@ -213,7 +213,8 @@
pgsql_get_binary(PGresult *res, int row, const char *field_name, int *size)
{
int col;
- void *src, *dst;
+ void *src;
+ char *dst;
col = PQfnumber(res, field_name);
if ((*size = PQgetlength(res, row, col)) <= 0) {
@@ -222,9 +223,9 @@
if ((src = PQgetvalue(res, row, col)) == NULL) {
return NULL;
}
- if ((dst = malloc(*size)) != NULL) {
+ GFARM_MALLOC_ARRAY(dst, *size);
+ if (dst != NULL)
memcpy(dst, src, *size);
- }
return dst;
}
@@ -2054,11 +2055,13 @@
paramFormats[1] = 0;
if (arg->xmlMode) {
- command = "INSERT INTO XmlAttr (inumber, attrname, attrvalue) VALUES ($1, $2, $3)";
+ command = "INSERT INTO XmlAttr (inumber, attrname, attrvalue) "
+ "VALUES ($1, $2, $3)";
diag = "pgsql_xmlattr_set";
paramFormats[2] = 0; // as text
} else {
- command = "INSERT INTO XAttr (inumber, attrname, attrvalue) VALUES ($1, $2, $3)";
+ command = "INSERT INTO XAttr (inumber, attrname, attrvalue) "
+ "VALUES ($1, $2, $3)";
diag = "pgsql_xattr_set";
paramFormats[2] = 1; // as binary
}
@@ -2072,6 +2075,7 @@
0, /* ask for text results */
diag);
+ free(arg);
return e;
}
@@ -2097,11 +2101,13 @@
paramFormats[1] = 0;
if (arg->xmlMode) {
- command = "UPDATE XmlAttr SET attrvalue = $3 WHERE inumber = $1 and attrname=$2";
+ command = "UPDATE XmlAttr SET attrvalue = $3 "
+ "WHERE inumber = $1 and attrname=$2";
diag = "pgsql_xmlattr_modify";
paramFormats[2] = 0; // as text
} else {
- command = "UPDATE XAttr SET attrvalue = $3 WHERE inumber = $1 and attrname=$2";
+ command = "UPDATE XAttr SET attrvalue = $3 "
+ "WHERE inumber = $1 and attrname=$2";
diag = "pgsql_xattr_modify";
paramFormats[2] = 1; // as binary
}
@@ -2115,6 +2121,7 @@
0, /* ask for text results */
diag);
+ free(arg);
return e;
}
@@ -2130,27 +2137,16 @@
sprintf(inumber, "%" GFARM_PRId64, arg->inum);
paramValues[0] = inumber;
-
- if (arg->attrname != NULL) {
- paramValues[1] = arg->attrname;
- paramNum = 2;
- if (arg->xmlMode) {
- command = "DELETE FROM XmlAttr WHERE inumber = $1 AND attrname = $2";
- diag = "pgsql_xmlattr_remove";
- } else {
- command = "DELETE FROM XAttr WHERE inumber = $1 AND attrname = $2";
- diag = "pgsql_xattr_remove";
- }
+ paramValues[1] = arg->attrname;
+ paramNum = 2;
+ if (arg->xmlMode) {
+ command = "DELETE FROM XmlAttr "
+ "WHERE inumber = $1 AND attrname = $2";
+ diag = "pgsql_xmlattr_remove";
} else {
- paramValues[1] = NULL;
- paramNum = 1;
- if (arg->xmlMode) {
- command = "DELETE FROM XmlAttr WHERE inumber = $1";
- diag = "pgsql_xmlattr_remove_all";
- } else {
- command = "DELETE FROM XAttr WHERE inumber = $1";
- diag = "pgsql_xattr_remove_all";
- }
+ command = "DELETE FROM XAttr "
+ "WHERE inumber = $1 AND attrname = $2";
+ diag = "pgsql_xattr_remove";
}
e = gfarm_pgsql_update_or_delete_with_retry(
command,
@@ -2162,67 +2158,88 @@
0, /* ask for text results */
diag);
+ free(arg);
return e;
}
static gfarm_error_t
-pgsql_xattr_load(PGresult *res, int row, void *vinfo)
+pgsql_xattr_set_attrvalue_string(PGresult *res, int row, void *vinfo)
{
- struct xattr_load_info *info = vinfo;
+ struct xattr_info *info = vinfo;
- info->value = pgsql_get_binary(res, row, "attrvalue", &info->size);
- return (GFARM_ERR_NO_ERROR);
+ info->attrvalue = pgsql_get_string(res, row, "attrvalue");
+ if (info->attrvalue != NULL) {
+ // include '\0' in attrsize
+ info->attrsize = strlen(info->attrvalue) + 1;
+ return (GFARM_ERR_NO_ERROR);
+ } else {
+ info->attrsize = 0;
+ return (GFARM_ERR_NO_MEMORY);
+ }
}
static gfarm_error_t
-gfarm_pgsql_xattr_load(struct db_xattr_arg *arg)
+pgsql_xattr_set_attrvalue_binary(PGresult *res, int row, void *vinfo)
{
+ struct xattr_info *info = vinfo;
+
+ info->attrvalue = pgsql_get_binary(res, row,
+ "attrvalue", &info->attrsize);
+ // NOTE: we allow attrsize==0, attrvalue==NULL
+ if ((info->attrsize > 0) && (info->attrvalue == NULL))
+ return (GFARM_ERR_NO_MEMORY);
+ else
+ return (GFARM_ERR_NO_ERROR);
+}
+
+static gfarm_error_t
+gfarm_pgsql_xattr_get(struct db_xattr_arg *arg)
+{
gfarm_error_t e;
const char *paramValues[2];
char inumber[GFARM_INT64STRLEN + 1];
char *diag;
char *command;
int n;
- struct xattr_load_info *vinfo;
+ struct xattr_info *vinfo;
+ gfarm_error_t (*set_fields)(PGresult *, int, void *);
sprintf(inumber, "%" GFARM_PRId64, arg->inum);
paramValues[0] = inumber;
paramValues[1] = arg->attrname;
if (arg->xmlMode) {
- command = "SELECT attrvalue FROM XmlAttr WHERE inumber = $1 AND attrname = $2";
+ command = "SELECT attrvalue FROM XmlAttr "
+ "WHERE inumber = $1 AND attrname = $2";
diag = "pgsql_xmlattr_load";
+ set_fields = pgsql_xattr_set_attrvalue_string;
} else {
- command = "SELECT attrvalue FROM XAttr WHERE inumber = $1 AND attrname = $2";
+ command = "SELECT attrvalue FROM XAttr "
+ "WHERE inumber = $1 AND attrname = $2";
diag = "pgsql_xattr_load";
+ set_fields = pgsql_xattr_set_attrvalue_binary;
}
e = gfarm_pgsql_generic_get_all(
command,
2, paramValues,
&n, &vinfo,
- &gfarm_base_xattr_load_ops, pgsql_xattr_load,
+ &gfarm_base_xattr_info_ops, set_fields,
diag);
- if (e != GFARM_ERR_NO_ERROR)
- return (e);
- if (n != 1) {
- for (n--; n>= 0; n--) {
- gfarm_base_xattr_load_ops.free(&vinfo[n]);
- }
+ if (e == GFARM_ERR_NO_ERROR) {
+ *arg->sizep = vinfo->attrsize;
+ *arg->valuep = vinfo->attrvalue;
free(vinfo);
- return GFARM_ERR_UNKNOWN;
}
- *arg->sizep = vinfo->size;
- *arg->valuep = vinfo->value;
- free(vinfo);
- return (GFARM_ERR_NO_ERROR);
+ free(arg);
+ return e;
}
static gfarm_error_t
-pgsql_xattr_list(PGresult *res, int row, void *vinfo)
+pgsql_xattr_set_attrname(PGresult *res, int row, void *vinfo)
{
- struct xattr_list_info *info = vinfo;
+ struct xattr_info *info = vinfo;
info->attrname = pgsql_get_string(res, row, "attrname");
info->namelen = strlen(info->attrname) + 1; // include '\0'
@@ -2237,8 +2254,8 @@
char inumber[GFARM_INT64STRLEN + 1];
char *diag;
char *command;
- int i, n, len;
- struct xattr_list_info *vinfo;
+ int i, n = 0, len;
+ struct xattr_info *vinfo = NULL;
char *buffer, *p;
*arg->sizep = 0;
@@ -2259,21 +2276,26 @@
command,
1, paramValues,
&n, &vinfo,
- &gfarm_base_xattr_list_ops, pgsql_xattr_list,
+ &gfarm_base_xattr_info_ops, pgsql_xattr_set_attrname,
diag);
- if (e == GFARM_ERR_NO_SUCH_OBJECT)
- return GFARM_ERR_NO_ERROR;
+ if (e == GFARM_ERR_NO_SUCH_OBJECT) {
+ e = GFARM_ERR_NO_ERROR;
+ goto quit;
+ }
if (e != GFARM_ERR_NO_ERROR)
- return (e);
+ goto quit;
len = 0;
for (i = 0; i < n; i++) {
// NOTE: namelen including '\0'
len += vinfo[i].namelen;
}
- if ((buffer = malloc(len)) == NULL) {
- gfarm_base_xattr_list_free_array(n, vinfo);
- return GFARM_ERR_NO_MEMORY;
+ GFARM_MALLOC_ARRAY(buffer, len);
+ if (buffer == NULL) {
+ gfarm_base_generic_info_free_all(n, vinfo,
+ &gfarm_base_xattr_info_ops);
+ e = GFARM_ERR_NO_MEMORY;
+ goto quit;
}
p = buffer;
@@ -2283,11 +2305,74 @@
}
*arg->sizep = len;
*arg->valuep = buffer;
- gfarm_base_xattr_list_free_array(n, vinfo);
+ gfarm_base_generic_info_free_all(n, vinfo,
+ &gfarm_base_xattr_info_ops);
+quit:
+ free(arg);
+ return e;
+}
+
+static gfarm_error_t
+pgsql_xattr_set_inum_and_attrname(PGresult *res, int row, void *vinfo)
+{
+ struct xattr_info *info = vinfo;
+
+ info->inum = pgsql_get_int64(res, row, "inumber");
+ info->attrname = pgsql_get_string(res, row, "attrname");
+ info->namelen = strlen(info->attrname) + 1; // include '\0'
return (GFARM_ERR_NO_ERROR);
}
static gfarm_error_t
+gfarm_pgsql_xattr_load0(int xmlMode,
+ void (*callback)(void *, struct xattr_info *))
+{
+ gfar...
[truncated message content] |
|
From: <ta...@us...> - 2009-03-25 08:28:31
|
Revision: 4132
http://gfarm.svn.sourceforge.net/gfarm/?rev=4132&view=rev
Author: tatebe
Date: 2009-03-25 08:28:20 +0000 (Wed, 25 Mar 2009)
Log Message:
-----------
display user config file
Modified Paths:
--------------
gfarm_v2/branches/2.2.0/gftool/gfstatus/Makefile
gfarm_v2/branches/2.2.0/gftool/gfstatus/gfstatus.c
Modified: gfarm_v2/branches/2.2.0/gftool/gfstatus/Makefile
===================================================================
--- gfarm_v2/branches/2.2.0/gftool/gfstatus/Makefile 2009-03-25 08:14:31 UTC (rev 4131)
+++ gfarm_v2/branches/2.2.0/gftool/gfstatus/Makefile 2009-03-25 08:28:20 UTC (rev 4132)
@@ -19,4 +19,5 @@
###
-$(OBJS): $(DEPGFARMINC) $(GFARMLIB_SRCDIR)/config.h $(GFARMLIB_SRCDIR)/auth.h
+$(OBJS): $(DEPGFARMINC) $(GFARMLIB_SRCDIR)/config.h $(GFARMLIB_SRCDIR)/auth.h \
+ $(GFARMLIB_SRCDIR)/gfpath.h
Modified: gfarm_v2/branches/2.2.0/gftool/gfstatus/gfstatus.c
===================================================================
--- gfarm_v2/branches/2.2.0/gftool/gfstatus/gfstatus.c 2009-03-25 08:14:31 UTC (rev 4131)
+++ gfarm_v2/branches/2.2.0/gftool/gfstatus/gfstatus.c 2009-03-25 08:28:20 UTC (rev 4132)
@@ -7,6 +7,7 @@
#include <gfarm/gfarm.h>
#include "config.h"
#include "auth.h"
+#include "gfpath.h"
void
error_check(char *msg, gfarm_error_t e)
@@ -25,6 +26,21 @@
printf("%s: %s\n", msg, status);
}
+void
+print_user_config_file(char *msg)
+{
+ static char gfarm_client_rc[] = GFARM_CLIENT_RC;
+ char *rc;
+
+ /* copied from gfarm_config_read() in config_client.c */
+ printf("%s: ", msg);
+ rc = getenv("GFARM_CONFIG_FILE");
+ if (rc == NULL)
+ printf("%s/%s\n", gfarm_get_local_homedir(), gfarm_client_rc);
+ else
+ printf("%s\n", rc);
+}
+
int
main(int argc, char *argv[])
{
@@ -41,7 +57,8 @@
e = gfarm_initialize(&argc, &argv);
error_check("gfarm_initialize", e);
- print_msg("config file", gfarm_config_file);
+ print_user_config_file("user config file ");
+ print_msg("system config file", gfarm_config_file);
puts("");
print_msg("hostname ", gfarm_host_get_self_name());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ta...@us...> - 2009-03-25 08:14:34
|
Revision: 4131
http://gfarm.svn.sourceforge.net/gfarm/?rev=4131&view=rev
Author: tatebe
Date: 2009-03-25 08:14:31 +0000 (Wed, 25 Mar 2009)
Log Message:
-----------
typo
Modified Paths:
--------------
gfarm2fs/branches/1.1.0/RELNOTES
Modified: gfarm2fs/branches/1.1.0/RELNOTES
===================================================================
--- gfarm2fs/branches/1.1.0/RELNOTES 2009-03-25 06:59:25 UTC (rev 4130)
+++ gfarm2fs/branches/1.1.0/RELNOTES 2009-03-25 08:14:31 UTC (rev 4131)
@@ -33,7 +33,7 @@
The Gfarm2fs is a mount command for the Gfarm v2 distributed file
system. FUSE (Filesystem in Userspace) [1] is required to build and
-ues gfarm2fs.
+use gfarm2fs.
[1] http://fuse.sourceforge.net/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ta...@us...> - 2009-03-25 06:59:49
|
Revision: 4130
http://gfarm.svn.sourceforge.net/gfarm/?rev=4130&view=rev
Author: tatebe
Date: 2009-03-25 06:59:25 +0000 (Wed, 25 Mar 2009)
Log Message:
-----------
Release note for the version 1.1.0
Modified Paths:
--------------
gfarm2fs/branches/1.1.0/LICENSE
Added Paths:
-----------
gfarm2fs/branches/1.1.0/RELNOTES
Modified: gfarm2fs/branches/1.1.0/LICENSE
===================================================================
--- gfarm2fs/branches/1.1.0/LICENSE 2009-03-25 03:38:41 UTC (rev 4129)
+++ gfarm2fs/branches/1.1.0/LICENSE 2009-03-25 06:59:25 UTC (rev 4130)
@@ -1,4 +1,4 @@
-Copyright (c) 2007-2008 Osamu Tatebe. All Rights Reserved.
+Copyright (c) 2007-2009 Osamu Tatebe. All Rights Reserved.
The authors hereby grant permission to use, copy, modify, and
distribute this software and its documentation for any purpose,
Added: gfarm2fs/branches/1.1.0/RELNOTES
===================================================================
--- gfarm2fs/branches/1.1.0/RELNOTES (rev 0)
+++ gfarm2fs/branches/1.1.0/RELNOTES 2009-03-25 06:59:25 UTC (rev 4130)
@@ -0,0 +1,56 @@
+Release note for Gfarm2fs 1.1.0
+===============================
+
+[2009.3.26]
+
+New Feature
+* symbolic link support
+* directory listing speedup by attribute cache
+
+New Command-line Option
+* -E option to specify the expiration period of the attribute cache
+
+Release note for Gfarm2fs 1.0.2
+===============================
+
+[2008.9.27]
+
+New Feature
+* hard link support
+
+Release note for Gfarm2fs 1.0.1
+===============================
+
+[2008.5.28]
+
+New Feature
+* statfs support
+
+Release note for Gfarm2fs 1.0.0
+===============================
+
+[2007.11.28]
+
+The Gfarm2fs is a mount command for the Gfarm v2 distributed file
+system. FUSE (Filesystem in Userspace) [1] is required to build and
+ues gfarm2fs.
+
+[1] http://fuse.sourceforge.net/
+
+GFARM2FS(1)
+
+NAME
+ gfarm2fs - mounts the Gfarm file system
+
+SYNOPSIS
+ gfarm2fs <mount_point> [FUSE options]
+
+DESCRIPTION
+ gfarm2fs mounts the Gfarm file system at the specified mount
+ point.
+
+ENVIRONMENT
+ GFARM_CONFIG_FILE
+ specifies the Gfarm configuration file.
+
+$Id$
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ta...@us...> - 2009-03-25 03:38:46
|
Revision: 4129
http://gfarm.svn.sourceforge.net/gfarm/?rev=4129&view=rev
Author: tatebe
Date: 2009-03-25 03:38:41 +0000 (Wed, 25 Mar 2009)
Log Message:
-----------
release branch for the version 1.1.0
Added Paths:
-----------
gfarm2fs/branches/1.1.0/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ta...@us...> - 2009-03-25 02:35:55
|
Revision: 4128
http://gfarm.svn.sourceforge.net/gfarm/?rev=4128&view=rev
Author: tatebe
Date: 2009-03-25 02:35:41 +0000 (Wed, 25 Mar 2009)
Log Message:
-----------
Release note and RPM spec file for the version 2.2.0
Modified Paths:
--------------
gfarm_v2/branches/2.2.0/RELNOTES
gfarm_v2/branches/2.2.0/package/redhat/gfarm.spec
Modified: gfarm_v2/branches/2.2.0/RELNOTES
===================================================================
--- gfarm_v2/branches/2.2.0/RELNOTES 2009-03-25 02:32:28 UTC (rev 4127)
+++ gfarm_v2/branches/2.2.0/RELNOTES 2009-03-25 02:35:41 UTC (rev 4128)
@@ -1,7 +1,7 @@
-Release note for Gfarm 2.1.2
+Release note for Gfarm 2.2.0
============================
-[2009.3.21]
+[2009.3.26]
New Feature
* symbolic link support
@@ -12,6 +12,12 @@
* gfstatus - display Gfarm configuration status
* gfln - create a hard link or a symbolic link
+New Admin Command
+* config-gfarm-update - update the backend database.
+ 'config-gfarm-update --update-symlink' updates the backend database
+ to manage symbolic links. Note that the postgresql backend is only
+ supported for now.
+
New API
* gfs_symlink, gfs_readlink - symbolic link support
* gfs_lstat
Modified: gfarm_v2/branches/2.2.0/package/redhat/gfarm.spec
===================================================================
--- gfarm_v2/branches/2.2.0/package/redhat/gfarm.spec 2009-03-25 02:32:28 UTC (rev 4127)
+++ gfarm_v2/branches/2.2.0/package/redhat/gfarm.spec 2009-03-25 02:35:41 UTC (rev 4128)
@@ -1,6 +1,6 @@
# Part 1 data definition
%define pkg gfarm
-%define ver 2.1.1
+%define ver 2.2.0
%define rel 1
# a hook to make RPM version number different from %{ver}
@@ -954,6 +954,7 @@
%defattr(-,root,root)
%{prefix}/sbin/gfmd
%{prefix}/bin/config-gfarm
+%{prefix}/bin/config-gfarm-update
%{prefix}/bin/gfdump.postgresql
%if %{gfarm_v2_not_yet}
%{prefix}/bin/gfusage
@@ -963,6 +964,7 @@
%{share_prefix}/config/bdb.DB_CONFIG.in
%{share_prefix}/config/config-gfarm.ldap
%{share_prefix}/config/config-gfarm.postgresql
+%{share_prefix}/config/config-gfarm-update.postgresql
%{share_prefix}/config/gfarm.conf-ldap.in
%{share_prefix}/config/gfarm.conf-postgresql.in
%{share_prefix}/config/gfarm.conf.in
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ta...@us...> - 2009-03-25 02:32:31
|
Revision: 4127
http://gfarm.svn.sourceforge.net/gfarm/?rev=4127&view=rev
Author: tatebe
Date: 2009-03-25 02:32:28 +0000 (Wed, 25 Mar 2009)
Log Message:
-----------
consider namespace
Modified Paths:
--------------
gfarm_v2/branches/2.2.0/gftool/config-gfarm/config-gfarm-update.postgresql
Modified: gfarm_v2/branches/2.2.0/gftool/config-gfarm/config-gfarm-update.postgresql
===================================================================
--- gfarm_v2/branches/2.2.0/gftool/config-gfarm/config-gfarm-update.postgresql 2009-03-25 02:03:17 UTC (rev 4126)
+++ gfarm_v2/branches/2.2.0/gftool/config-gfarm/config-gfarm-update.postgresql 2009-03-25 02:32:28 UTC (rev 4127)
@@ -1,4 +1,4 @@
-getvalue() {
+getvalue_postgresql() {
KEY=$1
if [ X"$KEY" != X ]; then
value=`egrep "^$KEY " $GFMD_CONF | awk '{ print $2 }'`
@@ -9,7 +9,7 @@
}
# $LINE is appended to $FILE only if $LINE is not included in $FILE
-update_file()
+update_file_postgresql()
{
FILE="$1"
LINE="$2"
@@ -37,18 +37,18 @@
[ $rv = 0 ] || return $rv
# disable path expansion
set -f
- update_file $PGPASS "$BACKEND_HOSTNAME:$BACKEND_PORT:$DB_NAME:$BACKEND_USER:$password"
- update_file $PGPASS "localhost:$BACKEND_PORT:$DB_NAME:$BACKEND_ADMIN_USER:$admin_password"
+ update_file_postgresql $PGPASS "$BACKEND_HOSTNAME:$BACKEND_PORT:$DB_NAME:$BACKEND_USER:$password"
+ update_file_postgresql $PGPASS "localhost:$BACKEND_PORT:$DB_NAME:$BACKEND_ADMIN_USER:$admin_password"
return $rv
}
update_first_set_param_postgresql()
{
- : ${BACKEND_HOSTNAME:=`getvalue postgresql_server_host`}
- : ${BACKEND_PORT=`getvalue postgresql_server_port`}
- : ${DB_NAME:=`getvalue postgresql_dbname`}
- : ${BACKEND_USER:=`getvalue postgresql_user`}
- : ${password:=`getvalue postgresql_password | awk -F\" '{ print $2 }'`}
+ : ${BACKEND_HOSTNAME:=`getvalue_postgresql postgresql_server_host`}
+ : ${BACKEND_PORT=`getvalue_postgresql postgresql_server_port`}
+ : ${DB_NAME:=`getvalue_postgresql postgresql_dbname`}
+ : ${BACKEND_USER:=`getvalue_postgresql postgresql_user`}
+ : ${password:=`getvalue_postgresql postgresql_password | awk -F\" '{ print $2 }'`}
}
update_last_set_param_postgresql()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ta...@us...> - 2009-03-25 02:03:25
|
Revision: 4126
http://gfarm.svn.sourceforge.net/gfarm/?rev=4126&view=rev
Author: tatebe
Date: 2009-03-25 02:03:17 +0000 (Wed, 25 Mar 2009)
Log Message:
-----------
release branch for the version 2.2.0.
Note that we skip to release the version 2.1.2, and release 2.2.0
since it has a new feature of symbolic links.
Added Paths:
-----------
gfarm_v2/branches/2.2.0/
Removed Paths:
-------------
gfarm_v2/branches/2.1.2/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ta...@us...> - 2009-03-25 01:56:22
|
Revision: 4125
http://gfarm.svn.sourceforge.net/gfarm/?rev=4125&view=rev
Author: tatebe
Date: 2009-03-25 01:56:19 +0000 (Wed, 25 Mar 2009)
Log Message:
-----------
regen
Modified Paths:
--------------
gfarm_v2/branches/2.1.2/configure
Modified: gfarm_v2/branches/2.1.2/configure
===================================================================
--- gfarm_v2/branches/2.1.2/configure 2009-03-25 01:55:56 UTC (rev 4124)
+++ gfarm_v2/branches/2.1.2/configure 2009-03-25 01:56:19 UTC (rev 4125)
@@ -24424,7 +24424,7 @@
test -d package || mkdir package
test -d util || mkdir util
- ac_config_files="$ac_config_files Makefile makes/config.mk makes/install-doc ${ns_makefiles} gftool/config-gfarm/config-gfarm gftool/config-gfarm/config-gfsd gftool/gfdump/gfdump.postgresql package/solaris/gfmd package/solaris/gfsd"
+ ac_config_files="$ac_config_files Makefile makes/config.mk makes/install-doc ${ns_makefiles} gftool/config-gfarm/config-gfarm gftool/config-gfarm/config-gfsd gftool/config-gfarm/config-gfarm-update gftool/gfdump/gfdump.postgresql package/solaris/gfmd package/solaris/gfsd"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -24957,6 +24957,7 @@
"${ns_makefiles}" ) CONFIG_FILES="$CONFIG_FILES ${ns_makefiles}" ;;
"gftool/config-gfarm/config-gfarm" ) CONFIG_FILES="$CONFIG_FILES gftool/config-gfarm/config-gfarm" ;;
"gftool/config-gfarm/config-gfsd" ) CONFIG_FILES="$CONFIG_FILES gftool/config-gfarm/config-gfsd" ;;
+ "gftool/config-gfarm/config-gfarm-update" ) CONFIG_FILES="$CONFIG_FILES gftool/config-gfarm/config-gfarm-update" ;;
"gftool/gfdump/gfdump.postgresql" ) CONFIG_FILES="$CONFIG_FILES gftool/gfdump/gfdump.postgresql" ;;
"package/solaris/gfmd" ) CONFIG_FILES="$CONFIG_FILES package/solaris/gfmd" ;;
"package/solaris/gfsd" ) CONFIG_FILES="$CONFIG_FILES package/solaris/gfsd" ;;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ta...@us...> - 2009-03-25 01:56:02
|
Revision: 4124
http://gfarm.svn.sourceforge.net/gfarm/?rev=4124&view=rev
Author: tatebe
Date: 2009-03-25 01:55:56 +0000 (Wed, 25 Mar 2009)
Log Message:
-----------
generate config-gfarm-update
Modified Paths:
--------------
gfarm_v2/branches/2.1.2/configure.ac
Modified: gfarm_v2/branches/2.1.2/configure.ac
===================================================================
--- gfarm_v2/branches/2.1.2/configure.ac 2009-03-25 01:55:30 UTC (rev 4123)
+++ gfarm_v2/branches/2.1.2/configure.ac 2009-03-25 01:55:56 UTC (rev 4124)
@@ -1260,7 +1260,7 @@
AC_CONFIG_FILES(Makefile makes/config.mk makes/install-doc
${ns_makefiles}
gftool/config-gfarm/config-gfarm gftool/config-gfarm/config-gfsd
- gftool/gfdump/gfdump.postgresql
+ gftool/config-gfarm/config-gfarm-update gftool/gfdump/gfdump.postgresql
package/solaris/gfmd package/solaris/gfsd
)
AC_OUTPUT
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ta...@us...> - 2009-03-25 01:55:39
|
Revision: 4123
http://gfarm.svn.sourceforge.net/gfarm/?rev=4123&view=rev
Author: tatebe
Date: 2009-03-25 01:55:30 +0000 (Wed, 25 Mar 2009)
Log Message:
-----------
config-gfarm-update - admin command to update the backend database
--update-symlink option creates a Symlink table to store symlinks
XXX - only postgresql backend supported
Modified Paths:
--------------
gfarm_v2/branches/2.1.2/Makefile.in
gfarm_v2/branches/2.1.2/gftool/config-gfarm/Makefile
Added Paths:
-----------
gfarm_v2/branches/2.1.2/gftool/config-gfarm/config-gfarm-update.in
gfarm_v2/branches/2.1.2/gftool/config-gfarm/config-gfarm-update.postgresql
Modified: gfarm_v2/branches/2.1.2/Makefile.in
===================================================================
--- gfarm_v2/branches/2.1.2/Makefile.in 2009-03-24 23:34:15 UTC (rev 4122)
+++ gfarm_v2/branches/2.1.2/Makefile.in 2009-03-25 01:55:30 UTC (rev 4123)
@@ -28,6 +28,7 @@
$(INC_BUILDDIR)/gfarm_config.h \
Makefile makes/config.mk makes/install-doc \
gftool/config-gfarm/config-gfarm \
+ gftool/config-gfarm/config-gfarm-update \
gftool/config-gfarm/config-gfsd \
gftool/gfdump/gfdump.postgresql \
package/solaris/gfmd package/solaris/gfsd
Modified: gfarm_v2/branches/2.1.2/gftool/config-gfarm/Makefile
===================================================================
--- gfarm_v2/branches/2.1.2/gftool/config-gfarm/Makefile 2009-03-24 23:34:15 UTC (rev 4122)
+++ gfarm_v2/branches/2.1.2/gftool/config-gfarm/Makefile 2009-03-25 01:55:30 UTC (rev 4123)
@@ -10,9 +10,11 @@
datadir=$(default_datadir)/gfarm/config
-SCRIPTS = config-gfarm config-gfsd $(srcdir)/gfarm.arch.guess
+SCRIPTS = config-gfarm config-gfarm-update config-gfsd \
+ $(srcdir)/gfarm.arch.guess
DATA = $(srcdir)/config-gfarm.postgresql \
$(srcdir)/config-gfarm.ldap \
+ $(srcdir)/config-gfarm-update.postgresql \
$(srcdir)/gfarm.conf-postgresql.in \
$(srcdir)/gfarm.conf-ldap.in \
$(srcdir)/gfarm.conf.in \
Added: gfarm_v2/branches/2.1.2/gftool/config-gfarm/config-gfarm-update.in
===================================================================
--- gfarm_v2/branches/2.1.2/gftool/config-gfarm/config-gfarm-update.in (rev 0)
+++ gfarm_v2/branches/2.1.2/gftool/config-gfarm/config-gfarm-update.in 2009-03-25 01:55:30 UTC (rev 4123)
@@ -0,0 +1,161 @@
+#!/bin/sh
+#
+# $Id$
+
+${DEBUG:="false"} && set -xu
+PROGNAME=`basename $0`
+
+# Gfarm installation directory
+prefix="@prefix@"
+sysconfdir="@sysconfdir@"
+config_dir="@datadir@/gfarm/config"
+
+# backend initialization
+BACKEND_TYPE=postgresql
+backend_all="postgresql"
+backend_candidates="postgresql"
+
+# load backend-dependent functions.
+for i in $backend_all
+do
+ . $config_dir/config-gfarm.$i
+ . $config_dir/config-gfarm-update.$i
+done
+
+usage()
+{
+ echo >&2 "usage: $PROGNAME [--help] [--prefix prefix] [-t]"
+ echo >&2 " [--update_symlink] [-P backend_prefix]"
+ echo >&2 " [-l metadata_directory] [-p metadata_backend_port]"
+ echo >&2 " [-f backend_file]"
+ exit 1
+}
+
+ABORT()
+{
+ [ $# -gt 0 ] && echo >&2 "${PROGNAME}: $@"
+ echo >&2 "$PROGNAME failure"
+ exit 1
+}
+
+update_sanity()
+{
+ if [ ! -f $GFMD_CONF ]
+ then
+ echo "$GFMD_CONF: no such file" >&2
+ return 1
+ fi
+
+ update_sanity_$BACKEND_TYPE
+}
+
+# most $BACKEND_TYPE calls the followings
+# from display_backend_params_$BACKEND_TYPE, but some may not.
+display_backend_data_dir_param()
+{
+ echo "metadata directory [-l]: $BACKEND_DATA_DIR"
+}
+display_backend_log_dir_param()
+{
+ echo "metadata log directory [-L]: $BACKEND_LOG_DIR"
+}
+
+display_params()
+{
+ echo "prefix [--prefix]: $CONFIG_PREFIX"
+ echo "metadata backend [-b]: $BACKEND_TYPE"
+ echo "(available backend: $backend_candidates)"
+
+ display_backend_params_$BACKEND_TYPE
+ display_backend_port_params_$BACKEND_TYPE
+ display_backend_optional_params_$BACKEND_TYPE
+
+ update_sanity
+ exit 0
+}
+
+#
+# parse arguments
+#
+
+: ${BACKEND_OPTIONS:=}
+
+while [ $# -gt 0 ] ; do
+ case $1 in
+
+ # set parameters
+ --prefix) shift; [ $# -ge 1 ] || usage
+ CONFIG_PREFIX=$1
+ ;;
+ -U) shift; [ $# -ge 1 ] || usage
+ BACKEND_ADMIN_USER=$1
+ ;;
+ -P) shift; [ $# -ge 1 ] || usage
+ BACKEND_PREFIX=$1
+ ;;
+ -l) shift; [ $# -ge 1 ] || usage
+ BACKEND_DATA_DIR=$1
+ ;;
+ -p) shift; [ $# -ge 1 ] || usage
+ BACKEND_PORT=$1
+ ;;
+ -f) shift; [ $# -ge 1 ] || usage
+ BACKEND_OPTIONS="$BACKEND_OPTIONS -f $1"
+ ;;
+
+ # control options
+ --help)
+ usage
+ ;;
+ -t)
+ DISPLAY_PARAMS=true
+ ;;
+ --update-symlink)
+ UPDATE_SYMLINK=true
+ ;;
+ *)
+ usage
+ ;;
+ esac
+ shift
+done
+
+#
+# default values
+#
+
+PATH="${prefix}/bin:${prefix}/sbin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/pkg/bin:/usr/pkg/sbin:/usr/local/bin:/usr/local/sbin:$PATH"
+export PATH
+search_path="$PATH"
+
+set_default_backend_perfix_$BACKEND_TYPE
+: ${CONFIG_PREFIX:=}
+set_first_defaults_$BACKEND_TYPE
+
+: ${DISPLAY_PARAMS:=false}
+: ${UPDATE_SYMLINK:=false}
+if [ X"$CONFIG_PREFIX" != X ]; then
+ : ${GFARM_CONF_DIR:="$CONFIG_PREFIX/etc"}
+else
+ : ${GFARM_CONF_DIR:="$sysconfdir"}
+fi
+: ${GFARM_CONF:="$GFARM_CONF_DIR/gfarm2.conf"}
+: ${GFMD_CONF:="$GFARM_CONF_DIR/gfmd.conf"}
+
+update_first_set_param_$BACKEND_TYPE
+set_last_defaults_$BACKEND_TYPE
+update_last_set_param_$BACKEND_TYPE
+
+update_sanity || ABORT "aborted"
+
+# -t option; display parameters
+$DISPLAY_PARAMS && display_params
+
+update_postprocess_$BACKEND_TYPE || ABORT "aborted"
+
+#
+if $UPDATE_SYMLINK; then
+ update_symlink_$BACKEND_TYPE
+else
+ access_db_postgresql $BACKEND_OPTIONS
+fi
Added: gfarm_v2/branches/2.1.2/gftool/config-gfarm/config-gfarm-update.postgresql
===================================================================
--- gfarm_v2/branches/2.1.2/gftool/config-gfarm/config-gfarm-update.postgresql (rev 0)
+++ gfarm_v2/branches/2.1.2/gftool/config-gfarm/config-gfarm-update.postgresql 2009-03-25 01:55:30 UTC (rev 4123)
@@ -0,0 +1,93 @@
+getvalue() {
+ KEY=$1
+ if [ X"$KEY" != X ]; then
+ value=`egrep "^$KEY " $GFMD_CONF | awk '{ print $2 }'`
+ else
+ value=
+ fi
+ echo $value
+}
+
+# $LINE is appended to $FILE only if $LINE is not included in $FILE
+update_file()
+{
+ FILE="$1"
+ LINE="$2"
+
+ if [ ! -f $FILE ]; then
+ echo $LINE > $FILE
+ elif ! grep "^$LINE$" $FILE > /dev/null; then
+ echo $LINE >> $FILE
+ fi
+}
+
+update_postprocess_postgresql()
+{
+ rv=0
+ PGPASS=$HOME/.pgpass
+ if [ ! -f $PGPASS ]; then
+ if ! touch $PGPASS; then
+ echo "$PGPASS: cannot create" >&2
+ rv=1
+ elif ! chmod 0600 $PGPASS; then
+ echo "$PGPASS: cannot change mode" >&2
+ rv=1
+ fi
+ fi
+ [ $rv = 0 ] || return $rv
+ # disable path expansion
+ set -f
+ update_file $PGPASS "$BACKEND_HOSTNAME:$BACKEND_PORT:$DB_NAME:$BACKEND_USER:$password"
+ update_file $PGPASS "localhost:$BACKEND_PORT:$DB_NAME:$BACKEND_ADMIN_USER:$admin_password"
+ return $rv
+}
+
+update_first_set_param_postgresql()
+{
+ : ${BACKEND_HOSTNAME:=`getvalue postgresql_server_host`}
+ : ${BACKEND_PORT=`getvalue postgresql_server_port`}
+ : ${DB_NAME:=`getvalue postgresql_dbname`}
+ : ${BACKEND_USER:=`getvalue postgresql_user`}
+ : ${password:=`getvalue postgresql_password | awk -F\" '{ print $2 }'`}
+}
+
+update_last_set_param_postgresql()
+{
+ : ${admin_password:=`cat $BACKEND_DATA_DIR/admin_password`}
+}
+
+update_sanity_postgresql()
+{
+ rv=0
+ if [ X"$BACKEND_HOSTNAME" = X -o X"$BACKEND_PORT" = X \
+ -o X"$DB_NAME" = X -o X"$BACKEND_USER" = X -o X"$password" = X ]
+ then
+ echo "ERROR: postgresql backend is not configured" >&2
+ rv=1
+ fi
+ if [ X"$admin_password" = X ]
+ then
+ echo "ERROR: password for postgresql administrator cannot be read" >&2
+ rv=1
+ fi
+ return $rv
+}
+
+update_symlink_postgresql()
+{
+ cat <<EOF | $PGSQL_BINDIR/psql -p $BACKEND_PORT $DB_NAME $BACKEND_ADMIN_USER
+CREATE TABLE Symlink (
+ inumber INT8 PRIMARY KEY,
+ sourcePath VARCHAR(1024) NOT NULL
+);
+
+GRANT SELECT, INSERT, UPDATE, DELETE ON Symlink TO $BACKEND_USER;
+EOF
+}
+
+access_db_postgresql()
+{
+ OPTIONS="$*"
+
+ $PGSQL_BINDIR/psql -p $BACKEND_PORT $OPTIONS $DB_NAME $BACKEND_ADMIN_USER
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ta...@us...> - 2009-03-24 23:34:26
|
Revision: 4122
http://gfarm.svn.sourceforge.net/gfarm/?rev=4122&view=rev
Author: tatebe
Date: 2009-03-24 23:34:15 +0000 (Tue, 24 Mar 2009)
Log Message:
-----------
more exact checking in update_file()
Modified Paths:
--------------
gfarm_v2/branches/2.1.2/gftool/gfdump/gfdump.postgresql.in
Modified: gfarm_v2/branches/2.1.2/gftool/gfdump/gfdump.postgresql.in
===================================================================
--- gfarm_v2/branches/2.1.2/gftool/gfdump/gfdump.postgresql.in 2009-03-24 06:56:47 UTC (rev 4121)
+++ gfarm_v2/branches/2.1.2/gftool/gfdump/gfdump.postgresql.in 2009-03-24 23:34:15 UTC (rev 4122)
@@ -85,7 +85,7 @@
if [ ! -f $FILE ]; then
echo $LINE > $FILE
- elif ! grep $LINE $FILE > /dev/null; then
+ elif ! grep "^$LINE$" $FILE > /dev/null; then
echo $LINE >> $FILE
fi
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ta...@us...> - 2009-03-24 06:57:02
|
Revision: 4121
http://gfarm.svn.sourceforge.net/gfarm/?rev=4121&view=rev
Author: tatebe
Date: 2009-03-24 06:56:47 +0000 (Tue, 24 Mar 2009)
Log Message:
-----------
do not overwrite .pgpass, but update it if required. suggested by soda-san
Modified Paths:
--------------
gfarm_v2/branches/2.1.2/gftool/gfdump/gfdump.postgresql.in
Modified: gfarm_v2/branches/2.1.2/gftool/gfdump/gfdump.postgresql.in
===================================================================
--- gfarm_v2/branches/2.1.2/gftool/gfdump/gfdump.postgresql.in 2009-03-24 06:05:56 UTC (rev 4120)
+++ gfarm_v2/branches/2.1.2/gftool/gfdump/gfdump.postgresql.in 2009-03-24 06:56:47 UTC (rev 4121)
@@ -77,15 +77,30 @@
err "$DUMPF: database dump file not exist"
fi
-# XXX - always overwrite ~/.pgpass
-PGPASS=~/.pgpass
-touch $PGPASS || err "$PGPASS: cannot create"
-chmod 0600 $PGPASS || err "$PGPASS: cannot change mode"
-cat > $PGPASS <<EOF
-$HOST:$PORT:$DBNAME:$USER:$PASSWD
-*:$PORT:$DBNAME:$ADMIN_USER:$ADMIN_PASSWD
-EOF
+# $LINE is appended to $FILE only if $LINE is not included in $FILE
+update_file()
+{
+ FILE="$1"
+ LINE="$2"
+ if [ ! -f $FILE ]; then
+ echo $LINE > $FILE
+ elif ! grep $LINE $FILE > /dev/null; then
+ echo $LINE >> $FILE
+ fi
+}
+
+# update $HOME/.pgpass
+PGPASS=$HOME/.pgpass
+if [ ! -f $PGPASS ]; then
+ touch $PGPASS || err "$PGPASS: cannot create"
+ chmod 0600 $PGPASS || err "$PGPASS: cannot change mode"
+fi
+# disable path expansion
+set -f
+update_file $PGPASS "$HOST:$PORT:$DBNAME:$USER:$PASSWD"
+update_file $PGPASS "localhost:$PORT:$DBNAME:$ADMIN_USER:$ADMIN_PASSWD"
+
case $MODE in
DUMP)
pg_dump -F c -h $HOST -p $PORT -U $USER -f $DUMPF $DBNAME ||
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <uj...@us...> - 2009-03-24 06:06:02
|
Revision: 4120
http://gfarm.svn.sourceforge.net/gfarm/?rev=4120&view=rev
Author: ujihara
Date: 2009-03-24 06:05:56 +0000 (Tue, 24 Mar 2009)
Log Message:
-----------
fix sample host name
Modified Paths:
--------------
gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-list/gfvoms-list
Modified: gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-list/gfvoms-list
===================================================================
--- gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-list/gfvoms-list 2009-03-24 05:12:23 UTC (rev 4119)
+++ gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-list/gfvoms-list 2009-03-24 06:05:56 UTC (rev 4120)
@@ -117,7 +117,7 @@
User DN should be the format of certification info like
- '/O=Grid/OU=GlobusTest/OU=simpleCA-gfdev.suri.co.jp/CN=GfarmDevelop'
+ '/O=Grid/OU=GlobusTest/OU=simpleCA-example.co.jp/CN=GfarmDevelop'
The row started with '#' will be treated as a commentation row."""
print usage_str
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <uj...@us...> - 2009-03-24 05:12:30
|
Revision: 4119
http://gfarm.svn.sourceforge.net/gfarm/?rev=4119&view=rev
Author: ujihara
Date: 2009-03-24 05:12:23 +0000 (Tue, 24 Mar 2009)
Log Message:
-----------
fix too long lines
Modified Paths:
--------------
gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-list/Makefile
gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-list/gfvoms-list
gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-sync/Makefile
gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-sync/gfvoms-sync.py
gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-update/gfvoms-update.c
gfarm_v2/trunk/gftool/gfvoms-sync/lib/Makefile
gfarm_v2/trunk/gftool/gfvoms-sync/lib/zsi_def.py
Modified: gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-list/Makefile
===================================================================
--- gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-list/Makefile 2009-03-21 16:54:00 UTC (rev 4118)
+++ gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-list/Makefile 2009-03-24 05:12:23 UTC (rev 4119)
@@ -28,7 +28,7 @@
-test -z "$(EXTRA_CLEAN_TARGETS)" || $(RM) -f $(EXTRA_CLEAN_TARGETS)
script-veryclean: clean
- -test -z "$(EXTRA_VERYCLEAN_TARGETS)" || $(RM) -f $(EXTRA_VERYCLEAN_TARGETS)
+ -test -z "$(EXTRA_VERYCLEAN_TARGETS)" || $(RM) -f "$(EXTRA_VERYCLEAN_TARGETS)"
script-distclean: veryclean
-test ! -f $(srcdir)/Makefile.in || $(RM) -f Makefile
Modified: gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-list/gfvoms-list
===================================================================
--- gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-list/gfvoms-list 2009-03-21 16:54:00 UTC (rev 4118)
+++ gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-list/gfvoms-list 2009-03-24 05:12:23 UTC (rev 4119)
@@ -14,7 +14,8 @@
# Apache 2.0 Licensed Products:
# This product includes software listed below that were licensed under
# the Apache License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of the License at
+# except in compliance with the License. You may obtain a copy of
+# the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an "AS IS" BASIS,
@@ -49,7 +50,8 @@
self.cur += delta
cursize = int(float(self.cur) / self.max * self.size)
leftsize = self.size - cursize
- self.out.write(self.format % ('*'*cursize, '-'*leftsize, self.cur, self.max))
+ self.out.write(self.format
+ % ('*'*cursize, '-'*leftsize, self.cur, self.max))
if self.cur >= self.max:
print "\nComplete"
@@ -94,24 +96,28 @@
print e
e = ""
usage_str ="""Usage:
- gfvoms-list -V vomsID -v vo [-f user-list-path] [-m membership-path] [-a hostids] [-h]
+ gfvoms-list -V vomsID -v vo [-f user-list-path] [-m membership-path]
+ [-a hostids] [-h]
options:
- -V voms : ID of VOMS Admin Server
- -v vo : Name of VO, which you want to get membership infos.[no default]
- -f user-list-path : List of users whom you want to get infos.[no default]
- If you don't set this option, all users in the voms:vo will be set.
- -m membership-path : Path for file to save membership info.[no default]
- If you don't set this option, membership info will write in stdout.
- -a hostids : Path of definition file of id and host.[default: '/var/gfarm/hostids']
- -h : Show this Usage.
+ -V voms : ID of VOMS Admin Server
+ -v vo : Name of VO.[no default]
+ -f user-list-path : List of users to get infos.[no default]
+ If you don't set this option,
+ all member of voms:vo will get.
+ -m membership-path : Path to save membership info.[no default]
+ If you don't set this option,
+ membership info will write in stdout.
+ -a hostids : Path of definition file of id and host.
+ [default: '/var/gfarm/hostids']
+ -h : Show this Usage.
membership-path format:
One user for one row, and the format is 'user=<User DN>'.
User DN should be the format of certification info like
- '/O=Grid/OU=GlobusTest/OU=simpleCA-gfdev.suri.co.jp/OU=suri.co.jp/CN=GfarmDevelop'
+ '/O=Grid/OU=GlobusTest/OU=simpleCA-gfdev.suri.co.jp/CN=GfarmDevelop'
The row started with '#' will be treated as a commentation row."""
print usage_str
@@ -135,7 +141,8 @@
lines = f.readlines()
f.close()
except:
- raise Exception("Error: Failed to read vomsID file['%s']."%(options["hostids"]))
+ raise Exception(
+ "Error: Failed to read vomsID file['%s']."%(options["hostids"]))
index = 0
for line in lines:
@@ -150,7 +157,8 @@
break
if len(list) < 2 or len(list) > 3:
print "Broken vomsid file. Cannot parse line(%d): %s"%(index, buf)
- raise Exception("Error:Failed to parse vomsID file['%s']."%(options["hostids"]))
+ raise Exception(
+ "Error:Failed to parse vomsID file['%s']."%(options["hostids"]))
if list[0] != options["vomsid"]:
continue
if len(list) == 2:
@@ -161,7 +169,8 @@
break
if host == "":
print "No definition for vomsID(%s) found."%(options["vomsid"])
- raise Exception("Error: Cannot find host in vomsID file['%s']."%(options["hostids"]))
+ raise Exception(
+ "Error: Cannot find host in vomsID file['%s']."%(options["hostids"]))
return host, port
def check_options():
@@ -236,13 +245,17 @@
info = tmp_line.split("=", 1)
if len(info) != 2:
print "invalid line(%d):%s"%(index, tmp_line)
- raise Exception("Error: Failed to parse user list['%s'])."%(infile))
+ raise Exception(
+ "Error: Failed to parse user list['%s'])."%(infile))
if info[0].strip() != "user":
print "invalid line(%d):%s"%(index, tmp_line)
- raise Exception("Error: Failed to parse user list['%s'])."%(infile))
+ raise Exception(
+ "Error: Failed to parse user list['%s'])."%(infile))
if info[1].strip() in users:
- print "duplicate definition for dn (in line %d):%s"%(index, info[1].strip())
- raise Exception("Error: Failed to parse user list['%s'])."%(infile))
+ print "duplicate definition for dn ",
+ print "(in line %d):%s"%(index, info[1].strip())
+ raise Exception(
+ "Error: Failed to parse user list['%s'])."%(infile))
users[info[1].strip()]=""
return users
except IOError, e:
@@ -252,7 +265,7 @@
raise e
def export(group_infos):
- """Print out the result to 'outfile' which is registered in global 'options'.
+ """Print the result to 'outfile' which is registered in global 'options'.
"""
groups = group_infos.keys()
f = sys.stdout
@@ -287,12 +300,16 @@
except socket.error, e:
errtuple = tuple(e)
if len(errtuple) == 2:
- raise Exception("SocketError(%d):%s [hostname=%s, post=%d]"%(errtuple[0], errtuple[1], options["host"], options["port"]))
+ raise Exception(
+ "SocketError(%d):%s [hostname=%s, post=%d]"%(
+ errtuple[0], errtuple[1], options["host"], options["port"]))
else:
raise e
except Exception, e:
if str(e).find("Insufficient privileges") != -1:
- counter.out.write("Ignored: Insufficient privileges to perform 'listSubGroups' to %s\n"%(group))
+ counter.out.write(
+ "Ignored: Insufficient privileges to perform '%s' to %s\n"%(
+ "listSubGroups", group))
else:
raise e
ret_list = glist[:]
@@ -330,7 +347,8 @@
rlist = admin.execute("listRoles", **options)
except Exception, e:
if str(e).find("Insufficient privileges") != -1:
- print "Ignored: Insufficient privileges to perform 'listRoles'"
+ print "Ignored: ",
+ print "Insufficient privileges to perform 'listRoles'"
else:
raise e
print "%d roles found..."%(len(rlist))
@@ -349,21 +367,31 @@
group_infos[grp_novo] = members
except Exception, e:
if str(e).find("Insufficient privileges") != -1:
- bar.out.write("Ignored: Insufficient privileges to perform 'listMembers' to %s\n"%(group))
+ bar.out.write(
+ "Ignored: " +
+ "Insufficient privileges to perform '%s' to %s\n"%(
+ "listMembers",group))
else:
raise e
for role in rlist:
try:
- r_members = admin.execute("listUsersWithRole", group=group, role=role)
+ r_members = admin.execute("listUsersWithRole",
+ group=group, role=role)
if dns != None:
r_members = [u for u in r_members if u._DN in dns]
group_infos["%s/%s"%(grp_novo, role)] = r_members
except Exception, e:
if str(e).find("containerName.length()") != -1:
- bar.out.write("Ignored: Too long groupname '%s/%s'\n"%(grp_novo, role))
+ bar.out.write(
+ "Ignored: " +
+ "Too long groupname '%s/%s'\n"%(grp_novo, role))
continue
elif str(e).find("Insufficient privileges") != -1:
- bar.out.write("Ignored: Insufficient privileges to perform 'listUsersWithRole' to %s/Role=%s\n"%(group, role))
+ bar.out.write(
+ "Ignored:" +
+ "Insufficient privileges to perform " +
+ "'%s' to %s/Role=%s\n"%(
+ "listUsersWithRole", group, role))
continue
else:
raise e
Modified: gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-sync/Makefile
===================================================================
--- gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-sync/Makefile 2009-03-21 16:54:00 UTC (rev 4118)
+++ gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-sync/Makefile 2009-03-24 05:12:23 UTC (rev 4119)
@@ -32,7 +32,7 @@
-test -e "gfvoms-sync" && $(RM) -f "gfvoms-sync"
script-veryclean: clean
- -test -z "$(EXTRA_VERYCLEAN_TARGETS)" || $(RM) -f $(EXTRA_VERYCLEAN_TARGETS)
+ -test -z "$(EXTRA_VERYCLEAN_TARGETS)" || $(RM) -f "$(EXTRA_VERYCLEAN_TARGETS)"
script-distclean: veryclean
-test ! -f $(srcdir)/Makefile.in || $(RM) -f Makefile
Modified: gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-sync/gfvoms-sync.py
===================================================================
--- gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-sync/gfvoms-sync.py 2009-03-21 16:54:00 UTC (rev 4118)
+++ gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-sync/gfvoms-sync.py 2009-03-24 05:12:23 UTC (rev 4119)
@@ -5,7 +5,8 @@
# gfvoms-sync
#
# Sync voms infos and gfarm
-# Using gfvoms-list and gfvoms-update, synchronize voms's membership infos and that of gfarm.
+# Using gfvoms-list and gfvoms-update,
+# synchronize voms's membership infos and that of gfarm.
#
# Copyright (c) 2009 National Institute of Informatics in Japan.
# All rights reserved.
@@ -23,15 +24,16 @@
print e
e = ""
usage_str ="""Usage:
- gfvoms-sync (-s|-d) -V vomsID -v vo [-g voms-membership-path] [-a hostids] [-h]
+ gfvoms-sync -s -V vomsID -v vo [-g voms-membership-path] [-a hostids] [-h]
+ gfvoms-sync -d -V vomsID -v vo [-g voms-membership-path] [-a hostids] [-h]
options:
-s : Synchronization mode.
-d : Deletion mode.
-V voms : ID of VOMS Admin Server
- -v vo : Name of VO, which you want to get membership infos.[no default]
+ -v vo : Name of VO to get membership infos.[no default]
-g membership-path : Path of voms membership info file.[no default]
- -a vomsids : Path of definition file of id and host.[default: '%s']
+ -a vomsids : Path of file of id and host.[default: '%s']
-h : Show this Usage.\n"""
print usage_str%(hostids)
sys.exit(e)
@@ -40,7 +42,8 @@
if (not options.has_key("sync")) and (not options.has_key("del")):
usage("No Operation is found. You must set '-s' or '-d' option.")
if (options.has_key("sync")) and options.has_key("del"):
- usage("Duplicate Operations. Option '-s' and '-d' cannot set in same time.")
+ usage("Duplicate Operations. " +
+ "Option '-s' and '-d' cannot set in same time.")
if not options.has_key("vomsid"):
usage("No vomsID Specified!")
@@ -84,7 +87,8 @@
sys.exit("Error parsing command line arguments:%s"%(e))
def getGfvomsListOptions():
- ret= "-a %s -V %s -v %s -m %s"%(options["hostids"], options["vomsid"], options["vo"], vomslist_tmpfile)
+ ret= "-a %s -V %s -v %s -m %s"%(
+ options["hostids"], options["vomsid"], options["vo"], vomslist_tmpfile)
return ret
def getGfvomsUpdOptions():
@@ -110,7 +114,8 @@
gfvoms_list = "./gfvoms-list"
if not os.path.isfile(gfvoms_list):
sys.exit("Cannot find command 'gfvoms-list'")
- status, gfvoms_update = commands.getstatusoutput("which gfvoms-update")
+ status, gfvoms_update = commands.getstatusoutput(
+ "which gfvoms-update")
if status != 0:
gfvoms_update = "./gfvoms-update"
if not os.path.isfile(gfvoms_update):
@@ -124,7 +129,8 @@
if not os.path.exists(tmpdir):
os.makedirs(tmpdir)
print "gfvoms-list started..."
- status = os.system("%s %s"%(gfvoms_list, getGfvomsListOptions()))
+ status = os.system("%s %s"%(
+ gfvoms_list, getGfvomsListOptions()))
if status != 0:
raise Exception("gfvoms-list failed!")
options["vomslist"] = vomslist_tmpfile
Modified: gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-update/gfvoms-update.c
===================================================================
--- gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-update/gfvoms-update.c 2009-03-21 16:54:00 UTC (rev 4118)
+++ gfarm_v2/trunk/gftool/gfvoms-sync/gfvoms-update/gfvoms-update.c 2009-03-24 05:12:23 UTC (rev 4119)
@@ -5,18 +5,17 @@
* All rights reserved.
*/
+#include <ctype.h>
+#include <libgen.h>
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <libgen.h>
-#include <errno.h>
#include <gfarm/gfarm.h>
+#include "config.h"
#include "gfm_client.h"
-#include "config.h"
#define MAX_LINE_LEN 4096
#define USER_ALLOC_SIZE 20
@@ -88,13 +87,18 @@
static void
usage(void)
{
- fprintf(stderr, "Usage: %s [-n] [-h] [-d] -V vomsID -v vo -m member-list\n", program_name);
+ fprintf(stderr,
+ "Usage: %s [-n] [-h] [-d] -V vomsID -v vo -m member-list\n",
+ program_name);
fprintf(stderr, " -h : Show this usage.\n");
- fprintf(stderr, " -d : Delete target vo groups from Gfarm.\n");
- fprintf(stderr, " -V vomsID : ID which defined in Definition file\n");
+ fprintf(stderr,
+ " -d : Delete target vo groups from Gfarm.\n");
+ fprintf(stderr,
+ " -V vomsID : ID which defined in Definition file\n");
fprintf(stderr, " -v vo : VO name which you want to sync\n");
- fprintf(stderr, " -m member-list: MemberShip list which generated by gfvoms-list\n");
- fprintf(stderr, " -n : Debug option. No update occurs. Just print results to stdout\n");
+ fprintf(stderr,
+ " -m member-list: MemberShip list generated by gfvoms-list\n");
+ fprintf(stderr, " -n : Debug option. No update occurs.\n");
}
/* delete space, CR and LF from head and tail of the string.*/
@@ -103,7 +107,8 @@
{
int i, j;
for (i = 0; i < len; i++) {
- if ((!isspace(str[i]) && str[i] != '\n' && str[i] != '\r') || str[i] == '\0') {
+ if ((!isspace(str[i]) && str[i] != '\n' && str[i] != '\r')
+ || str[i] == '\0') {
break;
}
}
@@ -120,7 +125,8 @@
str[i] = '\0';
i--;
}
- while (strlen(str) > 0 && (str[strlen(str) - 1] == '\n' || str[strlen(str) - 1] == '\r')) {
+ while (strlen(str) > 0 &&
+ (str[strlen(str) - 1] == '\n' || str[strlen(str) - 1] == '\r')) {
str[strlen(str) - 1] = '\0';
}
@@ -274,7 +280,8 @@
/* make new node and add it to doubly-circularly-linked list */
static gfarm_error_t
-set_new_list(struct group_info_list *pre, struct group_info_list **add, int nuser)
+set_new_list(struct group_info_list *pre, struct group_info_list **add,
+ int nuser)
{
gfarm_error_t e = GFARM_ERR_NO_ERROR;
struct group_info_list *tmp = NULL;
@@ -351,7 +358,8 @@
tmp2->group_info = &(groups[i]);
for (j = 0; j < groups[i].nusers; j++) {
- tmp2->user_infos[j] = get_user_info_by_name(groups[i].usernames[j]);
+ tmp2->user_infos[j] = get_user_info_by_name(
+ groups[i].usernames[j]);
if (tmp2->user_infos[j] == NULL) {
goto err;
}
@@ -415,8 +423,12 @@
line++;
idx = buf;
if (idx[strlen(idx)-1] != '\n' && idx[strlen(idx)-1] != '\r') {
- fprintf(stderr, "Error:In voms membership file('%s'[line %d])\n", vomsfile, line);
- fprintf(stderr, "Line was too long. Limit length is %d.\n", MAX_LINE_LEN);
+ fprintf(stderr,
+ "Error:In voms membership file('%s'[line %d])\n",
+ vomsfile, line);
+ fprintf(stderr,
+ "Line was too long. Limit length is %d.\n",
+ MAX_LINE_LEN);
goto err;
}
trim(idx, MAX_LINE_LEN);
@@ -424,34 +436,48 @@
if (isHead > 0) {
if ((p = strstr(idx, VOID_FORM)) != NULL && p == idx) {
if (flag == 1) {
- fprintf(stderr, "Error:In voms membership file('%s'[line %d])\n", vomsfile, line);
+ fprintf(stderr,
+ "Error:In voms membership file('%s'[line %d])\n",
+ vomsfile, line);
fprintf(stderr, "Duplicate header '%s'.\n", VOID_FORM);
goto err;
}
p += strlen(VOID_FORM);
if (strcmp(p, vomsid)) {
- fprintf(stderr, "Error:In voms membership file('%s'[line %d])\n", vomsfile, line);
- fprintf(stderr, "VOMS ID Contradiction:voms_file(%s) and command(%s)\n", p, vomsid);
+ fprintf(stderr,
+ "Error:In voms membership file('%s'[line %d])\n",
+ vomsfile, line);
+ fprintf(stderr,
+ "VOMSID Contradiction:vomsfile(%s) and command(%s)\n",
+ p, vomsid);
goto err;
}
flag = 1;
}
else if ((p = strstr(idx, VO_FORM)) != NULL && p == idx) {
if (flag == 2) {
- fprintf(stderr, "Error:In voms membership file('%s'[line %d])\n", vomsfile, line);
+ fprintf(stderr,
+ "Error:In voms membership file('%s'[line %d])\n",
+ vomsfile, line);
fprintf(stderr, "Duplicate header '%s'.\n", VO_FORM);
goto err;
}
p += strlen(VO_FORM);
if (strcmp(p, vo)) {
- fprintf(stderr, "Error:In voms membership file('%s'[line %d])\n", vomsfile, line);
- fprintf(stderr, "VO Contradiction:voms_file(%s) and command(%s)\n", p+1, vo+1);
+ fprintf(stderr,
+ "Error:In voms membership file('%s'[line %d])\n",
+ vomsfile, line);
+ fprintf(stderr,
+ "VO Contradiction:voms_file(%s) and command(%s)\n",
+ p+1, vo+1);
goto err;
}
flag = 2;
}
else {
- fprintf(stderr, "Error:In voms membership file('%s'[line %d])\n", vomsfile, line);
+ fprintf(stderr,
+ "Error:In voms membership file('%s'[line %d])\n",
+ vomsfile, line);
fprintf(stderr, "Unknown header:%s\n", idx);
goto err;
}
@@ -463,7 +489,9 @@
tmp2 = NULL;
e = set_new_list(tmp1, &tmp2, USER_ALLOC_SIZE);
if (e != GFARM_ERR_NO_ERROR) {
- fprintf(stderr, "Error:In voms membership file('%s'[line %d])\n", vomsfile, line);
+ fprintf(stderr,
+ "Error:In voms membership file('%s'[line %d])\n",
+ vomsfile, line);
goto err;
}
tmp2->nusers = 0;
@@ -472,7 +500,9 @@
p += strlen(GROUP_FORM);
tmp2->group_name = make_groupname(p);
if (tmp2->group_name == NULL) {
- fprintf(stderr, "Error:In voms membership file('%s'[line %d])\n", vomsfile, line);
+ fprintf(stderr,
+ "Error:In voms membership file('%s'[line %d])\n",
+ vomsfile, line);
e = GFARM_ERR_NO_MEMORY;
goto err;
}
@@ -480,9 +510,12 @@
else if ((p = strstr(idx, USER_FORM)) != NULL && p == idx) {
if (tmp2->nusers >= allocated_size) {
allocated_size += USER_ALLOC_SIZE;
- GFARM_REALLOC_ARRAY(user_tmp, tmp2->user_infos, allocated_size);
+ GFARM_REALLOC_ARRAY(user_tmp,
+ tmp2->user_infos, allocated_size);
if (user_tmp == NULL) {
- fprintf(stderr, "Error:In voms membership file('%s'[line %d])\n", vomsfile, line);
+ fprintf(stderr,
+ "Error:In voms membership file('%s'[line %d])\n",
+ vomsfile, line);
e = GFARM_ERR_NO_MEMORY;
goto err;
}
@@ -496,17 +529,21 @@
}
for (i = 0; i < tmp2->nusers; i++) {
if (tmp2->user_infos[i] == tmp2->user_infos[tmp2->nusers]) {
- fprintf(stderr, "Error:In voms membership file('%s'[line %d])\n", vomsfile, line);
fprintf(stderr,
+ "Error:In voms membership file('%s'[line %d])\n",
+ vomsfile, line);
+ fprintf(stderr,
"Error:Duplicated user(%s) in same group.\n",
- tmp2->user_infos[tmp2->nusers]->username);
+ tmp2->user_infos[tmp2->nusers]->username);
goto err;
}
}
tmp2->nusers++;
}
else {
- fprintf(stderr, "Error:In voms membership file('%s'[line %d])\n", vomsfile, line);
+ fprintf(stderr,
+ "Error:In voms membership file('%s'[line %d])\n",
+ vomsfile, line);
fprintf(stderr, "Unknown format line:'%s'\n", idx);
goto err;
}
@@ -562,14 +599,20 @@
if (e != GFARM_ERR_NO_ERROR) {
fprintf(stderr, "Error: Failed to add group.\n");
if (e == GFARM_ERR_ALREADY_EXISTS) {
- fprintf(stderr, "Group:'%s' cannot be added, because it already exists.\n", ret.groupname);
- fprintf(stderr, "The group might be updated before your operation.\n");
+ fprintf(stderr,
+ "Group:'%s' cannot be added, ", ret.groupname);
+ fprintf(stderr, "because it already exists.\n");
+ fprintf(stderr,
+ "The group might be updated before your operation.\n");
fprintf(stderr, "You should try sync once more.\n");
}
else if (e == GFARM_ERR_NO_SUCH_USER) {
- fprintf(stderr, "Unknown user was tried to add.\n");
- fprintf(stderr, "The user might be deleted before your operation.\n");
- fprintf(stderr, "You should try sync once more.\n");
+ fprintf(stderr,
+ "Unknown user was tried to add.\n");
+ fprintf(stderr,
+ "The user might be deleted before your operation.\n");
+ fprintf(stderr,
+ "You should try sync once more.\n");
}
goto err;
}
@@ -583,9 +626,12 @@
e = gfm_client_group_info_remove(gfarm_metadb_server, tmp->group_name);
if (e != GFARM_ERR_NO_ERROR) {
fprintf(stderr, "Error: Failed to delete group.\n");
- if (e == GFARM_ERR_NO_SUCH_OBJECT || e == GFARM_ERR_NO_SUCH_GROUP) {
- fprintf(stderr, "Group:'%s' didn't exist.\n", tmp->group_name);
- fprintf(stderr, "The group might be deleted before your operation.\n");
+ if (e == GFARM_ERR_NO_SUCH_OBJECT ||
+ e == GFARM_ERR_NO_SUCH_GROUP) {
+ fprintf(stderr,
+ "Group:'%s' didn't exist.\n", tmp->group_name);
+ fprintf(stderr,
+ "The group might be deleted before your operation.\n");
fprintf(stderr, "You should try sync once more.\n");
}
goto err;
@@ -612,14 +658,18 @@
e = gfm_client_group_info_modify(gfarm_metadb_server, &ret);
if (e != GFARM_ERR_NO_ERROR) {
fprintf(stderr, "Error: Failed to modify group.\n");
- if (e == GFARM_ERR_NO_SUCH_OBJECT || e == GFARM_ERR_NO_SUCH_GROUP) {
- fprintf(stderr, "Group:'%s' didn't exist.\n", tmp->group_name);
- fprintf(stderr, "The group might be deleted before your operation.\n");
+ if (e == GFARM_ERR_NO_SUCH_OBJECT ||
+ e == GFARM_ERR_NO_SUCH_GROUP) {
+ fprintf(stderr,
+ "Group:'%s' didn't exist.\n", tmp->group_name);
+ fprintf(stderr,
+ "The group might be deleted before your operation.\n");
fprintf(stderr, "You should try sync once more.\n");
}
else if (e == GFARM_ERR_NO_SUCH_USER) {
fprintf(stderr, "Unknown user was tried to add.\n");
- fprintf(stderr, "The user might be deleted before your operation.\n");
+ fprintf(stderr,
+ "The user might be deleted before your operation.\n");
fprintf(stderr, "You should try sync once more.\n");
}
goto err;
@@ -658,9 +708,11 @@
tmp = tmp->next;
continue;
}
- fprintf(stdout, "\tgroup=%s\n", tmp->group_name);
+ fprintf(stdout,
+ "\tgroup=%s\n", tmp->group_name);
for (i = 0; i < tmp->nusers; i++) {
- fprintf(stdout, "\t\tuser=%s | gsi_dn=%s\n",
+ fprintf(stdout,
+ "\t\tuser=%s | gsi_dn=%s\n",
tmp->user_infos[i]->username, tmp->user_infos[i]->gsi_dn);
}
tmp = tmp->next;
@@ -845,7 +897,8 @@
goto err;
}
if (!checkVomsIDChars()) {
- fprintf(stderr, "The chars which can use for vomsID are [a-zA-Z0-9_-].\n");
+ fprintf(stderr,
+ "The chars which can use for vomsID are [a-zA-Z0-9_-].\n");
goto err;
}
@@ -887,13 +940,11 @@
{
gfarm_error_t e = GFARM_ERR_NO_ERROR;
struct group_info_list *gfarm_list = NULL;
-
char noupd = 0, del = 0, c;
e = gfarm_initialize(&argc, &argv);
if (e != GFARM_ERR_NO_ERROR) {
- fprintf(stderr, "gfarm_initialize: %s\n",
- gfarm_error_string(e));
+ fprintf(stderr, "gfarm_initialize: %s\n",gfarm_error_string(e));
goto err;
}
@@ -902,21 +953,24 @@
case OP_VOMS_FILE:
SET_VOMS_MEMBER_FILE(optarg, e);
if (e != GFARM_ERR_NO_ERROR) {
- fprintf(stderr, "%s\n", gfarm_error_string(GFARM_ERR_NO_MEMORY));
+ fprintf(stderr,
+ "%s\n", gfarm_error_string(GFARM_ERR_NO_MEMORY));
goto err;
}
break;
case OP_VOMSID:
SET_VOMSID(optarg, e);
if (e != GFARM_ERR_NO_ERROR) {
- fprintf(stderr, "%s\n", gfarm_error_string(GFARM_ERR_NO_MEMORY));
+ fprintf(stderr,
+ "%s\n", gfarm_error_string(GFARM_ERR_NO_MEMORY));
goto err;
}
break;
case OP_VO:
SET_VO(optarg, e);
if (e != GFARM_ERR_NO_ERROR) {
- fprintf(stderr, "%s\n", gfarm_error_string(GFARM_ERR_NO_MEMORY));
+ fprintf(stderr,
+ "%s\n", gfarm_error_string(GFARM_ERR_NO_MEMORY));
goto err;
}
break;
Modified: gfarm_v2/trunk/gftool/gfvoms-sync/lib/Makefile
===================================================================
--- gfarm_v2/trunk/gftool/gfvoms-sync/lib/Makefile 2009-03-21 16:54:00 UTC (rev 4118)
+++ gfarm_v2/trunk/gftool/gfvoms-sync/lib/Makefile 2009-03-24 05:12:23 UTC (rev 4119)
@@ -41,7 +41,7 @@
done
script-veryclean: clean
- -test -z "$(EXTRA_VERYCLEAN_TARGETS)" || $(RM) -f $(EXTRA_VERYCLEAN_TARGETS)
+ -test -z "$(EXTRA_VERYCLEAN_TARGETS)" || $(RM) -f "$(EXTRA_VERYCLEAN_TARGETS)"
script-distclean: veryclean
-test ! -f $(srcdir)/Makefile.in || $(RM) -f Makefile
Modified: gfarm_v2/trunk/gftool/gfvoms-sync/lib/zsi_def.py
===================================================================
--- gfarm_v2/trunk/gftool/gfvoms-sync/lib/zsi_def.py 2009-03-21 16:54:00 UTC (rev 4118)
+++ gfarm_v2/trunk/gftool/gfvoms-sync/lib/zsi_def.py 2009-03-24 05:12:23 UTC (rev 4119)
@@ -8,7 +8,8 @@
# Apache 2.0 Licensed Products:
# This product includes software listed below that were licensed under
# the Apache License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of the License at
+# except in compliance with the License.
+# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -24,19 +25,24 @@
"""modules to use ZSI.
"""
+nspace = "http://glite.org/wsdl/services/org.glite.security.voms"
+encstyle = "http://schemas.xmlsoap.org/soap/encoding/"
+
import string, getopt, sys, os, os.path, types, re, urlparse
import ZSI
from ZSI import client
class ns0:
- targetNamespace = "http://glite.org/wsdl/services/org.glite.security.voms"
+ targetNamespace = nspace
class User_Def(ZSI.TCcompound.ComplexType, ZSI.schema.TypeDefinition):
- schema = "http://glite.org/wsdl/services/org.glite.security.voms"
+ schema = nspace
type = (schema, "User")
- def __init__(self, pname, ofwhat=(), attributes=None, extend=False, restrict=False, **kw):
+ def __init__(self, pname, ofwhat=(), attributes=None,
+ extend=False, restrict=False, **kw):
ns = self.__class__.schema
- option = {"minOccurs":1, "maxOccurs":1, "nillable":True, "typed":False, "encoded":kw.get("encoded")}
+ option = {"minOccurs":1, "maxOccurs":1, "nillable":True,
+ "typed":False, "encoded":kw.get("encoded")}
TClist = [
ZSI.TC.String(pname="CA", aname="_CA", **option),
ZSI.TC.String(pname="CN", aname="_CN", **option),
@@ -46,7 +52,8 @@
self.attribute_typecode_dict = attributes or {}
if extend: TClist += ofwhat
if restrict: TClist = ofwhat
- ZSI.TCcompound.ComplexType.__init__(self, None, TClist, pname=pname, inorder=0, **kw)
+ ZSI.TCcompound.ComplexType.__init__(
+ self, None, TClist, pname=pname, inorder=0, **kw)
class Holder:
typecode = self
def __init__(self):
@@ -62,16 +69,19 @@
Holder.__name__ = "User_Holder"
self.pyclass = Holder
- class VOMSException_Def(ZSI.TCcompound.ComplexType, ZSI.schema.TypeDefinition):
- schema = "http://glite.org/wsdl/services/org.glite.security.voms"
+ class VOMSException_Def(ZSI.TCcompound.ComplexType,
+ ZSI.schema.TypeDefinition):
+ schema = nspace
type = (schema, "VOMSException")
- def __init__(self, pname, ofwhat=(), attributes=None, extend=False, restrict=False, **kw):
+ def __init__(self, pname, ofwhat=(),
+ attributes=None, extend=False, restrict=False, **kw):
ns = self.__class__.schema
TClist = []
self.attribute_typecode_dict = attributes or {}
if extend: TClist += ofwhat
if restrict: TClist = ofwhat
- ZSI.TCcompound.ComplexType.__init__(self, None, TClist, pname=pname, inorder=0, **kw)
+ ZSI.TCcompound.ComplexType.__init__(self, None, TClist,
+ pname=pname, inorder=0, **kw)
class Holder:
typecode = self
def __init__(self):
@@ -81,25 +91,29 @@
self.pyclass = Holder
class ns1:
- targetNamespace = "http://glite.org/wsdl/services/org.glite.security.voms.service.admin"
+ targetNamespace = "%s.service.admin"%(nspace)
class ArrayOf_tns2_User_Def(ZSI.TC.Array, ZSI.schema.TypeDefinition):
#complexType/complexContent base="SOAP-ENC:Array"
- schema = "http://glite.org/wsdl/services/org.glite.security.voms.service.admin"
+ schema = "%s.service.admin"%(nspace)
type = (schema, "ArrayOf_tns2_User")
- def __init__(self, pname, ofwhat=(), extend=False, restrict=False, attributes=None, **kw):
+ def __init__(self, pname, ofwhat=(), extend=False,
+ restrict=False, attributes=None, **kw):
ofwhat = ns0.User_Def(None, typed=False)
- atype = (u'http://glite.org/wsdl/services/org.glite.security.voms', u'User[]')
- ZSI.TCcompound.Array.__init__(self, atype, ofwhat, pname=pname, childnames='item', **kw)
+ atype = (nspace, u'User[]')
+ ZSI.TCcompound.Array.__init__(self, atype, ofwhat, pname=pname,
+ childnames='item', **kw)
class ArrayOf_soapenc_string_Def(ZSI.TC.Array, ZSI.schema.TypeDefinition):
#complexType/complexContent base="SOAP-ENC:Array"
- schema = "http://glite.org/wsdl/services/org.glite.security.voms.service.admin"
+ schema = "%s.service.admin"%(nspace)
type = (schema, "ArrayOf_soapenc_string")
- def __init__(self, pname, ofwhat=(), extend=False, restrict=False, attributes=None, **kw):
+ def __init__(self, pname, ofwhat=(), extend=False,
+ restrict=False, attributes=None, **kw):
ofwhat = ZSI.TC.String(None, typed=False)
- atype = (u'http://schemas.xmlsoap.org/soap/encoding/', u'string[]')
- ZSI.TCcompound.Array.__init__(self, atype, ofwhat, pname=pname, childnames='item', **kw)
+ atype = (encstyle, u'string[]')
+ ZSI.TCcompound.Array.__init__(self, atype, ofwhat, pname=pname,
+ childnames='item', **kw)
class listUsersWithRoleRequest:
def __init__(self):
@@ -107,47 +121,56 @@
self._in1 = None
return
listUsersWithRoleRequest.typecode = ZSI.TCcompound.Struct(
- pname=("http://glite.org/wsdl/services/org.glite.security.voms.service.admin","listUsersWithRole"),
+ pname=("%s.service.admin"%(nspace),"listUsersWithRole"),
ofwhat=[
- ZSI.TC.String(pname="in0", aname="_in0", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True),
- ZSI.TC.String(pname="in1", aname="_in1", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True)],
+ ZSI.TC.String(pname="in0", aname="_in0", typed=False, encoded=None,
+ minOccurs=1, maxOccurs=1, nillable=True),
+ ZSI.TC.String(pname="in1", aname="_in1", typed=False, encoded=None,
+ minOccurs=1, maxOccurs=1, nillable=True)],
pyclass=listUsersWithRoleRequest,
- encoded="http://glite.org/wsdl/services/org.glite.security.voms.service.admin")
+ encoded="%s.service.admin"%(nspace))
class listUsersWithRoleResponse:
def __init__(self):
self._listUsersWithRoleReturn = None
return
listUsersWithRoleResponse.typecode = ZSI.TCcompound.Struct(
- pname=("http://glite.org/wsdl/services/org.glite.security.voms.service.admin","listUsersWithRoleResponse"),
+ pname=("%s.service.admin"%(nspace),"listUsersWithRoleResponse"),
ofwhat=[
ns1.ArrayOf_tns2_User_Def(
- pname="listUsersWithRoleReturn", aname="_listUsersWithRoleReturn", typed=False,
- encoded=None, minOccurs=1, maxOccurs=1, nillable=True)],
+ pname="listUsersWithRoleReturn",
+ aname="_listUsersWithRoleReturn",
+ typed=False, encoded=None,
+ minOccurs=1, maxOccurs=1, nillable=True)],
pyclass=listUsersWithRoleResponse,
- encoded="http://glite.org/wsdl/services/org.glite.security.voms.service.admin")
+ encoded="%s.service.admin"%(nspace))
class listMembersRequest:
def __init__(self):
self._in0 = None
return
listMembersRequest.typecode = ZSI.TCcompound.Struct(
- pyclass=listMembersRequest,
- pname=("http://glite.org/wsdl/services/org.glite.security.voms.service.admin","listMembers"),
- ofwhat=[ZSI.TC.String(
- pname="in0", aname="_in0", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True)],
- encoded="http://glite.org/wsdl/services/org.glite.security.voms.service.admin")
-
+ pname=("%s.service.admin"%(nspace),"listMembers"),
+ ofwhat=[
+ ZSI.TC.String(
+ pname="in0", aname="_in0", typed=False, encoded=None,
+ minOccurs=1, maxOccurs=1, nillable=True)],
+ pyclass=listMembersRequest,
+ encoded="%s.service.admin"%(nspace))
+
class listMembersResponse:
def __init__(self):
self._listMembersReturn = None
return
listMembersResponse.typecode = ZSI.TCcompound.Struct(
- pyclass=listMembersResponse,
- pname=("http://glite.org/wsdl/services/org.glite.security.voms.service.admin","listMembersResponse"),
- ofwhat=[ns1.ArrayOf_tns2_User_Def(
- pname="listMembersReturn", aname="_listMembersReturn", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True)],
- encoded="http://glite.org/wsdl/services/org.glite.security.voms.service.admin")
+ pname=("%s.service.admin"%(nspace),"listMembersResponse"),
+ ofwhat=[
+ ns1.ArrayOf_tns2_User_Def(
+ pname="listMembersReturn", aname="_listMembersReturn",
+ typed=False, encoded=None,
+ minOccurs=1, maxOccurs=1, nillable=True)],
+ pyclass=listMembersResponse,
+ encoded="%s.service.admin"%(nspace))
class listRolesRequest:
def __init__(self):
@@ -155,21 +178,24 @@
self._in1 = None
return
listRolesRequest.typecode = ZSI.TCcompound.Struct(
- pname=("http://glite.org/wsdl/services/org.glite.security.voms.service.admin","listRoles"),
+ pname=("%s.service.admin"%(nspace),"listRoles"),
ofwhat=[],
pyclass=listRolesRequest,
- encoded="http://glite.org/wsdl/services/org.glite.security.voms.service.admin")
+ encoded="%s.service.admin"%(nspace))
class listRolesResponse:
def __init__(self):
self._listRolesReturn = None
return
listRolesResponse.typecode = ZSI.TCcompound.Struct(
- pname=("http://glite.org/wsdl/services/org.glite.security.voms.service.admin","listRolesResponse"),
- ofwhat=[ns1.ArrayOf_soapenc_string_Def(
- pname="listRolesReturn", aname="_listRolesReturn", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True)],
+ pname=("%s.service.admin"%(nspace),"listRolesResponse"),
+ ofwhat=[
+ ns1.ArrayOf_soapenc_string_Def(
+ pname="listRolesReturn", aname="_listRolesReturn",
+ typed=False, encoded=None,
+ minOccurs=1, maxOccurs=1, nillable=True)],
pyclass=listRolesResponse,
- encoded="http://glite.org/wsdl/services/org.glite.security.voms.service.admin")
+ encoded="%s.service.admin"%(nspace))
class listSubGroupsRequest:
@@ -177,22 +203,27 @@
self._in0 = None
return
listSubGroupsRequest.typecode = ZSI.TCcompound.Struct(
- pname=("http://glite.org/wsdl/services/org.glite.security.voms.service.admin","listSubGroups"),
+ pname=("%s.service.admin"%(nspace),"listSubGroups"),
ofwhat=[
- ZSI.TC.String(pname="in0", aname="_in0", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True)],
+ ZSI.TC.String(pname="in0", aname="_in0",
+ typed=False, encoded=None,
+ minOccurs=1, maxOccurs=1, nillable=True)],
pyclass=listSubGroupsRequest,
- encoded="http://glite.org/wsdl/services/org.glite.security.voms.service.admin")
+ encoded="%s.service.admin"%(nspace))
class listSubGroupsResponse:
def __init__(self):
self._listSubGroupsReturn = None
return
listSubGroupsResponse.typecode = ZSI.TCcompound.Struct(
- pname=("http://glite.org/wsdl/services/org.glite.security.voms.service.admin","listSubGroupsResponse"),
- ofwhat=[ns1.ArrayOf_soapenc_string_Def(
- pname="listSubGroupsReturn", aname="_listSubGroupsReturn", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True)],
+ pname=("%s.service.admin"%(nspace),"listSubGroupsResponse"),
+ ofwhat=[
+ ns1.ArrayOf_soapenc_string_Def(
+ pname="listSubGroupsReturn", aname="_listSubGroupsReturn",
+ typed=False, encoded=None,
+ minOccurs=1, maxOccurs=1, nillable=True)],
pyclass=listSubGroupsResponse,
- encoded="http://glite.org/wsdl/services/org.glite.security.voms.service.admin")
+ encoded="%s.service.admin"%(nspace))
class SOAPBinding:
@@ -201,15 +232,20 @@
transdict = {"cert_file":kw['user_cert'], "key_file":kw['user_key']}
kw.setdefault("readerclass", None)
kw.setdefault("writerclass", None)
- admin_url = "https://%s:%d/voms/%s/services/VOMSAdmin" % (kw['host'],kw['port'],kw['vo'])
- self.binding = client.Binding(url=admin_url, transdict = transdict, **kw)
+ admin_url = "https://%s:%d/voms/%s/services/VOMSAdmin" % (
+ kw['host'],kw['port'],kw['vo'])
+ self.binding = client.Binding(
+ url=admin_url, transdict = transdict, **kw)
# op "list-members"
def listMembers(self, **kw):
request = listMembersRequest()
request._in0 = "%s"%(kw["group"])
- self.binding.Send(None, None, request, soapaction="", encodingStyle="http://schemas.xmlsoap.org/soap/encoding/", **kw)
- typecode = ZSI.TCcompound.Struct(pname=None, ofwhat=listMembersResponse.typecode.ofwhat, pyclass=listMembersResponse.typecode.pyclass)
+ self.binding.Send(None, None, request,
+ soapaction="", encodingStyle=encstyle, **kw)
+ typecode = ZSI.TCcompound.Struct(
+ pname=None, ofwhat=listMembersResponse.typecode.ofwhat,
+ pyclass=listMembersResponse.typecode.pyclass)
if self.binding.Receive(typecode)._listMembersReturn == None:
return []
return self.binding.Receive(typecode)._listMembersReturn
@@ -218,8 +254,11 @@
def listSubGroups(self, **kw):
request = listSubGroupsRequest()
request._in0 = "%s"%(kw["group"])
- self.binding.Send(None, None, request, soapaction="", encodingStyle="http://schemas.xmlsoap.org/soap/encoding/", **kw)
- typecode = ZSI.TCcompound.Struct(pname=None, ofwhat=listSubGroupsResponse.typecode.ofwhat, pyclass=listSubGroupsResponse.typecode.pyclass)
+ self.binding.Send(None, None, request,
+ soapaction="", encodingStyle=encstyle, **kw)
+ typecode = ZSI.TCcompound.Struct(
+ pname=None, ofwhat=listSubGroupsResponse.typecode.ofwhat,
+ pyclass=listSubGroupsResponse.typecode.pyclass)
response = self.binding.Receive(typecode)
if self.binding.Receive(typecode)._listSubGroupsReturn == None:
return []
@@ -228,8 +267,11 @@
# op "list-roles"
def listRoles(self, **kw):
request = listRolesRequest()
- self.binding.Send(None, None, request, soapaction="", encodingStyle="http://schemas.xmlsoap.org/soap/encoding/")
- typecode = ZSI.TCcompound.Struct(pname=None, ofwhat=listRolesResponse.typecode.ofwhat, pyclass=listRolesResponse.typecode.pyclass)
+ self.binding.Send(None, None, request,
+ soapaction="", encodingStyle=encstyle)
+ typecode = ZSI.TCcompound.Struct(
+ pname=None, ofwhat=listRolesResponse.typecode.ofwhat,
+ pyclass=listRolesResponse.typecode.pyclass)
if self.binding.Receive(typecode)._listRolesReturn == None:
return []
return self.binding.Receive(typecode)._listRolesReturn
@@ -239,8 +281,11 @@
request = listUsersWithRoleRequest()
request._in0 = "%s"%(kw["group"])
request._in1 = "%s"%(kw["role"])
- self.binding.Send(None, None, request, soapaction="", encodingStyle="http://schemas.xmlsoap.org/soap/encoding/")
- typecode = ZSI.TCcompound.Struct(pname=None, ofwhat=listUsersWithRoleResponse.typecode.ofwhat, pyclass=listUsersWithRoleResponse.typecode.pyclass)
+ self.binding.Send(None, None, request,
+ soapaction="", encodingStyle=encstyle)
+ typecode = ZSI.TCcompound.Struct(
+ pname=None, ofwhat=listUsersWithRoleResponse.typecode.ofwhat,
+ pyclass=listUsersWithRoleResponse.typecode.pyclass)
response = self.binding.Receive(typecode)
if self.binding.Receive(typecode)._listUsersWithRoleReturn == None:
return []
@@ -248,7 +293,8 @@
def execute(self, cmd, **arg):
- cmds = {"listUsersWithRole":"","listRoles":"","listSubGroups":"","listMembers":""}
+ cmds = {"listUsersWithRole":"","listRoles":"",
+ "listSubGroups":"","listMembers":""}
if cmd in cmds:
try:
response = self.__class__.__dict__[cmd](self, **arg)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ta...@us...> - 2009-03-21 16:54:11
|
Revision: 4118
http://gfarm.svn.sourceforge.net/gfarm/?rev=4118&view=rev
Author: tatebe
Date: 2009-03-21 16:54:00 +0000 (Sat, 21 Mar 2009)
Log Message:
-----------
update usage
Modified Paths:
--------------
gfarm_v2/branches/2.1.2/gftool/config-gfarm/config-gfarm.in
Modified: gfarm_v2/branches/2.1.2/gftool/config-gfarm/config-gfarm.in
===================================================================
--- gfarm_v2/branches/2.1.2/gftool/config-gfarm/config-gfarm.in 2009-03-21 15:36:20 UTC (rev 4117)
+++ gfarm_v2/branches/2.1.2/gftool/config-gfarm/config-gfarm.in 2009-03-21 16:54:00 UTC (rev 4118)
@@ -135,13 +135,15 @@
usage()
{
- echo >&2 "usage: $PROGNAME [--help] [--prefix prefix] [-t] [-f] [-W] [-w]"
- echo >&2 " [-b metadata_backend] [-V metadata_backend_version]"
+ echo >&2 "usage: $PROGNAME [--help] [--prefix prefix] [-t] [-f]"
+ echo >&2 " [-S] [-N] [-W] [-w]"
+ echo >&2 " [-h hostname] [-d domain_name] [-m gfmd_port]"
+ echo >&2 " [-A metadata_admin_user] [-D metadata_admin_gsi_dn]"
+ echo >&2 " [-a auth_type]"
+ echo >&2 " [-b metadata_backend] [-P backend_prefix]"
+ echo >&2 " [-V metadata_backend_version] [-p metadata_backend_port]"
echo >&2 " [-U backend_admin_user] [-u backend_user]"
- echo >&2 " [-d domain_name] [-h hostname]"
echo >&2 " [-l metadata_directory] [-L metadata_logging_directory]"
- echo >&2 " [-p metadata_backend_port]"
- echo >&2 " [-A metadata_admin_user] [-m gfmd_port] [-a auth_type]"
echo >&2 " $BACKEND_TYPE backend options: (must be specified after -b <backend_type>)"
usage_$BACKEND_TYPE ||
echo >&2 " no such option with backend=$BACKEND_TYPE"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ta...@us...> - 2009-03-21 15:36:27
|
Revision: 4117
http://gfarm.svn.sourceforge.net/gfarm/?rev=4117&view=rev
Author: tatebe
Date: 2009-03-21 15:36:20 +0000 (Sat, 21 Mar 2009)
Log Message:
-----------
honor sysconfdir and localstatedir
Modified Paths:
--------------
gfarm_v2/branches/2.1.2/gftool/gfdump/gfdump.postgresql.in
Modified: gfarm_v2/branches/2.1.2/gftool/gfdump/gfdump.postgresql.in
===================================================================
--- gfarm_v2/branches/2.1.2/gftool/gfdump/gfdump.postgresql.in 2009-03-20 14:56:41 UTC (rev 4116)
+++ gfarm_v2/branches/2.1.2/gftool/gfdump/gfdump.postgresql.in 2009-03-21 15:36:20 UTC (rev 4117)
@@ -12,9 +12,9 @@
# CONFIG_DIR configuration directory [$PREFIX/etc]
# DATA_DIR data directory of pgsql [$PREFIX/var/gfarm-pgsql]
-PREFIX=@prefix@
-: ${CONFIG_DIR:="$PREFIX/etc"}
-: ${DATA_DIR:="$PREFIX/var/gfarm-pgsql"}
+prefix=@prefix@
+: ${CONFIG_DIR:="@sysconfdir@"}
+: ${DATA_DIR:="@localstatedir@/gfarm-pgsql"}
GFMDCONF=$CONFIG_DIR/gfmd.conf
DUMPF=db.out
MODE=UNKNOWN
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n-...@us...> - 2009-03-20 14:56:44
|
Revision: 4116
http://gfarm.svn.sourceforge.net/gfarm/?rev=4116&view=rev
Author: n-soda
Date: 2009-03-20 14:56:41 +0000 (Fri, 20 Mar 2009)
Log Message:
-----------
revise previous change..
"dn.base" is a synonym of "dn", so mixing "dn.base" and "dn" is inconsistent.
Modified Paths:
--------------
gfarm_v2/branches/2.1.2/gftool/config-gfarm/slapd.conf-2.1.in
Modified: gfarm_v2/branches/2.1.2/gftool/config-gfarm/slapd.conf-2.1.in
===================================================================
--- gfarm_v2/branches/2.1.2/gftool/config-gfarm/slapd.conf-2.1.in 2009-03-20 14:53:02 UTC (rev 4115)
+++ gfarm_v2/branches/2.1.2/gftool/config-gfarm/slapd.conf-2.1.in 2009-03-20 14:56:41 UTC (rev 4116)
@@ -43,7 +43,7 @@
by users write
# to make the gfarm_ldap_sanity() function happy
-access to dn.base="@config_gfarm_ldap_base_dn@"
+access to dn="@config_gfarm_ldap_base_dn@"
by users read
# Indices to maintain
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|