Merge branch 'master' of gregkh@master.kernel.org:/pub/scm/linux/hotplug/udev

This commit is contained in:
Greg Kroah-Hartman
2005-11-09 09:53:53 -08:00
604 changed files with 216 additions and 30972 deletions
+3
View File
@@ -1,3 +1,6 @@
Summary of changes from v74 to v075
============================================
Summary of changes from v73 to v074
============================================
-79
View File
@@ -1,79 +0,0 @@
HOWTO use udev to manage /dev
This document describes one way to get udev working on a Fedora-development
machine to manage /dev. This procedure may be used to get udev to manage
/dev on other distros, if you modify some of the steps.
This will only work if you use a 2.6 based kernel, preferably the most
recent one. This does not prevent your machine from using a 2.4
kernel, if you boot into one, udev will not run and your old /dev will
be present with no changes needed.
NOTE NOTE NOTE NOTE NOTE NOTE NOTE
This is completely unsupported. Attempting to do this may cause your
machine to be unable to boot properly. USE AT YOUR OWN RISK. Always
have a rescue disk or CD handy to allow you to fix up any errors that
may occur.
NOTE NOTE NOTE NOTE NOTE NOTE NOTE
- Build and install udev as specified in the README that comes with
udev. I recommend using the following build options to get the
smallest possible binaries:
make USE_KLIBC=true USE_LOG=false DEBUG=false
- disable udev from the boot process by running:
chkconfig udev off
or
chkconfig --del udev
as root.
- place the start_udev script somewhere that is accessible by your
initscripts. I placed it into /etc/rc.d with the following command:
copy extras/start_udev /etc/rc.d/
- modify the rc.sysinit script to call the start_udev script as one of
the first things that it does, but after /proc and /sys are mounted.
I did this with the latest Fedora startup scripts with the patch at
the end of this file.
- make sure the /etc/udev/udev.conf file lists the udev_root as "/dev/"
and the udev_db as "/dev/.udevdb". It should contain the
following lines in order to work properly.
udev_root="/dev/"
udev_db="/dev/.udevdb"
- reboot into a 2.6 kernel and watch udev create all of the initial
device nodes in /dev
If anyone has any problems with this, please let me, and the
linux-hotplug-devel@lists.sourceforge.net mailing list know.
A big thanks go out to the Gentoo developers for showing me that this is
possible to do.
Greg Kroah-Hartman
<greg@kroah.com>
----------------------------------
Patch to modify rc.sysinit to call udev at the beginning of the boot
process:
--- /etc/rc.sysinit.orig 2004-02-17 11:45:17.000000000 -0800
+++ /etc/rc.sysinit 2004-02-17 13:28:33.000000000 -0800
@@ -32,6 +32,9 @@
. /etc/init.d/functions
+# start udev to populate /dev
+/etc/rc.d/start_udev
+
if [ "$HOSTTYPE" != "s390" -a "$HOSTTYPE" != "s390x" ]; then
last=0
for i in `LC_ALL=C grep '^[0-9].*respawn:/sbin/mingetty' /etc/inittab | sed 's/^.* tty\([0-9][0-9]*\).*/\1/g'`; do
+5 -20
View File
@@ -122,7 +122,6 @@ configdir = ${etcdir}/udev
udevdir = /dev
udevdb = ${udevdir}/.udevdb
LOCAL_CFG_DIR = etc/udev
KERNEL_DIR = /lib/modules/${shell uname -r}/build
DESTDIR =
INSTALL = /usr/bin/install -c
@@ -177,8 +176,7 @@ endif
# if our own version of klibc is used, we need to build it
ifeq ($(strip $(USE_KLIBC)),true)
KLIBC_INSTALL = $(PWD)/klibc/.install
KLCC = $(KLIBC_INSTALL)/bin/$(CROSS)klcc
KLCC = /usr/bin/$(CROSS)klcc
CC = $(KLCC)
LD = $(KLCC)
V = true
@@ -203,7 +201,7 @@ else
HOST_PROGS=
endif
all: $(KLCC) $(PROGRAMS) $(MAN_PAGES)
all: $(PROGRAMS) $(MAN_PAGES)
@extras="$(EXTRAS)"; for target in $$extras; do \
echo $$target; \
$(MAKE) CC="$(CC)" \
@@ -214,7 +212,6 @@ all: $(KLCC) $(PROGRAMS) $(MAN_PAGES)
LIB_OBJS="$(LIB_OBJS)" \
LIBUDEV="$(PWD)/$(LIBUDEV)" \
LIBSYSFS="$(PWD)/$(LIBSYSFS)" \
KERNEL_DIR="$(KERNEL_DIR)" \
QUIET="$(QUIET)" \
-C $$target $@; \
done;
@@ -229,28 +226,19 @@ all: $(KLCC) $(PROGRAMS) $(MAN_PAGES)
$(QUIET) $(CC) -c $(CFLAGS) $< -o $@
# "Static Pattern Rule" to build all programs
$(PROGRAMS): %: $(HOST_PROGS) $(KLCC) $(HEADERS) $(GEN_HEADERS) $(LIBSYSFS) $(LIBUDEV) %.o
$(PROGRAMS): %: $(HOST_PROGS) $(HEADERS) $(GEN_HEADERS) $(LIBSYSFS) $(LIBUDEV) %.o
$(QUIET) $(LD) $(LDFLAGS) $@.o -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS)
ifneq ($(STRIPCMD),)
$(QUIET) $(STRIPCMD) $@
endif
# our own copy of klibc, it is not used if KLCC is given
$(KLCC):
$(MAKE) -C klibc KRNLSRC=$(KERNEL_DIR) SUBDIRS=klibc TESTS= \
SHLIBDIR=$(KLIBC_INSTALL)/lib \
INSTALLDIR=$(KLIBC_INSTALL) \
bindir=$(KLIBC_INSTALL)/bin \
mandir=$(KLIBC_INSTALL)/man all install
.NOTPARALLEL: $(KLCC)
$(UDEV_OBJS): $(KLCC)
$(UDEV_OBJS):
$(LIBUDEV): $(HOST_PROGS) $(HEADERS) $(GEN_HEADERS) $(UDEV_OBJS)
@rm -f $@
$(QUIET) $(AR) cq $@ $(UDEV_OBJS)
$(QUIET) $(RANLIB) $@
$(SYSFS_OBJS): $(KLCC)
$(SYSFS_OBJS):
$(LIBSYSFS): $(HOST_PROGS) $(SYSFS_OBJS)
@rm -f $@
$(QUIET) $(AR) cq $@ $(SYSFS_OBJS)
@@ -288,13 +276,10 @@ clean:
- rm -f udev_gcov.txt
- rm -f core $(PROGRAMS) $(GEN_HEADERS) $(GEN_CONFIGS)
- rm -f udev-$(VERSION).tar.gz
$(MAKE) -C klibc SUBDIRS=klibc clean
@extras="$(EXTRAS)"; for target in $$extras; do \
echo $$target; \
$(MAKE) -C $$target $@; \
done;
$(MAKE) -C klibc SUBDIRS=klibc spotless
rm -rf klibc/.install
.PHONY: clean
release:
+4 -13
View File
@@ -45,9 +45,7 @@ Setting which are used for building udev:
USE_LOG
if set to 'true', udev will emit messages to the syslog when
it creates or removes device nodes. This is helpful to see
what udev is doing. This is enabled by default. Note, if you
are building udev against klibc it is recommended that you
disable this option (due to klibc's syslog implementation.)
what udev is doing. This is enabled by default.
DEBUG
if set to 'true', verbose debugging messages will be compiled into
the udev binaries. Default value is 'false'.
@@ -55,20 +53,13 @@ Setting which are used for building udev:
if set to 'true', udev will be built with SELinux support
enabled. This is disabled by default.
USE_KLIBC
if set to 'true', udev is built and linked against the
included version of klibc. Default value is 'false'.
KERNEL_DIR
If this is not set it will default to /lib/modules/`uname -r`/build
This is used if USE_KLIBC=true to find the kernel include
directory that klibc needs to build against. This must be set
if you are not building udev while running a 2.6 kernel.
if set to 'true', udev is built and linked against klibc.
Default value is 'false'. KLCC specifies the klibc compiler
wrapper, usually in /usr/bin/klcc
EXTRAS
if set, will build the "extra" helper programs as specified
as listed (see below for an example.)
if you want to build udev using klibc with debugging messages:
make USE_KLIBC=true DEBUG=true
if you want to build the udev helper program cdrom_id and scsi_id:
make EXTRAS="extras/cdrom_id extras/scsi_id"
+5
View File
@@ -1,3 +1,8 @@
udev 075
========
The copy of klibc is removed. A systemwide installed version of klibc
can be used to buil a klibc udev.
udev 074
========
NAME="" will not create any nodes, but execute RUN keys. To completely
+1 -3
View File
@@ -1,4 +1,4 @@
This is a short list of things that needs to be done. They are in no specific
This is a list of things that needs to be done. They are in no specific
order. We will gladly accept patches for any of these items:
- Completely replace the built-in wait_for_sysfs stuff in udev_sysfs.c
@@ -8,5 +8,3 @@ order. We will gladly accept patches for any of these items:
to syslog, so any error logged from the kernel can be associated with
any of the links at that time.
- remove klibc tree and make it an external dependency
+7 -7
View File
@@ -5,12 +5,8 @@
# Released under the GNU General Public License, version 2.
#
VOLUME_ID_BASE=volume_id
include $(VOLUME_ID_BASE)/Makefile.inc
PROG = vol_id
OBJS = $(VOLUME_ID_OBJS)
HEADERS = $(VOLUME_ID_HEADERS)
LIBVOLUME_ID = libvolume_id/libvolume_id.a
GEN_HEADERS =
MAN_PAGES =
@@ -36,8 +32,11 @@ all: $(PROG) $(MAN_PAGES)
%.o: %.c $(GEN_HEADERS)
$(QUIET) $(CC) -c $(CFLAGS) $< -o $@
$(PROG): %: $(HEADERS) %.o $(OBJS)
$(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS)
$(LIBVOLUME_ID):
$(MAKE) -C libvolume_id
$(PROG): %: $(HEADERS) %.o $(LIBVOLUME_ID)
$(QUIET) $(LD) $(LDFLAGS) $@.o $(LIBVOLUME_ID) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS)
ifneq ($(strip $(STRIPCMD)),)
$(QUIET) $(STRIPCMD) $@
endif
@@ -49,6 +48,7 @@ endif
clean:
rm -f $(PROG) $(OBJS) $(GEN_HEADERS)
$(MAKE) -C libvolume_id clean
.PHONY: clean
install-bin: all
+66
View File
@@ -0,0 +1,66 @@
# Makefile for udev extra invoked from the udev main Makefile
#
# Copyright (C) 2004-2005 Kay Sievers <kay.sievers@vrfy.org>
#
# Released under the GNU General Public License, version 2.
#
LIBVOLUME_ID = libvolume_id.a
OBJS= \
ext.o \
fat.o \
hfs.o \
highpoint.o \
isw_raid.o \
lsi_raid.o \
via_raid.o \
silicon_raid.o \
nvidia_raid.o \
promise_raid.o \
iso9660.o \
jfs.o \
linux_raid.o \
linux_swap.o \
lvm.o \
mac.o \
msdos.o \
ntfs.o \
reiserfs.o \
udf.o \
ufs.o \
xfs.o \
cramfs.o \
hpfs.o \
romfs.o \
sysv.o \
minix.o \
luks.o \
ocfs.o \
vxfs.o \
volume_id.o \
util.o
HEADERS= \
volume_id.h \
util.h
AR = $(CROSS)ar
RANLIB = $(CROSS)ranlib
all: $(LIBVOLUME_ID)
.PHONY: all
.DEFAULT: all
%.o: %.c
$(QUIET) $(CC) -c $(CFLAGS) $< -o $@
$(LIBVOLUME_ID): $(HEADERS) $(OBJS)
@rm -f $@
$(QUIET) $(AR) cq $@ $(OBJS)
$(QUIET) $(RANLIB) $@
clean:
rm -f $(LIBVOLUME_ID) $(OBJS)
.PHONY: clean
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "cramfs.h"
struct cramfs_super {
uint8_t magic[4];
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "util.h"
#include "logging.h"
#include "ext.h"
struct ext2_super_block {
uint32_t s_inodes_count;
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "fat.h"
#define FAT12_MAX 0xff5
#define FAT16_MAX 0xfff5
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "hfs.h"
struct hfs_finder_info{
uint32_t boot_folder;
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "highpoint.h"
struct hpt37x_meta {
uint8_t filler1[32];
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "hpfs.h"
struct hpfs_super
{
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "iso9660.h"
#define ISO_SUPERBLOCK_OFFSET 0x8000
#define ISO_SECTOR_SIZE 0x800
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "isw_raid.h"
struct isw_meta {
uint8_t sig[32];
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "jfs.h"
struct jfs_super_block {
uint8_t magic[4];
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "linux_raid.h"
struct mdp_super_block {
uint32_t md_magic;
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "linux_swap.h"
struct swap_header_v1_2 {
uint8_t bootbits[1024];
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "lsi_raid.h"
struct lsi_meta {
uint8_t sig[6];
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "util.h"
#include "logging.h"
#include "luks.h"
#define SECTOR_SHIFT 9
#define SECTOR_SIZE (1 << SECTOR_SHIFT)
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "lvm.h"
struct lvm1_super_block {
uint8_t id[2];
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "mac.h"
struct mac_driver_desc {
uint8_t signature[2];
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "minix.h"
struct minix_super_block
{
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "msdos.h"
struct msdos_partition_entry {
uint8_t boot_ind;
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "ntfs.h"
struct ntfs_super_block {
uint8_t jump[3];
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "nvidia_raid.h"
struct nvidia_meta {
uint8_t vendor[8];
@@ -27,7 +27,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "ocfs.h"
struct ocfs1_super_block_header {
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "promise_raid.h"
struct promise_meta {
uint8_t sig[24];
@@ -27,7 +27,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "reiserfs.h"
struct reiserfs_super_block {
uint32_t blocks_count;
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "romfs.h"
struct romfs_super {
uint8_t magic[8];
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "silicon_raid.h"
struct silicon_meta {
uint8_t unknown0[0x2E];
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "sysv.h"
#define SYSV_NICINOD 100
#define SYSV_NICFREE 50
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "udf.h"
struct volume_descriptor {
struct descriptor_tag {
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "ufs.h"
struct ufs_super_block {
uint32_t fs_link;
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "via_raid.h"
struct via_meta {
uint16_t signature;
@@ -30,36 +30,6 @@
#include "logging.h"
#include "util.h"
#include "ext.h"
#include "reiserfs.h"
#include "fat.h"
#include "hfs.h"
#include "jfs.h"
#include "xfs.h"
#include "ufs.h"
#include "ntfs.h"
#include "iso9660.h"
#include "udf.h"
#include "highpoint.h"
#include "isw_raid.h"
#include "lsi_raid.h"
#include "via_raid.h"
#include "silicon_raid.h"
#include "nvidia_raid.h"
#include "promise_raid.h"
#include "luks.h"
#include "linux_swap.h"
#include "linux_raid.h"
#include "lvm.h"
#include "cramfs.h"
#include "hpfs.h"
#include "romfs.h"
#include "sysv.h"
#include "minix.h"
#include "mac.h"
#include "msdos.h"
#include "ocfs.h"
#include "vxfs.h"
int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size)
{
@@ -213,28 +183,6 @@ struct volume_id *volume_id_open_node(const char *path)
return id;
}
/* open volume by major/minor */
struct volume_id *volume_id_open_dev_t(dev_t devt)
{
struct volume_id *id;
char tmp_node[VOLUME_ID_PATH_MAX];
snprintf(tmp_node, VOLUME_ID_PATH_MAX,
"/dev/.volume_id-%u-%u-%u", getpid(), major(devt), minor(devt));
tmp_node[VOLUME_ID_PATH_MAX-1] = '\0';
/* create tempory node to open the block device */
unlink(tmp_node);
if (mknod(tmp_node, (S_IFBLK | 0600), devt) != 0)
return NULL;
id = volume_id_open_node(tmp_node);
unlink(tmp_node);
return id;
}
void volume_id_close(struct volume_id *id)
{
if (id == NULL)
+116
View File
@@ -0,0 +1,116 @@
/*
* volume_id - reads partition label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_H_
#define _VOLUME_ID_H_
#include <stdint.h>
#define VOLUME_ID_VERSION 53
#define VOLUME_ID_LABEL_SIZE 64
#define VOLUME_ID_UUID_SIZE 36
#define VOLUME_ID_FORMAT_SIZE 32
#define VOLUME_ID_PATH_MAX 256
#define VOLUME_ID_PARTITIONS_MAX 256
enum volume_id_usage {
VOLUME_ID_UNUSED,
VOLUME_ID_UNPROBED,
VOLUME_ID_OTHER,
VOLUME_ID_FILESYSTEM,
VOLUME_ID_PARTITIONTABLE,
VOLUME_ID_RAID,
VOLUME_ID_DISKLABEL,
VOLUME_ID_CRYPTO,
};
struct volume_id_partition {
enum volume_id_usage usage_id;
char *usage;
char *type;
uint64_t off;
uint64_t len;
uint8_t partition_type_raw;
};
struct volume_id {
uint8_t label_raw[VOLUME_ID_LABEL_SIZE];
size_t label_raw_len;
char label[VOLUME_ID_LABEL_SIZE+1];
uint8_t uuid_raw[VOLUME_ID_UUID_SIZE];
size_t uuid_raw_len;
char uuid[VOLUME_ID_UUID_SIZE+1];
enum volume_id_usage usage_id;
char *usage;
char *type;
char type_version[VOLUME_ID_FORMAT_SIZE];
struct volume_id_partition *partitions;
size_t partition_count;
int fd;
uint8_t *sbbuf;
size_t sbbuf_len;
uint8_t *seekbuf;
uint64_t seekbuf_off;
size_t seekbuf_len;
int fd_close:1;
};
extern struct volume_id *volume_id_open_fd(int fd);
extern struct volume_id *volume_id_open_node(const char *path);
extern int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size);
extern void volume_id_close(struct volume_id *id);
/* filesystems */
extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_ext(struct volume_id *id, uint64_t off);
extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off);
extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off);
extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off);
extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_minix(struct volume_id *id, uint64_t off);
extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off);
extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off);
extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off);
extern int volume_id_probe_udf(struct volume_id *id, uint64_t off);
extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off);
/* special formats */
extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off);
extern int volume_id_probe_luks(struct volume_id *id, uint64_t off);
/* raid */
extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off);
extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off);
/* bios raid */
extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off);
extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size);
/* partition tables */
extern int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off);
extern int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off);
#endif
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "vxfs.h"
#define VXFS_SUPER_MAGIC 0xa501FCF5
@@ -26,7 +26,6 @@
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "xfs.h"
struct xfs_super_block {
uint8_t magic[4];
+1 -1
View File
@@ -31,7 +31,7 @@
#include "../../udev_utils.h"
#include "../../logging.h"
#include "volume_id/volume_id.h"
#include "libvolume_id/volume_id.h"
#define BLKGETSIZE64 _IOR(0x12,114,size_t)
-66
View File
@@ -1,66 +0,0 @@
VOLUME_ID_OBJS= \
$(VOLUME_ID_BASE)/ext.o \
$(VOLUME_ID_BASE)/fat.o \
$(VOLUME_ID_BASE)/hfs.o \
$(VOLUME_ID_BASE)/highpoint.o \
$(VOLUME_ID_BASE)/isw_raid.o \
$(VOLUME_ID_BASE)/lsi_raid.o \
$(VOLUME_ID_BASE)/via_raid.o \
$(VOLUME_ID_BASE)/silicon_raid.o \
$(VOLUME_ID_BASE)/nvidia_raid.o \
$(VOLUME_ID_BASE)/promise_raid.o \
$(VOLUME_ID_BASE)/iso9660.o \
$(VOLUME_ID_BASE)/jfs.o \
$(VOLUME_ID_BASE)/linux_raid.o \
$(VOLUME_ID_BASE)/linux_swap.o \
$(VOLUME_ID_BASE)/lvm.o \
$(VOLUME_ID_BASE)/mac.o \
$(VOLUME_ID_BASE)/msdos.o \
$(VOLUME_ID_BASE)/ntfs.o \
$(VOLUME_ID_BASE)/reiserfs.o \
$(VOLUME_ID_BASE)/udf.o \
$(VOLUME_ID_BASE)/ufs.o \
$(VOLUME_ID_BASE)/xfs.o \
$(VOLUME_ID_BASE)/cramfs.o \
$(VOLUME_ID_BASE)/hpfs.o \
$(VOLUME_ID_BASE)/romfs.o \
$(VOLUME_ID_BASE)/sysv.o \
$(VOLUME_ID_BASE)/minix.o \
$(VOLUME_ID_BASE)/luks.o \
$(VOLUME_ID_BASE)/ocfs.o \
$(VOLUME_ID_BASE)/vxfs.o \
$(VOLUME_ID_BASE)/volume_id.o \
$(VOLUME_ID_BASE)/util.o
VOLUME_ID_HEADERS= \
$(VOLUME_ID_BASE)/ext.h \
$(VOLUME_ID_BASE)/fat.h \
$(VOLUME_ID_BASE)/hfs.h \
$(VOLUME_ID_BASE)/highpoint.h \
$(VOLUME_ID_BASE)/isw_raid.h \
$(VOLUME_ID_BASE)/lsi_raid.h \
$(VOLUME_ID_BASE)/via_raid.h \
$(VOLUME_ID_BASE)/silicon_raid.h \
$(VOLUME_ID_BASE)/nvidia_raid.h \
$(VOLUME_ID_BASE)/promise_raid.h \
$(VOLUME_ID_BASE)/iso9660.h \
$(VOLUME_ID_BASE)/jfs.h \
$(VOLUME_ID_BASE)/linux_raid.h \
$(VOLUME_ID_BASE)/linux_swap.h \
$(VOLUME_ID_BASE)/lvm.h \
$(VOLUME_ID_BASE)/mac.h \
$(VOLUME_ID_BASE)/msdos.h \
$(VOLUME_ID_BASE)/ntfs.h \
$(VOLUME_ID_BASE)/reiserfs.h \
$(VOLUME_ID_BASE)/udf.h \
$(VOLUME_ID_BASE)/ufs.h \
$(VOLUME_ID_BASE)/xfs.h \
$(VOLUME_ID_BASE)/cramfs.h \
$(VOLUME_ID_BASE)/romfs.h \
$(VOLUME_ID_BASE)/sysv.h \
$(VOLUME_ID_BASE)/minix.h \
$(VOLUME_ID_BASE)/luks.h \
$(VOLUME_ID_BASE)/ocfs.h \
$(VOLUME_ID_BASE)/vxfs.h \
$(VOLUME_ID_BASE)/volume_id.h \
$(VOLUME_ID_BASE)/util.h
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_CRAMFS_
#define _VOLUME_ID_CRAMFS_
extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_EXT_
#define _VOLUME_ID_EXT_
extern int volume_id_probe_ext(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_FAT_
#define _VOLUME_ID_FAT_
extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_HFS_
#define _VOLUME_ID_HFS_
extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off);
#endif
-17
View File
@@ -1,17 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_HIGHPOINT_
#define _VOLUME_ID_HIGHPOINT_
extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off);
extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_HPFS_
#define _VOLUME_ID_HPFS_
extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_ISO9660_
#define _VOLUME_ID_ISO9660_
extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_ISW_RAID_
#define _VOLUME_ID_ISW_RAID_
extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_JFS_
#define _VOLUME_ID_JFS_
extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_LINUX_RAID_
#define _VOLUME_ID_LINUX_RAID_
extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_LINUX_SWAP_
#define _VOLUME_ID_LINUX_SWAP_
extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_LSI_RAID_
#define _VOLUME_ID_LSI_RAID_
extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 W. Michael Petullo <mike@flyn.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_LUKS_
#define _VOLUME_ID_LUKS_
extern int volume_id_probe_luks(struct volume_id *id, uint64_t off);
#endif
-17
View File
@@ -1,17 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_LVM_
#define _VOLUME_ID_LVM_
extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off);
extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_MAC_
#define _VOLUME_ID_MAC_
extern int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_MINIX_
#define _VOLUME_ID_MINIX_
extern int volume_id_probe_minix(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_MSDOS_
#define _VOLUME_ID_MSDOS_
extern int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_NTFS_
#define _VOLUME_ID_NTFS_
extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_NVIDIA_RAID_
#define _VOLUME_ID_NVIDIA_RAID_
extern int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size);
#endif
-18
View File
@@ -1,18 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Andre Masella <andre@masella.no-ip.org>
* Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_OCFS1_
#define _VOLUME_ID_OCFS1_
extern int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off);
extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_PROMISE_RAID_
#define _VOLUME_ID_PROMISE_RAID_
extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_REISERFS_
#define _VOLUME_ID_REISERFS_
extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_ROMFS_
#define _VOLUME_ID_ROMFS_
extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_SILICON_RAID_
#define _VOLUME_ID_SILICON_RAID_
extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_SYSV_
#define _VOLUME_ID_SYSV_
extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_UDF_
#define _VOLUME_ID_UDF_
extern int volume_id_probe_udf(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_UFS_
#define _VOLUME_ID_UFS_
extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_VIA_RAID_
#define _VOLUME_ID_VIA_RAID_
extern int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size);
#endif
-74
View File
@@ -1,74 +0,0 @@
/*
* volume_id - reads partition label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_H_
#define _VOLUME_ID_H_
#include <stdint.h>
#define VOLUME_ID_VERSION 52
#define VOLUME_ID_LABEL_SIZE 64
#define VOLUME_ID_UUID_SIZE 36
#define VOLUME_ID_FORMAT_SIZE 32
#define VOLUME_ID_PATH_MAX 256
#define VOLUME_ID_PARTITIONS_MAX 256
enum volume_id_usage {
VOLUME_ID_UNUSED,
VOLUME_ID_UNPROBED,
VOLUME_ID_OTHER,
VOLUME_ID_FILESYSTEM,
VOLUME_ID_PARTITIONTABLE,
VOLUME_ID_RAID,
VOLUME_ID_DISKLABEL,
VOLUME_ID_CRYPTO,
};
struct volume_id_partition {
enum volume_id_usage usage_id;
char *usage;
char *type;
uint64_t off;
uint64_t len;
uint8_t partition_type_raw;
};
struct volume_id {
uint8_t label_raw[VOLUME_ID_LABEL_SIZE];
size_t label_raw_len;
char label[VOLUME_ID_LABEL_SIZE+1];
uint8_t uuid_raw[VOLUME_ID_UUID_SIZE];
size_t uuid_raw_len;
char uuid[VOLUME_ID_UUID_SIZE+1];
enum volume_id_usage usage_id;
char *usage;
char *type;
char type_version[VOLUME_ID_FORMAT_SIZE];
struct volume_id_partition *partitions;
size_t partition_count;
int fd;
uint8_t *sbbuf;
size_t sbbuf_len;
uint8_t *seekbuf;
uint64_t seekbuf_off;
size_t seekbuf_len;
int fd_close:1;
};
extern struct volume_id *volume_id_open_fd(int fd);
extern struct volume_id *volume_id_open_node(const char *path);
extern struct volume_id *volume_id_open_dev_t(dev_t devt);
extern int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size);
extern void volume_id_close(struct volume_id *id);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID_VXFS_
#define _VOLUME_ID_VXFS_
extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off);
#endif
-16
View File
@@ -1,16 +0,0 @@
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _VOLUME_ID__
#define _VOLUME_ID__
extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off);
#endif
-98
View File
@@ -1,98 +0,0 @@
# -*- makefile -*-
#
# Makefile configuration, without explicit rules
#
# CROSS is the prefix used for system tools like gcc, ld etc.
CROSS =
# KCROSS is the prefix we use for klibc installations. This is usually
# the same as CROSS, but may be different, e.g. to install an i386
# cross-compilation suite on an x86-64 system, using the same gcc/binutils.
KCROSS ?= $(CROSS)
# Location for installation
prefix = /usr
bindir = $(prefix)/bin
libdir = $(prefix)/lib
mandir = $(prefix)/man
INSTALLDIR = $(prefix)/lib/klibc
INSTALLROOT =
INSTALL_EXEC = install -m 755
INSTALL_DATA = install -m 644
# Eventually support separate compilation, but we don't have it yet...
OBJROOT = $(SRCROOT)
# Kernel trees (source and obj) - can potentially be different
KRNLSRC = $(SRCROOT)/linux
KRNLOBJ = $(SRCROOT)/linux
# klibc version information
KLIBCVER = -D__KLIBC__=$(shell cut -d. -f1 < $(SRCROOT)/version) \
-D__KLIBC_MINOR__=$(shell cut -d. -f2 < $(SRCROOT)/version)
ARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/parisc.*/parisc/)
CC = $(CROSS)gcc
LD = $(CROSS)ld
KLIBSRC = $(SRCROOT)/klibc
KLIBOBJ = $(OBJROOT)/klibc
INCLUDE = -I$(SRCROOT)/include/arch/$(ARCH) \
-I$(SRCROOT)/include/bits$(BITSIZE) \
-I$(SRCROOT)/include \
-I$(KRNLOBJ)/include -I$(KRNLOBJ)/include2 -I$(KRNLSRC)/include
REQFLAGS = $(ARCHREQFLAGS) $(KLIBCVER) -nostdlib -nostdinc -iwithprefix include \
$(INCLUDE)
LDFLAGS =
AR = $(CROSS)ar
RANLIB = $(CROSS)ranlib
NM = $(CROSS)nm
PERL = perl
OBJCOPY = $(CROSS)objcopy
STRIP = $(CROSS)strip
STRIPFLAGS = --strip-all -R .comment -R .note
STRIPCMD = $(STRIP) $(STRIPFLAGS)
HOST_CC = gcc
HOST_CFLAGS = -g -O
HOST_LDFLAGS =
HOST_LIBS =
# Static library paths
CRT0 = $(KLIBOBJ)/crt0.o
KLIBC = $(KLIBOBJ)/libc.a
LIBGCC = $(shell $(CC) $(REQFLAGS) $(OPTFLAGS) --print-libgcc)
# Shared library paths
CRTSHARED = $(KLIBOBJ)/interp.o
LIBSHARED = $(KLIBOBJ)/libc.so
#
# This indicates the location of the final version of the shared library.
# THIS MUST BE AN ABSOLUTE PATH WITH NO FINAL SLASH.
# Leave this empty to make it the root.
#
SHLIBDIR = /lib
# Enable this to make perror/strerror return real error messages
# This makes klibc.so and any static binary which uses these functions
# about 4K bigger.
ERRLIST = 1
# Include zlib in klibc. This roughly triples the size of klibc!
ZLIB = 0
#
# Include arch-specific rule fragments
#
include $(KLIBSRC)/arch/$(ARCH)/MCONFIG
ifeq ($(DEBUG),y)
STRIP = /bin/true -Since_we_are_debugging
OPTFLAGS += -O1 -g
endif
# How to tell the linker main() is the entrypoint
EMAIN ?= -e main
-45
View File
@@ -1,45 +0,0 @@
# -*- makefile -*-
#
# Standard pattern rules
#
.SUFFIXES: .c .o .a .so .lo .i .S .s .ls .ss .lss
% : %.c # Cancel default rule
% : %.S
.c.o:
$(CC) $(CFLAGS) -c -o $@ $<
.c.i:
$(CC) $(CFLAGS) -E -o $@ $<
.c.s:
$(CC) $(CFLAGS) -S -o $@ $<
.S.o:
$(CC) $(CFLAGS) -D__ASSEMBLY__ -c -o $@ $<
.S.s:
$(CC) $(CFLAGS) -D__ASSEMBLY__ -E -o $@ $<
.S.lo:
$(CC) $(CFLAGS) $(SOFLAGS) -D__ASSEMBLY__ -c -o $@ $<
.S.ls:
$(CC) $(CFLAGS) $(SOFLAGS) -D__ASSEMBLY__ -E -o $@ $<
.s.o:
$(CC) $(CFLAGS) -x assembler -c -o $@ $<
.ls.lo:
$(CC) $(CFLAGS) $(SOFLAGS) -x assembler -c -o $@ $<
.c.lo:
$(CC) $(CFLAGS) $(SOFLAGS) -c -o $@ $<
.c.ls:
$(CC) $(CFLAGS) $(SOFLAGS) -S -o $@ $<
-77
View File
@@ -1,77 +0,0 @@
VERSION := $(shell cat version)
SUBDIRS = klibc ash ipconfig nfsmount utils kinit gzip
SRCROOT = .
all:
rpmbuild = $(shell which rpmbuild 2>/dev/null || which rpm)
klibc.spec: klibc.spec.in version
sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@
.PHONY: rpm
rpm: klibc.spec
+$(rpmbuild) -bb klibc.spec --target=$(ARCH)
$(CROSS)klibc.config: Makefile
rm -f $@
echo 'ARCH=$(ARCH)' >> $@
echo 'CROSS=$(CROSS)' >> $@
echo 'KCROSS=$(KCROSS)' >> $@
echo 'CC=$(CC)' >> $@
echo 'LD=$(LD)' >> $@
echo 'REQFLAGS=$(filter-out -I%,$(REQFLAGS))' >> $@
echo 'OPTFLAGS=$(OPTFLAGS)' >> $@
echo 'LDFLAGS=$(LDFLAGS)' >> $@
echo 'STRIP=$(STRIP)' >> $@
echo 'STRIPFLAGS=$(STRIPFLAGS)' >> $@
echo 'EMAIN=$(EMAIN)' >> $@
echo 'BITSIZE=$(BITSIZE)' >> $@
echo 'prefix=$(INSTALLDIR)' >> $@
echo 'bindir=$(INSTALLDIR)/$(KCROSS)bin' >> $@
echo 'libdir=$(INSTALLDIR)/$(KCROSS)lib' >> $@
echo 'includedir=$(INSTALLDIR)/$(KCROSS)include' >> $@
$(CROSS)klcc: klcc.in $(CROSS)klibc.config makeklcc.pl
$(PERL) makeklcc.pl klcc.in $(CROSS)klibc.config \
$(shell bash -c 'type -p $(PERL)') > $@ || ( rm -f $@ ; exit 1 )
chmod a+x $@
%: local-%
@set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
local-all: $(CROSS)klcc
local-clean:
rm -f klibc.config klcc
local-spotless: local-clean
rm -f klibc.spec *~ tags
local-install: $(CROSS)klcc
mkdir -p $(INSTALLROOT)$(bindir)
mkdir -p $(INSTALLROOT)$(mandir)/man1
mkdir -p $(INSTALLROOT)$(SHLIBDIR)
mkdir -p $(INSTALLROOT)$(INSTALLDIR)
-rm -rf $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib
mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin
set -xe ; for d in linux scsi asm-$(ARCH) asm-generic $(ASMARCH); do \
mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d ; \
for r in $(KRNLSRC)/include $(KRNLOBJ)/include $(KRNLOBJ)/include2 ; do \
[ ! -d $$r/$$d ] || \
cp -rfL $$r/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/$$d/. ; \
done ; \
done
cd $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include && ln -sf asm-$(ARCH) asm
cp -rf include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/.
$(INSTALL_DATA) klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1
$(INSTALL_EXEC) $(KCROSS)klcc $(INSTALLROOT)$(bindir)
# This does all the prep work needed to turn a freshly exported git repository
# into a release tarball tree
release: klibc.spec
rm -f maketar.sh
-include MCONFIG
-21
View File
@@ -1,21 +0,0 @@
Please see klibc/README for build instructions and for the status of
various platforms.
klibc is archived at:
ftp://ftp.kernel.org/pub/linux/libs/klibc/
There is a mailing list for klibc and early-userspace issues at:
http://www.zytor.com/mailman/listinfo/klibc/
There is also a cvsweb repository at:
http://www.zytor.com/cvsweb.cgi/klibc/
There is no direct public CVS access yet, however, the CVS repository
is available for rsync from:
rsync://rsync.kernel.org/pub/linux/libs/klibc/cvsroot/
-13
View File
@@ -1,13 +0,0 @@
/*
* alloca.h
*
* Just call the builtin alloca() function
*/
#ifndef _ALLOCA_H
#define _ALLOCA_H
#define alloca(size) __builtin_alloca(size)
#endif /* _ALLOCA_H */
@@ -1,33 +0,0 @@
/*
* arch/alpha/include/klibc/archsetjmp.h
*/
#ifndef _KLIBC_ARCHSETJMP_H
#define _KLIBC_ARCHSETJMP_H
struct __jmp_buf {
unsigned long __s0;
unsigned long __s1;
unsigned long __s2;
unsigned long __s3;
unsigned long __s4;
unsigned long __s5;
unsigned long __fp;
unsigned long __ra;
unsigned long __gp;
unsigned long __sp;
unsigned long __f2;
unsigned long __f3;
unsigned long __f4;
unsigned long __f5;
unsigned long __f6;
unsigned long __f7;
unsigned long __f8;
unsigned long __f9;
};
/* Must be an array so it will decay to a pointer when a function is called */
typedef struct __jmp_buf jmp_buf[1];
#endif /* _KLIBC_ARCHSETJMP_H */
@@ -1,13 +0,0 @@
/*
* arch/alpha/include/klibc/archsignal.h
*
* Architecture-specific signal definitions
*
*/
#ifndef _KLIBC_ARCHSIGNAL_H
#define _KLIBC_ARCHSIGNAL_H
/* No special stuff for this architecture */
#endif
-26
View File
@@ -1,26 +0,0 @@
#ifndef _KLIBC_ARCHSTAT_H
#define _KLIBC_ARCHSTAT_H
#define _STATBUF_ST_NSEC
struct stat {
unsigned long st_dev;
unsigned long st_ino;
unsigned long st_rdev;
long st_size;
unsigned long st_blocks;
unsigned int st_mode;
unsigned int st_uid;
unsigned int st_gid;
unsigned int st_blksize;
unsigned int st_nlink;
unsigned int __pad0;
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
long __unused[3];
};
#endif
-53
View File
@@ -1,53 +0,0 @@
/*
* arch/alpha/include/klibc/archsys.h
*
* Architecture-specific syscall definitions
*/
#ifndef _KLIBC_ARCHSYS_H
#define _KLIBC_ARCHSYS_H
/* Alpha has some bizarre Tru64-derived system calls which return two
different values in $0 and $20(!), respectively. The standard
macros can't deal with these; even the ones that give the right
return value have the wrong clobbers. */
#define _syscall0_dual0(type, name) \
type name(void) \
{ \
long _sc_ret, _sc_err; \
{ \
register long _sc_0 __asm__("$0"); \
register long _sc_19 __asm__("$19"); \
register long _sc_20 __asm__("$20"); \
\
_sc_0 = __NR_##name; \
__asm__("callsys" \
: "=r"(_sc_0), "=r"(_sc_19), "=r" (_sc_20) \
: "0"(_sc_0) \
: _syscall_clobbers); \
_sc_ret = _sc_0, _sc_err = _sc_19; (void)(_sc_20); \
} \
_syscall_return(type); \
}
#define _syscall0_dual1(type, name) \
type name(void) \
{ \
long _sc_ret, _sc_err; \
{ \
register long _sc_0 __asm__("$0"); \
register long _sc_19 __asm__("$19"); \
register long _sc_20 __asm__("$20"); \
\
_sc_0 = __NR_##name; \
__asm__("callsys" \
: "=r"(_sc_0), "=r"(_sc_19), "=r" (_sc_20) \
: "0"(_sc_0) \
: _syscall_clobbers); \
_sc_ret = _sc_20, _sc_err = _sc_19; (void)(_sc_0); \
} \
_syscall_return(type); \
}
#endif /* _KLIBC_ARCHSYS_H */
-44
View File
@@ -1,44 +0,0 @@
/*
* machine/asm.h
*/
#ifndef _MACHINE_ASM_H
#define _MACHINE_ASM_H
/* Standard aliases for Alpha register names */
#define v0 $0
#define t0 $1
#define t1 $2
#define t2 $3
#define t3 $4
#define t4 $5
#define t5 $6
#define t6 $7
#define t7 $8
#define s0 $9
#define s1 $10
#define s2 $11
#define s3 $12
#define s4 $13
#define s5 $14
#define fp $15
#define a0 $16
#define a1 $17
#define a2 $18
#define a3 $19
#define a4 $20
#define a5 $21
#define t8 $22
#define t9 $23
#define t10 $24
#define t11 $25
#define ra $26
#define t12 $27 /* t12 and pv are both used for $27 */
#define pv $27 /* t12 and pv are both used for $27 */
#define at $28
#define gp $29
#define sp $30
#define zero $31
#endif /* _MACHINE_ASM_H */
-14
View File
@@ -1,14 +0,0 @@
/*
* arch/i386/include/klibc/archsetjmp.h
*/
#ifndef _KLIBC_ARCHSETJMP_H
#define _KLIBC_ARCHSETJMP_H
struct __jmp_buf {
unsigned int regs[10];
};
typedef struct __jmp_buf jmp_buf[1];
#endif /* _SETJMP_H */
-13
View File
@@ -1,13 +0,0 @@
/*
* arch/arm/include/klibc/archsignal.h
*
* Architecture-specific signal definitions
*
*/
#ifndef _KLIBC_ARCHSIGNAL_H
#define _KLIBC_ARCHSIGNAL_H
/* No special stuff for this architecture */
#endif
-45
View File
@@ -1,45 +0,0 @@
#ifndef _KLIBC_ARCHSTAT_H
#define _KLIBC_ARCHSTAT_H
#include <endian.h>
#define _STATBUF_ST_NSEC
/* This matches struct stat64 in glibc2.1, hence the absolutely
* insane amounts of padding around dev_t's.
* Note: The kernel zero's the padded region because glibc might read them
* in the hope that the kernel has stretched to using larger sizes.
*/
struct stat {
unsigned long long st_dev;
unsigned char __pad0[4];
unsigned long __st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned long st_uid;
unsigned long st_gid;
unsigned long long st_rdev;
unsigned char __pad3[4];
long long st_size;
unsigned long st_blksize;
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned long __pad4; /* Future possible st_blocks hi bits */
unsigned long st_blocks; /* Number 512-byte blocks allocated. */
#else /* Must be little */
unsigned long st_blocks; /* Number 512-byte blocks allocated. */
unsigned long __pad4; /* Future possible st_blocks hi bits */
#endif
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
unsigned long long st_ino;
};
#endif
-12
View File
@@ -1,12 +0,0 @@
/*
* arch/cris/include/klibc/archsys.h
*
* Architecture-specific syscall definitions
*/
#ifndef _KLIBC_ARCHSYS_H
#define _KLIBC_ARCHSYS_H
/* No special syscall definitions for this architecture */
#endif /* _KLIBC_ARCHSYS_H */
@@ -1,24 +0,0 @@
/*
* arch/cris/include/klibc/archsetjmp.h
*/
#ifndef _KLIBC_ARCHSETJMP_H
#define _KLIBC_ARCHSETJMP_H
struct __jmp_buf {
unsigned long __r0;
unsigned long __r1;
unsigned long __r2;
unsigned long __r3;
unsigned long __r4;
unsigned long __r5;
unsigned long __r6;
unsigned long __r7;
unsigned long __r8;
unsigned long __sp;
unsigned long __srp;
};
typedef struct __jmp_buf jmp_buf[1];
#endif /* _KLIBC_ARCHSETJMP_H */
@@ -1,13 +0,0 @@
/*
* arch/cris/include/klibc/archsignal.h
*
* Architecture-specific signal definitions
*
*/
#ifndef _KLIBC_ARCHSIGNAL_H
#define _KLIBC_ARCHSIGNAL_H
/* No special stuff for this architecture */
#endif
-37
View File
@@ -1,37 +0,0 @@
#ifndef _KLIBC_ARCHSTAT_H
#define _KLIBC_ARCHSTAT_H
#define _STATBUF_ST_NSEC
/* This matches struct stat64 in glibc2.1, hence the absolutely
* insane amounts of padding around dev_t's.
*/
struct stat {
unsigned long long st_dev;
unsigned char __pad0[4];
unsigned long __st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned long st_uid;
unsigned long st_gid;
unsigned long long st_rdev;
unsigned char __pad3[4];
long long st_size;
unsigned long st_blksize;
unsigned long st_blocks; /* Number 512-byte blocks allocated. */
unsigned long __pad4; /* future possible st_blocks high bits */
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
unsigned long long st_ino;
};
#endif
-12
View File
@@ -1,12 +0,0 @@
/*
* arch/cris/include/klibc/archsys.h
*
* Architecture-specific syscall definitions
*/
#ifndef _KLIBC_ARCHSYS_H
#define _KLIBC_ARCHSYS_H
/* No special syscall definitions for this architecture */
#endif /* _KLIBC_ARCHSYS_H */
@@ -1,19 +0,0 @@
/*
* arch/i386/include/klibc/archsetjmp.h
*/
#ifndef _KLIBC_ARCHSETJMP_H
#define _KLIBC_ARCHSETJMP_H
struct __jmp_buf {
unsigned int __ebx;
unsigned int __esp;
unsigned int __ebp;
unsigned int __esi;
unsigned int __edi;
unsigned int __eip;
};
typedef struct __jmp_buf jmp_buf[1];
#endif /* _SETJMP_H */
@@ -1,13 +0,0 @@
/*
* arch/i386/include/klibc/archsignal.h
*
* Architecture-specific signal definitions
*
*/
#ifndef _KLIBC_ARCHSIGNAL_H
#define _KLIBC_ARCHSIGNAL_H
/* No special stuff for this architecture */
#endif
-37
View File
@@ -1,37 +0,0 @@
#ifndef _KLIBC_ARCHSTAT_H
#define _KLIBC_ARCHSTAT_H
#define _STATBUF_ST_NSEC
/* This matches struct stat64 in glibc2.1, hence the absolutely
* insane amounts of padding around dev_t's.
*/
struct stat {
unsigned long long st_dev;
unsigned char __pad0[4];
unsigned long __st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned long st_uid;
unsigned long st_gid;
unsigned long long st_rdev;
unsigned char __pad3[4];
long long st_size;
unsigned long st_blksize;
unsigned long st_blocks; /* Number 512-byte blocks allocated. */
unsigned long __pad4; /* future possible st_blocks high bits */
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
unsigned long long st_ino;
};
#endif
-12
View File
@@ -1,12 +0,0 @@
/*
* arch/cris/include/klibc/archsys.h
*
* Architecture-specific syscall definitions
*/
#ifndef _KLIBC_ARCHSYS_H
#define _KLIBC_ARCHSYS_H
/* No special syscall definitions for this architecture */
#endif /* _KLIBC_ARCHSYS_H */
-16
View File
@@ -1,16 +0,0 @@
/*
* arch/i386/include/klibc/diverr.h
*/
#ifndef _KLIBC_DIVERR_H
#define _KLIBC_DIVERR_H
#include <signal.h>
static __inline__ void
__divide_error(void)
{
asm volatile("divl %0" :: "rm" (0) : "eax", "edx");
}
#endif /* _KLIBC_DIVERR_H */
-126
View File
@@ -1,126 +0,0 @@
#ident "$Id: io.h,v 1.2 2004/01/25 07:49:39 hpa Exp $"
/* ----------------------------------------------------------------------- *
*
* Copyright 2004 H. Peter Anvin - All Rights Reserved
*
* 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.
*
* ----------------------------------------------------------------------- */
/*
* sys/io.h for the i386 architecture
*
* Basic I/O macros
*/
#ifndef _SYS_IO_H
#define _SYS_IO_H 1
/* I/O-related system calls */
int iopl(int);
int ioperm(unsigned long, unsigned long, int);
/* Basic I/O macros */
static __inline__ void
outb(unsigned char __v, unsigned short __p)
{
asm volatile("outb %0,%1" : : "a" (__v), "dN" (__p));
}
static __inline__ void
outw(unsigned short __v, unsigned short __p)
{
asm volatile("outw %0,%1" : : "a" (__v), "dN" (__p));
}
static __inline__ void
outl(unsigned int __v, unsigned short __p)
{
asm volatile("outl %0,%1" : : "a" (__v), "dN" (__p));
}
static __inline__ unsigned char
inb(unsigned short __p)
{
unsigned char __v;
asm volatile("inb %1,%0" : "=a" (__v) : "dN" (__p));
return __v;
}
static __inline__ unsigned short
inw(unsigned short __p)
{
unsigned short __v;
asm volatile("inw %1,%0" : "=a" (__v) : "dN" (__p));
return __v;
}
static __inline__ unsigned int
inl(unsigned short __p)
{
unsigned int __v;
asm volatile("inl %1,%0" : "=a" (__v) : "dN" (__p));
return __v;
}
/* String I/O macros */
static __inline__ void
outsb (unsigned short __p, const void *__d, unsigned long __n)
{
asm volatile("cld; rep; outsb" : "+S" (__d), "+c" (__n) : "d" (__p));
}
static __inline__ void
outsw (unsigned short __p, const void *__d, unsigned long __n)
{
asm volatile("cld; rep; outsw" : "+S" (__d), "+c" (__n) : "d" (__p));
}
static __inline__ void
outsl (unsigned short __p, const void *__d, unsigned long __n)
{
asm volatile("cld; rep; outsl" : "+S" (__d), "+c" (__n) : "d" (__p));
}
static __inline__ void
insb (unsigned short __p, void *__d, unsigned long __n)
{
asm volatile("cld; rep; insb" : "+D" (__d), "+c" (__n) : "d" (__p));
}
static __inline__ void
insw (unsigned short __p, void *__d, unsigned long __n)
{
asm volatile("cld; rep; insw" : "+D" (__d), "+c" (__n) : "d" (__p));
}
static __inline__ void
insl (unsigned short __p, void *__d, unsigned long __n)
{
asm volatile("cld; rep; insl" : "+D" (__d), "+c" (__n) : "d" (__p));
}
#endif /* _SYS_IO_H */

Some files were not shown because too many files have changed in this diff Show More