~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/nfs/nfsroot.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /fs/nfs/nfsroot.c (Version linux-6.12-rc7) and /fs/nfs/nfsroot.c (Version linux-5.6.19)


  1 // SPDX-License-Identifier: GPL-2.0                 1 // SPDX-License-Identifier: GPL-2.0
  2 /*                                                  2 /*
  3  *  Copyright (C) 1995, 1996  Gero Kuhlmann <g      3  *  Copyright (C) 1995, 1996  Gero Kuhlmann <gero@gkminix.han.de>
  4  *                                                  4  *
  5  *  Allow an NFS filesystem to be mounted as r      5  *  Allow an NFS filesystem to be mounted as root. The way this works is:
  6  *     (1) Use the IP autoconfig mechanism to       6  *     (1) Use the IP autoconfig mechanism to set local IP addresses and routes.
  7  *     (2) Construct the device string and the      7  *     (2) Construct the device string and the options string using DHCP
  8  *         option 17 and/or kernel command lin      8  *         option 17 and/or kernel command line options.
  9  *     (3) When mount_root() sets up the root       9  *     (3) When mount_root() sets up the root file system, pass these strings
 10  *         to the NFS client's regular mount i     10  *         to the NFS client's regular mount interface via sys_mount().
 11  *                                                 11  *
 12  *                                                 12  *
 13  *      Changes:                                   13  *      Changes:
 14  *                                                 14  *
 15  *      Alan Cox        :       Removed get_ad     15  *      Alan Cox        :       Removed get_address name clash with FPU.
 16  *      Alan Cox        :       Reformatted a      16  *      Alan Cox        :       Reformatted a bit.
 17  *      Gero Kuhlmann   :       Code cleanup       17  *      Gero Kuhlmann   :       Code cleanup
 18  *      Michael Rausch  :       Fixed recognit     18  *      Michael Rausch  :       Fixed recognition of an incoming RARP answer.
 19  *      Martin Mares    : (2.0) Auto-configura     19  *      Martin Mares    : (2.0) Auto-configuration via BOOTP supported.
 20  *      Martin Mares    :       Manual selecti     20  *      Martin Mares    :       Manual selection of interface & BOOTP/RARP.
 21  *      Martin Mares    :       Using network      21  *      Martin Mares    :       Using network routes instead of host routes,
 22  *                              allowing the d     22  *                              allowing the default configuration to be used
 23  *                              for normal ope     23  *                              for normal operation of the host.
 24  *      Martin Mares    :       Randomized tim     24  *      Martin Mares    :       Randomized timer with exponential backoff
 25  *                              installed to m     25  *                              installed to minimize network congestion.
 26  *      Martin Mares    :       Code cleanup.      26  *      Martin Mares    :       Code cleanup.
 27  *      Martin Mares    : (2.1) BOOTP and RARP     27  *      Martin Mares    : (2.1) BOOTP and RARP made configuration options.
 28  *      Martin Mares    :       Server hostnam     28  *      Martin Mares    :       Server hostname generation fixed.
 29  *      Gerd Knorr      :       Fixed wired in     29  *      Gerd Knorr      :       Fixed wired inode handling
 30  *      Martin Mares    : (2.2) "0.0.0.0" addr     30  *      Martin Mares    : (2.2) "0.0.0.0" addresses from command line ignored.
 31  *      Martin Mares    :       RARP replies n     31  *      Martin Mares    :       RARP replies not tested for server address.
 32  *      Gero Kuhlmann   : (2.3) Some bug fixes     32  *      Gero Kuhlmann   : (2.3) Some bug fixes and code cleanup again (please
 33  *                              send me your n     33  *                              send me your new patches _before_ bothering
 34  *                              Linus so that      34  *                              Linus so that I don' always have to cleanup
 35  *                              _afterwards_ -     35  *                              _afterwards_ - thanks)
 36  *      Gero Kuhlmann   :       Last changes o     36  *      Gero Kuhlmann   :       Last changes of Martin Mares undone.
 37  *      Gero Kuhlmann   :       RARP replies a     37  *      Gero Kuhlmann   :       RARP replies are tested for specified server
 38  *                              again. However     38  *                              again. However, it's now possible to have
 39  *                              different RARP     39  *                              different RARP and NFS servers.
 40  *      Gero Kuhlmann   :       "0.0.0.0" addr     40  *      Gero Kuhlmann   :       "0.0.0.0" addresses from command line are
 41  *                              now mapped to      41  *                              now mapped to INADDR_NONE.
 42  *      Gero Kuhlmann   :       Fixed a bug wh     42  *      Gero Kuhlmann   :       Fixed a bug which prevented BOOTP path name
 43  *                              from being use     43  *                              from being used (thanks to Leo Spiekman)
 44  *      Andy Walker     :       Allow to speci     44  *      Andy Walker     :       Allow to specify the NFS server in nfs_root
 45  *                              without giving     45  *                              without giving a path name
 46  *      Swen Thümmler  :       Allow to speci     46  *      Swen Thümmler  :       Allow to specify the NFS options in nfs_root
 47  *                              without giving     47  *                              without giving a path name. Fix BOOTP request
 48  *                              for domainname     48  *                              for domainname (domainname is NIS domain, not
 49  *                              DNS domain!).      49  *                              DNS domain!). Skip dummy devices for BOOTP.
 50  *      Jacek Zapala    :       Fixed a bug wh     50  *      Jacek Zapala    :       Fixed a bug which prevented server-ip address
 51  *                              from nfsroot p     51  *                              from nfsroot parameter from being used.
 52  *      Olaf Kirch      :       Adapted to new     52  *      Olaf Kirch      :       Adapted to new NFS code.
 53  *      Jakub Jelinek   :       Free used code     53  *      Jakub Jelinek   :       Free used code segment.
 54  *      Marko Kohtala   :       Fixed some bug     54  *      Marko Kohtala   :       Fixed some bugs.
 55  *      Martin Mares    :       Debug message      55  *      Martin Mares    :       Debug message cleanup
 56  *      Martin Mares    :       Changed to use     56  *      Martin Mares    :       Changed to use the new generic IP layer autoconfig
 57  *                              code. BOOTP an     57  *                              code. BOOTP and RARP moved there.
 58  *      Martin Mares    :       Default path n     58  *      Martin Mares    :       Default path now contains host name instead of
 59  *                              host IP addres     59  *                              host IP address (but host name defaults to IP
 60  *                              address anyway     60  *                              address anyway).
 61  *      Martin Mares    :       Use root_serve     61  *      Martin Mares    :       Use root_server_addr appropriately during setup.
 62  *      Martin Mares    :       Rewrote parame     62  *      Martin Mares    :       Rewrote parameter parsing, now hopefully giving
 63  *                              correct overri     63  *                              correct overriding.
 64  *      Trond Myklebust :       Add in prelimi     64  *      Trond Myklebust :       Add in preliminary support for NFSv3 and TCP.
 65  *                              Fix bug in roo     65  *                              Fix bug in root_nfs_addr(). nfs_data.namlen
 66  *                              is NOT for the     66  *                              is NOT for the length of the hostname.
 67  *      Hua Qin         :       Support for mo     67  *      Hua Qin         :       Support for mounting root file system via
 68  *                              NFS over TCP.      68  *                              NFS over TCP.
 69  *      Fabian Frederick:       Option parser      69  *      Fabian Frederick:       Option parser rebuilt (using parser lib)
 70  *      Chuck Lever     :       Use super.c's      70  *      Chuck Lever     :       Use super.c's text-based mount option parsing
 71  *      Chuck Lever     :       Add "nfsrootde     71  *      Chuck Lever     :       Add "nfsrootdebug".
 72  */                                                72  */
 73                                                    73 
 74 #include <linux/types.h>                           74 #include <linux/types.h>
 75 #include <linux/string.h>                          75 #include <linux/string.h>
 76 #include <linux/init.h>                            76 #include <linux/init.h>
 77 #include <linux/nfs.h>                             77 #include <linux/nfs.h>
 78 #include <linux/nfs_fs.h>                          78 #include <linux/nfs_fs.h>
 79 #include <linux/utsname.h>                         79 #include <linux/utsname.h>
 80 #include <linux/root_dev.h>                        80 #include <linux/root_dev.h>
 81 #include <net/ipconfig.h>                          81 #include <net/ipconfig.h>
 82                                                    82 
 83 #include "internal.h"                              83 #include "internal.h"
 84                                                    84 
 85 #define NFSDBG_FACILITY NFSDBG_ROOT                85 #define NFSDBG_FACILITY NFSDBG_ROOT
 86                                                    86 
 87 /* Default path we try to mount. "%s" gets rep     87 /* Default path we try to mount. "%s" gets replaced by our IP address */
 88 #define NFS_ROOT                "/tftpboot/%s"     88 #define NFS_ROOT                "/tftpboot/%s"
 89                                                    89 
 90 /* Default NFSROOT mount options. */               90 /* Default NFSROOT mount options. */
 91 #if defined(CONFIG_NFS_V2)                     << 
 92 #define NFS_DEF_OPTIONS         "vers=2,tcp,rs     91 #define NFS_DEF_OPTIONS         "vers=2,tcp,rsize=4096,wsize=4096"
 93 #elif defined(CONFIG_NFS_V3)                   << 
 94 #define NFS_DEF_OPTIONS         "vers=3,tcp,rs << 
 95 #else                                          << 
 96 #define NFS_DEF_OPTIONS         "vers=4,tcp,rs << 
 97 #endif                                         << 
 98                                                    92 
 99 /* Parameters passed from the kernel command l     93 /* Parameters passed from the kernel command line */
