Whamcloud - gitweb
[liblustre]:
authornfshp <nfshp>
Thu, 10 Apr 2003 02:07:12 +0000 (02:07 +0000)
committernfshp <nfshp>
Thu, 10 Apr 2003 02:07:12 +0000 (02:07 +0000)
 - add a fake ioctl which could dump mount options to file
 - sysio_mount use UUIDs from the mount options
 - minor fix for pnode count

lustre/liblustre/llite_lib.c
lustre/liblustre/llite_lib.h
lustre/liblustre/lltest.c
lustre/liblustre/super.c

index 176e610..4fd83fd 100644 (file)
@@ -116,12 +116,67 @@ int init_lib_portals()
 
 extern int class_handle_ioctl(struct obd_class_user_state *ocus, unsigned int cmd, unsigned long arg);
 
+struct mount_option_s mount_option = {NULL, NULL};
+
+/* FIXME simple arg parser FIXME */
+void parse_mount_options(void *arg)
+{
+        char *buf = NULL;
+        struct obd_ioctl_data *data;
+        char *ptr, *comma, *eq, **tgt, *v;
+        int len;
+
+        if (obd_ioctl_getdata(&buf, &len, arg)) {
+                CERROR("OBD ioctl: data error\n");
+                return;
+        }
+        data = (struct obd_ioctl_data *)buf;
+        ptr = data->ioc_inlbuf1;
+        printf("mount option: %s\n", ptr);
+
+        while (ptr) {
+                eq = strchr(ptr, '=');
+                if (!eq)
+                        return;
+
+                *eq = 0;
+                if (!strcmp("osc", ptr))
+                        tgt = &mount_option.osc_uuid;
+                else if (!strcmp("mdc", ptr))
+                        tgt = &mount_option.mdc_uuid;
+                else {
+                        printf("Unknown mount option %s\n", ptr);
+                        return;
+                }
+
+                v = eq + 1;
+                comma = strchr(v, ',');
+                if (comma) {
+                        *comma = 0;
+                        ptr = comma + 1;
+                } else
+                        ptr = NULL;
+
+                *tgt = malloc(strlen(v)+1);
+                strcpy(*tgt, v);
+        }
+
+        if (buf)
+                obd_ioctl_freedata(buf, len);
+}
+
 int lib_ioctl(int dev_id, int opc, void * ptr)
 {
         int rc;
 
        if (dev_id == OBD_DEV_ID) {
                 struct obd_ioctl_data *ioc = ptr;
+
+                if (opc == OBD_IOC_MOUNTOPT) {
+                        parse_mount_options(ptr);
+                        return 0;
+                }
+
                rc = class_handle_ioctl(&ocus, opc, (unsigned long)ptr);
 
                /* you _may_ need to call obd_ioctl_unpack or some
index 44d7b8b..107e51f 100644 (file)
@@ -88,9 +88,17 @@ static inline struct lustre_handle *llu_i2obdconn(struct inode *inode)
 }
 
 
+struct mount_option_s
+{
+       char *mdc_uuid;
+       char *osc_uuid;
+};
+
 /* llite_lib.c */
 void generate_random_uuid(unsigned char uuid_out[16]);
 
+extern struct mount_option_s mount_option;
+
 /* super.c */
 void llu_update_inode(struct inode *inode, struct mds_body *body,
                       struct lov_stripe_md *lmm);
index 6710f15..8f38fe7 100644 (file)
@@ -58,6 +58,7 @@
 #include <sysio.h>
 #include <mount.h>
 
+
 /*
  * Get stats of file and file system.
  *
@@ -75,6 +76,7 @@ extern int portal_debug;
 extern int portal_subsystem_debug;
 
 char* files[] = {"/dir1", "/dir1/file1", "/dir1/file2", "/dir1/dir2", "/dir1/dir2/file3"};
+
 int
 main(int argc, char * const argv[])
 {
@@ -140,5 +142,6 @@ main(int argc, char * const argv[])
         */
        _sysio_shutdown();
 
+       printf("complete successfully\n");
        return 0;
 }
index 093458b..651693d 100644 (file)
@@ -390,8 +390,8 @@ llu_fsswop_mount(const char *source,
         struct obd_uuid param_uuid;
         class_uuid_t uuid;
         struct obd_device *obd;
-        char *osc="lov1_UUID";
-        char *mdc="853fe49c56_MDC_lov1_mds1_704cccf8fd";
+        char *osc=mount_option.osc_uuid;
+        char *mdc=mount_option.mdc_uuid;
         int err = -EINVAL;
 
         ENTRY;
@@ -489,6 +489,9 @@ llu_fsswop_mount(const char *source,
                goto out_inode;
         }
 
+        /* not clear why we need this XXX */
+        P_REF((*mntp)->mnt_root);
+
         ptlrpc_req_finished(request);
         request = NULL;