Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit 050fc47

Browse files
committed
removing a few redundant functions
1 parent 2fbbe14 commit 050fc47

File tree

1 file changed

+15
-45
lines changed

1 file changed

+15
-45
lines changed

entrypoint.sh

Lines changed: 15 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -245,31 +245,6 @@ stop() {
245245
### runtime environment detection
246246
######################################################################################
247247

248-
get_requested_nfs_version() {
249-
250-
echo "${state[$STATE_NFS_VERSION]}"
251-
}
252-
253-
get_requested_port_mountd() {
254-
255-
echo "${state[$STATE_MOUNTD_PORT]}"
256-
}
257-
258-
get_requested_port_nfsd() {
259-
260-
echo "${state[$STATE_NFSD_PORT]}"
261-
}
262-
263-
get_requested_port_statd_in() {
264-
265-
echo "${state[$STATE_STATD_PORT_IN]}"
266-
}
267-
268-
get_requested_port_statd_out() {
269-
270-
echo "${state[$STATE_STATD_PORT_OUT]}"
271-
}
272-
273248
is_kerberos_requested() {
274249

275250
[[ -n "${!ENV_VAR_NFS_ENABLE_KERBEROS}" ]] && return 0 || return 1
@@ -285,6 +260,11 @@ is_idmapd_requested() {
285260
[[ -f "$PATH_FILE_ETC_IDMAPD_CONF" ]] && return 0 || return 1
286261
}
287262

263+
is_logging_debug() {
264+
265+
[[ -n ${state[$STATE_IS_LOGGING_DEBUG]} ]] && return 0 || return 1
266+
}
267+
288268
is_kernel_module_loaded() {
289269

290270
local -r module=$1
@@ -310,16 +290,6 @@ has_linux_capability() {
310290
return 1
311291
}
312292

313-
get_requested_count_nfsd_threads() {
314-
315-
echo "${state[$STATE_NFSD_THREAD_COUNT]}"
316-
}
317-
318-
is_logging_debug() {
319-
320-
[[ -n ${state[$STATE_IS_LOGGING_DEBUG]} ]] && return 0 || return 1
321-
}
322-
323293

324294
######################################################################################
325295
### runtime configuration assertions
@@ -568,7 +538,7 @@ boot_helper_mount() {
568538

569539
boot_helper_get_version_flags() {
570540

571-
local -r requested_version="$(get_requested_nfs_version)"
541+
local -r requested_version="${state[$STATE_NFS_VERSION]}"
572542
local flags=('--nfs-version' "$requested_version" '--no-nfs-version' 2)
573543

574544
if ! is_nfs3_enabled; then
@@ -638,7 +608,7 @@ boot_main_mountd() {
638608

639609
local version_flags
640610
read -r -a version_flags <<< "$(boot_helper_get_version_flags)"
641-
local -r port=$(get_requested_port_mountd)
611+
local -r port="${state[$STATE_MOUNTD_PORT]}"
642612
local args=('--port' "$port" "${version_flags[@]}")
643613
if is_logging_debug; then
644614
args+=('--debug' 'all')
@@ -679,8 +649,8 @@ boot_main_statd() {
679649
return
680650
fi
681651

682-
local -r port_in=$(get_requested_port_statd_in)
683-
local -r port_out=$(get_requested_port_statd_out)
652+
local -r port_in="${state[$STATE_STATD_PORT_IN]}"
653+
local -r port_out="${state[$STATE_STATD_PORT_OUT]}"
684654
local -r args=('--no-notify' '--port' "$port_in" '--outgoing-port' "$port_out")
685655

686656
boot_helper_start_daemon "starting statd on port $port_in (outgoing from port $port_out)" $PATH_BIN_STATD "${args[@]}"
@@ -690,8 +660,8 @@ boot_main_nfsd() {
690660

691661
local version_flags
692662
read -r -a version_flags <<< "$(boot_helper_get_version_flags)"
693-
local -r threads=$(get_requested_count_nfsd_threads)
694-
local -r port=$(get_requested_port_nfsd)
663+
local -r threads="${state[$STATE_NFSD_THREAD_COUNT]}"
664+
local -r port="${state[$STATE_NFSD_PORT]}"
695665
local args=('--tcp' '--udp' '--port' "$port" "${version_flags[@]}" "$threads")
696666

697667
if is_logging_debug; then
@@ -726,7 +696,7 @@ boot_main_svcgssd() {
726696

727697
summarize_nfs_versions() {
728698

729-
local -r reqd_version="$(get_requested_nfs_version)"
699+
local -r reqd_version="${state[$STATE_NFS_VERSION]}"
730700
local versions=''
731701

732702
case "$reqd_version" in
@@ -777,9 +747,9 @@ summarize_exports() {
777747

778748
summarize_ports() {
779749

780-
local -r port_nfsd="$(get_requested_port_nfsd)"
781-
local -r port_mountd="$(get_requested_port_mountd)"
782-
local -r port_statd_in="$(get_requested_port_statd_in)"
750+
local -r port_nfsd="${state[$STATE_NFSD_PORT]}"
751+
local -r port_mountd="${state[$STATE_MOUNTD_PORT]}"
752+
local -r port_statd_in="${state[$STATE_STATD_PORT_IN]}"
783753

784754
if ! is_nfs3_enabled; then
785755
log "list of container ports that should be exposed: $port_nfsd (TCP)"

0 commit comments

Comments
 (0)