100 static char nfs_root_parms[NFS_MAXPATHLEN + 1]     94 static char nfs_root_parms[NFS_MAXPATHLEN + 1] __initdata = "";
101                                                    95 
102 /* Text-based mount options passed to super.c      96 /* Text-based mount options passed to super.c */
103 static char nfs_root_options[256] __initdata =     97 static char nfs_root_options[256] __initdata = NFS_DEF_OPTIONS;
104                                                    98 
105 /* Address of NFS server */                        99 /* Address of NFS server */
106 static __be32 servaddr __initdata = htonl(INAD    100 static __be32 servaddr __initdata = htonl(INADDR_NONE);
107                                                   101 
108 /* Name of directory to mount */                  102 /* Name of directory to mount */
109 static char nfs_export_path[NFS_MAXPATHLEN + 1    103 static char nfs_export_path[NFS_MAXPATHLEN + 1] __initdata = "";
110                                                   104 
111 /* server:export path string passed to super.c    105 /* server:export path string passed to super.c */
112 static char nfs_root_device[NFS_MAXPATHLEN + 1    106 static char nfs_root_device[NFS_MAXPATHLEN + 1] __initdata = "";
113                                                   107 
114 #ifdef NFS_DEBUG                                  108 #ifdef NFS_DEBUG
115 /*                                                109 /*
116  * When the "nfsrootdebug" kernel command line    110  * When the "nfsrootdebug" kernel command line option is specified,
117  * enable debugging messages for NFSROOT.         111  * enable debugging messages for NFSROOT.
118  */                                               112  */
119 static int __init nfs_root_debug(char *__unuse    113 static int __init nfs_root_debug(char *__unused)
120 {                                                 114 {
121         nfs_debug |= NFSDBG_ROOT | NFSDBG_MOUN    115         nfs_debug |= NFSDBG_ROOT | NFSDBG_MOUNT;
122         return 1;                                 116         return 1;
123 }                                                 117 }
124                                                   118 
125 __setup("nfsrootdebug", nfs_root_debug);          119 __setup("nfsrootdebug", nfs_root_debug);
126 #endif                                            120 #endif
127                                                   121 
128 /*                                                122 /*
129  *  Parse NFS server and directory information    123  *  Parse NFS server and directory information passed on the kernel
130  *  command line.                                 124  *  command line.
131  *                                                125  *
132  *  nfsroot=[<server-ip>:]<root-dir>[,<nfs-opt    126  *  nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
133  *                                                127  *
134  *  If there is a "%s" token in the <root-dir>    128  *  If there is a "%s" token in the <root-dir> string, it is replaced
135  *  by the ASCII-representation of the client'    129  *  by the ASCII-representation of the client's IP address.
136  */                                               130  */
137 static int __init nfs_root_setup(char *line)      131 static int __init nfs_root_setup(char *line)
138 {                                                 132 {
139         ROOT_DEV = Root_NFS;                      133         ROOT_DEV = Root_NFS;
140                                                   134 
141         if (line[0] == '/' || line[0] == ',' |    135         if (line[0] == '/' || line[0] == ',' || (line[0] >= '' && line[0] <= '9')) {
142                 strscpy(nfs_root_parms, line,  !! 136                 strlcpy(nfs_root_parms, line, sizeof(nfs_root_parms));
143         } else {                                  137         } else {
144                 size_t n = strlen(line) + size    138                 size_t n = strlen(line) + sizeof(NFS_ROOT) - 1;
145                 if (n >= sizeof(nfs_root_parms    139                 if (n >= sizeof(nfs_root_parms))
146                         line[sizeof(nfs_root_p    140                         line[sizeof(nfs_root_parms) - sizeof(NFS_ROOT) - 2] = '\0';
147                 sprintf(nfs_root_parms, NFS_RO    141                 sprintf(nfs_root_parms, NFS_ROOT, line);
148         }                                         142         }
149                                                   143 
150         /*                                        144         /*
151          * Extract the IP address of the NFS s    145          * Extract the IP address of the NFS server containing our
152          * root file system, if one was specif    146          * root file system, if one was specified.
153          *                                        147          *
154          * Note: root_nfs_parse_addr() removes    148          * Note: root_nfs_parse_addr() removes the server-ip from
155          *       nfs_root_parms, if it exists.    149          *       nfs_root_parms, if it exists.
156          */                                       150          */
157         root_server_addr = root_nfs_parse_addr    151         root_server_addr = root_nfs_parse_addr(nfs_root_parms);
158                                                   152 
159         return 1;                                 153         return 1;
160 }                                                 154 }
161                                                   155 
162 __setup("nfsroot=", nfs_root_setup);              156 __setup("nfsroot=", nfs_root_setup);
163                                                   157 
164 static int __init root_nfs_copy(char *dest, co    158 static int __init root_nfs_copy(char *dest, const char *src,
165                                      const siz    159                                      const size_t destlen)
166 {                                                 160 {
167         if (strscpy(dest, src, destlen) == -E2 !! 161         if (strlcpy(dest, src, destlen) > destlen)
168                 return -1;                        162                 return -1;
169         return 0;                                 163         return 0;
170 }                                                 164 }
171                                                   165 
172 static int __init root_nfs_cat(char *dest, con    166 static int __init root_nfs_cat(char *dest, const char *src,
173                                const size_t de    167                                const size_t destlen)
174 {                                                 168 {
175         size_t len = strlen(dest);                169         size_t len = strlen(dest);
176                                                   170 
177         if (len && dest[len - 1] != ',')          171         if (len && dest[len - 1] != ',')
178                 if (strlcat(dest, ",", destlen !! 172                 if (strlcat(dest, ",", destlen) > destlen)
179                         return -1;                173                         return -1;
180                                                   174 
181         if (strlcat(dest, src, destlen) >= des !! 175         if (strlcat(dest, src, destlen) > destlen)
182                 return -1;                        176                 return -1;
183         return 0;                                 177         return 0;
184 }                                                 178 }
185                                                   179 
186 /*                                                180 /*
187  * Parse out root export path and mount option    181  * Parse out root export path and mount options from
188  * passed-in string @incoming.                    182  * passed-in string @incoming.
189  *                                                183  *
190  * Copy the export path into @exppath.            184  * Copy the export path into @exppath.
191  */                                               185  */
192 static int __init root_nfs_parse_options(char     186 static int __init root_nfs_parse_options(char *incoming, char *exppath,
193                                          const    187                                          const size_t exppathlen)
194 {                                                 188 {
195         char *p;                                  189         char *p;
196                                                   190 
197         /*                                        191         /*
198          * Set the NFS remote path                192          * Set the NFS remote path
199          */                                       193          */
200         p = strsep(&incoming, ",");               194         p = strsep(&incoming, ",");
201         if (*p != '\0' && strcmp(p, "default")    195         if (*p != '\0' && strcmp(p, "default") != 0)
202                 if (root_nfs_copy(exppath, p,     196                 if (root_nfs_copy(exppath, p, exppathlen))
203                         return -1;                197                         return -1;
204                                                   198 
205         /*                                        199         /*
206          * @incoming now points to the rest of    200          * @incoming now points to the rest of the string; if it
207          * contains something, append it to ou    201          * contains something, append it to our root options buffer
208          */                                       202          */
209         if (incoming != NULL && *incoming != '    203         if (incoming != NULL && *incoming != '\0')
210                 if (root_nfs_cat(nfs_root_opti    204                 if (root_nfs_cat(nfs_root_options, incoming,
211                                                   205                                                 sizeof(nfs_root_options)))
212                         return -1;                206                         return -1;
213         return 0;                                 207         return 0;
214 }                                                 208 }
215                                                   209 
216 /*                                                210 /*
217  *  Decode the export directory path name and     211  *  Decode the export directory path name and NFS options from
218  *  the kernel command line.  This has to be d    212  *  the kernel command line.  This has to be done late in order to
219  *  use a dynamically acquired client IP addre    213  *  use a dynamically acquired client IP address for the remote
220  *  root directory path.                          214  *  root directory path.
221  *                                                215  *
222  *  Returns zero if successful; otherwise -1 i    216  *  Returns zero if successful; otherwise -1 is returned.
223  */                                               217  */
224 static int __init root_nfs_data(char *cmdline)    218 static int __init root_nfs_data(char *cmdline)
225 {                                                 219 {
226         char mand_options[sizeof("nolock,addr=    220         char mand_options[sizeof("nolock,addr=") + INET_ADDRSTRLEN + 1];
227         int len, retval = -1;                     221         int len, retval = -1;
228         char *tmp = NULL;                         222         char *tmp = NULL;
229         const size_t tmplen = sizeof(nfs_expor    223         const size_t tmplen = sizeof(nfs_export_path);
230                                                   224 
231         tmp = kzalloc(tmplen, GFP_KERNEL);        225         tmp = kzalloc(tmplen, GFP_KERNEL);
232         if (tmp == NULL)                          226         if (tmp == NULL)
233                 goto out_nomem;                   227                 goto out_nomem;
234         strcpy(tmp, NFS_ROOT);                    228         strcpy(tmp, NFS_ROOT);
235                                                   229 
236         if (root_server_path[0] != '\0') {        230         if (root_server_path[0] != '\0') {
237                 dprintk("Root-NFS: DHCPv4 opti    231                 dprintk("Root-NFS: DHCPv4 option 17: %s\n",
238                         root_server_path);        232                         root_server_path);
239                 if (root_nfs_parse_options(roo    233                 if (root_nfs_parse_options(root_server_path, tmp, tmplen))
240                         goto out_optionstoolon    234                         goto out_optionstoolong;
241         }                                         235         }
242                                                   236 
243         if (cmdline[0] != '\0') {                 237         if (cmdline[0] != '\0') {
244                 dprintk("Root-NFS: nfsroot=%s\    238                 dprintk("Root-NFS: nfsroot=%s\n", cmdline);
245                 if (root_nfs_parse_options(cmd    239                 if (root_nfs_parse_options(cmdline, tmp, tmplen))
246                         goto out_optionstoolon    240                         goto out_optionstoolong;
247         }                                         241         }
248                                                   242 
249         /*                                        243         /*
250          * Append mandatory options for nfsroo    244          * Append mandatory options for nfsroot so they override
251          * what has come before                   245          * what has come before
252          */                                       246          */
253         snprintf(mand_options, sizeof(mand_opt    247         snprintf(mand_options, sizeof(mand_options), "nolock,addr=%pI4",
254                         &servaddr);               248                         &servaddr);
255         if (root_nfs_cat(nfs_root_options, man    249         if (root_nfs_cat(nfs_root_options, mand_options,
256                                                   250                                                 sizeof(nfs_root_options)))
257                 goto out_optionstoolong;          251                 goto out_optionstoolong;
258                                                   252 
259         /*                                        253         /*
260          * Set up nfs_root_device.  For NFS mo    254          * Set up nfs_root_device.  For NFS mounts, this looks like
261          *                                        255          *
262          *      server:/path                      256          *      server:/path
263          *                                        257          *
264          * At this point, utsname()->nodename     258          * At this point, utsname()->nodename contains our local
265          * IP address or hostname, set by ipco    259          * IP address or hostname, set by ipconfig.  If "%s" exists
266          * in tmp, substitute the nodename, th    260          * in tmp, substitute the nodename, then shovel the whole
267          * mess into nfs_root_device.             261          * mess into nfs_root_device.
268          */                                       262          */
269         len = snprintf(nfs_export_path, sizeof    263         len = snprintf(nfs_export_path, sizeof(nfs_export_path),
270                                 tmp, utsname()    264                                 tmp, utsname()->nodename);
271         if (len >= (int)sizeof(nfs_export_path    265         if (len >= (int)sizeof(nfs_export_path))
272                 goto out_devnametoolong;          266                 goto out_devnametoolong;
273         len = snprintf(nfs_root_device, sizeof    267         len = snprintf(nfs_root_device, sizeof(nfs_root_device),
274                                 "%pI4:%s", &se    268                                 "%pI4:%s", &servaddr, nfs_export_path);
275         if (len >= (int)sizeof(nfs_root_device    269         if (len >= (int)sizeof(nfs_root_device))
276                 goto out_devnametoolong;          270                 goto out_devnametoolong;
277                                                   271 
278         retval = 0;                               272         retval = 0;
279                                                   273 
280 out:                                              274 out:
281         kfree(tmp);                               275         kfree(tmp);
282         return retval;                            276         return retval;
283 out_nomem:                                        277 out_nomem:
284         printk(KERN_ERR "Root-NFS: could not a    278         printk(KERN_ERR "Root-NFS: could not allocate memory\n");
285         goto out;                                 279         goto out;
286 out_optionstoolong:                               280 out_optionstoolong:
287         printk(KERN_ERR "Root-NFS: mount optio    281         printk(KERN_ERR "Root-NFS: mount options string too long\n");
288         goto out;                                 282         goto out;
289 out_devnametoolong:                               283 out_devnametoolong:
290         printk(KERN_ERR "Root-NFS: root device    284         printk(KERN_ERR "Root-NFS: root device name too long.\n");
291         goto out;                                 285         goto out;
292 }                                                 286 }
293                                                   287 
294 /**                                               288 /**
295  * nfs_root_data - Return prepared 'data' for     289  * nfs_root_data - Return prepared 'data' for NFSROOT mount
296  * @root_device: OUT: address of string contai    290  * @root_device: OUT: address of string containing NFSROOT device
297  * @root_data: OUT: address of string containi    291  * @root_data: OUT: address of string containing NFSROOT mount options
298  *                                                292  *
299  * Returns zero and sets @root_device and @roo    293  * Returns zero and sets @root_device and @root_data if successful,
300  * otherwise -1 is returned.                      294  * otherwise -1 is returned.
301  */                                               295  */
302 int __init nfs_root_data(char **root_device, c    296 int __init nfs_root_data(char **root_device, char **root_data)
303 {                                                 297 {
304         servaddr = root_server_addr;              298         servaddr = root_server_addr;
305         if (servaddr == htonl(INADDR_NONE)) {     299         if (servaddr == htonl(INADDR_NONE)) {
306                 printk(KERN_ERR "Root-NFS: no     300                 printk(KERN_ERR "Root-NFS: no NFS server address\n");
307                 return -1;                        301                 return -1;
308         }                                         302         }
309                                                   303 
310         if (root_nfs_data(nfs_root_parms) < 0)    304         if (root_nfs_data(nfs_root_parms) < 0)
311                 return -1;                        305                 return -1;
312                                                   306 
313         *root_device = nfs_root_device;           307         *root_device = nfs_root_device;
314         *root_data = nfs_root_options;            308         *root_data = nfs_root_options;
315         return 0;                                 309         return 0;
316 }                                                 310 }
317                                                   311 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php