1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (c) 2003 Cluster File Systems, Inc.
6 * This file is part of Lustre, http://www.lustre.org.
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 # define EXPORT_SYMTAB
25 #define DEBUG_SUBSYSTEM S_OSC
28 # include <linux/module.h>
29 # include <linux/dcache.h>
30 # include <linux/namei.h>
31 # include <linux/obd.h>
32 # include <linux/obd_ost.h>
33 # include <linux/lustre_net.h>
34 # include <linux/lustre_dlm.h>
35 # include <linux/lustre_lib.h>
36 # include <linux/lustre_compat25.h>
38 /* convert a pathname into a kdev_t */
39 static kdev_t path2dev(char *path)
41 struct dentry *dentry;
43 kdev_t dev = KDEVT_INIT(0);
45 if (ll_path_lookup(path, LOOKUP_FOLLOW, &nd))
46 return val_to_kdev(0);
49 if (dentry->d_inode && !is_bad_inode(dentry->d_inode) &&
50 S_ISBLK(dentry->d_inode->i_mode))
51 dev = dentry->d_inode->i_rdev;
57 int client_sanobd_setup(struct obd_device *obddev, obd_count len, void *buf)
59 struct lustre_cfg* lcfg = buf;
60 struct client_obd *cli = &obddev->u.cli;
63 if (LUSTRE_CFG_BUFLEN(lcfg, 3) < 1) {
64 CERROR("setup requires a SAN device pathname\n");
68 client_obd_setup(obddev, len, buf);
70 cli->cl_sandev = path2dev(lustre_cfg_string(lcfg, 3));
71 if (!kdev_t_to_nr(cli->cl_sandev)) {
72 CERROR("%s seems not a valid SAN device\n", lustre_cfg_string(lcfg, 3));