ext2 import by filip navara with minor editing by arty.
Deleted: branches/ext2/reactos/drivers/fs/ext2/attr.c
Deleted: branches/ext2/reactos/drivers/fs/ext2/blockdev.c
Deleted: branches/ext2/reactos/drivers/fs/ext2/dir.c
Deleted: branches/ext2/reactos/drivers/fs/ext2/ext2fs.h
Deleted: branches/ext2/reactos/drivers/fs/ext2/file.c
Added: branches/ext2/reactos/drivers/fs/ext2/inc/
Added: branches/ext2/reactos/drivers/fs/ext2/inc/errmsg.h
Added: branches/ext2/reactos/drivers/fs/ext2/inc/ext2_fs.h
Added: branches/ext2/reactos/drivers/fs/ext2/inc/ext2fsd.h
Added: branches/ext2/reactos/drivers/fs/ext2/inc/ext2metadata.h
Added: branches/ext2/reactos/drivers/fs/ext2/inc/protos.h
Added: branches/ext2/reactos/drivers/fs/ext2/inc/resource.h
Added: branches/ext2/reactos/drivers/fs/ext2/inc/struct.h
Deleted: branches/ext2/reactos/drivers/fs/ext2/inode.c
Modified: branches/ext2/reactos/drivers/fs/ext2/makefile
Deleted: branches/ext2/reactos/drivers/fs/ext2/quota.c
Deleted: branches/ext2/reactos/drivers/fs/ext2/rw.c
Deleted: branches/ext2/reactos/drivers/fs/ext2/security.c
Added: branches/ext2/reactos/drivers/fs/ext2/src/
Added: branches/ext2/reactos/drivers/fs/ext2/src/.cvsignore
Added: branches/ext2/reactos/drivers/fs/ext2/src/DiskIO.c
Added: branches/ext2/reactos/drivers/fs/ext2/src/cleanup.c
Added: branches/ext2/reactos/drivers/fs/ext2/src/close.c
Added: branches/ext2/reactos/drivers/fs/ext2/src/create.c
Added: branches/ext2/reactos/drivers/fs/ext2/src/devcntrl.c
Added: branches/ext2/reactos/drivers/fs/ext2/src/dircntrl.c
Added: branches/ext2/reactos/drivers/fs/ext2/src/ext2.rc
Added: branches/ext2/reactos/drivers/fs/ext2/src/ext2init.c
Added: branches/ext2/reactos/drivers/fs/ext2/src/fastio.c
Added: branches/ext2/reactos/drivers/fs/ext2/src/fileinfo.c
Added: branches/ext2/reactos/drivers/fs/ext2/src/flush.c
Added: branches/ext2/reactos/drivers/fs/ext2/src/fsctrl.c
Added: branches/ext2/reactos/drivers/fs/ext2/src/io.c
Added: branches/ext2/reactos/drivers/fs/ext2/src/metadata.c
Added: branches/ext2/reactos/drivers/fs/ext2/src/misc.c
Added: branches/ext2/reactos/drivers/fs/ext2/src/read.c
Added: branches/ext2/reactos/drivers/fs/ext2/src/shutdown.c
Added: branches/ext2/reactos/drivers/fs/ext2/src/volinfo.c
Added: branches/ext2/reactos/drivers/fs/ext2/src/write.c
Deleted: branches/ext2/reactos/drivers/fs/ext2/super.c
_____
Deleted: branches/ext2/reactos/drivers/fs/ext2/attr.c
--- branches/ext2/reactos/drivers/fs/ext2/attr.c 2005-01-13
01:21:47 UTC (rev 13008)
+++ branches/ext2/reactos/drivers/fs/ext2/attr.c 2005-01-13
01:51:33 UTC (rev 13009)
@@ -1,136 +0,0 @@
-/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: services/fs/ext2/attr.c
- * PURPOSE: Set/Get file attributes support
- * PROGRAMMER: David Welch (welch(a)cwcom.net)
- * UPDATE HISTORY:
- */
-
-/* INCLUDES
*****************************************************************/
-
-#include <ddk/ntddk.h>
-#include <wchar.h>
-#include <string.h>
-
-//#define NDEBUG
-#include <debug.h>
-
-#include "ext2fs.h"
-
-/* FUNCTIONS
****************************************************************/
-
-NTSTATUS STDCALL
-Ext2SetInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp)
-{
- DPRINT("Ext2SetInformation(DeviceObject %x Irp
%x)\n",DeviceObject,Irp);
-
- Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
- Irp->IoStatus.Information = 0;
- IoCompleteRequest(Irp,
- IO_NO_INCREMENT);
-
- return(STATUS_UNSUCCESSFUL);
-}
-
-NTSTATUS STDCALL
-Ext2QueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp)
-{
- NTSTATUS Status;
- PIO_STACK_LOCATION Param;
- PFILE_OBJECT FileObject;
- PDEVICE_EXTENSION DeviceExt;
- ULONG Length;
- PFILE_BASIC_INFORMATION PFileBasicInformation;
- PFILE_STANDARD_INFORMATION PFileStandardInformation;
- PFILE_INTERNAL_INFORMATION PFileInternalInformation;
- PFILE_EA_INFORMATION PFileEaInformation;
- PFILE_ACCESS_INFORMATION PFileAccessInformation;
- PFILE_NAME_INFORMATION PFileNameInformation;
- PFILE_POSITION_INFORMATION PFilePositionInformation;
- PVOID Buffer;
-
- DPRINT("Ext2QueryInformation(DeviceObject %x Irp %x)\n",
DeviceObject, Irp);
-
- Param = IoGetCurrentIrpStackLocation(Irp);
- FileObject = Param->FileObject;
- DeviceExt = DeviceObject->DeviceExtension;
- Length = Param->Parameters.QueryFile.Length;
- Buffer = Irp->AssociatedIrp.SystemBuffer;
-
- switch (Param->Parameters.QueryFile.FileInformationClass)
- {
- case FileDirectoryInformation:
- case FileFullDirectoryInformation:
- case FileBothDirectoryInformation:
- Status = STATUS_NOT_IMPLEMENTED;
- break;
-
- case FileBasicInformation:
- PFileBasicInformation = (PFILE_BASIC_INFORMATION)Buffer;
- memset(PFileBasicInformation, 0,
sizeof(FILE_BASIC_INFORMATION));
- Status = STATUS_SUCCESS;
- break;
-
- case FileStandardInformation:
- PFileStandardInformation = (PFILE_STANDARD_INFORMATION)Buffer;
- memset(PFileStandardInformation, 0,
sizeof(FILE_STANDARD_INFORMATION));
- Status = STATUS_SUCCESS;
- break;
-
- case FileInternalInformation:
- PFileInternalInformation = (PFILE_INTERNAL_INFORMATION)Buffer;
- memset(PFileInternalInformation, 0,
sizeof(FILE_INTERNAL_INFORMATION));
- Status = STATUS_SUCCESS;
- break;
-
- case FileEaInformation:
- PFileEaInformation = (PFILE_EA_INFORMATION)Buffer;
- memset(PFileEaInformation, 0, sizeof(FILE_EA_INFORMATION));
- PFileEaInformation->EaSize = 0;
- Status = STATUS_SUCCESS;
- break;
-
- case FileAccessInformation:
- PFileAccessInformation = (PFILE_ACCESS_INFORMATION)Buffer;
- memset(PFileAccessInformation, 0,
sizeof(FILE_ACCESS_INFORMATION));
- PFileAccessInformation->AccessFlags = 0;
- Status = STATUS_SUCCESS;
- break;
-
- case FileNameInformation:
- PFileNameInformation = (PFILE_NAME_INFORMATION)Buffer;
- memset(PFileNameInformation, 0, sizeof(FILE_NAME_INFORMATION));
- Status = STATUS_SUCCESS;
- break;
-
- case FilePositionInformation:
- PFilePositionInformation = (PFILE_POSITION_INFORMATION)Buffer;
- memcpy(PFilePositionInformation,
- &FileObject->CurrentByteOffset,
- sizeof(FileObject->CurrentByteOffset));
- Status = STATUS_SUCCESS;
- break;
-
- case FileRenameInformation:
- Status = STATUS_NOT_IMPLEMENTED;
- break;
-
- default:
- Status = STATUS_NOT_SUPPORTED;
- }
-
-
-
-
- Irp->IoStatus.Status = Status;
- if (NT_SUCCESS(Status))
- Irp->IoStatus.Information =
- Param->Parameters.QueryFile.Length - Length;
- else
- Irp->IoStatus.Information = 0;
- IoCompleteRequest(Irp,
- IO_NO_INCREMENT);
-
- return(Status);
-}
_____
Deleted: branches/ext2/reactos/drivers/fs/ext2/blockdev.c
--- branches/ext2/reactos/drivers/fs/ext2/blockdev.c 2005-01-13
01:21:47 UTC (rev 13008)
+++ branches/ext2/reactos/drivers/fs/ext2/blockdev.c 2005-01-13
01:51:33 UTC (rev 13009)
@@ -1,155 +0,0 @@
-/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: services/fs/ext2/blockdev.c
- * PURPOSE: Temporary sector reading support
- * PROGRAMMER: David Welch (welch(a)cwcom.net)
- * UPDATE HISTORY:
- */
-
-/* INCLUDES
*****************************************************************/
-
-#include <ddk/ntddk.h>
-
-//#define NDEBUG
-#include <debug.h>
-
-#include "ext2fs.h"
-
-/* FUNCTIONS
***************************************************************/
-
-BOOLEAN
-Ext2ReadSectors(IN PDEVICE_OBJECT pDeviceObject,
- IN ULONG DiskSector,
- IN ULONG SectorCount,
- IN PVOID Buffer)
-{
- LARGE_INTEGER sectorNumber;
- PIRP irp;
- IO_STATUS_BLOCK ioStatus;
- KEVENT event;
- NTSTATUS status;
- ULONG sectorSize;
- int j;
-
- DPRINT("VFATReadSector(pDeviceObject %x, DiskSector %d, Buffer
%x)\n",
- pDeviceObject,DiskSector,Buffer);
-
- sectorNumber.u.HighPart = 0;
- sectorNumber.u.LowPart = DiskSector * BLOCKSIZE;
-
- DPRINT("DiskSector:%ld BLKSZ:%ld sectorNumber:%ld:%ld\n",
- (unsigned long) DiskSector,
- (unsigned long) BLOCKSIZE,
- (unsigned long) sectorNumber.u.HighPart,
- (unsigned long) sectorNumber.u.LowPart);
-
- KeInitializeEvent(&event, NotificationEvent, FALSE);
-
- sectorSize = BLOCKSIZE*SectorCount;
-
-
- DPRINT("Building synchronous FSD Request...\n");
- irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
- pDeviceObject,
- Buffer,
- sectorSize,
- §orNumber,
- &event,
- &ioStatus );
-
- if (!irp)
- {
- DbgPrint("READ failed!!!\n");
- return FALSE;
- }
-
- DPRINT("Calling IO Driver...\n");
- status = IoCallDriver(pDeviceObject, irp);
-
- DPRINT("Waiting for IO Operation...\n");
- if (status == STATUS_PENDING)
- {
- KeWaitForSingleObject(&event,
- Suspended,
- KernelMode,
- FALSE,
- NULL);
- DPRINT("Getting IO Status...\n");
- status = ioStatus.Status;
- }
-
- if (!NT_SUCCESS(status))
- {
- DbgPrint("IO failed!!! Error code: %d(%x)\n", status, status);
- return FALSE;
- }
-
- return TRUE;
-}
-
-BOOLEAN VFATWriteSectors(IN PDEVICE_OBJECT pDeviceObject,
- IN ULONG DiskSector,
- IN ULONG SectorCount,
- IN UCHAR* Buffer)
-{
- LARGE_INTEGER sectorNumber;
- PIRP irp;
- IO_STATUS_BLOCK ioStatus;
- KEVENT event;
- NTSTATUS status;
- ULONG sectorSize;
- PULONG mbr;
- int j;
-
- DPRINT("VFATWriteSector(pDeviceObject %x, DiskSector %d, Buffer
%x)\n",
- pDeviceObject,DiskSector,Buffer);
-
- sectorNumber.u.HighPart = 0;
- sectorNumber.u.LowPart = DiskSector * BLOCKSIZE;
-
- KeInitializeEvent(&event, NotificationEvent, FALSE);
-
- sectorSize = BLOCKSIZE*SectorCount;
-
-
- DPRINT("Building synchronous FSD Request...\n");
- irp = IoBuildSynchronousFsdRequest(IRP_MJ_WRITE,
- pDeviceObject,
- Buffer,
- sectorSize,
- §orNumber,
- &event,
- &ioStatus );
-
- if (!irp) {
- DbgPrint("WRITE failed!!!\n");
- return FALSE;
- }
-
- DPRINT("Calling IO Driver...\n");
- status = IoCallDriver(pDeviceObject,
- irp);
-
- DPRINT("Waiting for IO Operation...\n");
- if (status == STATUS_PENDING) {
- KeWaitForSingleObject(&event,
- Suspended,
- KernelMode,
- FALSE,
- NULL);
- DPRINT("Getting IO Status...\n");
- status = ioStatus.Status;
- }
-
- if (!NT_SUCCESS(status)) {
- DbgPrint("IO failed!!! Error code: %d(%x)\n", status, status);
- return FALSE;
- }
-
-
- ExFreePool(mbr);
- DPRINT("Block request succeeded\n");
- return TRUE;
-}
-
_____
Deleted: branches/ext2/reactos/drivers/fs/ext2/dir.c
--- branches/ext2/reactos/drivers/fs/ext2/dir.c 2005-01-13 01:21:47 UTC
(rev 13008)
+++ branches/ext2/reactos/drivers/fs/ext2/dir.c 2005-01-13 01:51:33 UTC
(rev 13009)
@@ -1,338 +0,0 @@
-/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: services/fs/ext2/dir.c
- * PURPOSE: ext2 filesystem
- * PROGRAMMER: David Welch (welch(a)cwcom.net)
- * UPDATE HISTORY:
- */
-
-/* INCLUDES
*****************************************************************/
-
-#include <ddk/ntddk.h>
-#include <wchar.h>
-#include <string.h>
-
-//#define NDEBUG
-#include <debug.h>
-
-#include "ext2fs.h"
-
-/* FUNCTIONS
*****************************************************************/
-
-
-static VOID Ext2ConvertName(PWSTR Out, PCH In, ULONG Len)
-{
- ULONG i;
-
- for (i=0; i<Len; i++)
- {
- *Out = *In;
- Out++;
- In++;
- }
- *Out = 0;
-}
-
-PVOID Ext2ProcessDirEntry(PDEVICE_EXTENSION DeviceExt,
- struct ext2_dir_entry* dir_entry,
- PIO_STACK_LOCATION IoStack,
- PVOID Buffer,
- ULONG FileIndex)
-{
- PFILE_DIRECTORY_INFORMATION FDI;
- PFILE_NAMES_INFORMATION FNI;
- PFILE_BOTH_DIRECTORY_INFORMATION FBI;
- struct ext2_inode inode;
-
- DPRINT("FileIndex %d\n",FileIndex);
- DPRINT("Buffer %x\n",Buffer);
-
- Ext2ReadInode(DeviceExt,
- dir_entry->inode,
- &inode);
-
- switch (IoStack->Parameters.QueryDirectory.FileInformationClass)
- {
- case FileNamesInformation:
- FNI = (PFILE_NAMES_INFORMATION)Buffer;
- FNI->NextEntryOffset = sizeof(FileDirectoryInformation) +
- dir_entry->name_len + 1;
- FNI->FileNameLength = dir_entry->name_len;
- Ext2ConvertName(FNI->FileName, dir_entry->name,
dir_entry->name_len);
- Buffer = Buffer + FNI->NextEntryOffset;
- break;
-
- case FileDirectoryInformation:
- FDI = (PFILE_DIRECTORY_INFORMATION)Buffer;
- FDI->NextEntryOffset = sizeof(FileDirectoryInformation) +
- dir_entry->name_len + 1;
- FDI->FileIndex = FileIndex;
-// FDI->CreationTime = 0;
-// FDI->LastAccessTime = 0;
-// FDI->LastWriteTime = 0;
-// FDI->ChangeTime = 0;
- FDI->AllocationSize.QuadPart = FDI->EndOfFile.QuadPart =
inode.i_size;
- FDI->FileAttributes = 0;
- FDI->FileNameLength = dir_entry->name_len;
- Ext2ConvertName(FDI->FileName, dir_entry->name,
dir_entry->name_len);
- Buffer = Buffer + FDI->NextEntryOffset;
- break;
-
- case FileBothDirectoryInformation:
- FBI = (PFILE_BOTH_DIRECTORY_INFORMATION)Buffer;
- FBI->NextEntryOffset = sizeof(FileBothDirectoryInformation) +
- dir_entry->name_len + 1;
- FBI->FileIndex = FileIndex;
- FBI->AllocationSize.QuadPart = FBI->EndOfFile.QuadPart =
inode.i_size;
- FBI->FileAttributes = 0;
- FBI->FileNameLength = dir_entry->name_len;
- Ext2ConvertName(FBI->FileName, dir_entry->name,
dir_entry->name_len);
- memset(FBI->ShortName, 0, sizeof(FBI->ShortName));
- Buffer = Buffer + FBI->NextEntryOffset;
- break;
-
- default:
- UNIMPLEMENTED;
- }
- return(Buffer);
-}
-
-
-NTSTATUS Ext2QueryDirectory(PDEVICE_EXTENSION DeviceExt,
- PEXT2_FCB Fcb,
- PIRP Irp,
- PIO_STACK_LOCATION IoStack)
-{
- ULONG Max;
- ULONG i;
- ULONG StartIndex;
- PVOID Buffer = NULL;
- struct ext2_dir_entry dir_entry;
-
- Buffer = Irp->UserBuffer;
- DPRINT("Buffer %x\n",Buffer);
- DPRINT("IoStack->Flags %x\n",IoStack->Flags);
-
- if (IoStack->Flags & SL_RETURN_SINGLE_ENTRY)
- {
- Max = 1;
- }
- else
- {
- UNIMPLEMENTED;
- }
-
- DPRINT("Buffer->FileIndex %d\n",
- ((PFILE_DIRECTORY_INFORMATION)Buffer)->FileIndex);
- if (IoStack->Flags & SL_INDEX_SPECIFIED)
- {
- StartIndex = ((PFILE_DIRECTORY_INFORMATION)Buffer)->FileIndex;
- }
- else
- {
- StartIndex = 0;
- }
-
- if (IoStack->Flags & SL_RESTART_SCAN)
- {
- StartIndex = 0;
- }
-
- DPRINT("StartIndex %d\n",StartIndex);
-
- for (i=0; i<Max ;i++)
- {
- if
(!Ext2ScanDir(DeviceExt,&Fcb->inode,"*",&dir_entry,&StartIndex))
- {
- ((PFILE_DIRECTORY_INFORMATION)Buffer)->NextEntryOffset = 0;
- return(STATUS_NO_MORE_FILES);
- }
- Buffer = Ext2ProcessDirEntry(DeviceExt,
- &dir_entry,
- IoStack,
- Buffer,
- StartIndex);
- }
- return(STATUS_SUCCESS);
-}
-
-NTSTATUS STDCALL
-Ext2DirectoryControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
-{
- PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
- PFILE_OBJECT FileObject = Stack->FileObject;
- PEXT2_FCB Fcb = (PVOID)FileObject->FsContext;
- NTSTATUS Status;
- PDEVICE_EXTENSION DeviceExt;
-
- DPRINT("Ext2DirectoryControl(DeviceObject %x, Irp
%x)\n",DeviceObject,Irp);
-
- DeviceExt = DeviceObject->DeviceExtension;
-
- switch (Stack->MinorFunction)
- {
- case IRP_MN_QUERY_DIRECTORY:
- Status = Ext2QueryDirectory(DeviceExt, Fcb, Irp, Stack);
- break;
-
- default:
- Status = STATUS_UNSUCCESSFUL;
- }
-
- Irp->IoStatus.Status = Status;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return(Status);
-}
-
-BOOL Ext2ScanDir(PDEVICE_EXTENSION DeviceExt,
- struct ext2_inode* dir,
- PCH filename,
- struct ext2_dir_entry* ret,
- PULONG StartIndex)
-{
- ULONG i;
- char* buffer;
- ULONG offset;
- char name[255];
- struct ext2_dir_entry* current;
- ULONG block;
- BOOL b;
-
- DPRINT("Ext2ScanDir(dir %x, filename %s, ret
%x)\n",dir,filename,ret);
-
- buffer = ExAllocatePool(NonPagedPool, BLOCKSIZE);
-
- for (i=0; i<((*StartIndex)/BLOCKSIZE); i++);
- for (; (block = Ext2BlockMap(DeviceExt, dir, i)) != 0; i++)
- {
- DPRINT("block %d\n",block);
- b = Ext2ReadSectors(DeviceExt->StorageDevice,
- block,
- 1,
- buffer);
- if (!b)
- {
- DbgPrint("ext2fs:%s:%d: Disk io failed\n", __FILE__,
__LINE__);
- return(FALSE);
- }
-
- offset = (*StartIndex)%BLOCKSIZE;
- while (offset < BLOCKSIZE)
- {
- current = &buffer[offset];
-
- strncpy(name,current->name,current->name_len);
- name[current->name_len]=0;
-
- DPRINT("Scanning offset %d inode %d name %s\n",
- offset,current->inode,name);
-
- DPRINT("Comparing %s %s\n",name,filename);
- if (strcmp(name,filename)==0 || strcmp(filename,"*")==0)
- {
- DPRINT("Match found\n");
- *StartIndex = (i*BLOCKSIZE) + offset +
current->rec_len;
- memcpy(ret,current,sizeof(struct ext2_dir_entry));
- ExFreePool(buffer);
- return(TRUE);
- }
-
- offset = offset + current->rec_len;
- ASSERT(current->rec_len != 0);
- DPRINT("offset %d\n",offset);
- }
- DPRINT("Onto next block\n");
- }
- DPRINT("No match\n");
- ExFreePool(buffer);
- return(FALSE);
-}
-
-void unicode_to_ansi(PCH StringA, PWSTR StringW)
-{
- while((*StringW)!=0)
- {
- *StringA = *StringW;
- StringA++;
- StringW++;
- }
- *StringA = 0;
-}
-
-NTSTATUS Ext2OpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT
FileObject,
- PWSTR FileName)
-/*
- * FUNCTION: Opens a file
- */
-{
- EXT2_INODE parent_inode;
- struct ext2_dir_entry entry;
- char name[255];
- ULONG current_inode = 2;
- char* current_segment;
- PEXT2_FCB Fcb;
- ULONG StartIndex = 0;
-
- DPRINT("Ext2OpenFile(DeviceExt %x, FileObject %x, FileName %S)\n",
- DeviceExt,FileObject,FileName);
-
- Fcb = ExAllocatePool(NonPagedPool, sizeof(EXT2_FCB));
-
- unicode_to_ansi(name,FileName);
- DPRINT("name %s\n",name);
- DPRINT("strtok %x\n",strtok);
- current_segment = strtok(name,"\\");
- DPRINT("current_segment %x\n", current_segment);
- while (current_segment!=NULL)
- {
- Ext2LoadInode(DeviceExt,
- current_inode,
- &parent_inode);
- if (!Ext2ScanDir(DeviceExt,
- parent_inode.inode,
- current_segment,
- &entry,
- &StartIndex))
- {
- Ext2ReleaseInode(DeviceExt,
- &parent_inode);
- ExFreePool(Fcb);
- return(STATUS_UNSUCCESSFUL);
- }
- current_inode = entry.inode;
- current_segment = strtok(NULL,"\\");
- StartIndex = 0;
- Ext2ReleaseInode(DeviceExt,
- &parent_inode);
- }
- DPRINT("Found file\n");
-
- Fcb->inode = current_inode;
- CcRosInitializeFileCache(FileObject, &Fcb->Bcb, PAGE_SIZE*3);
- FileObject->FsContext = Fcb;
-
- return(STATUS_SUCCESS);
-}
-
-NTSTATUS STDCALL
-Ext2Create(PDEVICE_OBJECT DeviceObject, PIRP Irp)
-{
- PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
- PFILE_OBJECT FileObject = Stack->FileObject;
- NTSTATUS Status;
- PDEVICE_EXTENSION DeviceExt;
-
- DPRINT("Ext2Create(DeviceObject %x, Irp %x)\n",DeviceObject,Irp);
-
- DeviceExt = DeviceObject->DeviceExtension;
- Status =
Ext2OpenFile(DeviceExt,FileObject,FileObject->FileName.Buffer);
-
- Irp->IoStatus.Status = Status;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return(Status);
-}
_____
Deleted: branches/ext2/reactos/drivers/fs/ext2/ext2fs.h
--- branches/ext2/reactos/drivers/fs/ext2/ext2fs.h 2005-01-13
01:21:47 UTC (rev 13008)
+++ branches/ext2/reactos/drivers/fs/ext2/ext2fs.h 2005-01-13
01:51:33 UTC (rev 13009)
@@ -1,289 +0,0 @@
-#include <ddk/ntddk.h>
-#include <ddk/ntifs.h>
-
-BOOLEAN Ext2ReadSectors(IN PDEVICE_OBJECT pDeviceObject,
- IN ULONG DiskSector,
- IN ULONG SectorCount,
- IN PVOID Buffer);
-
-#define BLOCKSIZE (1024)
-
-struct ext2_super_block {
- ULONG s_inodes_count; /* Inodes count */
- ULONG s_blocks_count; /* Blocks count */
- ULONG s_r_blocks_count; /* Reserved blocks count */
- ULONG s_free_blocks_count; /* Free blocks count */
- ULONG s_free_inodes_count; /* Free inodes count */
- ULONG s_first_data_block; /* First Data Block */
- ULONG s_log_block_size; /* Block size */
- LONG s_log_frag_size; /* Fragment size */
- ULONG s_blocks_per_group; /* # Blocks per group */
- ULONG s_frags_per_group; /* # Fragments per group */
- ULONG s_inodes_per_group; /* # Inodes per group */
- ULONG s_mtime; /* Mount time */
- ULONG s_wtime; /* Write time */
- USHORT s_mnt_count; /* Mount count */
- SHORT s_max_mnt_count; /* Maximal mount count */
- USHORT s_magic; /* Magic signature */
- USHORT s_state; /* File system state */
- USHORT s_errors; /* Behaviour when detecting
errors */
- USHORT s_minor_rev_level; /* minor revision level */
- ULONG s_lastcheck; /* time of last check */
- ULONG s_checkinterval; /* max. time between checks */
- ULONG s_creator_os; /* OS */
- ULONG s_rev_level; /* Revision level */
- USHORT s_def_resuid; /* Default uid for reserved
blocks */
- USHORT s_def_resgid; /* Default gid for reserved
blocks */
- /*
- * These fields are for EXT2_DYNAMIC_REV superblocks only.
- *
- * Note: the difference between the compatible feature set and
- * the incompatible feature set is that if there is a bit set
- * in the incompatible feature set that the kernel doesn't
- * know about, it should refuse to mount the filesystem.
- *
- * e2fsck's requirements are more strict; if it doesn't know
- * about a feature in either the compatible or incompatible
- * feature set, it must abort and not try to meddle with
- * things it doesn't understand...
- */
- ULONG s_first_ino; /* First non-reserved inode */
- USHORT s_inode_size; /* size of inode structure */
- USHORT s_block_group_nr; /* block group # of this
superblock */
- ULONG s_feature_compat; /* compatible feature set */
- ULONG s_feature_incompat; /* incompatible feature set */
- ULONG s_feature_ro_compat; /* readonly-compatible feature
set */
- ULONG s_reserved[230]; /* Padding to the end of the
block */
-};
-
-/*
- * Codes for operating systems
- */
-#define EXT2_OS_LINUX 0
-#define EXT2_OS_HURD 1
-#define EXT2_OS_MASIX 2
-#define EXT2_OS_FREEBSD 3
-#define EXT2_OS_LITES 4
-
-/*
- * Revision levels
- */
-#define EXT2_GOOD_OLD_REV 0 /* The good old (original)
format */
-#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode
sizes */
-
-#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV
-#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV
-
-/*
- * The second extended file system magic number
- */
-#define EXT2_SUPER_MAGIC 0xEF53
-
-/*
- * Constants relative to the data blocks
- */
-#define EXT2_NDIR_BLOCKS 12
-#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
-#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
-#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
-#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
-
-
-/*
- * Structure of an inode on the disk
- */
-struct ext2_inode {
- USHORT i_mode; /* File mode */
- USHORT i_uid; /* Owner Uid */
- ULONG i_size; /* Size in bytes */
- ULONG i_atime; /* Access time */
- ULONG i_ctime; /* Creation time */
- ULONG i_mtime; /* Modification time */
- ULONG i_dtime; /* Deletion Time */
- USHORT i_gid; /* Group Id */
- USHORT i_links_count; /* Links count */
- ULONG i_blocks; /* Blocks count */
- ULONG i_flags; /* File flags */
- union {
- struct {
- ULONG l_i_reserved1;
- } linux1;
- struct {
- ULONG h_i_translator;
- } hurd1;
- struct {
- ULONG m_i_reserved1;
- } masix1;
- } osd1; /* OS dependent 1 */
- ULONG i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
- ULONG i_version; /* File version (for NFS) */
- ULONG i_file_acl; /* File ACL */
- ULONG i_dir_acl; /* Directory ACL */
- ULONG i_faddr; /* Fragment address */
- union {
- struct {
- UCHAR l_i_frag; /* Fragment number */
- UCHAR l_i_fsize; /* Fragment size */
- USHORT i_pad1;
- ULONG l_i_reserved2[2];
- } linux2;
- struct {
- UCHAR h_i_frag; /* Fragment number */
- UCHAR h_i_fsize; /* Fragment size */
- USHORT h_i_mode_high;
- USHORT h_i_uid_high;
- USHORT h_i_gid_high;
- ULONG h_i_author;
- } hurd2;
- struct {
- UCHAR m_i_frag; /* Fragment number */
- UCHAR m_i_fsize; /* Fragment size */
- USHORT m_pad1;
- ULONG m_i_reserved2[2];
- } masix2;
- } osd2; /* OS dependent 2 */
-};
-
-#if defined(__KERNEL__) || defined(__linux__)
-#define i_reserved1 osd1.linux1.l_i_reserved1
-#define i_frag osd2.linux2.l_i_frag
-#define i_fsize osd2.linux2.l_i_fsize
-#define i_reserved2 osd2.linux2.l_i_reserved2
-#endif
-
-#ifdef __hurd__
-#define i_translator osd1.hurd1.h_i_translator
-#define i_frag osd2.hurd2.h_i_frag;
-#define i_fsize osd2.hurd2.h_i_fsize;
-#define i_uid_high osd2.hurd2.h_i_uid_high
-#define i_gid_high osd2.hurd2.h_i_gid_high
-#define i_author osd2.hurd2.h_i_author
-#endif
-
-#ifdef __masix__
-#define i_reserved1 osd1.masix1.m_i_reserved1
-#define i_frag osd2.masix2.m_i_frag
-#define i_fsize osd2.masix2.m_i_fsize
-#define i_reserved2 osd2.masix2.m_i_reserved2
-#endif
-
-/*
- * Constants relative to the data blocks
- */
-#define EXT2_NDIR_BLOCKS 12
-#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
-#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
-#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
-#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
-
-/*
- * Inode flags
- */
-#define EXT2_SECRM_FL 0x00000001 /* Secure
deletion */
-#define EXT2_UNRM_FL 0x00000002 /* Undelete
*/
-#define EXT2_COMPR_FL 0x00000004 /* Compress
file */
-#define EXT2_SYNC_FL 0x00000008 /* Synchronous
updates */
-#define EXT2_IMMUTABLE_FL 0x00000010 /* Immutable file */
-#define EXT2_APPEND_FL 0x00000020 /* writes to file may
only append */
-#define EXT2_NODUMP_FL 0x00000040 /* do not dump file
*/
-#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2
lib */
-
-
-/*
- * Structure of a blocks group descriptor
- */
-struct ext2_group_desc
-{
- ULONG bg_block_bitmap; /* Blocks bitmap block
*/
- ULONG bg_inode_bitmap; /* Inodes bitmap block
*/
- ULONG bg_inode_table; /* Inodes table block */
- USHORT bg_free_blocks_count; /* Free blocks count */
- USHORT bg_free_inodes_count; /* Free inodes count */
- USHORT bg_used_dirs_count; /* Directories count */
- USHORT bg_pad;
- ULONG bg_reserved[3];
-};
-
-#define EXT2_NAME_LEN 255
-
-struct ext2_dir_entry {
- ULONG inode; /* Inode number */
- USHORT rec_len; /* Directory entry length */
- USHORT name_len; /* Name length */
- char name[EXT2_NAME_LEN]; /* File name */
-};
-
-typedef struct
-{
- PDEVICE_OBJECT StorageDevice;
- struct ext2_super_block* superblock;
- PFILE_OBJECT FileObject;
- PBCB Bcb;
-} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
-
-typedef struct _EXT2_GROUP_DESC
-{
- ERESOURCE Lock;
- struct ext2_group_desc* desc;
- PCACHE_SEGMENT CacheSeg;
- PVOID BaseAddress;
-} EXT2_GROUP_DESC, *PEXT2_GROUP_DESC;
-
-PEXT2_GROUP_DESC Ext2LoadGroup(PDEVICE_EXTENSION DeviceExt,
- ULONG BlockGrp);
-VOID Ext2ReleaseGroup(PDEVICE_EXTENSION DeviceExt,
- PEXT2_GROUP_DESC GrpDesc);
-
-VOID Ext2ReadInode(PDEVICE_EXTENSION DeviceExt,
- ULONG ino,
- struct ext2_inode* inode);
-struct ext2_group_desc* Ext2LoadGroupDesc(PDEVICE_EXTENSION DeviceExt,
- ULONG block_group);
-
-typedef struct _EXT2_INODE
-{
- struct ext2_inode* inode;
- PVOID BaseAddress;
- PCACHE_SEGMENT CacheSeg;
-} EXT2_INODE, *PEXT2_INODE;
-
-typedef struct _EXT2_FCB
-{
- ULONG inode;
- EXT2_INODE i;
- PBCB Bcb;
-} EXT2_FCB, *PEXT2_FCB;
-
-ULONG Ext2BlockMap(PDEVICE_EXTENSION DeviceExt,
- struct ext2_inode* inode,
- ULONG offset);
-NTSTATUS Ext2OpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT
FileObject,
- PWSTR FileName);
-NTSTATUS Ext2ReadFile(PDEVICE_EXTENSION DeviceExt,
- PFILE_OBJECT FileObject,
- PVOID Buffer,
- ULONG Length,
- LARGE_INTEGER Offset);
-NTSTATUS STDCALL Ext2Create(PDEVICE_OBJECT DeviceObject, PIRP Irp);
-NTSTATUS STDCALL Ext2DirectoryControl(PDEVICE_OBJECT DeviceObject, PIRP
Irp);
-NTSTATUS STDCALL Ext2QueryQuota(PDEVICE_OBJECT DeviceObject, PIRP Irp);
-NTSTATUS STDCALL Ext2SetQuota(PDEVICE_OBJECT DeviceObject, PIRP Irp);
-NTSTATUS STDCALL Ext2SetSecurity(PDEVICE_OBJECT DeviceObject, PIRP
Irp);
-NTSTATUS STDCALL Ext2QuerySecurity(PDEVICE_OBJECT DeviceObject, PIRP
Irp);
-NTSTATUS STDCALL Ext2SetInformation(PDEVICE_OBJECT DeviceObject, PIRP
Irp);
-NTSTATUS STDCALL Ext2QueryInformation(PDEVICE_OBJECT DeviceObject, PIRP
Irp);
-NTSTATUS STDCALL Ext2Read(PDEVICE_OBJECT DeviceObject, PIRP Irp);
-NTSTATUS STDCALL Ext2Write(PDEVICE_OBJECT DeviceObject, PIRP Irp);
-NTSTATUS STDCALL Ext2Cleanup(PDEVICE_OBJECT DeviceObject, PIRP Irp);
-NTSTATUS STDCALL Ext2FlushBuffers(PDEVICE_OBJECT DeviceObject, PIRP
Irp);
-NTSTATUS STDCALL Ext2Shutdown(PDEVICE_OBJECT DeviceObject, PIRP Irp);
-NTSTATUS Ext2ReadPage(PDEVICE_EXTENSION DeviceExt,
- PEXT2_FCB Fcb,
- PVOID Buffer,
- ULONG Offset);
-VOID Ext2LoadInode(PDEVICE_EXTENSION DeviceExt,
- ULONG ino,
- PEXT2_INODE Inode);
-VOID Ext2ReleaseInode(PDEVICE_EXTENSION DeviceExt,
- PEXT2_INODE Inode);
-
_____
Deleted: branches/ext2/reactos/drivers/fs/ext2/file.c
--- branches/ext2/reactos/drivers/fs/ext2/file.c 2005-01-13
01:21:47 UTC (rev 13008)
+++ branches/ext2/reactos/drivers/fs/ext2/file.c 2005-01-13
01:51:33 UTC (rev 13009)
@@ -1,61 +0,0 @@
-/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: services/fs/ext2/super.c
- * PURPOSE: ext2 filesystem
- * PROGRAMMER: David Welch (welch(a)mcmail.com)
- * UPDATE HISTORY:
- */
-
-/* INCLUDES
*****************************************************************/
-
-#include <ddk/ntddk.h>
-
-#define NDEBUG
-#include <debug.h>
-
-#include "ext2fs.h"
-
-/* FUNCTIONS
****************************************************************/
-
-#define addr_per_block (BLOCKSIZE / sizeof(ULONG))
-
-ULONG Ext2BlockMap(PDEVICE_EXTENSION DeviceExt,
- struct ext2_inode* inode,
- ULONG offset)
-{
- ULONG block;
- PULONG TempBuffer;
- BOOL b;
-
- DPRINT("Ext2BlockMap(DeviceExt %x, inode %x, offset %d)\n",
- DeviceExt,inode,offset);
- if (offset < EXT2_NDIR_BLOCKS)
- {
- block = inode->i_block[offset];
- DPRINT("block %d\n",block);
- return(block);
- }
- offset = offset - EXT2_NDIR_BLOCKS;
- if (offset < addr_per_block)
- {
- block = inode->i_block[EXT2_IND_BLOCK];
- TempBuffer = ExAllocatePool(NonPagedPool, BLOCKSIZE);
- b = Ext2ReadSectors(DeviceExt->StorageDevice,
- block,
- 1,
- TempBuffer);
- if (!b)
- {
- DbgPrint("ext2fs:%s:%d: Disk io failed\n", __FILE__,
__LINE__);
- return(0);
- }
- block = TempBuffer[offset];
- ExFreePool(TempBuffer);
- return(block);
- }
- offset = offset - addr_per_block;
[truncated at 1000 lines; 21006 more skipped]