1*f4bc8af0Salnsn.\" $NetBSD: getfsspecname.3,v 1.7 2018/12/28 18:44:11 alnsn Exp $ 229484ab2Schristos.\" 329484ab2Schristos.\" Copyright (c) 2012 The NetBSD Foundation, Inc. 429484ab2Schristos.\" All rights reserved. 529484ab2Schristos.\" 629484ab2Schristos.\" This code is derived from software contributed to The NetBSD Foundation 729484ab2Schristos.\" by Christos Zoulas. 829484ab2Schristos.\" 929484ab2Schristos.\" Redistribution and use in source and binary forms, with or without 1029484ab2Schristos.\" modification, are permitted provided that the following conditions 1129484ab2Schristos.\" are met: 1229484ab2Schristos.\" 1. Redistributions of source code must retain the above copyright 1329484ab2Schristos.\" notice, this list of conditions and the following disclaimer. 1429484ab2Schristos.\" 2. Redistributions in binary form must reproduce the above copyright 1529484ab2Schristos.\" notice, this list of conditions and the following disclaimer in the 1629484ab2Schristos.\" documentation and/or other materials provided with the distribution. 1729484ab2Schristos.\" 1829484ab2Schristos.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 1929484ab2Schristos.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2029484ab2Schristos.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2129484ab2Schristos.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2229484ab2Schristos.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2329484ab2Schristos.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2429484ab2Schristos.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2529484ab2Schristos.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2629484ab2Schristos.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2729484ab2Schristos.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2829484ab2Schristos.\" POSSIBILITY OF SUCH DAMAGE. 2929484ab2Schristos.\" 3029484ab2Schristos.\" 31*f4bc8af0Salnsn.Dd December 28, 2018 3229484ab2Schristos.Dt GETFSSPECNAME 3 3329484ab2Schristos.Os 3429484ab2Schristos.Sh NAME 3529484ab2Schristos.Nm getfsspecname 3629484ab2Schristos.Nd get the underlying wedge name from a label 3729484ab2Schristos.Sh LIBRARY 388f3dcf00Schristos.Lb libutil 3929484ab2Schristos.Sh SYNOPSIS 4029484ab2Schristos.In util.h 4129484ab2Schristos.Ft const char * 4229484ab2Schristos.Fn getfsspecname "char *buf" "size_t buflen" "const char *spec" 4329484ab2Schristos.Sh DESCRIPTION 4429484ab2SchristosThe 4529484ab2Schristos.Fn getfsspecname 4629484ab2Schristosfunction translates an 4729484ab2Schristos.Ft fs_spec 4829484ab2Schristosfield in the 4929484ab2Schristos.Fa spec 5029484ab2Schristosargument of the form 5129484ab2Schristos.Dq NAME=wedgename 5229484ab2Schristosto the underlying 5329484ab2Schristos.Xr dk 4 5429484ab2Schristosdevice node, and places the resulting pathname in 5529484ab2Schristos.Fa buf 5629484ab2Schristosup to len 57f8c3486fSchristos.Fa buflen . 5829484ab2Schristos.Pp 5929484ab2SchristosIf the 6029484ab2Schristos.Fa spec 6151976c5cSjmcneillargument starts with 6251976c5cSjmcneill.Dq ROOT. , 6351976c5cSjmcneilla path in the form 6451976c5cSjmcneill.Dq /dev/[root_device][suffix] 6551976c5cSjmcneillis copied to 6651976c5cSjmcneill.Fa buf , 6751976c5cSjmcneillwhere 6851976c5cSjmcneill.Bq root_device 6951976c5cSjmcneillis the value of the 7051976c5cSjmcneill.Dq kern.root_device 7151976c5cSjmcneillsysctl and 7251976c5cSjmcneill.Bq suffix 7351976c5cSjmcneillis the characters following 7451976c5cSjmcneill.Dq ROOT. 7551976c5cSjmcneillin the 7651976c5cSjmcneill.Fa spec 7751976c5cSjmcneillargument. 78*f4bc8af0Salnsn.Pp 79*f4bc8af0SalnsnIf the 80*f4bc8af0Salnsn.Fa spec 81*f4bc8af0Salnsnargument is not of the form 82*f4bc8af0Salnsn.Dq NAME=wedgename 83*f4bc8af0Salnsnand it doesn't start with 84*f4bc8af0Salnsn.Dq ROOT. , 85*f4bc8af0Salnsn.Fa spec 86*f4bc8af0Salnsnis copied 87*f4bc8af0Salnsnto 88*f4bc8af0Salnsn.Fa buf 89*f4bc8af0Salnsnand returned. 9029484ab2Schristos.Sh RETURN VALUES 9129484ab2SchristosOn success the absolute pathname of the underlying wedge device is returned, 9229484ab2Schristosor the original 9329484ab2Schristos.Fa spec 9429484ab2Schristosargument. 9529484ab2SchristosOn failure 9629484ab2Schristos.Dv NULL 97e3df6c4cSdhollandis returned and 9829484ab2Schristos.Fa buf 9929484ab2Schristoscontains the reason for the error. 10029484ab2Schristos.Sh SEE ALSO 10129484ab2Schristos.Xr fstab 5 10229484ab2Schristos.Sh HISTORY 10329484ab2SchristosThe 10429484ab2Schristos.Fn getfsspecname 10529484ab2Schristosfunction appeared in 10698dbe2d3Swiz.Nx 7.0 . 107