RSS
Логотип
Баннер в шапке 1
Баннер в шапке 2
2010/05/25 16:31:00

File

-1 XLIFFService: Sequence contains no elements The file (engl. file is the folder, the folder) — the concept in ADP equipment: the entity which is allowing to get access to any resource of the computing system and having a number of signs:

Content

  • the fixed name (a character sequence, number or something other, unambiguously characterizing the file)
  • a certain logical notion and the reading/record transactions corresponding to it

There can be any — from the sequence of bits to the database with any organization or any intermediate option.
To the first case there correspond transactions of reading/record of a flow and/or an array (i.e. consecutive or with access by the index), to the second — the DBMS commands. Intermediate options - reading and analysis of various file formats.

Unlike a variable, the file (in particular, his name) makes sense out of the specific program. Work with files — at least, in the "simplest" representation — is implemented by means of operating systems, and before their emergence was implemented by their predecessors — monitors and libraries of subprogrammes.

Anything, representable in a digital form can be the resources available via files, in principle. Most often enter their list:

  • areas of data (it is optional on a disk)
  • devices (both physical, and virtual)
  • data streams (in particular, input or exit of other process)
  • network resources
  • subjects of the operating system

Files of the first type historically arose the first and are distributed most widely therefore often "file" call also the area of data corresponding to a name. As the file in different operating systems has a different set of attributes, properties and access methods, formulations of universal determination which would consider all features was not formulated.

File system

Основная статья: file system

In process of development of ADP equipment of files in systems became more and more. For convenience of work with them them, as well as other data, began to organize in structures (then symbolic names appeared). In the beginning it was the simple array "tied" to the specific information medium. Now the greatest distribution was gained by the treelike organization with a possibility of assembling and an insert of additional communications (i.e. links). Respectively, the file name purchased the nature of a way to the file: transfer of nodes of a tree of the file system which need to be passed that to reach it.

File as object of API of the operating system

The operating system provides to applications feature set and structures for work with files. Possibilities of the operating system impose additional restrictions for restrictions of the file system. From the point of view of Application Programming Interface (API) the file — an object in relation to which functions of this API can be applied. At the level of API it is not essential any more whether there is a file as subject of the file system or is, for example, the input-output device.

Properties of the file

Depending on the file system, the file can have different property set.

File name

In the majority of file systems the file name is used the address is made for the instruction to what file. In different file systems of restriction addressed to the file strongly differ:

  • In FAT16 and FAT12 the size of the file name is limited to 8 characters (3 extension characters).
  • In VFAT restriction of 255 bytes.
  • In FAT32, HPFS the file name is limited by 255 characters
  • In a NTFS name it is limited to 254 characters of Unicode
  • ext2В /ext3 restriction of 255 bytes.

In addition to restrictions of the file system, interfaces of the operating system in addition limit a symbol set which is admissible during the work with files.

  • For MS-DOS in the file name only capital letters, digits are admissible. Let's not allow a space, a question mark, the asterisk, characters is more/less, the character vertical [1]. By a call of system functions by names of files in the lower or mixed register, they are given to an uppercase.
  • For Microsoft Windows in the file name capital and lowercase letters, digits, some punctuation marks, a space are resolved. Illegal characters ">","<», «|», «?», «*», «/», «\», «:», «"».
  • For GNU/Linux (taking into account a possibility of masking) all characters, except "/" and zero byte are resolved.

The majority of operating systems require uniqueness of the file name in one directory though some systems allow files with identical names (for example, during the work with tape drives).

Expansion of the file name

Основная статья: expansion of the file name

Expansion of the file name (expansion of the file or expansion is frequent) as the independent file attribute existed in file systems FAT16 FAT12, and was used for determination of file type. In other file systems expansion — convention, the part of a name separated by the most right point in a name.

Attributes

Attributes are provided in some file systems (normally this binary yes/no value coded by one bit). Practically attributes do not influence the accessibility to files, for this purpose in some file systems there are access rights.

Name of attribute transfer value file systems operating systems
READ ONLYonly for reading is forbidden to write FAT32, FAT12, FAT16, NTFS, HPFS, VFAT DOS to the file OS/2, Windows
|SYSTEMFAT32, FAT12, FAT16, NTFS, HPFS, VFAT file of DOS, OS/2, critical for work of the operating system, Windows
|HIDDENthe file disappears from demonstration until return FAT32, FAT12, FAT16, NTFS, HPFS, VFAT of DOS, OS/2, Windows is obviously told
ARCHIVEarchive (requiring archiving) the file is changed after backup or not copied by programs of backup FAT32, FAT12, FAT16, NTFS, HPFS, VFAT DOS OS/2, Windows

