[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] dmsetup on uClibc based system



Greetings

(resend now that I'm subscribed and sending from the right account...)

     I'm trying to get dmsetup running on an embedded uClibc based
system - linux kernel 2.6.4 - X86 architecture, GCC 3.3.1.  The first
problem seems to be that when reading the table file, dmsetup uses the
'a' conversion modifier to have sscanf malloc space for the resulting
string.  uClibc doesn't appear to support this.  No biggy, fairly easy
fix (I believe - I assume ttype won't be larger than the line read in).
   Patch attached.

     Next problem is that I'm getting an error when I try and setup a
"chunk" of a partition:

     [root denis root]# dmsetup create hdc5.000
     0 204800 linear /dev/hdc5 0<cr>
     <ctrl-D>
     device-mapper ioctl cmd 9 failed: Invalid argument
     Command failed
     [root denis root]# dmsetup ls
     hdc5.000        (254, 0)
     [root denis root]# ls /dev/mapper/
     control

    The command appears to have worked, but the entry in /dev/mapper is
not there.

     Does dmsetup not work on partitions?  Or is this probably something
else going on?  Does it matter if the partition in question is mounted?

Thanks,
--- dmsetup.c.orig      2004-03-18 07:55:32.000000000 -0600
+++ dmsetup.c   2004-03-18 07:33:07.000000000 -0600
@@ -63,7 +63,7 @@
  */
 static int _parse_file(struct dm_task *dmt, const char *file)
 {
-       char buffer[LINE_SIZE], *ttype, *ptr, *comment;
+       char buffer[LINE_SIZE], ttype[LINE_SIZE], *ptr, *comment;
        FILE *fp;
        unsigned long long start, size;
        int r = 0, n, line = 0;
@@ -94,7 +94,7 @@
                if (!*ptr || *ptr == '#')
                        continue;

-               if (sscanf(ptr, "%llu %llu %as %n",
+               if (sscanf(ptr, "%llu %llu %s %n",
                           &start, &size, &ttype, &n) < 3) {
                        err("%s:%d Invalid format", file, line);
                        goto out;
@@ -106,8 +106,6 @@

                if (!dm_task_add_target(dmt, start, size, ttype, ptr))
                        goto out;
-
-               free(ttype);
        }
        r = 1;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]