#include <linux/obd_support.h>
-static inline int lustre_cfg_getdata(char **buf, int len, void *arg)
+static inline int lustre_cfg_getdata(char **buf, int len, void *arg, int kernel)
{
struct lustre_cfg *lcfg;
int err;
/* XXX allocate this more intelligently, using kmalloc when
* appropriate */
- OBD_VMALLOC(*buf, len);
+ OBD_ALLOC(*buf, len);
if (*buf == NULL) {
CERROR("Cannot allocate control buffer of len %d\n", len);
RETURN(-EINVAL);
}
- lcfg = (struct lustre_cfg *)*buf;
- err = copy_from_user(*buf, (void *)arg, len);
- if ( err ) {
- EXIT;
- return err;
+ if (kernel) {
+ memcpy(*buf, (void *)arg, len);
+ } else {
+ err = copy_from_user(*buf, (void *)arg, len);
+ if (err)
+ RETURN(err);
}
+ lcfg = (struct lustre_cfg *)*buf;
if (lcfg->lcfg_version != LUSTRE_CFG_VERSION) {
CERROR("Version mismatch kernel vs application\n");
{
ENTRY;
- OBD_VFREE(buf, len);
+ OBD_FREE(buf, len);
EXIT;
return;
}
}
obd = class_name2obd(name);
- if (obd != NULL)
+ if (obd != NULL) {
+ CERROR("obd %s already attached\n", name);
RETURN(-EEXIST);
+ }
obd = class_newdev(&dev);
if (dev == -1)
}
}
-int class_process_config(int len, char *data)
+int class_process_config(struct lustre_cfg *lcfg)
{
- char *buf;
struct obd_device *obd;
- struct lustre_cfg *lcfg;
int err;
- lustre_cfg_getdata(&buf, len, data);
- lcfg = (struct lustre_cfg* ) buf;
+ LASSERT(lcfg && !IS_ERR(lcfg));
CDEBUG(D_IOCTL, "processing cmd: %x\n", lcfg->lcfg_command);
}
}
out:
- lustre_cfg_freedata(buf, len);
RETURN(err);
}
mnt.mnt_freq = freq;
mnt.mnt_passno = pass;
- /* We get chatty now rather than after the update to mtab since the
- mount succeeded, even if the write to /etc/mtab should fail. */
-// if (verbose)
-// print_one (&mnt);
-
if (!nomtab) {
- if (flags & MS_REMOUNT) {
-// update_mtab (mnt.mnt_dir, &mnt);
- ;
+ fp = setmntent(MOUNTED, "a+");
+ if (fp == NULL) {
+ fprintf(stderr, "setmntent(%s): %s:", MOUNTED,
+ strerror (errno));
} else {
- fp = setmntent(MOUNTED, "a+");
- if (fp == NULL) {
- fprintf(stderr, "setmntent(%s): %s:",
- MOUNTED,
+ if ((addmntent (fp, &mnt)) == 1) {
+ fprintf(stderr, "addmntent: %s:",
strerror (errno));
- } else {
- if ((addmntent (fp, &mnt)) == 1) {
- fprintf(stderr, "addmntent: %s:",
- strerror (errno));
- }
- endmntent(fp);
}
+ endmntent(fp);
}
}
}