libcom32: Introduce disk header and module
authorShao Miller <shao.miller@yrdsb.edu.on.ca>
Mon, 28 Jun 2010 04:31:08 +0000 (00:31 -0400)
committerShao Miller <shao.miller@yrdsb.edu.on.ca>
Sat, 10 Jul 2010 05:00:47 +0000 (01:00 -0400)
An effort to move significant portions out of chain.c32 and
into library is underway.  We begin by simply moving
SECTOR into a header and building a disk module.

Note that some of this work will essentially duplicate
some of what's found in Pierre-Alexandre Meyer's fine
work in com32/gpllib/disk/.  A difference would be the
licensing, of course.

Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
com32/include/syslinux/disk.h [new file with mode: 0644]
com32/lib/Makefile
com32/lib/syslinux/disk.c [new file with mode: 0644]
com32/modules/chain.c

diff --git a/com32/include/syslinux/disk.h b/com32/include/syslinux/disk.h
new file mode 100644 (file)
index 0000000..482dece
--- /dev/null
@@ -0,0 +1,41 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 2003-2009 H. Peter Anvin - All Rights Reserved
+ *   Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
+ *   Copyright (C) 2010 Shao Miller
+ *
+ *   Permission is hereby granted, free of charge, to any person
+ *   obtaining a copy of this software and associated documentation
+ *   files (the "Software"), to deal in the Software without
+ *   restriction, including without limitation the rights to use,
+ *   copy, modify, merge, publish, distribute, sublicense, and/or
+ *   sell copies of the Software, and to permit persons to whom
+ *   the Software is furnished to do so, subject to the following
+ *   conditions:
+ *
+ *   The above copyright notice and this permission notice shall
+ *   be included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/**
+ * @file syslinux/disk.h
+ *
+ * Deal with disks and partitions
+ */
+
+#ifndef _SYSLINUX_DISK_H
+#define _SYSLINUX_DISK_H
+
+#define SECTOR 512             /* bytes/sector */
+
+#endif /* _SYSLINUX_DISK_H */
index 2035df2..ed4bb31 100644 (file)
@@ -119,7 +119,9 @@ LIBOBJS = \
        syslinux/setadv.o                                               \
        \
        syslinux/video/fontquery.o syslinux/video/forcetext.o           \
-       syslinux/video/reportmode.o
+       syslinux/video/reportmode.o                                     \
+       \
+       syslinux/disk.o
 
 # These are the objects which are also imported into the core
 LIBCOREOBJS =  \
diff --git a/com32/lib/syslinux/disk.c b/com32/lib/syslinux/disk.c
new file mode 100644 (file)
index 0000000..2a286e4
--- /dev/null
@@ -0,0 +1,36 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 2003-2009 H. Peter Anvin - All Rights Reserved
+ *   Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
+ *   Copyright (C) 2010 Shao Miller
+ *
+ *   Permission is hereby granted, free of charge, to any person
+ *   obtaining a copy of this software and associated documentation
+ *   files (the "Software"), to deal in the Software without
+ *   restriction, including without limitation the rights to use,
+ *   copy, modify, merge, publish, distribute, sublicense, and/or
+ *   sell copies of the Software, and to permit persons to whom
+ *   the Software is furnished to do so, subject to the following
+ *   conditions:
+ *
+ *   The above copyright notice and this permission notice shall
+ *   be included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/**
+ * @file disk.c
+ *
+ * Deal with disks and partitions
+ */
+
+#include <syslinux/disk.h>
index 48a83d2..d6005e2 100644 (file)
 #include <syslinux/loadfile.h>
 #include <syslinux/bootrm.h>
 #include <syslinux/config.h>
+#include <syslinux/disk.h>
 #include <syslinux/video.h>
 
-#define SECTOR 512             /* bytes/sector */
-
 static struct options {
     const char *loadfile;
     uint16_t keeppxe;