Time

For the file the following time marks can be defined:

  • Creation time
  • Modification time
  • Time of the last access

Owner and group of the file

The instruction on the owner of the file, and group of the owner is provided in some file systems.

Access rights

Opportunity for access restriction on users to file contents is provided in some file systems

In UNIX-LIKE operating systems for files usually select three types of the rights:

  • Right to record
  • Right to reading
  • Right to accomplishment

Each right is set separately for the owner, for group and for all others. ACL allow to expand this list.

In the Windows NT operating systems during the work with the NTFS file system of right of access are set obviously for users or groups (or are inherited from higher objects). The rights include:

  • Right to reading
  • Right to record
  • Right to execution
  • Right to removal
  • Right to change of attributes and owner
  • The right to creation, removal of subfolders (for folders)
  • Right to reading access rights

Each right can be set both permission, and prohibition, prohibition has a bigger priority, than permission.

Transactions with the file

It is conditionally possible to select two transaction types with the file - connected with its opening, and executed without its opening. Transactions of the first type usually serve for reading/data recording or preparation for record/reading. Transactions of the second type are executed with the file as with "subject" of the file system in which the file is the smallest unit of structuring.

The transactions connected with opening of the file

Depending on the operating system these or those transactions can be absent.

Usually select the additional entities work-related with the file:

  • handler of the file, or descriptor (descriptor). When opening the file (if it is possible), the operating system returns number (or the pointer on structure) using which all other file transactions are executed. On their end the file is closed, and the handler loses meaning.
  • file pointer. Number which is shift of rather zero byte in the file. Usually to this address reading/record is performed if the call of transaction of reading/record does not provide the indication of the address. At reading/record execution of operations the file pointer is displaced on number of the read (written) bytes. Serial calling of read operations thus allows to read all file without caring for its size.
  • file buffer. The operating system (and/or library of a programming language) performs caching of file transactions in the special buffer (memory section). When closing the file the buffer is reset.
  • access mode. Depending on requirements of the program, the file can be open on reading and/or record. Besides, some operating systems (and/or libraries) provide an operation mode with text files. The mode usually is specified when opening the file.
  • mode of the general access. In case of multitasking operating system the situation when several programs at the same time want to open the file on record and/or reading is possible. For regulation of it there are modes of the general access indicating a possibility of implementation of shared access to the file (for example in which file is made record it can be open for reading other programs is a standard mode of work of log-files).

Transactions
  • Opening of the file (usually as parameters the file name, an access mode and the mode of shared access is transferred, and the file handler or a descriptor acts as value), besides usually is available an opportunity in case of opening on record to point to whether file size on zero should change.
  • Closing of the file. The value received when opening the file acts as an argument. When closing all file buffers are reset.
  • Record — in the file data are located.
  • Reading — data from the file are located to the area of memory.
  • Movement of the pointer — the pointer moves to the specified number of bytes forward/back or moves on the specified shift concerning the beginning/end. Not all files allow accomplishment of this transaction (for example, the file on the tape drive can not "be able" to be rewound back).
  • Reset of buffers — contents of file buffers with information which is not written in the file registers. It is used usually for the instruction on completion of record of a logic block (for preserving of data in the file on a failure case).
  • Obtaining current value of the file pointer.

The transactions which are not connected with opening of the file

The transactions which are not requiring opening of the file operate with its "external" signs — the size, a name, provision in a catalog tree. At such transactions it is impossible to get access to file contents, the file is the minimum unit of division of information.

Depending on the file system, the information medium, the operating system a part of transactions can be unavailable.

List of transactions with files
  • Removal of the file
  • Renaming of the file
  • Copying of the file
  • Transfer of the file on other file system / information medium
  • Creation simlinka or hardlinka
  • Receiving or change of file attributes

Types of files

In different operating systems and/or file systems different types of files can be implemented; besides, implementation of different types can differ.

  • "The ordinary file" — the file allowing read operation, record, movements in the file
  • Directory (engl. directory is the alphabetical reference, it is often translated as the directory) — the file comprising records about other files. Directories may contain records about other directories, forming a tree structure.
  • The tough link (engl. hardlink, the tracing-paper hardlink is often used) — generally the same area of information can have several names indicating the same data. In this case such names are called tough links (hardlinka). Generally after creation a hardlinka to tell where "this" file and where hardlink it is impossible as names are equal; and the area of data exists until there is at least one of names. Hardlinki are possible only on one physical medium.
  • Symbolic link (simlink, softlink) — the file comprising the link to other file or a directory. Can refer to any element of the file system, including, and located on other physical medium.