Package org.jnode.driver

Examples of org.jnode.driver.Device


     *
     * @see org.jnode.driver.Driver#startDevice()
     */
    protected void startDevice() throws DriverException {
        try {
            final Device dev = getDevice();
            dev.getManager().rename(dev, IDEControllerAPI.DEVICE_PREFIX, true);
            startDriver();
            WorkUtils.add(new Work("IDE.registerDevices") {
                public void execute() {
                    try {
                        registerDevices();
View Full Code Here


    /**
     * @see org.jnode.driver.Driver#startDevice()
     */
    protected void startDevice() throws DriverException {
        final Device ideDev = getDevice();

        // Register my api's
        ideDev.registerAPI(SCSIHostControllerAPI.class, this);

        // Create the ATAPI bus
        this.atapiBus = new ATAPIBus(ideDev);

        // Create the generic SCSI device, attached to the ATAPI bus
        scsiDevice = new ATAPISCSIDevice(atapiBus, "_sg");

        // Execute INQUIRY
        try {
            scsiDevice.inquiry();
        } catch (SCSIException ex) {
            throw new DriverException("Cannot INQUIRY device due to SCSIException", ex);
        } catch (TimeoutException ex) {
            throw new DriverException("Cannot INQUIRY device due to TimeoutException", ex);
        } catch (InterruptedException ex) {
            throw new DriverException("Interrupted while INQUIRY device", ex);
        }

        // Register the generic SCSI device.
        try {
            final DeviceManager dm = ideDev.getManager();
            synchronized (dm) {
                dm.rename(scsiDevice, "sg", true);
                dm.register(scsiDevice);
                dm.rename(ideDev, SCSIHostControllerAPI.DEVICE_PREFIX, true);
            }
View Full Code Here

            log.error("can't flush " + api.getClass().getName(), e);
        }

        if (api instanceof Driver) {
            Driver driver = (Driver) api;
            Device device = driver.getDevice();

            if (device != null) {
                try {
                    StubDeviceManager.INSTANCE.stop(device);
                    StubDeviceManager.INSTANCE.unregister(device);
View Full Code Here

        } catch (DeviceException e) {
            log.error(e);
        }

        try {
            Device dev = StubDeviceManager.INSTANCE.getDevice(devName);
            log.debug("dev=" + dev);
            log
                .debug("driver="
                    + (dev == null ? "null" : "" + dev.getDriver()));
            return dev.getDriver();
        } catch (DeviceNotFoundException e) {
            log.fatal("can't find " + devName, e);
            return null;
        }
    }
View Full Code Here

     */
    public void testExtremeFragmentation() {
        System.out.println("NTFS : Test extreme fragmentation (" + TEST_IMAGE_FILENAME_1 + ").");
        try {
            File file = new File(TEST_IMAGE_FILENAME_1);
            Device device = new FileDevice(file, "r");
            FileSystem<?> fileSystem = new NTFSFileSystemType().create(device, true);
            FSDirectory root = fileSystem.getRootEntry().getDirectory();

            // Check the big file.  Every byte should be readable as zero, hopefully.
            FSFile bigFile = root.getEntry("bigfile.dat").getFile();
View Full Code Here

     */
    public void testSparseFiles() {
        System.out.println("NTFS : Test sparse file (" + TEST_IMAGE_FILENAME_2 + ").");
        try {
            File file = new File(TEST_IMAGE_FILENAME_2);
            Device device = new FileDevice(file, "r");
            FileSystem<?> fileSystem = new NTFSFileSystemType().create(device, true);
            FSDirectory root = fileSystem.getRootEntry().getDirectory();

            // The first file has 256 bytes of real data at the front, and the rest is sparse.
            byte[] expectedContents = new byte[10240];
View Full Code Here

            System.out.println("specify device ids");
        } else {
            final List<BlockDeviceAPI> apis = new ArrayList<BlockDeviceAPI>();
            for (int i = 0; i < args.length; i++) {
                final String id = args[i];
                final Device device = DeviceUtils.getDevice(id);
                apis.add(device.getAPI(BlockDeviceAPI.class));
            }

            final int repeatCount = 1000;
            final List<Thread> threads = new ArrayList<Thread>();
View Full Code Here

    /**
     * @return @throws
     *         IOException
     */
    protected Device lookupDevice() throws IOException {
        Device device = null;
        try {
            device = InitialNaming.lookup(DeviceManager.NAME)
                .getDevice(deviceName);
        } catch (DeviceNotFoundException ex) {
            final IOException ioe = new IOException();
View Full Code Here

        this.blockAlignment = new FSBlockAlignmentSupport(this, 2048);
    }

    @Override
    protected void startDevice() throws DriverException {
        final Device dev = getDevice();
        // Rename the device
        try {
            final DeviceManager dm = dev.getManager();
            synchronized (dm) {
                dm.rename(dev, "sg", true);
            }
        } catch (DeviceAlreadyRegisteredException ex) {
            throw new DriverException(ex);
        }

        this.locked = false;
        this.changed = true;
        this.capacity = null;
        this.blockAlignment.setAlignment(2048);

        dev.registerAPI(RemovableDeviceAPI.class, this);
        dev.registerAPI(FSBlockDeviceAPI.class, blockAlignment);
    }
View Full Code Here

    protected void startDevice() throws DriverException {
        try {
            final IDEDiskPartitionDevice dev = this.device;
            this.pte = dev.getPartitionTableEntry();
            final Device parent = dev.getParent();
            final long offset = dev.getStartSector() * SECTOR_SIZE;
            final long length = dev.getSectors() * SECTOR_SIZE;
            this.mapping = new MappedBlockDeviceSupport(parent, offset, length);
            /* Register the FSBlockDevice API */
            device.registerAPI(FSBlockDeviceAPI.class, this);
View Full Code Here

TOP

Related Classes of org.jnode.driver.Device

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.